Solutions of Linear System of Equations: Dr. Sukanta Deb
Solutions of Linear System of Equations: Dr. Sukanta Deb
Outline
Outline
2x1 + x2 + x3 =10
3x1 + 2x2 + 3x3 =18
x1 + 4x2 + 9x3 =16
Let
2 1 1 10 x1
A = 3 2 3 , b = 18 ,
X = x2
1 4 9 16 x3
R2 ←R2 − pR1
= 3 2 3 − 23 × 2 32 × 1 3
2 ×1
= 3 2 3 − 3 32 23
= 3 − 3 2 − 32 3 − 23
= 0 12 32
For i = 3,
R3 ←R3 − pR1
= 1 4 9 − 21 × 2 12 × 1 1
2 ×1
= 1 4 9 − 1 12 12
= 1 − 1 4 − 12 9 − 12 )
= 0 72 17
2
b2 − a23 ∗ x3 (3 − 32 ∗ 5)
x2 = = 1
= −9
a22 2
b1 − (a12 ∗ x2 + a13 ∗ x3 ) 10 − (1 ∗ (−9) + 1 ∗ 5)
x1 = = =7
a11 1
x1 = 7, x2 = −9, x3 = 5
2x1 + 2x2 + x3 = 6
4x1 + 2x2 + 3x3 = 4
x1 − x2 + x3 = 0
2 2 1 6
Let A|b = 4 2 3 4. From the first column, we find that
1 −1 1 0
the pivot element (the largest absolute value element) is 4.
Interchanging the row
corresponding to this element with the first
4 2 3 4
row, we obtain A|b = 2 2 1 6.
1 −1 1 0
Dr. Sukanta Deb Solutions of Linear System of Equations
Matrices and Linear System of Equations
Eliminating the first variable from the second row onwards using
the elementaryrow operations of basic Gauss elimination method,
4 2 3 4
we get A|b = 0 1 − 21 10
3 . From the second row
3 1
0 −2 4 −1
onwards, the pivot element is searched in the second column. It
can be seen that it is − 32 . Interchanging the second row with the
4 2 3 4
pivot element row, A|b = 0 − 32 1
4 −1 . Eliminating the
1 10
0 1 −2 3
second variable from the second row onwards using thebasic Gauss
4 2 3 4
3 1
elimination method, we get A|b = 0 − 2
4 −1 .
1 10
0 0 −3 3
b2 − a23 ∗ x3
x2 = = −1
a22
b1 − (a12 ∗ x2 + a13 ∗ x3 )
x1 = =9
a11
Therefore, the required solution is
x1 = 9, x2 = −1, x3 = −10
Gauss-Jordan Method
The Gauss-Jordan method is a variation of Gauss elimination
method. The major difference is that
1 0 −0.0680629 2.52356
A|b = 0 1 −0.0418848 −2.79320 R3 ←R3 /10.01200
0 0 1 7.0000
1 0 0 3.0000
= R1 ←R1 +0.0680629R3
0 1 0 −2.5000 R2 ←R2 +0.0418848R3
0 0 1 7.0000
Gauss-Seidel Method
The two most commonly used iterative methods for solving a set
of linear equations are:
jacobi’s method
Gauss-Seidel method
In the case of Jacobi’s method, the values of the unknowns are
updated when an iteration has completed. On the other hand, in
the case of Gauss-Seidel method, the values of the unknowns are
updated immediately without waiting for the iteration to complete.
These two methods are basically similar, having the same formula
for updating the values. Both methods require the coefficient
matrix of the system to be a special type of matrix called a
diagonally-dominant matrix. The difference between them lies in
the way updates are made: Gauss-Seidel uses the latest values of
the variables, whereas Jacobi does not use the latest values.
Gauss-Seidel Method
The difference between the Gauss-Seidel method and Jacobi
iteration is depicted in the following figure.
Diagonally-dominant Matrix
n
X
|aii | > |aij | , for i = 1, 2, . . . , n
j=1
j6=i
Diagonally-dominant Matrix
5 −1 3
The following matrix is diagonally-dominant: A = 2 −7 −1,
4 −2 8
since
Gauss-Seidel Method
Let us consider 3 × 3 set of equations:
a11 x1 + a12 x2 + a13 x3 = b1
a21 x1 + a22 x2 + a23 x3 = b2
a31 x1 + a32 x2 + a33 x3 = b3
If the diagonal elements aii 6= 0 (i = 1, 2, 3), the first equation can
be solved for x1 , the second for x2 and the third for x3 to yield
b1 − a12 x2 − a13 x3
x1 = (1)
a11
b2 − a21 x1 − a23 x3
x2 = (2)
a22
b3 − a31 x1 − a32 x2
x3 = (3)
a33
Now, we can start the solution process by choosing guesses for the
x’s.
Dr. Sukanta Deb Solutions of Linear System of Equations
Matrices and Linear System of Equations
Gauss-Seidel Method
A simple way to obtain initial guesses is to assume that they are all
zero, i.e., x1 = x2 = x3 = 0. These zeros (x2 = x3 = 0) can be
substituted into Equation (1), which can be used to calculate a
new value for x1 = b1 /a11 . Then, we substitute this new value of
x1 along with the previous guess of zero for x3 into Equation (2) to
compute a new value for x2 . The process is repeated for
Equation (3) to calculate a new estimate for x3 . Then we return to
the first equation and repeat the entire procedure until our solution
converges closely enough to the true values.
Note: Before applying the Gauss-Seidel method, please ensure
that the coefficient matrix A is diagonally-dominant,i.e.,
n
X
|aii | > |aij | , for i = 1, 2, . . . , n
j=1
j6=i
28x1 + 4x2 − x3 = 32
x1 + 3x2 + 10x3 = 24 (Not a diagonally-dominant matrix)
2x1 + 17x2 + 4x3 = 35
28x1 + 4x2 − x3 = 32
2x1 + 17x2 + 4x3 = 35 (Diagonally-dominant matrix)
x1 + 3x2 + 10x3 = 24
Iteration x1 x2 x3
0 0 0 0
1 1.1429 1.9244 1.7084
2 0.9290 1.5476 1.8428
3 0.9876 1.5090 1.8485
4 0.9933 1.5070 1.8486
5 0.9936 1.5070 1.8485
6 0.9936 1.5070 1.8485
Jacobi Method
A simple way to obtain initial guesses is to assume that they are all
zero, i.e., x1 = x2 = x3 = 0. These zeros (x2 = x3 = 0) can be
substituted into Equation (1), which can be used to calculate a
new value for x1 = b1 /a11 . Similarly the zeros (x1 = x3 = 0) can
be used to compute a new value for x2 using Equation (2). The
process is repeated for Equation (3) to calculate a new estimate for
x3 using x1 = x2 = 0. Then we return to the first equation and
repeat the entire procedure until our solution converges closely
enough to the true values.
Note: Before applying the Jacobi method, please ensure that the
coefficient matrix A is diagonally-dominant,i.e.,
n
X
|aii | > |aij | , for i = 1, 2, . . . , n
j=1
j6=i
28x1 + 4x2 − x3 = 32
2x1 + 17x2 + 4x3 = 35
x1 + x2 + 10x3 = 24
32 − 4(0) + 0
x1 = = 1.1429
28
35 − 2(0) − 4(0)
x2 = = 2.0588
17
24 − 0 − 0
x3 = = 2.4000.
10
Repeating this procedure, we obtain the successive approximations
as shown below:
Iteration x1 x2 x3
0 0 0 0
1 1.1429 2.0588 2.4000
2 0.9345 1.3597 2.0798
3 1.0229 1.4595 2.1706
4 1.0119 1.4278 2.1518
5 1.0157 1.4335 2.1560
6 1.0151 1.4320 2.1551
7 1.0152 1.4323 2.1553
Internal Assessment-I
Internal Assessment-I
x1 + x2 − x3 = −3
6x1 + 2x2 + 2x3 = 2
−3x1 + 4x2 + x3 = 1
6x1 + x2 + x3 = 20
x1 + 4x2 − x3 = 6
x1 − x2 + 5x3 = 7
A Quote
Nature is beautiful!
“The scientist does not study nature because it is
useful; he studies it because he delights in it, and he
delights in it because it is beautiful. If nature were
not beautiful, it would not be worth knowing, and if
nature were not worth knowing, life would not be
worth living.”
—Henri Poincaré.
Contact Me?
QPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPR
THANK YOU!
T 9810362087
Í https://sites.google.com/site/sukantodeb
QPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPRQPPPPPPR
Dr. Sukanta Deb Solutions of Linear System of Equations