A⁻¹ is the transformation that undoes A, and it exists exactly when A doesn't squash space flat.
On Day 5 a matrix became a motion of the whole plane, and on Day 6 two motions chained into a product. Today asks whether a motion can be run backwards. The answer matters for solving equations, because Ax=b asks which point A moves onto b, and a matrix that runs A backwards would carry b straight to that point.
Each section below opens with a problem. Try it before you open the walkthrough, even if you only get partway. Every problem uses only Day 6's product and ordinary equation solving.
Undoing a matrix
The matrix A=[2111] moved some point x onto (3,2). Which point was it?
Walk through the solutionHide the walkthrough
We want the point that A sends to (3,2), so we call it (p,q) and write out A(p,q) with Day 4's column picture:
p[21]+q[11]=[2p+qp+q]=[32]
That gives 2p+q=3 and p+q=2. Subtracting the second equation from the first removes q and leaves p=1. Then q=2−1=1.
So x=(1,1). Solving worked, but we would have to solve again for every new target. It would be better to have one matrix that runs A backwards on any point.
Someone claims that C=[1−1−12] runs A backwards. Test the claim by computing CA and AC. Enter CA row by row.
Walk through the solutionHide the walkthrough
If C undoes A, then doing A and then C should change nothing. By Day 6, "do A, then C" is the product CA. We compute it with the row–column rule:
CA=[1−1−12][2111]=[2−1−2+21−1−1+2]=[1001]
That is the identity I, the matrix that leaves every point where it is. The other order checks that doing C first and then A also changes nothing:
AC=[2111][1−1−12]=[2−11−1−2+2−1+2]=[1001]
Both products are I, so the claim holds. As a check, C(3,2)=(3−2,−3+4)=(1,1), which is the point from Problem 1.
An n×n matrix A is invertible if there is an n×n matrix C with
CA=IandAC=I.
Then C is the inverse of A, written A−1. A matrix with no inverse is called singular, and an invertible matrix is also called nonsingular.
A matrix has at most one inverse. If B were a second one, then B=B(AC)=(BA)C=IC=C, using Day 6's rule that grouping does not matter.
The columns of A−1 have a direct meaning, and the next problem finds it.
Find the point that A=[2111] sends onto ^=(1,0). Compare your answer with the first column of C in Problem 2.
Walk through the solutionHide the walkthrough
Call the point (p,q). We need 2p+q=1 and p+q=0. Subtracting the second equation from the first gives p=1, and then q=−1.
The point is (1,−1), which is exactly the first column of C. That is no accident. The first column of A−1 is A−1^, and A−1 carries ^ back to the point that A sent onto ^.
The columns of an inverse
Column 1 of A−1 is the point that A sends onto ^, and column 2 is the point that A sends onto ^. So finding A−1 is the same as solving Ax=^ and Ax=^.
Build A−1 yourself below. Each pink column has to land on its ringed basis arrow.
Drag the pink columns of C until A sends the first onto ^ and the second onto ^. Then AC=I.
You built A−1=[1001]. Each of its columns is the point that A moves onto a basis arrow.
A=[2111]
C=[1001]
AC=[2111]
The formula for a 2 × 2 inverse
Solving two systems every time is slow. For 2×2 matrices a short formula does the work, and the next problem shows where it comes from.
Let A=[4232]. Swap the two diagonal entries and flip the signs of the other two, which gives [2−2−34]. Multiply A by this new matrix. What do you get, and how can you turn it into A−1?
Walk through the solutionHide the walkthrough
We multiply with the row–column rule, one entry at a time:
[4232][2−2−34]=[8−64−4−12+12−6+8]=[2002]
The result is 2I, which is almost the identity. Dividing the new matrix by 2 divides the product by 2 and gives exactly I:
A−1=21[2−2−34]=[1−1−3/22]
The 2 we divided by is 4⋅2−3⋅2. The same swap and sign flip works for any 2×2 matrix, and the leftover number is always ad−bc.
Theorem 4
Let A=[acbd]. If ad−bc=0, then A is invertible and
A−1=ad−bc1[d−c−ba].
If ad−bc=0, then A is not invertible. The number ad−bc is the determinant of A, written detA.
The recipe works because multiplying out gives [acbd][d−c−ba]=(ad−bc)I, just as Problem 4 gave 2I. The determinant comes back on Day 25, which shows that it measures how much A scales area. Larger matrices have no recipe this short, so Day 8 computes their inverses by row reduction.
Which matrix is the inverse of [3512]?
Solving with the inverse
Use A−1=[1−1−12] from Problem 2 to solve the system 2x1+x2=4 and x1+x2=3.
Walk through the solutionHide the walkthrough
The system is Ax=b with A=[2111] and b=(4,3). We want x alone, so we multiply both sides on the left by A−1, which cancels the A:
A−1Ax=A−1b⟹Ix=A−1b
Now compute the right side:
x=[1−1−12][43]=[4−3−4+6]=[12]
Check: 2(1)+2=4 and 1+2=3.
Theorem 5
If A is an invertible n×n matrix, then for each b in Rn the equation Ax=b has exactly one solution, x=A−1b.
The vector A−1b works because A(A−1b)=Ib=b. It is the only solution, because any u with Au=b gives u=A−1Au=A−1b after multiplying both sides by A−1 on the left. For large systems, row reduction is faster than finding A−1 first, and Day 9 explains why.
Find the solution by hand below. There is exactly one spot where x works.
Drag x until its image T(x)=Ax lands on the ringed point b=(4,3). Count steps along the blue grid.
That is the only point that works. x=(1,2), which is A−1b.
[2111][10]=[21]
=1[21]+0[11]
Matrix equations
The same move solves equations whose unknown is a whole matrix. The only new care is the side you multiply on, because Day 6 showed that A−1B and BA−1 are usually different.
A is invertible, and X is an unknown matrix with XA=B. Solve for X.
Walk through the solutionHide the walkthrough
We want to remove the A that sits on the right of X. Multiplying on the left would put A−1 in front of X, where it cancels nothing. So we multiply both sides on the right by A−1:
XAA−1=BA−1⟹XI=BA−1⟹X=BA−1
The inverse has to go on the same side as the A it cancels, and it has to go on that side of both equations.
A is invertible and AX=B. What is X?
This also repairs Day 6's failed cancellation. If A is invertible and AB=AC, multiplying on the left by A−1 gives B=C. Cancelling failed on Day 6 only because the matrix there was singular.
The inverse of a product
Day 8 builds an inverse by undoing a chain of row operations, so it needs to know how to undo a product.
The shear S=[1011] followed by the quarter turn R=[01−10] is RS=[01−11]. Find (RS)−1 with the formula, enter it row by row, and then decide whether it equals S−1R−1 or R−1S−1.
Walk through the solutionHide the walkthrough
The determinant of RS is 0⋅1−(−1)(1)=1. Swapping the diagonal and flipping the other signs gives
(RS)−1=[1−110].
Now the two candidates. The formula gives S−1=[10−11] and R−1=[0−110].
1
S−1R−1=[10−11][0−110]=[0+10−11+00+0]=[1−110]. This matches.
2
R−1S−1=[0−110][10−11]=[0+0−1+00+11+0]=[0−111]. This does not.
So (RS)−1=S−1R−1. Read right to left, it undoes the turn first and the shear second. The turn was the last move made, so it has to be the first move undone, just as you take off your shoes before your socks.
This grid was sheared by S and then turned by R. Undo both moves so the yellow arrow returns to its ring.
Home. You undid the turn first and the shear second, so (RS)−1=S−1R−1.
(RS)=[01−11]
That order leaves the grid skewed. The last move made has to be the first one undone.
Theorem 6
If A and B are invertible n×n matrices, then
(a) A−1 is invertible and (A−1)−1=A,
(b) AB is invertible and (AB)−1=B−1A−1,
(c) AT is invertible and (AT)−1=(A−1)T.
Each part is proved by checking the definition. For (b), the middle of the product collapses first:
(AB)(B−1A−1)=A(BB−1)A−1=AIA−1=AA−1=I,
and (B−1A−1)(AB)=I collapses the same way. The guess A−1B−1 fails because B and A−1 never sit next to each other, so nothing cancels. The same reasoning with three factors gives (ABC)−1=C−1B−1A−1.
Singular matrices
The formula divides by ad−bc, so it breaks when ad−bc=0. The next problem shows what goes wrong in the picture.
Let M=[1224]. Compute M[10], M[−11] and M[3−1]. Could any matrix undo M?
Walk through the solutionHide the walkthrough
Use the entries as weights on the columns (1,2) and (2,4):
All three points land on (1,2). A matrix that undoes M would have to send (1,2) back to all three of them at once, and a matrix sends each input to only one output. So no inverse exists. Its determinant confirms this: 1⋅4−2⋅2=0.
The three inputs differ by multiples of (−2,1), and M(−2,1)=−2(1,2)+1(2,4)=0. Adding a vector that lands on 0 never changes where a point lands.
Drag the three yellow points to three different places so that M sends every one of them onto the ringed point [12].
Three different inputs share one output. An inverse would have to send [12] back to all three at once, so M has no inverse.
M=[1224]
Mx1=[00]
Mx2=[36]
Mx3=[−2−4]
Zero determinant means the plane is flattened
When ad−bc=0, the two columns of A lie on one line through the origin, and A squashes the whole plane onto that line. The vector x=(−b,a) always gives Ax=(ab−ba,ad−bc). The first entry is always 0 and the second is the determinant, so when the determinant is zero some nonzero vector lands on 0. Then many points share each landing spot, and no inverse can exist.
For which value of h is [h412] singular?
Walk through the solutionHide the walkthrough
The matrix is singular exactly when its determinant is zero, so we compute the determinant with h left as a letter: 2h−1⋅4=2h−4. Setting 2h−4=0 gives h=2.
At h=2 the columns are (2,4) and (1,2). The first is twice the second, so they lie on one line. For every other h, the columns point in different directions, and the matrix is invertible.
Slide h until the parallelogram built from the two columns has no area left.
At h=2 the green column lies on the same line as the red one, so ad−bc=0 and the matrix is singular.
A=[−2412]
ad−bc=2(−2)−1(4)=−8
Drag both columns below to find another flat matrix of your own.
Drag ^ and ^ until ad−bc=0, keeping the green column away from the origin.
The two columns now lie on one line, so A squashes the whole plane onto it. Many points share each landing spot, and no matrix can send them back.
A=[2112]
ad−bc=3
A−1=31[2−1−12]
Day 19 gathers many other tests for whether a square matrix flattens space and shows they all agree with this one.
Practice
Warm-up
Compute the determinant of [34−21]. Is the matrix invertible?
Show the solutionHide the solution
det=3⋅1−(−2)⋅4=3+8=11. It is not zero, so the matrix is invertible.
Let A=[2513] and C=[3−5−12]. Compute AC, entering it row by row. Is C=A−1? (Modeled on Lay §2.2, Example 1.)
Show the solutionHide the solution
AC=[6−515−15−2+2−5+6]=[1001]
The other order gives CA=[6−5−10+103−3−5+6]=I as well, so C=A−1.
Find the inverse of [1301], row by row.
Show the solutionHide the solution
The determinant is 1⋅1−0⋅3=1. Swap the diagonal entries (both 1) and flip the signs of 0 and 3: [1−301]. The matrix adds 3 times the first coordinate to the second, and its inverse subtracts it again.
Core
Find the inverse of [5723] and use it to solve 5x1+2x2=4, 7x1+3x2=5. (Modeled on Lay §2.2 #1 and #5.)
Show a hintHide the hint
Find the determinant first. Then x=A−1b with b=(4,5).
Find the inverse of [4365], row by row. You can type fractions such as 5/2. (Modeled on Lay §2.2 #1.)
Show a hintHide the hint
This time the determinant is not 1, so every entry of the swapped matrix gets divided by it.
Show the solutionHide the solution
detAA−1=4⋅5−6⋅3=2=21[5−3−64]=[5/2−3/2−32]
Check the first row of AA−1: 4⋅25+6⋅(−23)=10−9=1 and 4(−3)+6(2)=0.
For which value of h is [h436] singular? (Modeled on Lay §2.2 #10(c).)
Show a hintHide the hint
Write the determinant with h as a letter and set it equal to zero.
Show the solutionHide the solution
The determinant is 6h−3⋅4=6h−12, which is zero exactly when h=2. Then the columns (2,4) and (3,6) both lie on the line y=2x, and the matrix squashes the whole plane onto that line.
Let P=[1327] and Q=[2111]. Find (PQ)−1 as Q−1P−1, and enter it row by row. (Modeled on Lay §2.2 #15.)
Show a hintHide the hint
Invert P and Q separately with the formula. Then multiply them in the reverse order.
The wrong order gives P−1Q−1=[9−4−115], which is a different matrix. You can confirm the right answer by multiplying it by PQ=[413310] and getting I.
Let A=[1327]. Use one inverse to solve both Ax=(3,10) and Ay=(0,1). Enter x and then y. (Modeled on Lay §2.2 #7.)
Show a hintHide the hint
Find A−1 once, then multiply it by each right side.
The second answer is just column 2 of A−1, because (0,1)=^.
Challenge
P is invertible and A=PBP−1. Which expression equals B?
Show a hintHide the hint
The P on the left of B needs a P−1 on its left, and the P−1 on the right of B needs a P on its right.
Show the solutionHide the solution
P−1AP=P−1(PBP−1)P=(P−1P)B(P−1P)=B
The matrix A=[2−1−63] has determinant 0. Find the vector x with first entry 3 and Ax=0. (Modeled on Lay §2.2 #25.)
Show a hintHide the hint
The vector (−b,a) always works when detA=0. Scale it so its first entry is 3.
Show the solutionHide the solution
Here (−b,a)=(6,2), and A(6,2)=(12−12,−6+6)=(0,0). Half of it is (3,1), and A(3,1)=3(2,−1)+1(−6,3)=(0,0) as well. Since a nonzero vector lands on 0, the equation Ax=0 has two different solutions, 0 and (3,1). Theorem 5 says an invertible matrix gives exactly one, so A is singular.
Let A=[2513]. Find (AT)−1, row by row, without inverting AT directly.
Show a hintHide the hint
Theorem 6(c) says (AT)−1=(A−1)T. Invert A, then flip.
Show the solutionHide the solution
detA=6−5=1, so A−1=[3−5−12]. Its transpose is [3−1−52].
Check: AT=[2153], and [2153][3−1−52]=[6−53−3−10+10−5+6]=I.
Tomorrow each row operation becomes a matrix, and a chain of them that reduces A to I multiplies out to A−1.