Beruflich Dokumente
Kultur Dokumente
Two steps
1. Forward Elimination
2. Back Substitution
Forward Elimination
A set of n equations and n unknowns
a11x1 a12 x2 a13 x3 ... a1n xn b1
a21x1 a22 x2 a23 x3 ... a2n xn b2
. .
. .
. .
an1x1 an 2 x2 an3 x3 ... ann xn bn
a 11 a 12 a 13 a 14 b1
0 a a a b Upper triangular
22 23 24 2 matrix
0 0 a 33 a 34 b3
0 0 0 a 44 b4
x 4 b4 / a 44
a 11 , a 22 , a 33 , a 44 0
x 3 ( b3 a 34 x 4 ) / a 33
x 2 ( b2 a 23 x 3 a 24 x 4 ) / a 22
x 1 ( b1 a 12 x 2 a 13 x 3 a 14 x 4 ) / a 11
Example
1 0 2 3 1
1 2 2 3 1 f 21 1
0 1 1 4 2 f 31 0
6 2 2 4 1 f 41 6
1 0 2 3 1
0 2 4 0 0 ( 2 ) ( 1) f 21
0 1 1 4 2 ( 3 ) ( 1) f 31
0 2 10 14 5 ( 4 ) ( 1) f 41
Forward Elimination
1 0 2 3 1
0 2 4 0 0
0 1 1 4 2 f 32 1/2
0 2 10 14 5 f 42 1
1 0 2 3 1
0 2 4 0 0
0 0 1 4 2 ( 3 ) ( 2 ) f 32
0 0 14 14 5 ( 4 ) ( 2 ) f 42
Upper Triangular Matrix
1 0 2 3 1
0 2 4 0 0
0 1 1 4 2
0 2 14 14 5 f 43 14
1 0 2 3 1
0 2 4 0 0
0 0 1 4 2
0 0 0 70 33 ( 4 ) ( 3 ) f 43
Back-Substitution
1 0 2 3 1
0 2 4 0
0
0 0 1 4 2
0 0 0 70 33
x 4 33/ 70 33/70 13/70
x 3 4 x 4 2 4/35
8/35
x
x 2 2 x 3 8/35 4/35
x 1 1 2 x 3 3 x 4 13/70 33/70
Partial Pivoting
Problems with Gauss elimination
• division by zero
• round off errors
• ill conditioned systems
0 1 1 4 2 f 32 3/7
0 1/3 5/3 7/3 5/6 f 42 1/7
6 2 2 4 1
0 7/3 7/3 7/3 5/6
0 0 0 5 33/14 ( 3 ) ( 2 ) f 32
0 0 2 2 5/7 ( 4 ) ( 2 ) f 42
Back-Substitution
6 2 2 4 1
0 7/3 7/3 7/3 5/6
0 0 2 2 5/7 Interchange rows 3 & 4
0 0 0 5 33/14 f 43 0
x 4 ( 33/14 ) /5 33/70
13/70
8/35
x 3 ( 5/7 2 x 4 ) /2 4/35
x
x 2 ( 5/6 7/3 x 4 7/3 x 3 ) / (7/3 ) 8/35 4/35
x1 ( 1 4 x 4 2 x 3 2 x 2 ) /6 13/70
33/70
• Example. Consider the linear system