Direct Methods for the Solution of Linear System of Equations 7
of ‘back substitution’. The elimination procedure is started from the equation which
has the largest coefficient for the first unknown x1. The value of x1 is expressed in
terms of the other unknowns, i.e. x2, x3, ...., etc. is substituted in other equations.
The elimination procedure is repeated until only one unknown remains in the last
equation and its value determined. The other unknowns are evaluated by back
substitution. The method is illustrated through the following practical examples.
Example 1.5
Solve the following set of equations by Gaussian elimination method.
3x1 + x2 + x3 = 4 (1)
x1 + 4x2 + x3 = – 5 (2)
x1 + x2 – 6x3 = – 12 (3)
Solution
Step 1
Consider Eq. (1) having the largest coefficient of x1 and divide it by 3 and rewrite
the equation as
x1 = (1.33 – 0.33x2 – 0.33x3) (4)
Step 2
Substitute Eq. (4) in Eqs. (2) and (3)
(1.33 – 0.33x2 – 0.33x3) + 4x2 – x3 = – 5
3.67x2 – 1.33x3 = – 6.33 (5)
(1.33 – 0.33x2 – 0.33x3) + x2 – 6x3 = – 12
0.67x2 – 6.33x3 = – 13.33 (6)
Step 3
Consider Eq. (5) has the largest coefficient of
3.67x2 – 1.33x3 = – 6.33
3.67x2 = – 6.33 + 1.033x3 (7)
x2 = – 1.72 + 0.362x3
Step 4
Substitute Eq. (7) in Eq. (6)
0.67(–1.72 + 0.362x3) – 6.33x3 = –13.33
Therefore x3 = 2
Step 5
By back substitution, evaluate x1 and x2
From Eq. (7), x2 = –1.72 + 0.362(2) = –1
From Eq. (4), x1 = 1.33 + 0.33(–1) – 0.33(2) = 1
Therefore x1 = 1, x2 = –1, x3 = 2
Example 1.6
Solve the following set of equations by the Gaussian elimination method.
Solution
w+x+y=3 (1)
– 3w – 17x + y + 2z = 1 (2)
4w + 8y – 5z = 1 (3)
– 5x – 2y + z = 1 (4)
12 Numerical Techniques and Computer Programming for Engineering Problems
where L is the unit lower triangular matrix and U is the upper triangular matrix. The
triangular matrices are represented as
⎡ 1 0 0 ⎤ ⎡U11 U12 U13 ⎤
⎢L 1 0 ⎥⎥ ⎢⎢ 0 U22 U23 ⎥⎥ = [ A]
⎢ 21
⎢⎣ L31 L32 0 ⎥⎦ ⎢⎣ 0 0 U33 ⎥⎦
The matrix representation shown above is termed as factorisation. The diagonal
non-zero entry of L matrix is the ith pivot of factorisation. Multiplying L and U, we
can evaluate all the elements of [A]. The factorisation method is generally preferred
over the Gaussian elimination method in computers having the facility of accumulating
products in double length. The application of this method is illustrated by the
following examples.
Example 1.9
Solve the following system of linear equations using factorisation method.
5x − 2y + z = 4 (1)
7 x + y − 5z = 8 (2)
3 x + 7 y + 4 z = 10 (3)
Solution
The equation can be expressed in the matrix following form as,
⎡ 5 −2 1 ⎤ ⎧ x1 ⎫ ⎧ 4 ⎫
⎢ ⎥ ⎪ ⎪ ⎪ ⎪
⎢ 7 1 −5 ⎥ ⎨ x 2 ⎬ = ⎨ 8 ⎬
⎢⎣ 3 7 4 ⎥⎦ ⎩⎪ x3 ⎭⎪ ⎩⎪10⎭⎪
The coefficient matrix is written in the following form.
⎡ 1 0 0 ⎤ ⎡U11 U12 U13 ⎤ ⎡ 5 −2 1 ⎤
⎢L 1 0 ⎥⎥ ⎢⎢ 0 U 22 U23 ⎥⎥ = ⎢⎢ 7 1 −5 ⎥⎥
⎢ 21
⎢⎣ L31 L32 1⎥⎦ ⎢⎣ 0 0 U33 ⎥⎦ ⎢⎣ 3 7 4 ⎥⎦
[L][U] = [A]
The elements of the triangular matrix are determined by multiplying [L] and [U]
and equating to the corresponding elements in the coefficient matrix as outlined in
the following steps.
1(U11 ) + 0 ( 0) + 0 = 5
∴ U11 = 5 (4)
1(U12 ) + 0 (U22 ) + 0 = − 2
∴U12 = − 2 (5)
1(U13 ) + 0 (U 23 ) + 0 (U33 ) = 1
∴U13 = 1 (6)
Direct Methods for the Solution of Linear System of Equations 19
⎛ a ⎞ ⎛ −1 ⎞
g31 = ⎜ 13 ⎟ = ⎜ ⎟ = − 0.577
⎝ g11 ⎠ ⎝ 1.732 ⎠
2
2
g22 = a22 − g 21 = 4 − (1.555) = 1.633
⎛ a − g21 g31 ⎞ ⎡ 2 − (1.155 )( −0.577 ) ⎤
g32 = ⎜ 23 ⎟=⎢ ⎥ = 1.633
⎝ g22 ⎠ ⎣ 1.633 ⎦
2
2
g33 = a33 − g 31 2
− g32 = 4 − [(−0.577 ) + 1.6332 = 1.0
The resulting matrix is
⎡ 1.732 0 0⎤
⎢ ⎥
[ G] = ⎢ 1.155 1.633 0⎥
⎢⎣−0.577 1.633 1⎥⎦
Step 2. Forward solution
[ G][ Y ] = [C]
⎡ 1.732 0 0 ⎤ ⎡ y1 ⎤ ⎡ 4 ⎤
⎢ 1.155 1.633 0 ⎥ ⎢ y ⎥ = ⎢ 8 ⎥
⎢ ⎥ ⎢ 2⎥ ⎢ ⎥
⎢⎣ −0.577 1.633 1 ⎥⎦ ⎢⎣ y3 ⎥⎦ ⎢⎣ 5 ⎥⎦
Solving the first equation for y1 gives
1.732 y1 = 4
∴ y1 = 2.309
Solving the second equation for y2 gives
1.155 y1 + 1.633 y2 = 8
1.155 ( 2.309) + 1.633 y2 = 8 ∴ y2 = 3.266
Solving the third equation for y3 gives
−0.577 y1 + 1.633 y 2 + y 3 = 5
−0.577 ( 2.309) + 1.633 ( 3.266) + y3 = 5
Solving y3 = 1.000
Step 3. Backward solution
Solve the equation
T
[ G] [ X ] = [ Y ]
⎡1.732 1.155 −0.577 ⎤ ⎡ x ⎤ ⎡ 2.309 ⎤
⎢ 0 1.633 1.633 ⎥⎥ ⎢⎢ y ⎥⎥ = ⎢⎢ 3.266 ⎥⎥
⎢
⎢⎣ 0 0 1 ⎥⎦ ⎢⎣ z ⎥⎦ ⎢⎣ 1.000 ⎥⎦
28 Numerical Techniques and Computer Programming for Engineering Problems
Solution
The equations are expressed in the matrix form
⎡ 1 2 −1⎤ ⎧ x ⎫ ⎧ −3 ⎫
⎢ 4 −3 4 ⎥ ⎪ y ⎪ = ⎪ 1 ⎪
⎢ ⎥⎨ ⎬ ⎨ ⎬
⎢⎣ 2 −1 1 ⎥⎦ ⎩⎪ z ⎭⎪ ⎩⎪ −2 ⎭⎪
[ A] {X} = {K}
Therefore X = [ A(−1) ]K , where A−1 is the inverse of matrix A.
The cofactors of the matrix A are determined as follows:
2 −3 4
A11 = (−1) =−3+4=1
−1 1
3 4 4
A12 = (−1) = (−1)( 4 − 8) = 4
2 1
4 4 −3
A13 = (−1) =−4+6= 2
2 −1
3 2 −1
A21 = (−1) = (−1)( 2 − 1) = − 1
−1 1
4 1 −1
A22 = (−1) =1+ 2= 3
2 1
5 1 2
A23 = (−1) = (−1)(−1 − 4) = 5
2 −1
4 2 −1
A31 = (−1) =8−3=5
−3 4
5 1 −1
A32 = (−1) = (−1)( 4 + 4) = − 8
4 4
6 1 −2
A33 = (−1) = − 3 − 8 = − 11
4 −3
T
⎡ A11 A12 A13 ⎤
⎢ ⎥
Therefore adj. A = ⎢ A21 A22 A23 ⎥
⎢⎣ A31 A32 A33 ⎥⎦
T
⎡1 4 2 ⎤ ⎡ 1 −1 5 ⎤
⎢ ⎥ ⎢ ⎥
= ⎢ −1 3 5 ⎥ = ⎢ 4 3 −8 ⎥
⎢⎣ 5 −8 −11⎥⎦ ⎢⎣ 2 5 −11⎥⎦