Today s class Linear Algebraic Equations LU Decomposition 1
Linear Algebraic Equations Gaussian Elimination works well for solving linear systems of the form: AX = B What if you have to solve the linear system several times, with changing B vectors? Then, Gaussian elimination becomes tedious Instead, use a method that separates out transformations on A from transformations on B 2
LU Decomposition Assume that A can be factorized into the product of an upper triangular matrix and a lower triangular matrix 3
LU Decomposition Substitute the factorization into the linear system We have transformed the problem into two steps Factorize A into L and U Solve the two sub problems LD=B UX=D 4
LU Decomposition The upper triangular matrix comes from Forward elimination Eliminate x1 from row 2 Multiply row 1 by l 21 =a 21 /a 11 This time keep track of the multiplier factors 5
LU Decomposition Populate the L matrix with the multiplier factors used during forward elimination 6
LU Decomposition Construct the L and U matrices Solve for the D vector using forward substitution Solve for the X vector using backward substitution 7
LU Decomposition Example Factorize A using forward elimination 8
LU Decomposition Example 9
LU Decomposition Example 10
LU Decomposition Example 11
LU Decomposition Example 12
LU Decomposition Example Factorize A using forward elimination 13
LU Decomposition When LU decomposition is not possible because of division by zero, introduce a permutation matrix that will pivot the matrix PA = LU P is a matrix with precisely single 1 in each column and row and all other entries are zero 14
LU Decomposition Example 15
Matrix inversion Find the matrix inverse using LU decomposition [A][A] -1 =[I] LU decomposition allows us to change b To find the inverse, set b to each of the unit vectors in the identity matrix The corresponding x solution represents the respective column in the inverse matrix 16
Matrix inversion Example: Find inverse of 17
Matrix inversion Start with b = 18
Matrix inversion 19
Matrix inversion 20
Matrix inversion Put the three x vectors together to get the inverse 21
LU Decomposition Tridiagonal systems 22
LU Decomposition Symmetric matrices Cholesky Decomposition 23
Iterative Methods When exactness is not required, and an approximate solution is fine, you can use an iterative method to solve the linear system Better control of round-off errors Jacobi relaxation Gauss-Seidel 24
Jacobi iteration Use an iteration method to refine the estimate of the solution Example Rewrite the equations in a x=g(x,y,z) form 25
Jacobi iteration 26
Jacobi iteration Start with x=1, y=2, z=2 27
Jacobi iteration Non-convergent example Rewrite the equations in a x=g(x,y,z) form 28
Jacobi iteration Start with x=1, y=2, z=2 29
Gauss-seidel iteration Similar to Jacobi, except that we use the latest value of x and y when calculating y and z 30
Gauss-seidel iteration Start with x=1, y=2, z=2 31
Iterative methods Stopping criteria Define the norm of a vector as The euclidean distance is Use this value to calculate your approximate error 32
Iterative methods Convergence criteria In general 33
Iterative methods u :13x 2 v : 9x 2 + 11x 1 + 11x 1 = 286 = 99 v : 9x u :13x 2 2 + 11x + 11x 1 1 = 99 = 286 34
Exam 1 Oct 4, closed book, one cheat sheet (8.5in x 11in) allowed Chapters 1-11 Error Analysis Taylor Series Roots of Equations Linear Systems 35
Next class Optimization HW4, due 10/4 36