Professional Documents
Culture Documents
CHAPTER IV
NUMERICAL SOLUTION OF
LINEAR SIMULTANEOUS EQUATIONS
4.1 Introduction
In almost every scientific discipline there are problems that give rise to a system of linear
algebraic equations. An n×n linear system is a system of n simultaneous linear equations
in n unknowns. The notation for such a system will be: -
or A×X=B
where Xi’s are the unknowns, aij’s are the coefficients and bi’s are constants.
In this chapter we will discuss and develop numerical methods for solving such system of
equations. A solution of this system of equations is a set of values (X 1, X2, …,Xn) which
simultaneously satisfies each equation of the system.
There are a number of numerical methods for solving the system of linear algebraic
equations. The following will be covered in this course:
1- Gauss elimination method.
2- Gauss-Jordan method.
35
Numerical Analysis Ch IV: Linear Systems of Equations
2 X1 – 3 X 2 + X 3 = 7 (1)
X1 – X2 – 2 X3 = –2 (2)
3 X1 + X 2 – X 3 = 0 (3)
Solution:
- We eliminate X1 from equation (2) by multiplying equation (1) by T21 and add it to
equation (2) where:
T21 = - a21/a11 ( a11 ≠ 0 )
T21 = -(1/2)
- We eliminate X1 from equation (3) by multiplying equation (1) by T31 and add it to
equation (3) where:
T31 = - a31/a11 ( a11 ≠ 0 )
T31 = -(3/2)
- We eliminate X2 from equation (3') by multiplying equation (2’) by T32 and add it to
equation (3') where:
T32 = - a32/a22 ( a22 ≠ 0 )
T32 = - (5.5/0.5)
Equation (3') become
25 X3 = 50 (3'')
- The system of equations becomes:
2 X 1 – 3 X2 + X 3 = 7 (1)
0.5 X2 – 2.5 X3 = – 5.5 (2')
25 X3 = 50 (3'')
- Starting from the bottom to find the values of X1, X2, and X3 ; this process is known as
back substitution.
X3 = 2
X2 = ( -5.5 + 2.5(2))/0.5 = -1
36
Numerical Analysis Ch IV: Linear Systems of Equations
X1 = ( 7 – 2 + 3(-1))/2 = 1
The solution is [ 2 , -1 , 1 ]
Problem: 4.1
2 X1 + X 2 + X 3 = 7 (1)
4 X1 + 4 X2 + 3 X3 = 21 (2)
6 X1 + 7 X2 + 4 X3 = 32 (3)
Example 4.2
2 X1 + X 2 – X 3 = 5 (1)
X1 + 2 X2 + 4 X3 = 10 (2)
5 X1 + 4 X2 – X3 = 14 (3)
Solution:
1. Using equation (1) to eliminate X1 from equation (2) & (3)
- multiply equation (1) by T21 and add it to equation (2) where:
T21 = - a21/a11 ( a11 ≠ 0 )
T21 = -(1/2) = -0.5
37
Numerical Analysis Ch IV: Linear Systems of Equations
Equation (3) become
1.5 X2 + 1.5 X3 = 1.5 (3’)
38
Numerical Analysis Ch IV: Linear Systems of Equations
The solution is [ 4 , -1 , 2 ]
Problem: 4.2
Using Gauss – Jordon elimination method, solve the following system of equations:
X1 + 2 X2 - 2X3 + X4 = 4 (1)
2X1 + 5 X2 - 2X3 +3X4 = 7 (2)
- 2X1 - 2 X2 + 5X3 +3X4 = -1 (3)
X1 + 3 X2 + 3X3 +2X4 = 0 (4)
4.4 Pivoting
39
Numerical Analysis Ch IV: Linear Systems of Equations
Read*,n
3- read the coefficients aij and constants a i,n+1 as
read*,((a(i,j),j=1,n+1),i=1,n)
4- Calculate the multiplication terms and do the elimination as
Do 20 k =1,n
Do 20 i =1, n
If(i.EQ.k) goto 20
T(i,k)= -(a(i,k) / a(k,k))
Do 25 j=1,n+1
a(i,j) = a(i,j) + T(i,k)* a(k,j)
25 Continue
20 Continue
5- Calculate and print the unknowns as
Do 30 i=1, n
x(i) = a(i,n+1) / a(i,i)
print*,x(i)
30 continue
6- Stop
End
4X1 + X2 + 3 X3 = 16 (1)
X1 + 3X2 + 2 X3 = 10 (2)
X1 + 2X2 + 5 X3 = 12 (3)
4.6 Other topics related to the subject:
Hint:
40
Numerical Analysis Ch IV: Linear Systems of Equations
Use Kirchhoff’s Law to write the 6 equation into 6 unknowns that are the currents
passing in the circuit.
If the sign of the calculated current is –ve, it means that the direction of the current
is opposite to what was proposes.
3 R = 10 ohms 2 R = 5 ohms 1
I32 I12
I54 I65
4 5 6
R = 15 ohms R = 20 ohms
Solution:
I12 = + 6.1538
I52 = - 4.6154
I32 = - 1.5385
I65 = - 6.1538
I54 = - 1.5385
I43 = - 1.5385
41