Chapter 2 Linear Equation System
Chapter 2 Linear Equation System
CHAPTER 2
LINEAR EQUATION SYSTEMS
LU FACTORIZATION
• DOOLITTLE
• CROUT
• THOMAS METHOD
• THOMAS ALGORITHM
• CHOLESKY
2.1 INTRODUCTION OF LINEAR EQUATION SYSTEMS
Linear equations: ax = b
a11 x1 + a12 x2 + + a1n xn = b1
a21 x1 + a22 x2 + + a2 n xn = b2
am1 x1 + am 2 x2 + + amn xn = bm
• Gauss Elimination
• Gauss elimination with partial pivoting
Given:
a11 x1 + a12 x2 + a13 x3 = b1
a21 x1 + a22 x2 + a23 x3 = b2
a31 x1 + a32 x2 + a33 x3 = b3
Written in augmented matrix form as:
u11 u12 u13 f1
a11 a12 a13 b1
0 u22 u23 f 2
Elementary row
a21 a22 a23 b2 operations
0 0 u33 f 3
a31 a32 a33 b3
Ux = f
Ax = b Elementary row
operations
Backward
subst.
x3 = f3 u33 u11 u12 u13 x1 f1
x2 ( f 2 − u33 x3 ) / u22
=
0 u 22 u 23 2 f 2
x =
x1 =( f1 − u12 x2 − u 13 x3 ) / u33 0 0 u f
33 x3 3
Example 1:
Solution
2.51 1.48 4.53 5.56 B2 → −0.59 B1 + B2
1.48 0.93 − 1.30 − 0.75
2.68 3.04 − 1.48 − 1.84
multiplier, m21 = a21 a11 = 0.59 multiplier, m31 = a31 a11 = 1.07
B → −1.07 B + B
3 1 3
multiplier,
5 − 1 1 x1 10
2 4 0 x = 12
2
1 1 5 x3 − 1
why????
• to solve problem that involve division by zero (in case a11 = 0
or a22 = 0)
• reduce the round-off errors.
Example 2:
0 0 3 4 x1 8
2 9 1 0 x 6
2 =
0 1 9 4 x3 8
5 1 0 0 x4 9
Solution
Then we have:
1.
2.
Ans: 1.
2.
2.2 LU FACTORIZATION METHOD
LUx = b
Let
Ux = Y
Yields
LY = b
L = a 0 0 0 U = k l m n
b c 0 0
0 u p q
d
e f 0 0 0 r s
g h i j
0 0 0 t
Procedure:
A = LU
3 x1 + 2 x2 + 9 x3 = 28
2 x1 − x2 + 6 x3 = 14
5 x1 + 2 x2 − 4 x3 = −13
Example 4:
2 x1 = 3
x1 + 1.5 x2 = 4.5
− 3 x2 + 0.5 x3 = −6.6
x4 + x3 + 2 x1 − 2 x2 − 0.8 = 0
2.2.2 Crout Method
A = LU
1 l m n
Diagonal element for matrix U = 1 0 1 p q
0 0 1 s
0 0 0 1
Ax = b
objectiveto find the value of x
Step:
1. A = LU , determine L and U
3 x1 + 2 x2 + 9 x3 = 28
2 x1 − x2 + 6 x3 = 14
5 x1 + 2 x2 − 4 x3 = −13
2.2.3 Thomas Method
Ax = b
Check this first!
Ax = b
objective to find the value of x
Step:
Example 6:
di
ci
Formula:
Thomas’s Algorithm:
α 1 = d1
α i = d i − ci β i −1 , i = 2, 3, ..., n
ei
βi =
α i , i = 1, 2, 3, ..., n − 1
y1 = b1 / α1
, i = 2, 3, ..., n
, i = n − 1, n − 2, ..., 1
Table:
i 1 2 n
di
ei
ci
bi
αi
βi
yi
xi
Example 7:
1 3 0 0 x1 − 1
1
2 1 0 x2 1
=
0 4 − 1 − 5 x3 − 20
0 0 2 3 x4 11
Example 8:
Given
3 x3 + 4 x4 = 8
2 x1 + 9 x2 + x3 = 6
x2 + 9 x3 + 4 x4 = 8
2 x1 + x2 = 9
(i) What condition that needs to be fulfilled before using
Thomas’s Algorithm?
(ii) If the system above satisfied the condition, solve the
equation system.
2.2.5 Cholesky Method
Ax = b
Matrix A must be symmetric positive-definite
A = LU
T
where U = L
Ax = b
Target to find the value of x
Step:
1. A = LU , determine L and U
4 x1 − x2 + x3 = 7
− x1 + 7 x2 + 3x3 = 6
x1 + 3x2 + 5 x3 = 1
2.3 ITERATIVE METHOD
e.g.
3 2 0
Show that
2 −5 1
is a SDD matrix.
1 2 7
Solution:
B1 : 3 > 2 + 0
B2 : − 5 > 2 + 1
B3 : 7 > 2 + 1
2.3.1 Jacobi Method
Formula:
(k ) (k )
( k +1) b − a x − a13 x3
x1 = 1 12 2
a11
(k ) (k )
( k +1) b − a21 x1 − a23 x3
x2 = 2
a22
(k ) (k )
( k +1) b − a31 x1 − a32 x2
x3 = 3
a33
(0)
Initial guess: x = (0 0 0) T
max
1≤ i ≤ n
{ xi(k ) − xi(k −1) }< ε
for a given value of ε and take x ≈ x (k )
Example 10:
x1 − 3 x2 + 12 x3 = 31
4 x1 + x2 − x3 = 3
2 x1 + 7 x2 + x3 = 19
Solution
Is matrix A SDD?
Rearrange rows :
4 x1 + x2 − x3 = 3
2 x1 + 7 x2 + x3 = 19
x1 − 3 x2 + 12 x3 = 31
0 0 0 0
1
2
3
4
5
{
x (5) − x ( 4) = max xi (5) − xi ( 4)
1≤ i ≤ 3
}
= max {0.01, 0.01, 0.01} = 0.01 < ε
∴ x ≈ x (5) = (1.01, 2.00, 3.00)
2.3.2 Gauss Seidel Method
Formula:
(k ) (k )
( k +1) b1 − a12 x2 − a13 x3
x1 =
a11
( k +1) (k )
( k +1) b2 − a21 x1 − a23 x3
x2 =
a22
( k +1) ( k +1)
( k +1) b3 − a31 x1 − a32 x2
x3 =
a33
(0)
Initial guess: x = (0 0 0) T
max
1≤ i ≤ n
{ xi(k +1) − xi(k ) }< ε
for a given value of ε and take x ≈ x (k )
Example 11:
x1 − 3 x2 + 12 x3 = 31
4 x1 + x2 − x3 = 3
2 x1 + 7 x2 + x3 = 19
Solution
Is matrix A SDD?
Rearrange rows :
4 x1 + x2 − x3 = 3
2 x1 + 7 x2 + x3 = 19
x1 − 3 x2 + 12 x3 = 31
0 0 0 0
1
2
3
4
{
x ( 4) − x (3) = max xi ( 4) − xi (3)
1≤ i ≤ 3
}
= max {0.00, 0.00, 0.00} = 0.00 < ε
5 x1 − x2 + x3 = 11
2 x1 + 8 x2 − x3 = 17
− x1 + x2 + 7 x3 = 21
Then find the value of x1, x2, and x3. Do the calculation in 3 decimal
places.
10 − 1 2 0 x1 6
− 1 11 − 1 3 x 25
2 =
2 − 1 10 − 1 x3 − 11
0 3 − 1 8 x4 15