Title: The Gauss Jordan method
1The Gauss Jordan method Major difference -
eliminate unknowns from all rows, not just
subsequent ones Normalize matrix so all entries
are 1 Leads to identity matrix instead of upper
triangular Backsubstitution is easy
2Example
First pivot
3Normalize pivot row
4Multiply 1st row by 3 and subtract from 2nd row
5Do the other two rows
Now pivot again
6Normalize
7Multiply 2nd row by 0.75 and subtract from first
row
8For first row
and after all eliminated
9No need to pivot, so normalize
Work on rows 1,2 and 4 with row 3
10No rows below row 4 to pivot with, so normalize
and eliminate column 4
11We now have our answer, since backsubstitution is
trivial
12LU decomposition - another method for solving
matrix equations Idea behind LU decomposition -
start with
or
13We know (because we did it in G.E.) we can write
i.e
or
14Assume there exists L
such that
15means that
16LU method 1) factor (decompose) A into L and U 2)
given b, determine d from Ldb 3) using Uxd and
backsubstitution, solve for x Advantage Once you
have L and U, can use many different bs
17How do you get L and U?
Gauss elimination gives you U. It also gives you
L.
The factors are the entries in L
18Changes in algorithm for Gauss elimination for LU
decomposition loop over all the rows except the
last one loop over all the rows below the current
one get fik aik/akk multiply row k by f and
subtract from row i put fik in L at row i, column
k end loop end loop A is now upper triangular
U make all Lkk1
19A fancier way of storing L and U
Good if n is large More overhead to sort out
20Pivoting in LU decomposition Still need it Messes
up order of L What to do?
Need to pivot also both L and a permutation
matrix P
21Initialize P as identity matrix and pivot when A
is pivoted. Also pivot L
22Example
Starting out
23No pivot
24Now exchange rows 2 and 4
25The pivot factors are
26No pivot again, factor
27Now make the diagonal elements of L1
28Recall
29(No Transcript)
30LU method 1) factor (decompose) A into L and U 2)
given b, determine d 3) using Uxd and
backsubstitution, solve for x Advantage Once you
have L and U, can use many different bs
31Example (no pivoting)
32Get d
33Use Uxd and backsubstitute
34Now change b
We dont have to do elimination again Use the
same L and U
35Get d
36Use Uxd and backsubstitute