LU - Factorizations Matrix Factorization into Triangular Matrices Triangular Matrices A nn square matrix L=(lij) is called Lower Triangular if lij = 0 if i<j (i.e. all entries above the diagonal are zero). A nn square matrix U=(uij) is called Upper Triangular if uij = 0 if i>j (i.e. all entries below the diagonal are zero). l11 0 l 21 l22 l31 l32 ln1 ln 2 0 0 l33 ln 3 0 0 0 lnn Lower Triangular Matrix u11 u12 0 u 22 0 0 0 0 u13 u1n u23 u2 n u33 u3n 0 unn Upper Triangular Matrix LU Factorization The LU Factorization of a nn square Matrix M = (mij) is a way of expressing the Matrix M as a product of two square nn matrices L and U where the matrix L is a lower triangular matrix and The matrix U is an upper triangular matrix. Furthermore the matrix L has all 1's on the diagonal. m11 m 21 M LU m31 mn1 m12 m22 m32 mn 2 m13 m1n m23 m2 n m33 m3n mn 3 mnn 1 0 l 21 1 l31 l32 ln1 ln 2 0 0 1 ln 3 0 0 0 1 u11 u12 0 u 22 0 0 0 0 u13 u1n u23 u2 n u33 u3n 0 unn LU Factorization Method The factorization is done by keeping tract of a series of elementary matrices where multiplication on the left by an elementary matrix corresponds to a row operation. 1. Apply the necessary row operations to get the matrix to be upper triangular. 2. For each row operation multiply on the right by an elementary matrix to get U. u11 u12 0 u 22 Ek Ek 1 E1 M U 0 0 0 0 u13 u1n u23 u2 n u33 u3n 0 unn 3. Multiply on the right by the inverse of all of the elementary matrices to get L. M E11 E21 Ek1 1 0 l 21 1 U L U l31 l32 ln1 ln 2 0 0 1 ln 3 0 u11 u12 0 0 u22 0 0 0 1 0 0 u13 u1n u23 u2 n u33 u3n 0 unn Elementary Matrices The elementary matrices Ek must be of a certain type that correspond to multiplying a row by a number and adding it to another row. Consider the row operation of multiplying row i by c and adding it to row j (i≠j). This row operation is abbreviated by Rj=cRi+Rj. The corresponding elementary matrix has 1's going down the diagonal, a c in row j and column i, and zeros in every other position. Rj=cRi+Rj jth row 1 0 0 0 0 0 0 1 Ek 0 c 0 0 1 ith column 1. The inverse of a matrix like this just puts a –c in the position where c is. 2. The product of two of these type of matrices with a c1 and c2 in two different positions results in a matrix with c1 in the position where it was and c2 in the position it was in and 1's on the diagonal and zeros everywhere else. 3. If all row operations have i<j the matrix will be lower triangular. LU Factorization Method (Example) The following is an example of how to factor a 33 matrix and keep tract of the elementary row reduction matrices. 1 3 2 4 6 6 6 3 10 R2 = -2R1 + R2 1 3 2 1 3 1 0 0 2 2 1 0 4 0 6 6 4 0 0 0 1 6 3 10 6 3 10 1 3 2 1 3 1 0 0 2 0 1 0 0 0 4 0 4 0 3 0 1 6 3 10 0 0 1 R3 = 3R1 + R3 The matrix is now upper triangular we combine the two multiplications. 1 3 2 1 3 1 0 0 1 0 0 2 0 1 0 2 1 0 4 0 4 0 6 6 3 0 1 0 0 1 6 3 10 0 0 1 Use matrix arithmetic and substitution. 1 1 0 0 1 0 0 2 1 0 2 1 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 0 3 0 1 3 0 1 Calculating the inverse for elementary matrices of this type can be done quickly (i.e. a shortcut) by just taking the negative of the nonzero, nondiagonal entry. 1 1 1 3 1 0 0 1 0 0 2 1 3 2 4 2 1 0 0 1 0 0 4 0 6 6 6 3 10 0 0 1 3 0 1 0 0 1 1 3 1 0 0 1 0 0 2 1 3 2 4 6 6 2 1 0 0 1 0 0 4 0 6 3 10 0 0 1 3 0 1 0 0 1 1 3 1 0 0 2 1 3 2 4 2 1 0 0 4 0 6 6 6 3 10 3 0 1 0 0 1 Multiply by the inverses from previous slide. Substitute and group elementary matrices A short cut for multiplying these matrices is putting the entries in the corresponding positions. LU Factorization (Short Cut) We do not need to do all the moving around of matrices on each side of the equation. We just keep tract of the row operations and fill in the entries of the corresponding matrix to get a sequence of lower triangular matrices. 3 2 0 12 7 2 0 5 8 R2=-4R1+R2 0 3 2 0 1 2 0 5 8 R3=5R2+R3 3 2 0 0 1 2 0 0 2 1 0 0 L1 4 1 0 0 0 1 1 0 0 L 4 1 0 0 5 1 Stop here the matrix is upper triangular and this is the matrix U. Can check that the factorization is correct with a matrix multiplication 1 LU 4 0 3 12 0 0 1 5 2 7 5 0 3 2 0 0 0 1 2 1 0 0 2 0 2 8 Matrices Without LU Factorizations 0 1 M 1 0 det M 1 Not every matrix has an LU Factorization, just like not all numbers or polynomials can be factored. Look at the simple 22 matrix M given to the right. To show this is impossible to factor this way consider what L and U would need to do. L is lower triangular and U is upper triangular. M = LU This means that ae = 0 so that either a = 0 or e=0 If a=0 then detL=0 so the detLU=0 If e=0 then detU=0 so the detLU=0 a 0 L c d a LU c 0 M 1 e U 0 f h 0 e d 0 f ae af h ce cf dh 1 af ae LU ce cf dh 0 0 0 0 L or U 0 c d When row reducing the matrix if you ever need to do the row operation of interchanging (swapping) two rows the matrix can not be LU factored. f h