Unit 6, lesson 84

Inverse Matrices and Solving Systems

When a square matrix has an inverse, how to find it with the 2 by 2 formula or by row reduction, and how an inverse solves a system of linear equations in a single multiplication.

  • Theory part 167
  • Practice part 168
  • Matrices

To solve 3x=123x = 12 you multiply both sides by 1/31/3, the number that undoes multiplying by 33. Many matrices can be undone in the same way. If a matrix moves the points of the plane and no two points land on the same spot, another matrix moves every point back. With that matrix in hand, a whole system of equations is solved in one multiplication.

Key terms

Identity matrix

Definition The n×nn \times n identity matrix InI_n has 11 in each entry of the main diagonal and 00 everywhere else. For every n×nn \times n matrix AA and every x\mathbf{x} in Rn\mathbb{R}^n

AIn=InA=AandInx=x.AI_n = I_n A = A \quad \text{and} \quad I_n \mathbf{x} = \mathbf{x}.

In plain words Among n×nn \times n matrices the identity plays the part of the number 11. As a map it leaves every vector where it is, so it is the target when you undo a matrix.

Example Multiplying by I2I_2 changes nothing,

[3512][1001]=[3⋅1+5⋅03⋅0+5⋅11⋅1+2⋅01⋅0+2⋅1]=[3512].\begin{aligned} &\begin{bmatrix} 3 & 5 \\ 1 & 2 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \\[0.8em] &\quad = \begin{bmatrix} 3 \cdot 1 + 5 \cdot 0 & 3 \cdot 0 + 5 \cdot 1 \\ 1 \cdot 1 + 2 \cdot 0 & 1 \cdot 0 + 2 \cdot 1 \end{bmatrix} \\[0.8em] &\quad = \begin{bmatrix} 3 & 5 \\ 1 & 2 \end{bmatrix}. \end{aligned}

Inverse matrix

Definition Let AA be an n×nn \times n matrix. The matrix AA is invertible when there is an n×nn \times n matrix BB with

AB=InandBA=In.AB = I_n \quad \text{and} \quad BA = I_n.

Such a BB is unique, because if CC also works then B=B(AC)=(BA)C=CB = B(AC) = (BA)C = C. It is called the inverse of AA and written A−1A^{-1}. If AA and BB are invertible n×nn \times n matrices, then (A−1)−1=A(A^{-1})^{-1} = A, and ABAB is invertible with

(AB)−1=B−1A−1.(AB)^{-1} = B^{-1}A^{-1}.

In plain words The inverse undoes what AA does. Apply AA and then A−1A^{-1}, and every vector is back where it started. To undo two steps, undo the last one first, the way you take off shoes before socks.

Example The two matrices below are inverses of each other, since

[2111][1−1−12]=[2−1−2+21−1−1+2]=[1001],\begin{aligned} &\begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix} \\[0.8em] &\quad = \begin{bmatrix} 2 - 1 & -2 + 2 \\ 1 - 1 & -1 + 2 \end{bmatrix} \\[0.8em] &\quad = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \end{aligned}

and the product in the other order is also I2I_2.

Square and nonsingular conditions

Definition Only square matrices have inverses. If AA is m×nm \times n with m≠nm \ne n, no matrix BB satisfies both AB=ImAB = I_m and BA=InBA = I_n. A square matrix AA is invertible exactly when it is nonsingular, that is, when det⁡A≠0\det A \ne 0. Equivalently, its reduced row echelon form is the identity matrix. For square matrices one product is enough to check, because if AA and BB are n×nn \times n and AB=InAB = I_n, then also BA=InBA = I_n and B=A−1B = A^{-1}.

In plain words Only a square matrix that does not flatten the plane can be undone. A flattening matrix sends different points to the same place, and no matrix can send one point back to two places.

Example The matrix below has determinant 1⋅4−2⋅2=01 \cdot 4 - 2 \cdot 2 = 0, and it sends two different vectors to the same one,

[1224][20]=[24]=[1224][01].\begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix} \begin{bmatrix} 2 \\ 0 \end{bmatrix} = \begin{bmatrix} 2 \\ 4 \end{bmatrix} = \begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix}.

An inverse BB would have to send ⟨2,4⟩\langle 2, 4 \rangle back to both ⟨2,0⟩\langle 2, 0 \rangle and ⟨0,1⟩\langle 0, 1 \rangle, which is impossible. So this matrix has no inverse.

The 2 by 2 inverse formula

Definition Let AA have rows (a,b)(a, b) and (c,d)(c, d). If ad−bc≠0ad - bc \ne 0, then

A−1=1ad−bc[d−b−ca].A^{-1} = \frac{1}{ad - bc} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}.

If ad−bc=0ad - bc = 0, the matrix AA has no inverse. The formula works because

[abcd][d−b−ca]=[ad−bc00ad−bc]=(ad−bc)I2.\begin{aligned} &\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix} \\[0.8em] &\quad = \begin{bmatrix} ad - bc & 0 \\ 0 & ad - bc \end{bmatrix} \\[0.8em] &\quad = (ad - bc) I_2. \end{aligned}

In plain words Swap the two diagonal entries, change the signs of the other two, and divide everything by the determinant.

Example For the matrix AA with rows (4,3)(4, 3) and (2,2)(2, 2) the determinant is 4⋅2−3⋅2=24 \cdot 2 - 3 \cdot 2 = 2, so

A−1=12[2−3−24]=[1−3/2−12].\begin{aligned} A^{-1} &= \frac{1}{2} \begin{bmatrix} 2 & -3 \\ -2 & 4 \end{bmatrix} \\[0.8em] &= \begin{bmatrix} 1 & -3/2 \\ -1 & 2 \end{bmatrix}. \end{aligned}

As a check, the top left entry of AA−1AA^{-1} is 4⋅1+3⋅(−1)=14 \cdot 1 + 3 \cdot (-1) = 1 and the top right entry is 4⋅(−3/2)+3⋅2=04 \cdot (-3/2) + 3 \cdot 2 = 0, and the bottom row works out to (0,1)(0, 1) in the same way.

Finding an inverse by row reduction

Definition Let AA be n×nn \times n. Row reduce the n×2nn \times 2n matrix [A∣In][A \mid I_n]. If the left block becomes InI_n, the right block is A−1A^{-1},

[A∣In]⟶[In∣A−1].[A \mid I_n] \longrightarrow [I_n \mid A^{-1}].

If instead a row of zeros appears in the left block, then AA is singular and has no inverse.

In plain words Whatever row operations turn AA into the identity, apply them to the identity at the same time. What the identity turns into is the inverse.

Example Take the matrix with rows (1,1,0)(1, 1, 0), (0,1,1)(0, 1, 1) and (0,0,1)(0, 0, 1). Replace R2R_2 by R2−R3R_2 - R_3, then R1R_1 by R1−R2R_1 - R_2,

[110100011010001001]→[1001−1101001−1001001].\begin{aligned} &\left[\begin{array}{ccc|ccc} 1 & 1 & 0 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 \end{array}\right] \\[0.8em] \to {} &\left[\begin{array}{ccc|ccc} 1 & 0 & 0 & 1 & -1 & 1 \\ 0 & 1 & 0 & 0 & 1 & -1 \\ 0 & 0 & 1 & 0 & 0 & 1 \end{array}\right]. \end{aligned}

The left block is now I3I_3, so the inverse is the matrix with rows (1,−1,1)(1, -1, 1), (0,1,−1)(0, 1, -1) and (0,0,1)(0, 0, 1).

Matrix equation

Definition A system of mm linear equations in nn variables can be written as the single matrix equation

Ax=b,A\mathbf{x} = \mathbf{b},

where AA is the m×nm \times n coefficient matrix, x\mathbf{x} is the n×1n \times 1 column of variables and b\mathbf{b} is the m×1m \times 1 column of constants. The row-column product AxA\mathbf{x} rebuilds the left sides of the equations, one row at a time.

In plain words The coefficients go into one matrix, the unknowns into one column and the right sides into another. The whole system becomes one equation that looks like ax=bax = b.

Example The system 3x+5y=43x + 5y = 4 and x+2y=1x + 2y = 1 becomes

[3512][xy]=[41].\begin{bmatrix} 3 & 5 \\ 1 & 2 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 4 \\ 1 \end{bmatrix}.

The first row times the column gives 3x+5y3x + 5y, the left side of the first equation.

Solving a system with the inverse

Definition If AA is an invertible n×nn \times n matrix, then for every b\mathbf{b} in Rn\mathbb{R}^n the equation Ax=bA\mathbf{x} = \mathbf{b} has exactly one solution,

x=A−1b.\mathbf{x} = A^{-1}\mathbf{b}.

Multiplying both sides on the left by A−1A^{-1} shows that any solution must equal A−1bA^{-1}\mathbf{b}, and A(A−1b)=bA(A^{-1}\mathbf{b}) = \mathbf{b} shows that it is one. The inverse goes on the left, because bA−1\mathbf{b}A^{-1} is not even defined for a column b\mathbf{b} when n≥2n \ge 2.

In plain words Undo AA on both sides and the unknowns are left alone. This pays off most when you solve many systems with the same coefficients and different right sides.

Example For the system above, the 2×22 \times 2 formula with determinant 3⋅2−5⋅1=13 \cdot 2 - 5 \cdot 1 = 1 gives

[xy]=[2−5−13][41]=[8−5−4+3]=[3−1].\begin{aligned} \begin{bmatrix} x \\ y \end{bmatrix} &= \begin{bmatrix} 2 & -5 \\ -1 & 3 \end{bmatrix} \begin{bmatrix} 4 \\ 1 \end{bmatrix} \\[0.8em] &= \begin{bmatrix} 8 - 5 \\ -4 + 3 \end{bmatrix} \\[0.8em] &= \begin{bmatrix} 3 \\ -1 \end{bmatrix}. \end{aligned}

Check it, 3⋅3+5⋅(−1)=43 \cdot 3 + 5 \cdot (-1) = 4 and 3+2⋅(−1)=13 + 2 \cdot (-1) = 1. If the right sides change to 77 and 33, the same inverse gives x=14−15=−1x = 14 - 15 = -1 and y=−7+9=2y = -7 + 9 = 2 at once.

Inverse versus entrywise reciprocal

Definition The inverse of an n×nn \times n matrix AA is defined by the products AA−1=A−1A=InAA^{-1} = A^{-1}A = I_n, not entry by entry. In general A−1A^{-1} is not the matrix of reciprocals 1/aij1/a_{ij}, and a matrix with zero entries can still be invertible. Reciprocals do work for a diagonal matrix with nonzero diagonal entries d1,…,dnd_1, \ldots, d_n. Its inverse is the diagonal matrix with diagonal entries 1/d1,…,1/dn1/d_1, \ldots, 1/d_n, and its zeros off the diagonal stay zeros. There is also no division of matrices. Write A−1BA^{-1}B or BA−1BA^{-1}, which are usually different.

In plain words Flipping each entry upside down does not undo a matrix. You have to compute the inverse.

Example For the matrix with rows (2,1)(2, 1) and (1,1)(1, 1), the matrix of reciprocals fails,

[2111][1/2111]=[233/22]≠I2.\begin{aligned} \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 1/2 & 1 \\ 1 & 1 \end{bmatrix} &= \begin{bmatrix} 2 & 3 \\ 3/2 & 2 \end{bmatrix} \\[0.8em] &\ne I_2. \end{aligned}

The true inverse, found earlier, has rows (1,−1)(1, -1) and (−1,2)(-1, 2). In the other direction, the matrix with rows (0,1)(0, 1) and (1,0)(1, 0) has no reciprocal matrix at all, since 1/01/0 is undefined, yet it is its own inverse, because swapping the coordinates twice changes nothing.

Check yourself

  1. Find the inverse of the matrix AA with rows (4,7)(4, 7) and (1,2)(1, 2), and check it.
Show the answer

The determinant is 4⋅2−7⋅1=14 \cdot 2 - 7 \cdot 1 = 1, so the formula gives

A−1=[2−7−14].A^{-1} = \begin{bmatrix} 2 & -7 \\ -1 & 4 \end{bmatrix}.

The product AA−1AA^{-1} has rows (8−7,−28+28)=(1,0)(8 - 7, -28 + 28) = (1, 0) and (2−2,−7+8)=(0,1)(2 - 2, -7 + 8) = (0, 1), which is I2I_2.

  1. Solve 2x+y=72x + y = 7 and 5x+3y=185x + 3y = 18 with an inverse matrix.
Show the answer

The coefficient matrix has determinant 2⋅3−1⋅5=12 \cdot 3 - 1 \cdot 5 = 1, so

[xy]=[3−1−52][718]=[31].\begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 3 & -1 \\ -5 & 2 \end{bmatrix} \begin{bmatrix} 7 \\ 18 \end{bmatrix} = \begin{bmatrix} 3 \\ 1 \end{bmatrix}.

So x=3x = 3 and y=1y = 1, and indeed 6+1=76 + 1 = 7 and 15+3=1815 + 3 = 18.

  1. Does the matrix with rows (6,3)(6, 3) and (4,2)(4, 2) have an inverse?
Show the answer

No. Its determinant is 6⋅2−3⋅4=06 \cdot 2 - 3 \cdot 4 = 0, so it is singular. Its second column is half of its first, so it flattens the plane onto a line and cannot be undone.

How this lesson connects