BetaFree coursewareRewritten from MIT OpenCourseWareCC BY-NC-SA 4.0
Open CosmologyPhysics & cosmology, from high school to a graduate year

Factorization into A = LU

The inverse of a product reverses the order, (AB)⁻¹ = B⁻¹A⁻¹, like putting socks and shoes back on; likewise (A⁻¹)ᵀ is the inverse of Aᵀ. Elimination without row exchanges takes A to U by elimination matrices, E₃₂E₃₁E₂₁A = U. Moving them to the other side gives A = LU with L = E₂₁⁻¹E₃₁⁻¹E₃₂⁻¹, lower triangular with ones on the diagonal. In that order the multipliers do not interfere: they simply sit in L, so L costs nothing to record, while the forward product E mixes them (a 10 from multipliers 2 and 5). Pulling the pivots out of U gives A = LDU. Elimination on an n × n matrix costs about n² + (n − 1)² + … + 1² ≈ n³/3 operations, and each right-hand side about n². Row exchanges use permutation matrices: there are 6 of size 3 × 3 (n! in general), products and inverses of them are again permutations, and P⁻¹ = Pᵀ.

You need this first

Full reading path (8 pages)
  1. Vectors (8.01)
  2. Vectors and the dot product (18.02)
  3. Determinants and the cross product (18.02)
  4. Planes through three points, and matrices (18.02)
  5. Equations of planes and square systems (18.02)
  6. The geometry of linear equations (18.06)
  7. Elimination with matrices (18.06)
  8. Matrix multiplication and inverse matrices (18.06)
On this page · 6 sections
  1. Inverses and transposes of products
  2. A = LU for a 2 × 2 matrix
  3. Three by three: why L is better than E
  4. How expensive is elimination?
  5. Permutations
  6. Summary

This lecture completes elimination by writing it as a factorization, A=LUA = LU, the most basic factorization of a matrix (transcript, pp. 1, 4). It continues matrix multiplication and inverses.

Inverses and transposes of products#

If AA and BB are invertible, so is ABAB, with the inverses in reverse order (transcript, pp. 1–2):

Inverse of a product
(AB)−1=B−1A−1,(AB)(B−1A−1)=A I A−1=I(AB)^{-1} = B^{-1}A^{-1}, \qquad (AB)(B^{-1}A^{-1}) = A\,I\,A^{-1} = I
In words

( capital A capital B ) to the power minus 1 equals capital B to the power minus 1 capital A to the power minus 1, ( capital A capital B )( capital B to the power minus 1 capital A to the power minus 1 ) equals capital A capital I capital A to the power minus 1 equals capital I

using the freedom to move parentheses. Take off shoes, then socks; to undo it, socks go back on first (p. 2). For the transpose, take AA−1=IAA^{-1} = I and transpose both sides: transposes of a product also come in reverse order, and IT=II^T = I (pp. 2–3):

Inverse of a transpose
(A−1)TAT=I,(AT)−1=(A−1)T(A^{-1})^T A^T = I, \qquad (A^T)^{-1} = (A^{-1})^T
In words

( capital A to the power minus 1 )^ capital T capital A ^ capital T equals capital I, ( capital A ^ capital T ) to the power minus 1 equals ( capital A to the power minus 1 )^ capital T

Transposing and inverting can be done in either order (p. 3).

A = LU for a 2 × 2 matrix#

Take AA with first pivot 2 and multiplier 4 (transcript, pp. 4–5). (A 4 in the bottom right corner would leave no second pivot: a singular matrix.) Elimination is one step (p. 5):

Elimination step
E21A=(10−41)(2187)=(2103)=UE_{21}A = \begin{pmatrix} 1 & 0 \\ -4 & 1 \end{pmatrix}\begin{pmatrix} 2 & 1 \\ 8 & 7 \end{pmatrix} = \begin{pmatrix} 2 & 1 \\ 0 & 3 \end{pmatrix} = U
In words

E two one capital A equals 1 0; minus 4 1 2 1; 8 7 equals 2 1; 0 3 equals U

Multiply by E21−1E_{21}^{-1}, which adds back what E21E_{21} removed (pp. 5–6):

A=LUA = LU
(2187)=(1041)(2103)=LU\begin{pmatrix} 2 & 1 \\ 8 & 7 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 4 & 1 \end{pmatrix}\begin{pmatrix} 2 & 1 \\ 0 & 3 \end{pmatrix} = LU
In words

2 1; 8 7 equals 1 0; 4 1 2 1; 0 3 equals L U

LL is lower triangular with ones on its diagonal; UU has the pivots on its diagonal (p. 6). Dividing each row of UU by its pivot gives a more balanced form, with a diagonal matrix DD of pivots in the middle (pp. 6–7):

A=LDUA = LDU
(2187)=(1041)(2003)(11/201)\begin{pmatrix} 2 & 1 \\ 8 & 7 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 4 & 1 \end{pmatrix}\begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix}\begin{pmatrix} 1 & 1/2 \\ 0 & 1 \end{pmatrix}
In words

2 1; 8 7 equals 1 0; 4 1 2 0; 0 3 1 one half; 0 1

Three by three: why L is better than E#

With no row exchanges, E32E31E21A=UE_{32}E_{31}E_{21}A = U (transcript, p. 7). Moving the matrices across inverts them in reverse order (p. 8):

L as a product of inverses
A=E21−1E31−1E32−1 U=LUA = E_{21}^{-1}E_{31}^{-1}E_{32}^{-1}\,U = LU
In words

capital A equals E two one to the power minus 1 E three one to the power minus 1 E three two to the power minus 1 U equals L U

Why prefer this product? Take multipliers 2 for E21E_{21} and 5 for E32E_{32}, with E31=IE_{31} = I (p. 9). The forward product mixes them (pp. 9–10):

Forward product E
E32E21=(1000100−51)(100−210001)=(100−21010−51)E_{32}E_{21} = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & -5 & 1 \end{pmatrix}\begin{pmatrix} 1 & 0 & 0 \\ -2 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 \\ -2 & 1 & 0 \\ 10 & -5 & 1 \end{pmatrix}
In words

E three two E two one equals 1 0 0; 0 1 0; 0 minus 5 1 1 0 0; minus 2 1 0; 0 0 1 equals 1 0 0; minus 2 1 0; 10 minus 5 1

The 10 appears because 2 of row 1 went into row 2 and then 5 of that row 2 went into row 3, so row 1 affected row 3 (p. 10). Both EE and LL are lower triangular with ones on the diagonal, because rows are only subtracted from rows below them (p. 10). In the reverse order nothing interferes (pp. 10–12):

L
L=E21−1E32−1=(100210001)(100010051)=(100210051)L = E_{21}^{-1}E_{32}^{-1} = \begin{pmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}\begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 5 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 0 & 5 & 1 \end{pmatrix}
In words

L equals E two one to the power minus 1 E three two to the power minus 1 equals 1 0 0; 2 1 0; 0 0 1 1 0 0; 0 1 0; 0 5 1 equals 1 0 0; 2 1 0; 0 5 1

With no row exchanges, the multipliers go directly into LL (p. 12). So there is nothing to compute: record the multipliers during elimination, save each new row of UU, and AA itself can be forgotten (pp. 12–13). This is the new insight that the matrix form brings (p. 13).

How expensive is elimination?#

Can we solve systems of order a thousand, or a million, in a second, an hour, a week (transcript, p. 13)? Count one operation as a multiply plus a subtract, for a full n×nn \times n matrix with no zeros (pp. 14–15). Clearing the first column changes nearly all n2n^2 entries; the next stage works on an (n−1)×(n−1)(n - 1) \times (n - 1) matrix, and so on (pp. 16–17):

Operation count
n2+(n−1)2+⋯+22+12≈∫0nx2 dx=13n3n^2 + (n - 1)^2 + \cdots + 2^2 + 1^2 \approx \int_0^n x^2\,dx = \frac{1}{3}n^3
In words

n squared plus the quantity n minus 1, all squared plus and so on plus 2 squared plus 1 squared is approximately the integral from 0 to n of x squared d x equals one third n cubed

Not nn, not n!n! (as determinants by their formula would be), but 13n3\frac13n^3: the 13\frac13 accounts for the shrinking matrices, as calculus shows (p. 18). (Strang integrates from 1 to nn; from 0 gives exactly 13n3\frac13n^3, and the difference is negligible for large nn.) Each right-hand side bb costs only about n2n^2, so after the expensive split of AA into LL and UU, many right-hand sides are cheap (p. 19).

Permutations#

Row exchanges are needed when a zero appears in a pivot position, and are done by permutation matrices: the rows of the identity rearranged (transcript, pp. 20–21). For 3×33 \times 3 there are six: the identity, three single exchanges, and two cycles, such as the one moving row 2 to row 1, row 3 to row 2 and row 1 to row 3 (pp. 20–22). They form a group: products and inverses of permutations are again permutations (p. 22). A single exchange is its own inverse, the two cycles are inverses of each other, and in general (p. 23)

Inverse of a permutation
P−1=PTP^{-1} = P^T
In words

capital P to the power minus 1 equals capital P ^ capital T

There are 4!=244! = 24 permutation matrices of size 4×44 \times 4 (p. 23); in general there are n!n! of size nn.

Worked example

An LU factorization of your own

(a) Factor A=(312645−334)A = \begin{pmatrix} 3 & 1 & 2 \\ 6 & 4 & 5 \\ -3 & 3 & 4 \end{pmatrix} as LULU and find its determinant. (b) Estimate the cost of elimination for n=1000n = 1000, and what doubling nn does.

(a) Multipliers

ℓ21=2\ell_{21} = 2: row 2 becomes (0,2,1)(0, 2, 1). ℓ31=−1\ell_{31} = -1: row 3 becomes (0,4,6)(0, 4, 6). ℓ32=2\ell_{32} = 2: row 3 becomes (0,0,4)(0, 0, 4).

(a) The factors

L=(100210−121)L = \begin{pmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ -1 & 2 & 1 \end{pmatrix} and U=(312021004)U = \begin{pmatrix} 3 & 1 & 2 \\ 0 & 2 & 1 \\ 0 & 0 & 4 \end{pmatrix}. Check row 3 of LULU: −1(3,1,2)+2(0,2,1)+(0,0,4)=(−3,3,4)-1(3, 1, 2) + 2(0, 2, 1) + (0, 0, 4) = (-3, 3, 4). The determinant is the product of the pivots (as in Lecture 2), 3⋅2⋅4=243\cdot2\cdot4 = 24.

(b) Cost

13(1000)3≈3.3×108\frac13(1000)^3 \approx 3.3 \times 10^8 operations. Doubling nn multiplies the cost by 23=82^3 = 8, but the cost of each right-hand side only by 4.

Summary#

  • (AB)−1=B−1A−1(AB)^{-1} = B^{-1}A^{-1} and (AT)−1=(A−1)T(A^T)^{-1} = (A^{-1})^T.
  • Without row exchanges, A=LUA = LU: LL is lower triangular with ones on the diagonal and the multipliers below; A=LDUA = LDU separates the pivots.
  • Elimination costs about 13n3\frac13n^3 operations; each right-hand side about n2n^2.
  • Permutation matrices perform row exchanges; there are n!n! of them, and P−1=PTP^{-1} = P^T.

Symbols on this page

Show the 24 symbols used here
ℓ\ell script l.
A length or distance; ℓ_p is a physical distance and ℓ_c a comoving one. Unit: m (a comoving ℓ_c is in notches, Guth's units). Say it: “ell”.
≈\approx approximately equal.
Is approximately equal to. Say it: “is approximately”.
×\times times.
Times (multiplication). Between two vectors: the cross product. Say it: “times”.
⋅\cdot dot.
Times (multiplication). Between two vectors: the dot product. Say it: “times”.
∫\int integral.
Integral: the sum of infinitely many small pieces, such as the area under a curve. Say it: “the integral of”.
TT T.
As a superscript: the transpose (rows become columns). Say it: “capital T”.
xx x.
The integration variable in ∫x² dx, standing in for the size of each stage. Say it: “x”.
dd d.
As in dx: an infinitesimal step in x. Say it: “d”.
nn n.
The size of the matrix (n × n). Say it: “n”.
PP P.
A permutation matrix: the identity with its rows rearranged. Say it: “capital P”.
DD D.
The diagonal matrix of pivots, in A = LDU. Say it: “capital D”.
AA A.
The matrix being factored, A = LU. Say it: “capital A”.
BB B.
A second invertible matrix, in (AB)⁻¹ = B⁻¹A⁻¹. Say it: “capital B”.
bb b.
A right-hand side vector, in Ax = b. Say it: “b”.
LL L.
The lower triangular matrix with ones on its diagonal and the multipliers below it: A = LU. Say it: “L”.
EE E.
The elimination matrix, as a whole or as a product of the elimination steps. Say it: “E”.
UU U.
The upper triangular matrix that elimination produces, with the pivots on its diagonal. Say it: “U”.
II I.
The identity matrix. Say it: “capital I”.
E21E_{21} E two one.
The elimination matrix that clears position (2, 1). Say it: “E two one”.
E31E_{31} E three one.
The elimination matrix that clears position (3, 1). Say it: “E three one”.
E32E_{32} E three two.
The elimination matrix that clears position (3, 2). Say it: “E three two”.
ℓ21\ell_{21} ell 2 1.
The multiplier that clears position (2, 1): ℓ times the pivot row is subtracted; it is the (2, 1) entry of L. Say it: “ell 2 1”.
ℓ31\ell_{31} ell 3 1.
The multiplier that clears position (3, 1): ℓ times the pivot row is subtracted; it is the (3, 1) entry of L. Say it: “ell 3 1”.
ℓ32\ell_{32} ell 3 2.
The multiplier that clears position (3, 2): ℓ times the pivot row is subtracted; it is the (3, 2) entry of L. Say it: “ell 3 2”.

Tap or click a symbol in a formula to see the same explanation. All symbols: symbols and notation.

Words on this page

Show the 22 words used here

New here

factorization.
Writing something, such as a number, a matrix or an operator, as a product of simpler pieces.
group.
A collection of matrices, or other objects, in which the product of any two and the inverse of each are again in the collection.

Also used

elimination.
Solving equations by subtracting multiples of one from another until each unknown can be found in turn. Explained in The geometry of linear equations.
matrix.
A rectangular table of numbers, which acts on vectors to give new ones and so describes a linear change of coordinates. Explained in Planes through three points, and matrices.
p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
inverse.
The thing that undoes another: a matrix times its inverse gives the identity matrix, as a function followed by its inverse gives back the start. Explained in Planes through three points, and matrices.
invertible.
Of a square matrix or operator: having an inverse that undoes it; for a matrix this happens exactly when its determinant is not zero. Explained in The geometry of linear equations.
transpose.
The matrix made by writing the rows of a matrix as columns, flipping it across its main diagonal. Explained in Planes through three points, and matrices.
pivot.
In elimination, the first nonzero number in a row, used to clear out the entries below it. Explained in Positive definite matrices and minima.
singular.
Of a square matrix: having no inverse, because its determinant is zero and some nonzero vector is sent to zero. Explained in The geometry of linear equations.
triangular matrix.
A square matrix with only zeros below its diagonal (upper triangular) or only zeros above it (lower triangular). Explained in Elimination with matrices.
diagonal.
In a square matrix, the entries running from the top left corner to the bottom right; a diagonal matrix has zeros everywhere else. Explained in The four fundamental subspaces.
row exchange.
Swapping two rows of a matrix, needed in elimination when a zero sits where a pivot should be.
determinant.
A single number worked out from a square array of numbers (a matrix), which measures how the matrix stretches areas or volumes. Explained in Determinants and the cross product.
integration.
Finding an integral: adding up very many small pieces, or finding an antiderivative. Explained in Differentials and antiderivatives.
permutation matrix.
A matrix made by reordering the rows of the identity matrix; multiplying by it reorders the rows of another matrix the same way. Explained in Elimination with matrices.
permutation.
A rearrangement of a list of things into a new order. Explained in Elimination with matrices.

Academic

transcript.
A written record of exactly what was said in a recorded lecture, word for word.
insight.
A clear, deep understanding of how or why something works.
of order.
Roughly equal to, within a factor of a few; of order one means neither much bigger nor much smaller than one.
accounts for.
Explains, makes up a stated share of, or takes into account something.
negligible.
So small that leaving it out makes no noticeable difference to the result.

Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).

Where this leads

In cosmology

32 more cosmology pages that build on this

Pages that build on this

Practise

Check your understanding

  1. What is (AB)−1(AB)^{-1}?
  2. Why is LL in A=LUA = LU easy to write down?
  3. About how many operations does elimination take on an n×nn \times n matrix?
0 of 3 answered

Flashcards

1 / 3