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

Cramer's rule, the inverse matrix and volume

The determinant gives formulas for things computed so far by elimination. The inverse is A⁻¹ = Cᵀ/det A, where C is the matrix of cofactors; for 2 × 2 that is the familiar (1/(ad − bc)) times the matrix with rows (d, −b) and (−c, a). The reason: ACᵀ = (det A)I. On the diagonal, a row times its own cofactors is the cofactor formula for det A; off the diagonal, a row times the cofactors of another row is the determinant of a matrix with two equal rows, so 0. Applied to Ax = b this gives Cramer's rule: xⱼ = det Bⱼ / det A, where Bⱼ is A with column j replaced by b. It needs n + 1 determinants and is a disastrous way to compute, though the formulas are valuable for algebra. Third, |det A| is the volume of the box (parallelepiped) whose edges are the rows of A; the sign says whether the box is right- or left-handed. The unit cube and any rotated cube (A = Q, with det Q = ±1 from QᵀQ = I) have volume 1, and doubling an edge doubles both the volume and the determinant. In two dimensions the parallelogram with sides (a, b) and (c, d) has area ad − bc, with no square roots, the triangle half of that, and a triangle with any three corners has area ½ times the absolute value of a 3 × 3 determinant with a column of ones.

You need this first

Full reading path (12 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)
  9. Factorization into A = LU (18.06)
  10. Transposes, permutations and vector spaces (18.06)
  11. Properties of determinants (18.06)
  12. Determinant formulas and cofactors (18.06)
On this page · 4 sections
  1. The inverse from cofactors
  2. Cramer's rule
  3. The determinant is a volume
  4. Summary

The last lecture on determinants is about their applications: one number that gives formulas for things computed so far without formulas (transcript, p. 1). It continues determinant formulas and cofactors.

The inverse from cofactors#

The 2×22 \times 2 inverse is known (transcript, p. 1):

Two by two inverse
(abcd)−1=1ad−bc(d−b−ca)\begin{pmatrix} a & b \\ c & d \end{pmatrix}^{-1} = \frac{1}{ad - bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}
In words

a b; c d to the power minus 1 equals 1 over the quantity a d minus b c, d minus b; minus c a

The entries are cofactors: dd is the cofactor of aa, and −b-b is the cofactor of cc (the minus because 2+12 + 1 is odd), sitting in the position of bb: the cofactor matrix is transposed (pp. 1–3). In general (p. 2):

Inverse from cofactors
A−1=1det⁡A CTA^{-1} = \frac{1}{\det A}\,C^T
In words

capital A to the power minus 1 equals 1 over the quantity the determinant of capital A, times capital C ^ capital T

For 3×33 \times 3, det⁡A\det A is a sum of products of three entries and each cofactor a product of two, such as ei−fhei - fh for the corner entry aa of a matrix with rows (a,b,c)(a, b, c), (d,e,f)(d, e, f), (g,h,i)(g, h, i) (pp. 3–4). Gauss–Jordan was the better algorithm; this is the algebra behind it (p. 4).

Why it is right (pp. 4–9). It is enough to check (p. 5)

The identity behind the inverse
ACT=(det⁡A) IAC^T = (\det A)\,I
In words

capital A capital C ^ capital T equals ( the determinant of capital A ) capital I

On the diagonal, row ii of AA times column ii of CTC^T (the cofactors of row ii) is ai1Ci1+⋯+ainCina_{i1}C_{i1} + \cdots + a_{in}C_{in}, the cofactor formula: det⁡A\det A (pp. 5–6). Off the diagonal, row 1 of AA times the cofactors of row 2 must give 0 (p. 7). The reason: it is the cofactor expansion of a matrix in which row 2 has been replaced by a copy of row 1, a matrix with two equal rows, so its determinant is zero (pp. 8–9). For 2×22 \times 2: the matrix with rows (a,b)(a, b) and (a,b)(a, b) has determinant a⋅b+b⋅(−a)=0a \cdot b + b \cdot (-a) = 0 (pp. 8–9). The formula also shows how A−1A^{-1} responds when one entry of AA changes: through the determinant and the cofactors (pp. 9–10).

Cramer's rule#

The solution of Ax=bAx = b is x=A−1b=CTb/det⁡Ax = A^{-1}b = C^Tb/\det A (transcript, p. 10). The products of cofactors with the numbers b1,…,bnb_1, \dots, b_n are themselves a determinant (pp. 11–13):

Cramer's rule
xj=det⁡Bjdet⁡A,Bj=A with column j replaced by bx_j = \frac{\det B_j}{\det A}, \qquad B_j = A \text{ with column } j \text{ replaced by } b
In words

x sub j equals the determinant of capital B j over the quantity the determinant of capital A, capital B j equals capital A with column j replaced by b

Expanding det⁡B1\det B_1 by cofactors down its first column gives b1C11+b2C21+⋯b_1C_{11} + b_2C_{21} + \cdots, exactly the first entry of CTbC^Tb (p. 12). Is the rule good in practice? It needs n+1n + 1 determinants, and computing them takes "approximately forever": a disastrous way to go, while elimination produces xx in an instant (p. 13). Strang recalls a popular book from his childhood, Mathematics for the Million, that praised Cramer's rule, and jokes that it should have been "for the millionaire" (p. 13). (He names the author as Bell; the book of that title is by Lancelot Hogben.) The formulas are worth having for algebra, not for computation; MATLAB never uses them (p. 14).

The determinant is a volume#

Take the rows of a 3×33 \times 3 matrix as three edges from the origin and complete the box, properly a parallelepiped, whose faces are parallelograms (transcript, pp. 14–16):

Determinant and volume
∣det⁡A∣=volume of the box with edges the rows of A|\det A| = \text{volume of the box with edges the rows of } A
In words

the absolute value of the determinant of capital A equals volume of the box with edges the rows of capital A

The sign of det⁡A\det A says whether the box is right-handed or left-handed; exchanging two edges flips it without changing the volume (p. 16). Since det⁡AT=det⁡A\det A^T = \det A, columns would do as well (p. 17).

Checking it (pp. 16–21). The elegant proof shows that volume has the three properties that define the determinant.

  • A=IA = I: the unit cube, volume 1 (pp. 16–17).
  • A=QA = Q, an orthogonal matrix: a rotated unit cube, volume 1 (pp. 17–18).
  • Doubling one edge of a rectangular box doubles the volume (two copies fit together), and doubling a row doubles the determinant: property 3A (pp. 19–20).
  • Exchanging two rows does not change the box: property 2 up to sign (pp. 20–21).

For the rotated cube the determinant agrees, by properties 9 and 10 (pp. 18–19):

Determinant of an orthogonal matrix
QTQ=I  ⇒  (det⁡QT)(det⁡Q)=(det⁡Q)2=1  ⇒  det⁡Q=±1Q^TQ = I \;\Rightarrow\; (\det Q^T)(\det Q) = (\det Q)^2 = 1 \;\Rightarrow\; \det Q = \pm 1
In words

Q^ capital T Q equals capital I which gives ( the determinant of Q^ capital T )( the determinant of Q) equals ( the determinant of Q) squared equals 1 which gives the determinant of Q equals plus or minus 1

Property 3B, linearity in a row (for 2×22 \times 2: the area for the row (a+a′,b+b′)(a + a', b + b') splits into the areas for (a,b)(a, b) and (a′,b′)(a', b')), needs a figure; Strang leaves it to the book (pp. 21, 24).

Areas in the plane (pp. 21–24). The parallelogram with sides (a,b)(a, b) and (c,d)(c, d), with fourth corner (a+c,b+d)(a + c, b + d), has area ∣ad−bc∣|ad - bc| (p. 22). The usual way, base times height, brings square roots and worse; the determinant needs only the coordinates (p. 22). The triangle with corners (0,0)(0, 0), (a,b)(a, b), (c,d)(c, d) is half of it (p. 23). For a triangle with any three corners (p. 24):

Area of a triangle
area=12∣det⁡(x1y11x2y21x3y31)∣\text{area} = \frac{1}{2}\left|\det\begin{pmatrix} x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \\ x_3 & y_3 & 1 \end{pmatrix}\right|
In words

area equals one half the absolute value of the determinant of x one y one 1; x two y two 1; x three y three 1

Subtracting row 1 from the other rows kills two of the ones and amounts to moving the triangle to start at the origin (p. 24). (Strang writes the determinant and says it is half of a parallelogram; the factor 12\frac{1}{2} is written into the formula here.) Eigenvalues come next (p. 24).

Worked example

Cofactors, Cramer and area of your own

(a) For A=(3245)A = \begin{pmatrix} 3 & 2 \\ 4 & 5 \end{pmatrix}, find A−1A^{-1} from cofactors and solve Ax=(8,13)Ax = (8, 13) by Cramer's rule. (b) Find the area of the triangle with corners (1,1)(1, 1), (4,2)(4, 2), (2,5)(2, 5).

(a) Inverse

det⁡A=15−8=7\det A = 15 - 8 = 7. Cofactors: C11=5C_{11} = 5, C12=−4C_{12} = -4, C21=−2C_{21} = -2, C22=3C_{22} = 3. So A−1=17(5−2−43)A^{-1} = \frac{1}{7}\begin{pmatrix} 5 & -2 \\ -4 & 3 \end{pmatrix}.

(a) Cramer

x1=det⁡(82135)/7=(40−26)/7=2x_1 = \det\begin{pmatrix} 8 & 2 \\ 13 & 5 \end{pmatrix}/7 = (40 - 26)/7 = 2 and x2=det⁡(38413)/7=(39−32)/7=1x_2 = \det\begin{pmatrix} 3 & 8 \\ 4 & 13 \end{pmatrix}/7 = (39 - 32)/7 = 1. Check: 3⋅2+2=83 \cdot 2 + 2 = 8 and 4⋅2+5=134 \cdot 2 + 5 = 13.

(b) Area

det⁡(111421251)=1(2−5)−1(4−2)+1(20−4)=11\det\begin{pmatrix} 1 & 1 & 1 \\ 4 & 2 & 1 \\ 2 & 5 & 1 \end{pmatrix} = 1(2 - 5) - 1(4 - 2) + 1(20 - 4) = 11, so the area is 5.55.5. Check by moving (1,1)(1, 1) to the origin: the sides (3,1)(3, 1) and (1,4)(1, 4) give 12(12−1)=5.5\frac{1}{2}(12 - 1) = 5.5.

Summary#

  • A−1=CT/det⁡AA^{-1} = C^T/\det A, because ACT=(det⁡A)IAC^T = (\det A)I: own cofactors give det⁡A\det A, another row's cofactors give 0.
  • Cramer's rule: xj=det⁡Bj/det⁡Ax_j = \det B_j/\det A. A fine formula, a poor algorithm.
  • ∣det⁡A∣|\det A| is the volume of the box spanned by the rows; det⁡Q=±1\det Q = \pm1 for orthogonal QQ.
  • Parallelogram area ∣ad−bc∣|ad - bc|; triangle area half of that, or 12∣det⁡∣\frac{1}{2}|\det| with a column of ones for any corners.

Symbols on this page

Show the 46 symbols used here
⇒\Rightarrow implies.
Implies: what follows is a consequence of what came before. Say it: “which gives”.
±\pm plus or minus.
Plus or minus: both signs, or an uncertainty (67.3 ± 1.2). Say it: “plus or minus”.
×\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”.
det⁡\det determinant.
Determinant of a matrix. Say it: “the determinant of”.
aa a.
The top left entry of a 2 × 2 matrix (or of the 3 × 3 example). Say it: “a”.
cc c.
The bottom left entry of a 2 × 2 matrix. Say it: “c”.
kk k.
The number of another row, whose cofactors are used. Say it: “k”.
TT T.
As a superscript: the transpose. Say it: “capital T”.
xx x.
The solution of Ax = b. Say it: “x”.
dd d.
The bottom right entry of a 2 × 2 matrix. Say it: “d”.
ii i.
A row number; also the last entry of the 3 × 3 example. Say it: “i”.
jj j.
A column number. Say it: “j”.
nn n.
The size of the matrix. Say it: “n”.
ee e.
An entry of the 3 × 3 example (row 2, column 2). Say it: “e”.
ff f.
An entry of the 3 × 3 example (row 2, column 3). Say it: “f”.
gg g.
An entry of the 3 × 3 example (row 3, column 1). Say it: “g”.
QQ Q.
An orthogonal matrix: QᵀQ = I. Say it: “Q”.
AA A.
A square invertible matrix. Say it: “capital A”.
CC C.
The cofactor matrix of A. Say it: “capital C”.
bb b.
The top right entry of a 2 × 2 matrix; in Ax = b, the right-hand side. Say it: “b”.
hh h.
An entry of the 3 × 3 example (row 3, column 2). Say it: “h”.
aina_{\text{in}} a in.
The last entry of row i of A. Say it: “a sub in”.
x1x_{1} x 1.
The first component of the solution; in the area formula, the x-coordinate of the first corner. Say it: “x one”.
x2x_{2} x 2.
The second component of the solution; in the area formula, the x-coordinate of the second corner. Say it: “x two”.
y1y_{1} y 1.
The y-coordinate of the first corner. Say it: “y one”.
y2y_{2} y 2.
The y-coordinate of the second corner. Say it: “y two”.
x3x_{3} x three.
The x-coordinate of the third corner. Say it: “x three”.
y3y_{3} y three.
The y-coordinate of the third corner. Say it: “y three”.
II I.
The identity matrix. Say it: “capital I”.
xjx_{j} x j.
The j-th component of the solution. Say it: “x sub j”.
B1B_{1} B 1.
A with column 1 replaced by b. Say it: “capital B one”.
B2B_{2} B 2.
A with column 2 replaced by b. Say it: “capital B two”.
b1b_{1} b 1.
The first component of b. Say it: “b one”.
b2b_{2} b 2.
The second component of b. Say it: “b two”.
C12C_{12} C one two.
The cofactor of a₁₂. Say it: “capital C one two”.
bnb_{n} b sub n.
The last component of b. Say it: “b sub n”.
a′a' a prime.
The first entry of a second row (a′, b′) in the sum rule for areas. Say it: “a prime”.
b′b' b prime.
The second entry of that second row. Say it: “b prime”.
C11C_{11} C one one.
The cofactor of a₁₁. Say it: “capital C one one”.
BjB_{j} B j.
A with column j replaced by b. Say it: “capital B j”.
ai1a_{i1} a i one.
The first entry of row i of A. Say it: “a i one”.
Ci1C_{i1} C i one.
The cofactor of aᵢ₁. Say it: “capital C i one”.
CinC_{\text{in}} C i n.
The cofactor of aᵢₙ. Say it: “capital C i n”.
C21C_{21} C two one.
The cofactor of a₂₁. Say it: “capital C two one”.
C22C_{22} C two two.
The cofactor of a₂₂. Say it: “capital C two two”.

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

Words on this page

Show the 23 words used here

Also used

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.
p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
cofactor.
A minor of a matrix with a plus or minus sign attached, following a checkerboard of signs that starts with plus in the top-left corner. Explained in Planes through three points, and matrices.
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.
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.
Gauss–Jordan.
A method that continues elimination upwards as well as downwards until the matrix becomes the identity, which finds the inverse. Explained in The four fundamental subspaces.
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.
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.
Cramer's rule.
A formula that solves a set of linear equations, giving each unknown as a ratio of two determinants. Explained in Driven coupled oscillators and symmetry.
parallelepiped.
A slanted box: a solid with six faces, each a parallelogram, with opposite faces equal and parallel. Explained in Determinants and the cross product.
right-handed.
Of a set of axes: arranged so that curling the right hand from x to y makes the thumb point along z. Explained in Torque and the cross product.
left-handed.
Of a set of axes or a turning: the mirror image of the usual right-handed one, matching the curled fingers of a left hand.
proof.
A chain of reasoning showing beyond doubt that a statement follows from definitions and results already known. Explained in Limits and continuity.
orthogonal matrix.
A square matrix whose columns are perpendicular unit vectors; it rotates or reflects without changing lengths, and its inverse is its transpose. Explained in Orthogonal matrices and Gram–Schmidt.
linear.
Of a map, operator or equation: respecting sums and multiples, so that L(au + bv) = aL(u) + bL(v). Explained in The geometry of linear equations.
eigenvalue.
A number λ for which a matrix turns some non-zero vector into λ times that vector, only stretching or shrinking it. Explained in Linear systems with constant coefficients: eigenvalues and eigenvectors.
span.
The span of some vectors is everything that can be made by combining them; vectors span a space when they fill all of it. Explained in Independence, basis and dimension.
orthogonal.
At right angles; more generally, of two vectors or functions, having a dot product, or an integral of their product, of zero. Explained in Introduction to Fourier series.

Academic

transcript.
A written record of exactly what was said in a recorded lecture, word for word.
in practice.
In reality, as things are actually done or measured, rather than in theory.
approximation.
Close to, but not exactly, the true value; an approximation is such a value or formula, chosen because it is simpler.
elegant.
Simple, short and clear in a way that seems to reveal how things really fit together.
kills.
In maths slang, to make a term or vector zero.

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

31 more cosmology pages that build on this

Pages that build on this

Practise

Check your understanding

  1. In A−1=CT/det⁡AA^{-1} = C^T/\det A, why do the off-diagonal entries of ACTAC^T vanish?
  2. In Cramer's rule, x2=det⁡B2/det⁡Ax_2 = \det B_2/\det A. What is B2B_2?
  3. What is the area of the triangle with corners (0,0)(0, 0), (a,b)(a, b), (c,d)(c, d)?
0 of 3 answered

Flashcards

1 / 3