Lu Decomposition
Lu Decomposition
07
LU Decomposition
04.07.1
04.07.2 Chapter 04.07
then
[L][Z ] = [C ] (1)
and
[U ][X ] = [Z ] (2)
So we can solve Equation (1) first for [Z ] by using forward substitution and then use
Equation (2) to calculate the solution vector [X ] by back substitution.
This is all exciting but LU decomposition looks more complicated than Gaussian
elimination. Do we use LU decomposition because it is computationally more efficient
than Gaussian elimination to solve a set of n equations given by [A][X]=[C]?
For a square matrix [ A] of n × n size, the computational time 1 CT |DE to decompose the [ A]
matrix to [ L][U ] form is given by
8n 3 20n
CT |DE = T + 4n 2 − ,
3 3
where
T = clock cycle time 2.
The computational time CT |FS to solve by forward substitution [L][Z ] = [C ] is given by
CT |FS = T (4n 2 − 4n )
The computational time CT |BS to solve by back substitution [U ][ X ] = [Z ] is given by
CT |BS = T (4n 2 + 12n )
So, the total computational time to solve a set of equations by LU decomposition is
CT |LU = CT |DE + CT |FS + CT |BS
8n 3 20n
= T + 4n 2 − + T (4n 2 − 4n )+ T (4n 2 + 12n )
3 3
8n 3 4n
= T + 12n 2 +
3 3
Now let us look at the computational time taken by Gaussian elimination. The computational
time CT |FE for the forward elimination part,
8n 3 32n
CT |FE = T + 8n 2 − ,
3 3
1
The time is calculated by first separately calculating the number of additions, subtractions,
multiplications, and divisions in a procedure such as back substitution, etc. We then assume
4 clock cycles each for an add, subtract, or multiply operation, and 16 clock cycles for a
divide operation as is the case for a typical AMD®-K7 chip.
http://www.isi.edu/~draper/papers/mwscas07_kwon.pdf
2
As an example, a 1.2 GHz CPU has a clock cycle of 1 /(1.2 × 109 ) = 0.833333 ns
LU Decomposition 04.07.3
and the computational time CT |BS for the back substitution part is
CT |BS = T (4n 2 + 12n )
So, the total computational time CT |GE to solve a set of equations by Gaussian Elimination
is
CT |GE = CT |FE + CT |BS
8n 3 32n
= T + 8n 2 − + T (4n 2 + 12n )
3 3
8n 3 4n
= T + 12n 2 +
3 3
The computational time for Gaussian elimination and LU decomposition is identical.
This has confused me further! Why learn LU decomposition method when it takes the
same computational time as Gaussian elimination, and that too when the two methods
are closely related. Please convince me that LU decomposition has its place in solving
linear equations!
We have the knowledge now to convince you that LU decomposition method has its
place in the solution of simultaneous linear equations. Let us look at an example where the
LU decomposition method is computationally more efficient than Gaussian elimination.
Remember in trying to find the inverse of the matrix [ A] in Chapter 04.05, the problem
reduces to solving n sets of equations with the n columns of the identity matrix as the RHS
vector. For calculations of each column of the inverse of the [ A] matrix, the coefficient
matrix [ A] matrix in the set of equation [A][X ] = [C ] does not change. So if we use the LU
decomposition method, the [A] = [L ][U ] decomposition needs to be done only once, the
forward substitution (Equation 1) n times, and the back substitution (Equation 2) n times.
Therefore, the total computational time CT |inverse LU required to find the inverse of a
matrix using LU decomposition is
CT |inverse LU = 1× CT |DE + n × CT |FS + n × CT |BS
8n 3 20n
= 1 × T + 4n 2 − + n × T (4n 2 − 4n )+ n × T (4n 2 + 12n )
3 3
32n 3 20n
= T + 12n 2 −
3 3
In comparison, if Gaussian elimination method were used to find the inverse of a matrix, the
forward elimination as well as the back substitution will have to be done n times. The total
computational time CT |inverse GE required to find the inverse of a matrix by using Gaussian
elimination then is
CT |inverse GE = n × CT |FE + n × CT |BS
8n 3 32n
= n × T + 8n 2 − + n × T (4n 2 + 12n )
3 3
04.07.4 Chapter 04.07
8n 4 4n 2
= T + 12n 3 +
3 3
Clearly for large n , CT |inverse GE >> CT |inverse LU as CT |inverse GE has the dominating terms of n 4
and CT |inverse LU has the dominating terms of n 3 . For large values of n , Gaussian elimination
method would take more computational time (approximately n / 4 times – prove it) than the
LU decomposition method. Typical values of the ratio of the computational time for
different values of n are given in Table 1.
Are you convinced now that LU decomposition has its place in solving systems of equations?
We are now ready to answer other curious questions such as
1) How do I find LU matrices for a nonsingular matrix [ A] ?
2) How do I conduct forward and back substitution steps of Equations (1) and (2),
respectively?
How do I decompose a non-singular matrix [ A] , that is, how do I find [A] = [L][U ]?
If forward elimination steps of the Naïve Gauss elimination methods can be applied on a
nonsingular matrix, then [A] can be decomposed into LU as
a11 a12 a1n
a a 22 a2n
[ A] = 21
a n1 an 2 a nn
1 0 0 u11 u12
u1n
1 u2 n
0 0 u22
= 21
n1 n2 1 0 unn
0
The elements of the [U ] matrix are exactly the same as the coefficient matrix one obtains at
the end of the forward elimination steps in Naïve Gauss elimination.
The lower triangular matrix [L ] has 1 in its diagonal entries. The non-zero elements on the
non-diagonal elements in [L ] are multipliers that made the corresponding entries zero in the
upper triangular matrix [U ] during forward elimination.
Let us look at this using the same example as used in Naïve Gaussian elimination.
LU Decomposition 04.07.5
Example 1
Find the LU decomposition of the matrix
25 5 1
[A] = 64 8 1
144 12 1
Solution
[A] = [L][U ]
1 0 0 u11 u12 u13
= 21 1 0 0 u22 u23
31 32 1 0 0 u33
The [U ] matrix is the same as found at the end of the forward elimination of Naïve Gauss
elimination method, that is
25 5 1
[U ] = 0 − 4.8 − 1.56
0 0 0.7
To find 21 and 31 , find the multiplier that was used to make the a 21 and a 31 elements zero
in the first step of forward elimination of the Naïve Gauss elimination method. It was
64
21 =
25
= 2.56
144
31 =
25
= 5.76
To find 32 , what multiplier was used to make a32 element zero? Remember a 32 element
was made zero in the second step of forward elimination. The [A] matrix at the beginning of
the second step of forward elimination was
25 5 1
0 − 4.8 − 1.56
0 − 16.8 − 4.76
So
− 16.8
32 =
− 4.8
= 3.5
Hence
1 0 0
[L] = 2.56 1 0
5.76 3.5 1
Confirm [L][U ] = [A] .
04.07.6 Chapter 04.07
1 00 25 5 1
[L][U ] = 2.56 10 0 − 4.8 − 1.56
5.76 3.5 1 0 0 0.7
25 5 1
= 64 8 1
144 12 1
Example 2
Use the LU decomposition method to solve the following simultaneous linear equations.
25 5 1 a1 106.8
64 8 1 a = 177.2
2
144 12 1 a 3 279.2
Solution
Recall that
[A][X ] = [C ]
and if
[A] = [L][U ]
then first solving
[L][Z ] = [C ]
and then
[U ][X ] = [Z ]
gives the solution vector [X ] .
Now in the previous example, we showed
[A] = [L][U ]
1 0 0 25 5 1
= 2.56 1 0 0 − 4.8 − 1.56
5.76 3.5 1 0 0 0.7
First solve
[L][Z ] = [C ]
1 0 0 z1 106.8
2.56 1 0 z = 177.2
2
5.76 3.5 1 z 3 279.2
to give
z1 = 106.8
2.56 z1 + z 2 = 177.2
5.76 z1 + 3.5z 2 + z3 = 279.2
Forward substitution starting from the first equation gives
z1 = 106.8
LU Decomposition 04.07.7
z 2 = 177.2 − 2.56 z1
= 177.2 − 2.56 × 106.8
= −96.208
z3 = 279.2 − 5.76 z1 − 3.5z 2
= 279.2 − 5.76 × 106.8 − 3.5 × (− 96.208)
= 0.76
Hence
z1
[Z ] = z 2
z 3
106.8
= − 96.208
0.76
This matrix is same as the right hand side obtained at the end of the forward elimination steps
of Naïve Gauss elimination method. Is this a coincidence?
Now solve
[U ][X ] = [Z ]
25 5 1 a1 106.8
0 − 4.8 − 1.56 a = − 96.208
2
0 0 0.7 a3 0.76
25a1 + 5a 2 + a3 = 106.8
− 4.8a 2 − 1.56a3 = −96.208
0.7 a3 = 0.76
From the third equation
0.7 a3 = 0.76
0.76
a3 =
0.7
= 1.0857
Substituting the value of a3 in the second equation,
− 4.8a 2 − 1.56a3 = −96.208
− 96.208 + 1.56a3
a2 =
− 4.8
− 96.208 + 1.56 × 1.0857
=
− 4.8
= 19.691
Substituting the value of a 2 and a3 in the first equation,
25a1 + 5a 2 + a3 = 106.8
106.8 − 5a 2 − a3
a1 =
25
04.07.8 Chapter 04.07
Example 3
Use LU decomposition to find the inverse of
25 5 1
[A] = 64 8 1
144 12 1
Solution
Knowing that
[A] = [L][U ]
1 0 0 25 5 1
= 2.56 1 0 0 − 4.8 − 1.56
5.76 3.5 1 0 0 0.7
LU Decomposition 04.07.9
25 5 1 b11 1
64 8 1 b = 0
21
144 12 1 b31 0
First solve
[L][Z ] = [C ] ,
that is
1 0 0 z1 1
2.56 1 0 z = 0
2
5.76 3.5 1 z 3 0
to give
z1 = 1
2.56 z1 + z 2 = 0
5.76 z1 + 3.5 z 2 + z 3 = 0
Forward substitution starting from the first equation gives
z1 = 1
z2 = 0 − 2.56 z1
= 0 − 2.56(1)
= −2.56
z 3 = 0 − 5.76 z1 − 3.5 z 2
= 0 − 5.76(1) − 3.5(− 2.56 )
= 3.2
Hence
z1
[Z ] = z 2
z 3
1
= − 2.56
3.2
Now solve
[U ][X ] = [Z ]
that is
25 5 1 b11 1
0 − 4.8 − 1.56 b = − 2.56
21
0 0 0.7 b31 3.2
25b11 + 5b21 + b31 = 1
− 4.8b21 − 1.56b31 = −2.56
04.07.10 Chapter 04.07
0.7b31 = 3.2
Backward substitution starting from the third equation gives
3.2
b31 =
0.7
= 4.571
− 2.56 + 1.56b31
b21 =
− 4.8
− 2.56 + 1.56(4.571)
=
− 4.8
= −0.9524
1 − 5b21 − b31
b11 =
25
1 − 5(−0.9524) − 4.571
=
25
= 0.04762
Hence the first column of the inverse of [A] is
b11 0.04762
b = − 0.9524
21
b31 4.571
Similarly by solving
25 5 1 b12 0 b12 − 0.08333
64 8 1 b = 1 gives b = 1.417
22 22
144 12 1 b32 0 b32 − 5.000
and solving
25 5 1 b13 0 b13 0.03571
64 8 1 b = 0 gives b = − 0.4643
23 23
144 12 1 b33 1 b33 1.429
Hence
0.04762 − 0.08333 0.03571
[A] = − 0.9524 1.417 − 0.4643
−1
Key Terms:
LU decomposition
Inverse
MULTIPLE CHOICE TEST: LU DECOMPOSITION: SIMULTANEOUS LINEAR EQUATIONS
2. The lower triangular matrix [L] in the [L][U] decomposition of matrix given below
⎡25 5 4 ⎤ ⎡ 1 0 0⎤ ⎡u11 u12 u13 ⎤
⎢10 8 16 ⎥ = ⎢l ⎥⎢ ⎥
⎢ ⎥ ⎢ 21 1 0⎥ ⎢ 0 u22 u23 ⎥
⎢⎣ 8 12 22⎥⎦ ⎢⎣l 31 l 32 1⎥⎦ ⎢⎣ 0 0 u33 ⎥⎦
is
⎡ 1 0 0⎤
(A) ⎢0.40000
⎢ 1 0⎥⎥
⎢⎣0.32000 1.7333 1⎥⎦
⎡25 5 4 ⎤
(B) ⎢ 0 6 14.400 ⎥
⎢ ⎥
⎢⎣ 0 0 − 4.2400⎥⎦
⎡ 1 0 0⎤
(C) ⎢10 1 0⎥
⎢ ⎥
⎢⎣ 8 12 0⎥⎦
⎡ 1 0 0⎤
⎢
(D) ⎢0.40000 1 0⎥⎥
⎢⎣0.32000 1.5000 1⎥⎦
3. The upper triangular matrix [U] in the [L][U] decomposition of matrix given below
MULTIPLE CHOICE TEST: LU DECOMPOSITION: SIMULTANEOUS LINEAR EQUATIONS
⎡ 1 0 0⎤
(A) ⎢0.40000
⎢ 1 0⎥⎥
⎢⎣0.32000 1.7333 1⎥⎦
⎡25 5 4 ⎤
(B) ⎢ 0 6 14.400 ⎥
⎢ ⎥
⎢⎣ 0 0 − 4.2400⎥⎦
⎡25 5 4 ⎤
(C) ⎢ 0 8 16 ⎥
⎢ ⎥
⎢⎣ 0 0 − 2⎥⎦
⎡1 0.2000 0.16000⎤
(D) ⎢0
⎢ 1 2.4000 ⎥⎥
⎢⎣0 0 − 4.240 ⎥⎦
4. For a given 2000 × 2000 matrix [A], assume that it takes about 15 seconds to find the
inverse of [A] by the use of the [L][U] decomposition method, that is, finding the [L][U]
once, and then doing forward substitution and back substitution 2000 times using the
2000 columns of the identity matrix as the right hand side vector. The approximate time,
in seconds, that it will take to find the inverse if found by repeated use of Naive Gauss
Elimination method, that is, doing forward elimination and back substitution 2000 times
by using the 2000 columns of the identity matrix as the right hand side vector is
(A) 300
(B) 1500
(C) 7500
(D) 30000
MULTIPLE CHOICE TEST: LU DECOMPOSITION: SIMULTANEOUS LINEAR EQUATIONS
5. The algorithm in solving the set of equations [A][X] = [C], where [A] = [L][U]
involves solving [L][Z] = [C] by forward substitution. The algorithm to solve [L][Z]=[C]
is given by
(A) z1 = c1 / l11
for i from 2 to n do
sum = 0
for j from 1 to i do
sum = sum + l ij * z j
end do
zi = (ci – sum) / lii
end do
(B) z1 = c1 / l11
for i from 2 to n do
sum = 0
for j from 1 to (i-1) do
sum = sum + l ij * z j
end do
zi = (ci – sum) / lii
end do
(C) z1 = c1 / l11
for i from 2 to n do
for j from 1 to (i-1) do
sum = sum + l ij * z j
end do
zi = (ci – sum) / lii
end do
04.07.1
04.07.2 Chapter 04.07
4 2 1
Row 2 − (Row 1 × (1.5625)) = 0 − 0.625 − 0.5625
9 3 1
Divide Row 1 by 4 and multiply it by 9 , that is, multiply it by 9 4 = 2.25 . Then subtract the
result from Row 3.
4 2 1
Row 3 − (Row 1 × (2.25)) = 0 − 0.625 − 0.5625
0 − 1.5 0.1
Second step
Now divide Row 2 by − 0.625 and multiply it by − 1.5 , that is, multiply it by
− 1.5 − 0.625 = 2.4 . Then subtract the result from Row 3.
4 2 1
Row 3 − (Row 2 × (2.4 )) = 0 − 0.625 − 0.5625
0 0 0.1
4 2 1
[U ] = 0 − 0.625 − 0.5625
0 0 0.1
Now find [L] .
1 0 0
[L] = 21 1 0
31 32 1
From Step 1 of the forward elimination process
6.25
21 = = 1.5625
4
9
31 = = 2.25
4
From Step 2 of the forward elimination process
− 1.5
32 = = 2.4
− 0.625
1 0 0
[L] = 1.5625 1 0
2.25 2.4 1
Now that [L ] and [U ] are known, solve [L ][Z ] = [C ] .
1 0 0 z1 8.57
1.5625 1 0 z = 10
2
2.25 2.4 1 z 3 12
gives
LU Decomposition-More Examples: Chemical Engineering 04.07.3
z1 = 8.57
1.5625 z1 + z 2 = 10
2.25 z1 + 2.4 z 2 + z 3 = 12
Forward substitution starting from the first equation gives
z1 = 8.57
z 2 = 10 − 1.5625 z1
= 10 − 1.5625 × 8.57
= −3.3906
z 3 = 12 − 2.25 z1 − 2.4 z 2
= 12 − 2.25 × 8.57 − 2.4 × (− 3.3906 )
= 0.855
Hence
z1 8.57
[Z ] = z 2 = − 3.3906
z 3 0.855
Now solve [U ][ X ] = [Z ] .
4 2 1 x1 8.57
0 − 0.625 − 0.5625 x = − 3.3906
2
0 0 0.1 x3 0.855
4 x1 + 2 x 2 + x3 = 8.57
− 0.625 x 2 + (−0.5625) x3 = −3.3906
0.1x3 = 0.855
From the third equation,
0.1x3 = 0.855
0.855
x3 =
0.1
= 8.55
Substituting the value of x3 in the second equation,
− 0.625 x 2 + (−0.5625) x3 = −3.3906
− 3.3906 − (−0.5625) x3
x2 =
− 0.625
− 3.3906 − (−0.5625) × 8.55
=
− 0.625
= −2.27
Substituting the value of x2 and x3 in the first equation,
4 x1 + 2 x 2 + x3 = 8.57
04.07.4 Chapter 04.07
8.57 − 2 x 2 − x3
x1 =
4
8.57 − 2 × (−2.27) − 8.55
=
4
= 1.14
The solution vector is
x1 1.14
x = − 2.27
2
x3 8.55
The polynomial that passes through the three data points is then
g (a ) = x1 a 2 + x 2 a + x3
= 1.14a 2 + (− 2.27 )a + 8.55, 2 ≤ a ≤ 3
where g is the amount of nickel in the organic phase and a is the amount of nickel in the
aqueous phase.
When 2.3 g l is in the aqueous phase, using quadratic interpolation, the estimated amount of
nickel in the organic phase is
g (2.3) = 1.14 × (2.3) + (− 2.27 ) × (2.3) + 8.55
2
= 9.3596 g/l
In the compound cylinder, the inner cylinder has an internal radius of a = 5 " , and an outer
radius c = 6.5 " , while the outer cylinder has an internal radius of c = 6.5 " and an outer
radius of b = 8 " . Given E = 30 × 10 6 psi, ν = 0.3 , and that the hoop stress in the outer
cylinder is given by
E 1 − ν
σθ = c (1 + ν ) + c 4 2 ,
2 3
1 −ν r
find the stress on the inside radius of the outer cylinder.
Find the values of c1 , c 2 , c3 and c 4 using LU decomposition.
Solution
1 0 0 u11 u12 u13 u14
0
1 0 0 u 22 u 23 u 24
0
[A] = [L][U ] = 21
31 32 0 0
1 0 u 33 u 34
41 42 43
1 0 0 0 u 44
The [U ] matrix is the same as the one found at the end of the forward elimination steps of the
naïve Gauss elimination method.
Forward Elimination of Unknowns
Since there are four equations, there will be three steps of forward elimination of unknowns.
4.2857 × 10 7 − 9.2307 × 10 5 0 0
4.2857 × 10 − 5.4619 × 10 − 4.2857 × 10 5.4619 × 10 5
7 5 7
04.07.1
04.07.2 Chapter 04.07
First step
Divide Row 1 by 4.2857 × 10 7 and multiply it by 4.2857 × 10 7 , that is, multiply Row 1 by
4.2857 × 10 7 4.2857 × 10 7 = 1 . Then subtract the result from Row 2.
4.2857 × 10 7 − 9.2307 × 10 5 0 0
5
0 3.7688 × 10 5 − 4.2857 × 10 7 5.4619 × 10
Row 2 − (Row 1 × (1)) =
− 6.5 − 0.15384 6.5 0.15384
0 0 4.2857 × 10 7 − 3.6057 × 10 5
Divide Row 1 by 4.2857 × 10 7 and multiply it by − 6.5 , that is, multiply Row 1 by
− 6.5 4.2857 × 10 7 = −1.5167 × 10 −7 . Then subtract the result from Row 3.
4.2857 × 10 7 − 9.2307 × 10 5 0 0
3.7688 × 10 5 − 4.2857 × 10 7 5.4619 × 10 5
( (
Row 3 − Row 1 × − 1.5167 × 10 −7 )) =
0
0 − 0.29384 6.5 0.15384
0 0 4.2857 × 10 7 − 3.6057 × 10 5
Third step
Divide Row 3 by − 26.914 and multiply it by 4.2857 × 10 7 that is, multiply Row 3 by
4.2857 × 10 7 − 26.914 = −1.5924 × 10 6 . Then subtract the result from Row 4.
4.2857 × 10 7 − 9.2307 × 10 5 0 0
5
3.7688 × 10 − 4.2857 × 10 7 5.4619 × 10
( ( ))
5
0
Row 4 − Row 3 × − 1.5924 × 10 6 =
0 0 − 26.914 0.57968
0 0 0 5.6250 × 10 5
The coefficient matrix after the completion of the forward elimination steps is
4.2857 × 10 7 − 9.2307 × 10 5 0 0
3.7688 × 10 5 − 4.2857 × 10 7 5.4619 × 10 5
[U ] =
0
0 0 − 26.9140 0.579684
0 0 0 5.62500 × 10 5
Now find [L] .
1 0 0 0
1 0 0
[L] = 21
31 32 1 0
41 42 43 1
From the first step of forward elimination,
4.2857 × 10 7
21 = =1
4.2857 × 10 7
− 6.5
31 = = −1.5167 × 10 −7
4.2857 × 10 7
0
41 = =0
4.2857 × 10 7
From the second step of forward elimination,
− 0.29384
32 = = −7.7966 × 10 −7
3.7688 × 10 5
0
42 = =0
3.7688 × 10 5
From the third step of forward elimination,
4.2857 × 10 7
43 = = −1.5294 × 10 6
− 26.914
Hence
1 0 0 0
1 1 0 0
[L] =
− 1.5167 × 10 −7
− 7.7966 × 10 −7
1 0
0 0 − 1.5924 × 10 6 1
Now that [L] and [U ] are known, solve [L ][Z ] = [C ]
04.07.4 Chapter 04.07
1 0 0 0 z1 − 7.887 × 10 3
1 1 0 0 z 2 0
=
− 1.5167 × 10 −7 − 7.7966 × 10 −7
1 0 z 3 0.007
0 0 − 1.5924 × 10 6 1 z 4 0
to give
z1 = −7.887 × 10 3
z1 + z 2 = 0
− 1.5167 × 10 −7 z1 + (− 7.7966 × 10 −7 )z 2 + z 3 = 0.007
− 1.5924 × 10 6 z 3 + z 4 = 0
Forward substitution starting from the first equation gives
z1 = −7.887 × 10 3
z 2 = − z1
(
= − − 7.887 × 10 3 )
= 7.887 × 10 3
z 3 = 0.007 − (− 1.5167 × 10 −7 )z1 − (− 7.7966 × 10 −7 )z 2
( ) ( ) (
= 0.007 − − 1.51667 × 10 −7 × − 7.887 × 10 3 − − 7.79662 × 10 −7 × 7.887 × 10 3 ) ( )
= 1.1953 × 10 −2
z 4 = −(− 1.5924 × 10 6 )z 3
( ) (
= − − 1.5924 × 10 6 × 1.1953 × 10 −2 )
= 19034
Hence
z1 − 7.887 × 10 3
z 3
[Z ] = 2 = 7.887 × 10 −2
z 3 1.1953 × 10
z 4 19034
Now solve
[U ][C ] = [Z ]
4.2857 × 10 7 − 9.2307 × 10 5 0 0 c1 − 7.887 × 10 3
5 c 3
0 3.7688 × 10 5 − 4.2857 × 10 7 5.4619 × 10 2 = 7.887 × 10
0 0 − 26.914 0.57968 c3 1.1953 × 10 − 2
0 0 0 5.6250 × 10 5 c 4 19034
( )
4.2857 × 10 7 c1 + − 9.2307 × 10 5 c 2 + (0 )c3 + (0 )c 4 = −7.887 × 10 3
3.7688 × 10 c 2
5
+ (− 4.2857 × 10 )c
7
3 + 5.4619 × 10 5 c 4 = 7.887 × 10 3
− 26.914c3 + 0.57968c 4 = 1.1953 × 10 −2
5.6250 × 10 5 c 4 = 19034
LU Decomposition-More Examples: Civil Engineering 04.07.5
c2 =
( )
7.887 × 10 3 − − 4.2857 × 10 7 c3 − 5.4619 × 10 5 c 4
3.7668 × 10 5
=
( ) ( ) (
7.887 × 10 3 − − 4.2857 × 10 7 × 2.84687 × 10 −4 − 5.4619 × 10 5 × 3.3838 × 10 −2 )
3.7688 × 10 5
−3
= 4.2615 × 10
Substituting the values of c 2 , c3 and c 4 into the first equation,
( )
4.2857 × 10 7 c1 + − 9.2307 × 10 5 c 2 + (0 )c3 + (0 )c 4 = −7.887 × 10 3
c1 =
(
− 7.887 × 10 3 − − 9.2307 × 10 5 c 2 )
4.2857 × 10 7
=
( ) (
− 7.887 × 10 3 − − 9.2307 × 10 5 × 4.2615 × 10 −3 )
4.2857 × 10 7
= 9.2244 × 10 −5
The solution vector is
c1 − 9.2244 × 10 −5
c −3
2 = 4.2615 × 10
c3 2.8469 × 10 − 4
−2
c 4 3.3837 × 10
The stress on the inside radius of the outer cylinder is then given by
E 1 − ν
σθ = c (1 + ν ) + c 4 2
2 3
1 −ν r
30 × 10 6 − 2 1 − 0.3
2.8469 × 10 (1 + 0.3) + 3.3837 × 10 6.5 2
−4
=
1 − 0.3 2
= 30683 psi
Chapter 04.07
LU Decomposition – More Examples
Computer Engineering
Example 1
To infer the surface shape of an object from images taken of a surface from three different
directions, one needs to solve the following set of equations.
0.2425 0 − 0.9701 x1 247
0 0.2425 − 0.9701 x 2 = 248
− 0.2357 − 0.2357 − 0.9428 x3 239
The right hand side values are the light intensities from the middle of the images, while the
coefficient matrix is dependent on the light source directions with respect to the camera. The
unknowns are the incident intensities that will determine the shape of the object.
First step
Divide Row 1 by 0.2425 and multiply it by 0, that is, multiply it by 0 0.2425 = 0 . Then
subtract the result from Row 2.
0.2425 0 − 0.9701
Row 2 − (Row 1 × (0 )) = 0 0.2425 − 0.9701
− 0.2357 − 0.2357 − 0.9428
04.07.1
04.07.2 Chapter 04.07
x1 0.10905
x = 4.2328
2
x3 − 254.59
04.07.1
04.07.2 Chapter 04.07
Divide Row 1 by 0.7460 and multiply it by 0.0100, that is, multiply Row 1 by
0.0100 0.7460 = 0.013405 .
Row 1 × (0.013405) =
[0.0100 − 0.0060536 0.00013405 − 0.00010724 0.00013405 − 0.00010724] [1.6086]
Subtract the result from Row 3 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 − 0.0019464 0.77857 − 0.52061 0.0098660 − 0.0078928 I br − 61.609
=
0 .0080 0 . 0100 0 .5205 0 .7787 0 .0080 0 .0100 I bi − 103.9
0.0100 − 0.0080 0.0100 − 0.0080 0.8080 − 0.6040 I cr − 60.00
0.0080 0.0100 0.0080 0.0100 0.6040 0.8080 I ci 103.9
Divide Row 1 by 0.7460 and multiply it by 0.0080, that is, multiply Row 1 by
0.0080 0.7460 = 0.010724 .
Row 1 × (0.010724 ) =
[0.0080 − 0.0048429 0.00010724 − 8.5791 × 10 −5 0.00010724 − 8.5791 × 10 −5 ] [1.2869]
Subtract the result from Row 4 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 − 0.0019464 0.77857 − 0.52061 0.0098660 − 0.0078928 I br − 61.609
=
0 0 . 014843 0 .52039 0 . 77879 0 . 0078928 0 . 010086 I bi − 105.19
0.0100 − 0.0080 0.0100 − 0.0080 0.8080 − 0.6040 I cr − 60.00
0.0080 0.0100 0.0080 0.0100 0.6040 0.8080 I ci 103.9
Divide Row 1 by 0.7460 and multiply it by 0.0100, that is, multiply Row 1 by
0.0100 0.7460 = 0.013405 .
Row 1 × (0.013405) =
[0.0100 − 0.0060536 0.00013405 − 0.00010724 0.00013405 − 0.00010724] [1.6086]
Subtract the result from Row 5 to get
LU Decomposition-More Examples: Electrical Engineering 04.07.3
Divide Row 1 by 0.7460 and multiply it by 0.0080, that is, multiply Row 1 by
0.0080 0.7460 = 0.010724 .
Row 1 × (0.010724 ) =
[0.0080 − 0.0048429 0.00010724 − 8.5791 × 10 −5 0.00010724 − 8.5791 × 10 −5 ] [1.2869]
Subtract the result from Row 6 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 − 0.0019464 0.77857 − 0.52039 0.0098660 − 0.0078928 I br − 61.609
=
0 0.014843 0.52039 0.77879 0.0078928 0.010086 I bi − 105.19
0 − 0.0019464 0.0098660 − 0.0078928 0.80787 − 0.60389 I cr − 61.609
0 0.014843 0.0078928 0.010086 0.60389 0.80809 I ci 102.61
Second step
Divide Row 2 by 1.0194 and multiply it by −0.0019464, that is, multiply Row 2 by
− 0.0019464 1.0194 = −0.0019094 .
Row 2 × (− 0.0019094 ) =
[0 − 0.0019464 − 3.7164 × 10 −6 − 2.8341 × 10 −5 − 3.7164 × 10 −6 − 2.8341 × 10 −5 ] [0.13870]
Subtract the result from Row 3 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 0 0.77857 − 0.52036 0.0098697 − 0.0078644 I br − 61.747
=
0 0.014843 0.52039 0.77879 0.0078928 0.010086 I bi − 105.19
0 − 0.0019464 0.0098660 − 0.0078928 0.80787 − 0.60389 I cr − 61.609
0 0.014843 0.0078928 0.010086 0.60389 0.80809 I ci 102.61
Divide Row 2 by 1.0194 and multiply it by 0.014843, that is, multiply Row 2 by
0.014843 1.0194 = 0.014561 .
Row 2 × (0.014561) =
[0 0.014843 2.8341 × 10 −5 0.00021612 2.8341 × 10 −5 0.00021612 ] [− 1.0577]
Subtract the result from Row 4 to get
04.07.4 Chapter 04.07
Divide Row 2 by 1.0194 and multiply it by −0.0019464, that is, multiply Row 2 by
− 0.0019464 1.0194 = −0.0019094 .
Row 2 × (− 0.0019094 ) =
[0 − 0.0019464 − 3.7164 × 10 −6 − 2.8341 × 10 −5 − 3.7164 × 10 −6 − 2.8341 × 10 −5 ] [0.13870]
Subtract the result from Row 5 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 0 0.77857 − 0.52036 0.0098697 − 0.0078644 I br − 61.747
=
0 0 0.52036 0.77857 0.0078644 0.0098697 I bi − 104.13
0 0 0.0098697 − 0.0078644 0.80787 − 0.60386 I cr − 61.747
0 0.014843 0.0078928 0.010086 0.60389 0.80809 I ci 102.61
Divide Row 2 by 1.0194 and multiply it by 0.014843, that is, multiply Row 2 by
0.014843 1.0194 = 0.014561 .
Row 2 × (0.014561) =
[0 0.014843 2.8341 × 10 −5 0.00021612 2.8341 × 10 −5 0.00021612 ] [− 1.0577]
Subtract the result from Row 6 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 0 0.77857 − 0.52036 0.0098697 − 0.0078644 I br − 61.747
=
0 0 0 . 52036 0 .77857 0 . 0078644 0 . 0098697 I bi − 104.13
0 0 0.0098697 − 0.0078644 0.80787 − 0.60386 I cr − 61.747
0 0 0.0078644 0.0098697 0.60386 0.80787 I ci 103.67
Third step
Divide Row 3 by 0.77857 and multiply it by 0.52036, that is, multiply Row 3 by
0.52036 0.77857 = 0.66836 .
Row 3 × (0.66836) =
[0 0 0.52036 − 0.34779 0.0065965 − 0.0052563] [− 41.269]
Subtract the result from Row 4 to get
LU Decomposition-More Examples: Electrical Engineering 04.07.5
Divide Row 3 by 0.77857 and multiply it by 0.0098697, that is, multiply Row 3 by
0.0098697 0.77857 = 0.012677 .
Row 3 × (0.012677 ) =
[0 0 0.0098697 − 0.0065965 0.00012511 − 9.9695 × 10− 5 ]
[− 0.78275]
Subtract the result from Row 5 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 0 0.77857 − 0.52036 0.0098697 − 0.0078644 I br − 61.747
=
0 0 0 1.1264 0.0012679 0.015126 I bi − 62.860
0 0 0 − 0.0012679 0.80774 − 0.60376 I cr − 60.965
0 0 0.0078644 0.0098697 0.60386 0.80787 I ci 103.67
Divide Row 3 by 0.77857 and multiply it by 0.0078644, that is, multiply Row 3 by
0.0078644 0.77857 = 0.010101 .
Row 3 × (0.010101) =
[0 0 0.0078644 − 0.0052563 9.9695 × 10− 5 − 7.9439 × 10− 5 ]
[− 0.62372]
Subtract the result from Row 6 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 0 0.77857 − 0.52036 0.0098697 − 0.0078644 I br − 61.747
=
0 0 0 1.1264 0.0012679 0.015126 I bi − 62.860
0 0 0 − 0.0012679 0.80774 − 0.60376 I cr − 60.965
0 0 0 0.015126 0.60376 0.80795 I ci 104.29
Fourth step
Divide Row 4 by 1.1264 and multiply it by −0.0012679, that is, multiply Row 4 by
− 0.0012679 1.1264 = −0.0011257 .
Row 4 × (− 0.0011257 ) =
[0 0 0 − 0.0012679 − 1.4273 × 10− 6 − 1.7027 × 10− 5 ] [0.070761]
04.07.6 Chapter 04.07
Divide Row 4 by 1.1264 and multiply it by 0.015126, that is, multiply Row 4 by
0.015126 1.1264 = 0.013429 .
Row 4 × (0.013429) =
[0 0 0 0.015126 1.7027 × 10− 5 0.00016196 ][− 0.67308]
Subtract the result from Row 6 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 0 0.77857 − 0.52036 0.0098697 − 0.0078644 I br − 61.747
=
0 0 0 1 . 1264 0. 0012679 0 . 015126 I bi − 62.860
0 0 0 0 0.80775 − 0.60375 I cr − 61.035
0 0 0 0 0.60375 0.80775 I ci 104.97
Fifth step
Divide Row 5 by 0.80775 and multiply it by 0.60375, that is, multiply Row 5 by
0.60375 0.80775 = 0.74745 .
Row 5 × (0.74741) =
[0 0 0 0 0.60375 − 0.45127] [− 45.621]
Subtract the result from Row 6 to get
0.7460 − 0.4516 0.0100 − 0.0080 0.0100 − 0.0080 I ar 120
0
1.0194 0.0019464 0.014843 0.0019464 0.014843 I ai − 72.643
0 0 0.77857 − 0.52036 0.0098697 − 0.0078644 I br − 61.747
=
0 0 0 1.1264 0.0012679 0.015126 I bi − 62.860
0 0 0 0 0.80775 − 0.60375 I cr − 61.035
0 0 0 0 0 1.2590 I ci 150.76
The coefficient matrix after the completion of the forward elimination steps is the [U ]
matrix.
LU Decomposition-More Examples: Electrical Engineering 04.07.7
0.0078644
63 = = 0.01010
0.77857
From Step 4 of the forward elimination process
− 0.0012679
54 = = −0.0011257
1.1264
0.015126
64 = = 0.013429
1.1264
From Step 5 of the forward elimination process
0.60375
65 = = 0.74745
0.80775
Hence
1 0 0 0 0 0
0.60536
1 0 0 0 0
0.013405 − 0.0019094 1 0 0 0
[L] =
0.010724 0.014561 0.66836 1 0 0
0.013405 − 0.0019094 0.012677 − 0.0011257 1 0
0.010724 0.014561 0.01010 0.013429 0.74745 1
Now that [L ] and [U ] are known, solve [L ][Z ] = [C ]
1 0 0 0 0 0 z1 120
0.60536
1 0 0 0 0 z2 0.000
0.013405 − 0.0019094 1 0 0 0 z3 − 60.00
=
0 .010724 0 .014561 0 .66836 1 0 0 z4 − 103.9
0.013405 − 0.0019094 0.012677 − 0.0011257 1 0 z5 − 60.00
0.010724 0.014561 0.01010 0.013429 0.74745 1 z6 103.9
This provides the six equations
z1 = 120
0.60536 z1 + z2 = 0.000
0.013405 z1 + (− 0.0019094 )z2 + z3 = −60.00
0.010724 z1 + 0.014561z2 + 0.66836z 3 + z4 = −103.9
0.013405 z1 + (− 0.0019094 )z2 + 0.012677 z3 + (− 0.0011257 )z4 + z5 = −60.00
0.010724 z1 + 0.014561z2 + 0.01010 z3 + 0.013429 z4 + 0.74745 z5 + z6 = 103.9
Forward substitution starting from the first equation gives
z1 = 120
Substituting the value of z1 into the second equation,
z 2 = −0.60536 z1
= −0.60536(120 )
= −72.643
LU Decomposition-More Examples: Electrical Engineering 04.07.9
I ar 119.33
I − 71.973
ai
I br − 116.66
=
I bi − 57.432
I cr 13.940
I ci 119.74
Divide Row 1 by 0.3333 and multiply it by 1.05, that is, multiply Row 1 by
1.05 0.3333 = 3.1503 . Then subtract the results from Row 3.
04.07.1
04.07.2 Chapter 04.07
z 2 = 1260 − 0.50015 z1
= 1260 − 0.50015 × 756
= 881.89
z 3 = 0 − 3.1503 z1 − (−2.6147) z 2
= 0 − 3.1503 × 756 − (−2.6147) × 881.89
= −75.864
Hence
z1 756
[Z ] = z 2 = 881.89
z 3 − 75.864
Now solve [U ][ X ] = [Z ] .
0.3333 0.1667 0.6667 x1 756
0
0.58332 − 0.00015002 x 2 = 881.89
0 0 − 2.1007 x3 − 75.864
0.3333 x1 + 0.1667 x 2 + 0.6667 x3 = 756
0.58332 x 2 + (−0.00015002) x3 = 881.89
− 2.1007 x3 = −75.864
From the third equation,
− 2.1007 x3 = −75.864
− 75.864
x3 =
− 2.1007
= 36.113
Substituting the value of x3 in the second equation,
0.58332 x 2 + (−0.00015002) x3 = 881.89
881.89 − (−0.00015002) x3
x2 =
0.58332
881.89 − (−0.00015002) × 36.113
=
0.58332
= 1511.8
Substituting the values of x 2 and x3 in the first equation,
0.3333 x1 + 0.1667 x 2 + 0.6667 x3 = 756
756 − 0.1667 x 2 − 0.6667 x3
x1 =
0.3333
756 − 0.1667 × 1511.8 − 0.6667 × 36.113
=
0.3333
= 1439.8
The solution vector is
04.07.4 Chapter 04.07
x1 1439.8
x = 1511.9
2
x3 36.113
The equation that gives the diametric contraction ∆D of the trunnion in a dry-ice/alcohol
mixture (boiling temperature is − 108°F ) is given by
−108
∆D = 12.363 ∫ α (T )dT
80
The equation for the thermal expansion coefficient, α = a1 + a 2T + a3T 2 , is obtained using
regression analysis where the constants of the model are found by solving the following
simultaneous linear equations.
24 − 2860 7.26 × 10 5 a1 1.057 × 10 −4
− 2860 7.26 × 10 5 − 1.86472 × 10 8 a 2 = − 1.04162 × 10 − 2
7.26 × 10 5 − 1.86472 × 10 8 5.24357 × 1010 a3 2.56799
Find the values of a1 , a 2 , and a3 using LU decomposition.
04.07.1
04.07.2 Chapter 04.07
Solution
1 0 0 u11 u12 u13
[A] = [L][U ] = 21 1 0 0 u 22 u 23
31 32 1 0 0 u 33
The [U ] matrix is the same as the one found at the end of the forward elimination steps of the
naïve Gauss elimination method.
Forward Elimination of Unknowns
Since there are three equations, there will be two steps of forward elimination of unknowns.
24 − 2860 7.26 × 10 5
− 2860 7.26 × 10 5 − 1.86472 × 10 8
7.26 × 10 5 − 1.86472 × 10 8 5.24357 × 1010
First step
Divide Row 1 by 24 and multiply it by −2860, that is, multiply it by − 2860 24 = −119.17 .
Then subtract the result from Row 2.
24 − 2860 7.26 × 10 5
Row 2 − (Row 1 × (− 119.17 )) = 0 3.8518 × 10 5 − 99.957 × 10 6
7.26 × 10 5 − 1.8647 × 10 8 5.2436 × 1010
Divide Row 1 by 24 and multiply it by 7.26 × 10 5 , that is, multiply it by
7.26 × 10 5 24 = 30250 . Then subtract the result from Row 3.
24 − 2860 7.26 × 105
Row 3 − (Row 1 × 30250 ) = 0 3.8518 × 105 − 99.957 × 106
0 − 99.957 × 106 30.474 × 109
Second step
We now divide Row 2 by 3.8518 × 10 5 and multiply it by − 99.957 × 10 6 , that is, multiply it
by − 99.957 × 10 6 3.8518 × 10 5 = −259.50 . Then subtract the result from Row 3.
24 − 2860 7.26 × 10 5
Row 3 − (Row 2 × (− 259.50 )) = 0 3.8518 × 10 5 − 99.957 × 10 6
0
0 4.5349 × 10 9
24 − 2860 7.26 × 10 5
[U ] = 0 3.8518 × 10 5 − 99.957 × 10 6
0
0 4.5349 × 10 9
[Z ] = z 2 = 0.0021797
z 3 − 0.063788
Now solve
[U ][A] = [Z ]
24 − 2860 7.26 × 105 a1 1.057 × 10−4
0 3.8518 × 10
5
− 99.957 × 106 a2 = 0.0021797
0
0 4.5349 × 109 a3 − 0.063788
24a1 + (− 2860 )a2 + 7.26 × 105 a3 = 1.057 × 10−4
04.07.4 Chapter 04.07
( )
3.8518 × 105 a2 + − 99.957 × 106 a3 = 0.0021797
4.5349 × 10 a3 = −0.063788
9
a = 2.0087 × 10− 9
2
a3 − 1.4066 × 10−11