9 Gauss Elimination
9 Gauss Elimination
9 Gauss Elimination
ES 204
Numerical Methods in Engineering
How to solve small number of
equations (n3) by graphical method?
Example:
Determinant of 2x2:
b11 a12 a13 a11 b12 a13 a11 a12 b13
b21 a22 a23 a21 b22 a23 a21 a22 b23
b a32 a33 a b32 a33 a a32 b33
Cramers rule for 3x3 A matrix: x1 31 x2 31 x3 31
a11 a12 a13 b11 a12 a13 b11 a12 a13
a21 a22 a23 b21 a22 a23 b21 a22 a23
a31 a32 a33 b31 a32 a33 b31 a32 a33
Example: Cramers rule
Use Cramers rule to solve
How to use Octaves det function?
Eliminate x1
Subtract to eliminate x1
0.3
3x1 0.1x2 0.2 x3 7.85
3
Solve x by Gauss elimination
0.190000
7.00333x2 0.293333x3 19.5617
7 .00333
b21 a123 x3
2
j 3
x2 1
a 22 a122
3
b a10j x j
0
exact solution
outer loop moves down the matrix from one pivot row to the next
partial pivoting before normalization, determine the coefficient with the largest absolute
value in the column below the pivot element
Rows can then be switched so that the largest element is the pivot element
complete pivoting - If columns as well as rows are searched for the largest element and then
switched
Example: Partial Pivoting
Use Gauss elimination to solve
With pivoting:
Final notes:
Computational effort for Gauss elimination is
proportional to n3
Tridiagonal systems proportional to n