Académique Documents
Professionnel Documents
Culture Documents
SYSTEMS
Dr. Indah Soesanti, S.T., M.T.
Universitas Gadjah Mada
Gaussian Elimination
A direct method frequently used in
many applications is the Gaussian
elimination method
Gaussian Elimination transforms the
problem into a triangular system
aM 1 x1 aM 2 x2 aM 3 x3 ... aMN xN bM
A x b
a
...
a
21
22
2N
A
...
aM 1 aM 2 ... aMN
b1
x1
b
x
2
2
b
x
...
...
bM
x M
Gaussian Elimination
The method consists of two steps:
Forward Elimination: the system is reduced to
upper triangular form. A sequence of
elementary operations is used.
Backward Substitution: Solve the system
starting from the last variable.
2
0
0 a33 ' x3 b3 '
(4)
(5)
(6)
x2 a23
x3 b' 2
a22
We then multiply Eq.(4) by a31/a11 and add it to Eq.(6), resulting in:
'
3
32 2
33 3
a x a x b
(7)
(8)
(9)
(10)
x2 a23
x3 b'2
a22
(11)
x3 b"3
a33
(12)
x3 b"3 / a33
(13)
x3 ) / a22
x2 (b' 2 a23
(14)
(15)
Based on the example above, we may formulate a general procedure for the forward
elimination, solution for the last unknown, and back substitution to get the rest
of the unknowns
Gaussian Elimination in 3D
2x 4 y 2z 2
4 x 9 y 3z 8
2 x 3 y 7 z 10
Using the first equation to eliminate x from
the next two equations
Gaussian Elimination in 3D
2x 4 y 2z 2
y z 4
y 5z 12
Using the second equation to eliminate y
from the third equation
Gaussian Elimination in 3D
2x 4 y 2z 2
y z 4
4z 8
Using the second equation to eliminate y
from the third equation
2x 4 y 2z 2
y z 4
4z 8
xn bn / Ann
n
xi bi Aij x j / Aii , i n 1,
j i 1
,1
Backward Substitution
From the previous work, we have
2x 4 y 2z 2
y z 4
z 2
Backward Substitution
2x 4 y 4 2
y 2 4
z 2
We can solve y
Backward Substitution
2x 4 y 4 2
y
2
z 2
Substitute to the first equation
Backward Substitution
2x 8 4 2
y
2
z 2
We can solve the first equation
Backward Substitution
x
y
1
2
z 2
Gauss-Jordan Method
The method reduces the general system of equations
to
where I is an identity matrix.
AX=B IX=B
GAUSS-JORDAN
a11x1 + a12x2 + a13x3 + a14x4 = b1
a21x1 + a22x2 + a23x3 + a24x4 = b2
a31x1 + a32x2 + a33x3 + a34x4 = b3
a41x1 + a42x2 + a43x3 + a44x4 = b4
a11
a
21
a31
a41
a12 a13
a22 a23
a32 a33
a42 a43
a14 x1 b1
a24 x2 b2
a34 x3 b3
a44 x4 b4
a31 a32 a33 a34 x3 b3
a41 a42 a43 a44 x4 b4
a
'
'
x
b
'
'
23
24
2
2
0 a'32 a'33 a'34 x3 b'3
0 a'42 a'43 a'44 x4 b'4
1
0
0
1
0
0
a' '13
a' '23
a' '33
a' '43
1
0
0
1
0
0
0 x1 b
0 x2 b
0 x3 b
1 x4 b
IV
1
IV
2
IV
3
IV
4
0
0
1
0
x1 b
IV
1
x2 b
IV
2
x3 b
IV
3
x4 b
IV
4
Gauss-Jordan Method
Example
2 2 2 x1 0
1 1 1
4 2 1 x 7
4 2 1
2 2 4 x3 2
2 2 4
Step 1 Eleminate x1 from equations 2and 3
x1 0
x 7
2
x3 2
eq1 eq1 / 2
1 1 1 x1 0
4
eq2 eq2 eq1 0 6 5 x2 7
1
0 0 2 x3 2
2
eq3 eq3 eq1
1
CISE301_Topic3
27
Gauss-Jordan Method
Example
1
1 1 1 x1 0
1 1
0 6 5 x 7
0 1 0.833
0 0 2 x3 2
2
0 0
Step 2 Eleminate x 2 from equations1 and 3
eq2 eq2 / 6
1 0 0.1667
1
eq1 eq1 eq2 0 1 0.8333
1
0 0
2
0
CISE301_Topic3
x1 0
x 1.1667
2
x3 2
x1 1.1667
x 1.1667
2
x3 2
28
Gauss-Jordan Method
Example
1 0 0.1667
0 1 0.8333
0 0
2
x1 1.1667
1 0 0.1667
x 1.1667
0 1 0.8333
2
x3 2
1
0 0
Step 3 Eleminate x 3 from equations1 and 2
eq3 eq3 / 2
1 0 0 x1 1
0.1667
eq1 eq1
eq
3
0 1 0 x2 2
1
0 0 1 x 1
3
0.8333
eq2 eq2
eq3
1
x1 1.1667
x 1.1667
2
x3 1
Gauss-Jordan Method
Example
2 2 2 x1 0
4 2 1 x 7
2
2 2 4 x3 2
is transformed to
1 0 0 x1 1
x1 1
0 1 0 x 2 solutionis x 2
2
2
0 0 1 x3 1
x3 1
CISE301_Topic3
30
LU Decomposition
This motivates a factorization approach to
solving arbitrary systems:
Find a way of writing A as LU, where L and U are
both triangular
Ax=b LUx=b Ly=b Ux=y
Time for factoring matrix dominates computation
LU Decomposition
ii 1
LU = A
Thus A x = (LU) x = L (U x) = b
Crouts Method
a11
a21
a
31
a12
a22
a32
a13 1
a23 l21
a33 l31
u11 a11
l21u11 a21
l31u11 a31
0
1
l32
u12 a12
0 u11
0 0
1 0
u12
u22
0
u13 a13
a21
l21
u11
a31
l31
u11
u13
u23
u33
Crouts Method
a11
a21
a
31
a12
a22
a32
a13 1
a23 l21
a33 l31
0
1
l32
0 u11
0 0
1 0
u12
u22
0
u13
u23
u33
Crouts Method
a11
a21
a
31
a12
a22
a32
a13 1
a23 l21
a33 l31
0
1
l32
0 u11
0 0
1 0
For i = 1..n
For j = 1..i
j 1
For j = i+1..n
u ji a ji l jk uki
k 1
i 1
l ji
a ji l jk uki
k 1
uii
u12
u22
0
u13
u23
u33
Cholesky Decomposition
For symmetric matrices, choose U=LT
Perform decomposition
a11
a12
a
13
a12
a22
a23
a13 l11
a23 l21
a33 l31
0
l22
l32
0 l11
0 0
l33 0
l21
l22
0
l31
l32
l33
Cholesky Decomposition
a11
a12
a
13
a12
a22
a23
a13 l11
a23 l21
a33 l31
0
l22
l32
0 l11
0 0
l33 0
l21
l22
0
a23 l21l31
l32
l22
l31
l32
l33
Cholesky Decomposition
a11
a12
a
13
a12
a22
a23
a13 l11
a23 l21
a33 l31
0
l22
l32
0 l11
0 0
l33 0
i 1
i 1
l ji
aij lik l jk
k 1
lii
l21
l22
0
l31
l32
l33
Thanks