Skip to main content

Lecture 4. Factorization into A=LUA = LU

讲座摘要(lecture summary)

One goal of today’s lecture is to understand Gaussian elimination in terms of matrices; to find a matrix LL such that A=LUA = LU. We start with some useful facts about matrix multiplication.

Inverse of a product

The inverse of a matrix product ABAB is B1A1B^{−1}A^{−1}.

数学语言表达如下
(AB)1=B1A1(AB)^{-1} = B^{-1}A^{-1}

Transpose of a product

We obtain the transpose of a matrix by exchanging its rows and columns. In other words, the entry in row ii column jj of AA is the entry in row jj column ii of ATAT.

The transpose of a matrix product ABAB is BTATB^TA^T. For any invertible matrix AA, the inverse of ATA^T is (A1)T(A^{−1})^T.

A=LUA = LU

We’ve seen how to use elimination to convert a suitable matrix AA into an upper triangular matrix UU. This leads to the factorization A=LUA = LU, which is very helpful in understanding the matrix AA.

Recall that (when there are no row exchanges) we can describe the elimination of the entries of matrix AA in terms of multiplication by a succession of elimination matrices EijE_{ij}, so that AE21AE31E21AUA \to E_{21}A \to E_{31}E_{21}A \to \dots \to U. In the two by two case this looks like:

E21AU[1041][2187]=[2103]\begin{array}{cccc} E_{21} & A & &U \\ \begin{bmatrix*}[c] 1 & 0 \\ -4 & 1 \end{bmatrix*} & \begin{bmatrix*}[c] 2 & 1 \\ 8 & 7 \end{bmatrix*} & = & \begin{bmatrix*}[c] 2 & 1 \\ 0 & 3 \end{bmatrix*} \end{array}

We can convert this to a factorization A=LUA = LU by “canceling” the matrix E21E_{21}; multiply by its inverse to get E211E21A=E211UE_{21}^{−1} E_{21}A = E_{21}^{−1}U.

ALU[2187][1041]=[2103]\begin{array}{cccc} A & L & &U \\ \begin{bmatrix*}[c] 2 & 1 \\ 8 & 7 \end{bmatrix*} & \begin{bmatrix*}[c] 1 & 0 \\ 4 & 1 \end{bmatrix*} & = & \begin{bmatrix*}[c] 2 & 1 \\ 0 & 3 \end{bmatrix*} \end{array}

The matrix UU is upper triangular with pivots on the diagonal. The matrix LL is lower triangular and has ones on the diagonal. Sometimes we will also want to factor out a diagonal matrix whose entries are the pivots:

ALDU[2187]=[1041][2003][11/201]\begin{array}{ccccc} A & & L & D & U^{'} \\ \begin{bmatrix*}[c] 2 & 1 \\ 8 & 7 \end{bmatrix*}& = & \begin{bmatrix*}[c] 1 & 0 \\ 4 & 1 \end{bmatrix*} & \begin{bmatrix*}[c] 2 & 0 \\ 0 & 3 \end{bmatrix*} & \begin{bmatrix*}[r] 1 & 1/2 \\ 0 & 1 \end{bmatrix*} \end{array}

In the three dimensional case, if E32E31E21A=UE_{32}E_{31}E_{21}A = U then A=E211E311E321U=LUA = E_{21}^{−1}E{31}^{−1}E_{32}^{−1}U = LU.

For example, suppose E31E_{31} is the identity matrix and E32E_{32} and E21E_{21} are as shown below:

E32E21E[100010051][100210001]=[1002101051]\begin{array}{cccc} E_{32} & E_{21} & & E \\ \begin{bmatrix*}[c] 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & -5 & 1 \\ \end{bmatrix*} & \begin{bmatrix*}[c] 1 & 0 & 0 \\ -2 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix*} & = & \begin{bmatrix*}[c] 1 & 0 & 0 \\ -2 & 1 & 0 \\ 10 & -5 & 1 \end{bmatrix*} \end{array}

The 1010 in the lower left corner arises because we subtracted twice the first row from the second row, then subtracted five times the new second row from the third.

The factorization A=LUA = LU is preferable to the statement EA=UEA = U because the combination of row subtractions does not have the effect on LL that it did on EE. Here L=E1=E211E321L = E^{−1} = E_{21}^{−1}E_{32}^{−1}:

E211E321L[100210001][100010051]=[100210051]\begin{array}{cccc} E_{21}^{-1} & E_{32}^{-1} & & L \\ \begin{bmatrix*}[c] 1 & 0 & 0 \\ 2 & 1 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix*} & \begin{bmatrix*}[c] 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 5 & 1 \end{bmatrix*} & = & \begin{bmatrix*}[c] 1 & 0 & 0 \\ 2 & 1 & 0 \\ 0 & 5 & 1 \end{bmatrix*} \end{array}

Notice the 00 in row three column one of L=E1L = E^{−1}, where EE had a 1010. If there are no row exchanges, the multipliers from the elimination matrices are copied directly into LL.

How expensive is elimination?

Some applications require inverting very large matrices. This is done using a computer, of course. How hard will the computer have to work? How long will it take?

When using elimination to find the factorization A=LUA = LU we just saw that we can build LL as we go by keeping track of row subtractions. We have to remember LL and (the matrix which will become) UU; we don’t have to store AA or EijE_{ij} in the computer’s memory.

How many operations does the computer perform during the elimination process for an n×nn × n matrix? A typical operation is to multiply one row and then subtract it from another, which requires on the order of nn operations. There are nn rows, so the total number of operations used in eliminating entries in the first column is about n2n^2. The second row and column are shorter; that product costs about (n1)2(n − 1)^2 operations, and so on. The total number of operations needed to factor AA into LULU is on the order of n3n^3:

12+22++(n1)2+n2=i=1ni20nx2dx=13n3.1^2 + 2^2 + \dots + (n-1)^2 + n^2 = \sum_{i = 1}^n i^2 \approx \int_{0}^{n}x^2dx = \frac{1}{3}n^3.

While we’re factoring A we’re also operating on b\bm{b}. That costs about n2n^2 operations, which is hardly worth counting compared to 13n3\displaystyle\frac{1}{3}n^3.

Row exchanges

What if there are row exchanges? In other words, what happens if there’s a zero in a pivot position?

To swap two rows, we multiply on the left by a permutation matrix. For example,

P12=[010100001]P_{12} = \begin{bmatrix*}[c] 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix*}

swaps the first and second rows of a 3×33 × 3 matrix. The inverse of any permutation matrix PP is P1=PTP^{−1} = P^{T}.

There are n!n! different ways to permute the rows of an n×nn × n matrix (including the permutation that leaves all rows fixed) so there are n!n! permutation matrices. These matrices form a multiplicative group.

Problems and Solutions(习题及答案)

Exercises on factorization into A=LUA = LU

Problem 4.1: What matrix EE puts AA into triangular form EA=UEA = U? Multiply by E1=LE^{−1} = L to factor AA into LULU.

A=[130240201]A = \begin{bmatrix*}[c] 1 & 3 & 0 \\ 2 & 4 & 0 \\ 2 & 0 & 1 \end{bmatrix*}

Solution

We will perform a series of row operations to transform the matrix AA into an upper triangular matrix. First, we multiply the first row by 22 and then subtract it from the second row in order to make the first element of the second row 00.:

[100210001][130240201]=[130020201]\begin{bmatrix*}[r] 1 & 0 & 0 \\ -2 & 1 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[c] 1 & 3 & 0 \\ 2 & 4 & 0 \\ 2 & 0 & 1 \end{bmatrix*} = \begin{bmatrix*}[r] 1 & 3 & 0 \\ 0 & -2 & 0 \\ 2 & 0 & 1 \end{bmatrix*}

Next, we multiply the first row by 22 (again) and subtract it from the third row in order to make the first element of the third row 00:

[100010201][130020201]=[130020061]\begin{bmatrix*}[r] 1 & 0 & 0 \\ 0 & 1 & 0 \\ -2 & 0 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[r] 1 & 3 & 0 \\ 0 & -2 & 0 \\ 2 & 0 & 1 \end{bmatrix*} = \begin{bmatrix*}[r] 1 & 3 & 0 \\ 0 & -2 & 0 \\ 0 & -6 & 1 \end{bmatrix*}

Now, we multiply the second row by 33 and subtract it from the third row in order to make the second element of the third row 00:

[100010031][130020061]=[130020001]=U.\begin{bmatrix*}[r] 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & -3 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[r] 1 & 3 & 0 \\ 0 & -2 & 0 \\ 0 & -6 & 1 \end{bmatrix*} = \begin{bmatrix*}[r] 1 & 3 & 0 \\ 0 & -2 & 0 \\ 0 & 0 & 1 \end{bmatrix*} = U.

We take the three matrices we used to perform each operation and multiply them to get EE:

E=[100010031][100010201][100210001]=[100010031][100210201]=[100210431]=E.\begin{array}{l} E = \begin{bmatrix*}[r] 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & -3 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[r] 1 & 0 & 0 \\ 0 & 1 & 0 \\ -2 & 0 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[r] 1 & 0 & 0 \\ -2 & 1 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix*} \\ \\ =\begin{bmatrix*}[r] 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & -3 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[r] 1 & 0 & 0 \\ -2 & 1 & 0 \\ -2 & 0 & 1 \\ \end{bmatrix*}= \begin{bmatrix*}[r] 1 & 0 & 0 \\ -2 & 1 & 0 \\ 4 & -3 & 1 \\ \end{bmatrix*} = E. \end{array}

To check, we evaluate EAEA:

[100210031][130240201]=[130020001]=U.\begin{bmatrix*}[r] 1 & 0 & 0 \\ -2 & 1 & 0 \\ 0 & -3 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[r] 1 & 3 & 0 \\ 2 & 4 & 0 \\ 2 & 0 & 1 \\ \end{bmatrix*}= \begin{bmatrix*}[r] 1 & 3 & 0 \\ 0 & -2 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix*} = U.

To find E1E^{−1}, use the Gauss-Jordan elimination method (or just insert the multipliers 2,2,32, 2, 3 into E1E^{−1})

[100100210010431001][100100010210031401][100100010210001231][100210231]=E1\begin{array}{c} \bigg[\begin{array}{rrr|rrr} 1 & 0 & 0 & 1 & 0 & 0 \\ -2 & 1 & 0 & 0 & 1 & 0 \\ 4 & -3 & 1 & 0 & 0 & 1 \end{array}\bigg] \to \bigg[\begin{array}{rrr|rrr} 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 2 & 1 & 0 \\ 0 & -3 & 1 & -4 & 0 & 1 \end{array}\bigg] \to \\ \\ \bigg[\begin{array}{rrr|rrr} 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 2 & 1 & 0 \\ 0 & 0 & 1 & 2 & 3 & 1 \end{array}\bigg] \to \begin{bmatrix*}[r] 1 & 0 & 0 \\ 2 & 1 & 0 \\ 2 & 3 & 1 \\ \end{bmatrix*} = E^{-1} \end{array}

We can check that this is in fact the inverse of E:

EE1=[100210431][100210231]=[100010001]=I.EE^{-1} = \begin{bmatrix*}[r] 1 & 0 & 0 \\ -2 & 1 & 0 \\ 4 & -3 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[r] 1 & 0 & 0 \\ 2 & 1 & 0 \\ 2 & 3 & 1 \\ \end{bmatrix*} = \begin{bmatrix*}[r] 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix*} = I.

Finally, to factorize AA into LULU (where L=E1L = E^{−1}):

[130240201]=A=LU=[100210231][130020001].\begin{bmatrix*}[c] 1 & 3 & 0 \\ 2 & 4 & 0 \\ 2 & 0 & 1 \end{bmatrix*} = A = LU = \begin{bmatrix*}[r] 1 & 0 & 0 \\ 2 & 1 & 0 \\ 2 & 3 & 1 \\ \end{bmatrix*} \begin{bmatrix*}[r] 1 & 3 & 0 \\ 0 & -2 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix*}.

Problem 4.2: (2.6 #13. Introduction to Linear Algebra: Strang) Compute LL and UU for the symmetric matrix

A=[aaaaabbbabccabcd]A = \begin{bmatrix*}[r] a & a & a & a \\ a & b & b & b \\ a & b & c & c \\ a & b & c & d \end{bmatrix*}

Find four conditions on a,b,c,da, b, c, d to get A=LUA = LU with four pivots.

Solution

Elimination subtracts row 11 from rows 242-4, then row 22 from rows 343-4, and finally row 33 from row 44; the result is UU. All the multipliers ij\ell_{ij} are equal to 11; so LL is the lower triangular matrix with 11’s on the diagonal and below it.

A[aaaa0bababa0bacaca0bacada][aaaa0bababa00cbcb00cbdb][aaaa0bababa00cbcb000dc]=U,L=[1000110011101111]\begin{array}{c} A \to \begin{bmatrix*}[c] a & a & a & a \\ 0 & b-a & b-a & b-a \\ 0 & b-a & c-a & c-a \\ 0 & b-a & c-a & d-a \end{bmatrix*} \to \begin{bmatrix*}[c] a & a & a & a \\ 0 & b-a & b-a & b-a \\ 0 & 0 & c-b & c-b \\ 0 & 0 & c-b & d-b \end{bmatrix*}\to \\ \\ \begin{bmatrix*}[c] a & a & a & a \\ 0 & b-a & b-a & b-a \\ 0 & 0 & c-b & c-b \\ 0 & 0 & 0 & d-c \end{bmatrix*} = U, L = \begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ 1 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 \end{bmatrix*} \end{array}

The pivots are the nonzero entries on the diagonal of UU. So there are four pivots when these four conditions are satisfied: a0,ba,cba \ne 0, b \ne a, c \ne b,and dcd \ne c.