L2 - Simultaneous Equation Solution

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

SOLUTION OF SIMULTANEOUS EQUATIONS

M.L. KANSAL
NEEPCO Chair Professor & Professor,
Department of Water Resources Development and Management,
Indian Institute of Technology Roorkee, ROORKEE 247 667

EQUATIONS AND IDENTITIES


An equation is a statement of equality between two algebraic expressions which holds good
for a limited number of values of the variable or variables. If the statement of equality is true
for all values of the unknowns, then the statement is an identity. For example, x 2 – y2 = (x - y)
× (x + y) is true for all values of x and y, and is therefore identity. Further, (a + 3) 2 = a2 + 6a +
9 is an identity and (a + 3)2 = a2 + 4a + 17 is an equation as it is true only for a = 4. The identity
is represented by 3 horizontal bars, whereas, equation is represented by 2 bars.
LINEAR EQUATION
If one has linear equation of form ax = b where, x is unknown, and a & b are constants, then,
three possibilities arise:

b
1. a  0 then x = = a −1b . In this case the equation ax = b has a unique solution for x .
a
2. a = 0 , b = 0 then the equation ax = b becomes 0 = 0 and any value of x will do. In this
case the equation ax = b has infinitely many solutions.
3. a = 0 , b  0 then ax = b becomes 0 = b which is a contradiction. In this case the equation
ax = b has no solution for x .

In general form, simultaneous linear equations can be written as :


a11 X1 + a12 X2 + ……….. + a1n Xn = b1

a21 X1 + a22 X2 + ……….. + a2n Xn = b2


..
..
..
am1 X1 + am2 X2 + ……….. + amn Xn = bm

In matrix form, these are written as

 a11 a12 a1n   x1   b1 


a a 22 a 2 n   x  b 
 21  2= 2
     
     
a m1 am2 a mn   x m  bm 
or,

MLK_SDT_L2_20-21_1/10
AX = b
where A is the coefficient matrix, X is the column vector of unknown quantities, and b is the
column vector of known quantities.
If A is square and non-singular (whose determinant is not zero) then,
X = A-1 b
Therefore, the values of X can be found by pre-multiplying the vector of known quantities by
the inverse of the coefficient matrix A.
Problem. 1. Find the inverse of matrix

1 2 3 
0 1 5 
 
 5 6 0 

Solution:
Step 1: Determinate of matrix A, i.e., |A|
Repeat the first two columns

Take the difference of Sum of multiplication of diagonal elements, i.e.,


(1*1*0+2*5*5+3*0*6) – (5*1*3+6*5*1+0*0*2)
|A| = (0+50+0) – (15+30+0) = 5
Step 2: Calculate the minor of the matrix A,
5| |0 1
|1 5| |0 |
6 0 5 0 5 6
2 3 1 3 1 2
Minor of A = | | | | | |
6 0 5 0 5 6
2 3 1 3 1 2
[ |1 5
| |
0 5
| |
0 1]
|

 −30 −25 −5


=  −18 −15 −4 
 7 5 1 

Step 3: Cofactor matrix


Multiply each element of the matrix by ( -1)i+j
where, i and j are the row and column of the matrix, respectively.

MLK_SDT_L2_20-21_2/10
 −30 25 −5
Cofactor of A =  18 −15 4 
 
 7 −5 1 

Step 4: Adjugate the matrix (also called the Adjoint)


Transpose of cofactor matrix (Step 3).

 −30 18 7 
Adjoint of A =  25 −15 −5
 
 −5 4 1 

Step 4: Inverse matrix is obtained by dividing the elements of Adjoint matrix by the
determinant value.
1
A−1 =  Adjoint of A
| A|

 18 7 
−6
 −30 18 7  5 5
−1 1   
A =  25 −15 −5 =  5 −3 −1
5
 −5 4 1   4 1
 −1 
 5 5
1. SOLUTION OF SIMULTANEOUS EQUATIONS

A. MATRIX METHOD

Problem.2. Solve the following system of linear equations by Matrix method:


x + 2y − z = 7

2x − 3 y − 4z = −3

x+ y+z =0

The systems of linear equations can be written as

1 2 −1  x   7 
 2 −3 −4    y  =  −3
     
1 1 1   z   0 

Solution:
Follow the above steps to find out inverse of a matrix

MLK_SDT_L2_20-21_3/10
 1 3 11 
 − 16 16 16 
 
So, A-1 = 
3 1 1
− −
 8 8 8
 
− 5 −
1 7 
 16 16 16 

We can write the equation ( A−1 AX = A−1 B ) as:

 1 3 11   1 3 11 
 − 16 16 
16 1 2 −1  x   16

16 16   7 
   
 3 1     1  
−   2 −3 −4    y  = 
1 3 1
− − −   −3
 8 8 8  8 8 8
  1 1 1   z    0
− 5 1 7  − 5 1 7   
− −
 16 16 16   16 16 16 

 x   −1
 y =  3 
   
 z   −2 

So, x = -1, y = 3 and z = -2 (Ans.)

B. CRAMER’S RULE
Another simple way of solving the simultaneous linear equations is the Cramer’s rule
provided A  0 . Using this rule, the values of X vector can be estimated as:

b1 a12 a13 a11 b1 a13 a11 a12 b1


1 1 1
x= b2 a 22 a 23 y = a 21 b2 a 23 z = a 21 a 22 b2
A A A
b3 a32 a33 a31 b3 a33 a31 a32 b3

Problem 3: Use Cramer’s Rule to solve


2𝑥 + 3𝑦 − 𝑧 = 1

4𝑥 + 𝑦 − 3𝑧 = 11
3𝑥 − 2𝑦 + 5𝑧 = 21

Step 1: Find the determinant, D, by using the x, y and z values from the problem
2 3 −1 2 3 −1 2 3
D = |4 1 −3| = |4 1 −3| 4 1 = -9 – 69 = -78
3 −2 5 3 −2 5 3 −2
Since A  0 we can proceed with Cramer’s Rule

MLK_SDT_L2_20-21_4/10
Step 2: Find the determinant, Dx, by replacing the coefficient of x in the first column with
the RHS values of the equations leaving the y and z columns unchanged.
1 3 −1 1 3 −1 1 3
DX = |11 1 −3| = |11 1 −3| 11 1 = -162 - 150 = -312
21 −2 5 21 −2 5 21 −2
Step 3: Find the determinant, Dy, by replacing the coefficient of y in the first column with
the RHS values of the equations leaving the x and z columns unchanged.
2 1 −1 2 1 −1 2 1
Dy = |4 11 −3| = |4 11 −3| 4 11 = 17-(-139) = 156
3 21 5 3 21 5 3 21
Step 4: Find the determinant, Dz, by replacing the coefficient of z in the first column with the
RHS values of the equations leaving the x and y columns unchanged.
2 3 1 2 3 1 2 3
Dz = |4 1 11| = |4 1 11| 4 1 = 133 – 211 = -78
3 −2 21 3 −2 21 3 −2
Step 5: Use Cramer’s Rule to find the values of x, y and z.
Dx −312
x = = = 4
D −78
𝐷𝑦 156
y = = = -2
𝐷 −78
𝐷𝑧 −78
z = = = 1
𝐷 −78

Generally, the answer is written as an order triple (4, -2, 1) representing the x, y and z
values.
Note:

The Cramer’s rule and Matrix method become tedious for large systems. However, there exist other
numerical methods of solution which are well suited for large problems. These are the Direct Methods
and the Iterative Methods of Solution.

1. DIRECT METHODS - Gauss Elimination and Gauss Jordan methods

Problem Solve the following simultaneous linear equations;

x + y + z = 6;

x − y + z = 2;

2x − y + 3z = 9 ;

Solution:

1. Arrange the equations such that 1st equation is with the largest coeff. of X; 2nd is with
largest coeff. of Y and 3rd is with largest coefficient of Z (Preferable but not necessary).

MLK_SDT_L2_20-21_5/10
x+ y+z =6 (1)

x− y+z =2 (2)

2x − y + 3z = 9 (3)

2. Write the augmented matrix

1 1 1 6
[1 −1 1| 2]
2 −1 3 9

Gauss Elimination Method: Gauss Jordan Method:


3. Transform the augmented matrix 3. Transform the augmented matrix into an
into upper triangular matrix by row identity or unit matrix (i.e., 1 on diagonal
operations. It will be more and zero elsewhere) by row operations.
convenient if it transformed into Unit
upper triangular matrix. ➢ R2→R2-R1; R3→R3-2R1
➢ R2→R2-R1; R3→R3-2R1 1 1 1 6
1 1 1 6 [0 −2 0| −4]
[0 −2 0| −4] 0 −3 1 −3
0 −3 1 −3 ➢ R2→R2/(-2)
➢ R2→R2/(-2) 1 1 1 6
1 1 1 6 [0 1 0| 2 ]
[0 1 0| 2 ] 0 −3 1 −3
0 −3 1 −3 ➢ R3→R3+3R2
➢ R3→R3+3R2 1 1 1 6
1 1 1 6 [0 1 0| 2]
[0 1 0| 2] 0 0 1 3
0 0 1 3 ➢ R1→R1-(R2+R3)
4. Write the augmented matrix in 1 0 0 1
[0 1 0| 2]
equation form.
0 0 1 3
x+ y+z =6 (4) 4. Divide right-hand side’s elements as
y=2 (5) well as diagonal elements by the diagonal
z =3 (6) elements in the row, which will make each
5. Use back substitution, one can get diagonal element equal to one. Here the
the solution. diagonal elements are already one.
z = 3; putting value of z in (5) will give Therefore, we do not need to divide. (This
value of y and by putting the values step if performed at end is better to avoid
of z and y in (4) will give value of x. computations with fractional values.)
Hence, solution will be z = 3, y = 2 and Hence, solution is x =1, y = 2 and z= 3.
x =1.

MLK_SDT_L2_20-21_6/10
2. ITERATIVE METHODS OF SOLUTION

In this method, one start from an approximation close to true solution and keep on improving
the solution in each cycle till the solution matches with the previous cycle solution with a
desired level of satisfaction.
Consider the equations:

a1x + b1y + c1z = d1 (1)

a2 x + b2 y + c2 z = d 2 (2)

a3 x + b3 y + c3 z = d 3 (3)

Arrange the equations such that 1st equation is with the largest coeff. of x; 2nd is with largest
coeff. of y and 3rd is with largest coefficient of z. If, a1, b2 and c3 are large as compared to other
coefficients, then solve the Eq. 1 for x, Eq. 2 for y and Eq. 3 for z.
1
x= (d1 − b1 y − c1z ) (4)
a1

1
y= (d2 − a2 x − c2z ) (5)
b2

1
z= (d3 − a3x − b3 y) (6)
c3

Jacobi’s Iteration method Gauss-Seidel iteration method


Required Conditions:
|a1| > |b1| + |c1|
|b2 | > |a 2 | + |c2 |
|c3 | > |a 3 | + |b3 |
1. Initial approximations: 1. Initial approximations:
Take x = y = z = 0. Substituting on Take y = z = 0. Substitute in the right
the right side of Eq. (4), (5) and (6), side of Eq. (4), and get the first
we get the first approximations: d
d d d
approximations: x1 = 1 . Put the value
x 1 = 1 ; y 1 = 2 ; z1 = 3 a1
a1 b2 c3 of x = x1 and z=0 in Eq. (5) and find out y=
2. Second approximation: y1. Further substitute the value of x=x1
1 and y=y1 in the Eq. (6) to get the value of
x 2 = (d1 − b1 y 1 − c1z1 )
a1 z = z1.
2. Second approximation:
1
y2 = (d2 − a2 x 1 − c2z1 ) 1
b2 x 2 = (d1 − b1 y 1 − c1z1 )
a1
1
z2 = (d3 − a3x 1 − b 3 y 1 )
c3

MLK_SDT_L2_20-21_7/10
3. Repeat this process till the 1
y2 = (d 2 − a2 x2 − c2 z1 )
difference between the two b2
consecutive approximations is 1
negligible. z2 = (d3 − a3 x2 − b3 y2 )
c3
3. Repeat this process till the difference
between the two consecutive
approximations is negligible.

Example: Solve the system of linear Example: Solve the system of linear
equations equations
20x + y - 2z =17 20x + y - 2z =17
3x + 20y – z = -18 3x + 20y – z = -18
2x – 3y + 20z = 25 2x – 3y + 20z = 25

Rearrange the given equations as follows: Rearrange the given equations as follows:
1 1
x = (17 − y + 2z) (1) x= (17 − y + 2z) (1)
20 20
1 1
y = (−18 − 3x + z) (2) y = (−18 − 3x + z) (2)
20 20
1 1
z = (25 − 2x + 3y) (3) z = (25 − 2x + 3y) (3)
20 20
Iteration 1: Iteration 1:
Initial Assumption: X = y = z = 0. Initial Assumption: y = z = 0.
Substituting these on the right sides of the So, x = 17 = 0.85 from Eq. (1)
1
above equations, we get 20
17 18 Substitute x = 0.85 and z = 0 in Eq. (2)
x1 = = 0.85 ; y1 = − = −0.9 ; (−18−3×0.85+1×0)
20 20 Then, 𝑦1 = = −1.0275
20
25 Substitute x = 0.85 and y = -1.0275 in Eq. (3)
z1 = = 1.25
20 Then,
Iteration 2: {25 − 2  0.85 + 3  (−1.0275)}
z1 = = 1.0109
Substituting these new values again on the 20
right sides of the equations (1), (2) and (3), Iteration 2:
we get Substitute the value of y = -1.0275 and z =
1 1.0109 in Eq. (1), then
x 2 = (17 − y1 + 2 z1 )
20 {17 − (−1.0275) + 2 1.0109}
x2 = = 1.0025
1 20
= [17 − (−0.9) + 2  (1.25)] = 1.02
20 Substitute the value of x = 1.0025 and z =
1 1.0109 in Eq. (2), then
y2 = (−18 − 3 x1 + z1 ) (−18 − 3 1.0025 + 1.0109)
20 y2 = = −0.9998
1 20
= [−18 − 3  (0.85) + 1.25] = −0.965 Substitute the value of x = 1.0025 and y = -
20
1 0.9998 in Eq. (3), then
z2 = (25 − 2 x1 + 3 y1 ) {25 − 2 1.0025 + 3  (−0.9998)}
20 z2 = = 0.9998
1 20
= [25 − 2  (0.85) + 3  (−0.9)] = 1.03
20
Iteration 3:

MLK_SDT_L2_20-21_8/10
Iteration 3: Similarly, if we proceed then, x3 = 1, y3 = -1, z3
Substituting these new values, i.e. (x1,y2 & = 1.
z2) again on the right sides of the Iteration 4:
equations (1), (2) and (3), we get X4 = 1, y4 = -1 and z4 = 1.
x3 = 1.0013, y3 = -1.0015 & z3 = 1.0033
Iteration 4: Hence, the solution is x=1, y= -1 and z = 1.
Substituting the values of x3 = 1.0013, y3 =
-1.0015 & z3 = 1.0033 we get x4 = 1.0004, Here, precision up to 4th decimal place is
y4 = -1.0000 and z4 = 0.9996. considered.
Iteration 5:
Substituting the values of x4 = 1.0004, y4 =
-1.0000 and z4 = 0.9996 we get x5 = 1.0000,
y5 = -1.0001 and z5 = 1.0000.
Iteration 6:
Substituting the values of x5 = 1.0000, y5 =
-1.0001 and z5 = 1.0000 we get x6 = 1, y6 =
-1 and z6 = 1.
Iteration 7:
Substituting the values of x6 = 1, y6 = -1 and
z6 = 1 we get x7 = 1, y7 = -1 and z7 = 1.

Hence, the solution is x = 1, y = -1 and z =


1.
Here, precision up to 4th decimal place is
considered.

REFERENCES
1. Grewal, B.S. (2005). Higher Engineering Mathematics. Khanna Publishers, New Delhi.
2. Kansal, M.L. (2004). System Analysis Techniques in Water Resources Management.
3. Matrix solution of equations, Helping Engineers Learn Mathematics, http://helm.lboro.ac.uk/
4. http://atozmath.com/Menu/Algebra.aspx

MLK_SDT_L2_20-21_9/10
Appendix – A Exercises
Solve the system of linear equations with 3 variables.
Problem 1. Problem 5:
4x + 2y - 2z = 10 −x + 3y − 2z = 5
2x + 8y + 4z = 32 4x − y − 3z = −8
30x + 12y - 4z = 24 2x + 2y − 5z = 7
79 91
Solution: ( -2, 6, -3) Solution: (-10, - , − )
11 11
Problem 2. Problem 6:
3x - 2y + z = 24 x + 2y + 3z = −5
2x + 2y + 2z = 12 3x + y − 3z = 4
x + 5y - 2z = -31 −3x + 4y + 7z = −7
Solution: (3, -4, 7) Solution: (-1,1,-2)
Problem 3. Problem 7:
−2x − y − 3z = 3
5x - 2y + 4x = 0
2x − 3y + z = −13
2x - 3y + 5z = 8 2x − 3z = −11
3x + 4y - 3z = -11 Solution: (-4,2,1)
Solution: (-2, 1, 3) Problem 8:
Problem 4. −y − 2z = −8
x + 2y + 2z = 5 x + 3z = 2
3x - 2y + z = -6 7x + y + z = 0
2x + y - z = -1 Solution: (-1,6,1)
Solution: (-1, 2, 1)

Gauss-Seidal & Jacobi Iteration methods


Problem 9. Problem 11.
27x +6y -1z = 85 5x - 2y + 3z = -1
6x + 15y -2z = 72 -3x + 9y + 1z = 2
x + y +54z = 110 2x - 1y - 7z = 3

Problem 10. Problem 12.


10x +2y -3z = 7 12x +3y -5z = 1
x + 8y + 3z = -4 1x + 5y + 3z = 28
-2x - y +10z = 9 3x + 7y +13z = 76

MLK_SDT_L2_20-21_10/10

You might also like