Exercise: the 2×2 inverse

Goal

  • Compute the inverse of a \(2\times2\) matrix by row reduction on the augmented matrix \([\,A \mid I\,]\).
  • Check your answer by confirming \(A A^{-1} = I\).
  • Solve a small system \(A\mathbf{x} = \mathbf{b}\) using \(\mathbf{x} = A^{-1}\mathbf{b}\).
  • Recognise a singular matrix that has no inverse: row reduction gives a row of zeros on the left.

The method

The identity matrix \(I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\) is the “1” of matrices: \(A A^{-1} = I\) for any invertible \(A\).

To find \(A^{-1}\), write \(A\) and \(I\) side by side in one augmented matrix \([\,A \mid I\,]\), the same shorthand as \([\,A \mid \mathbf{b}\,]\) in Linear systems by hand, now with two columns on the right. Then use row operations until the left half is \(I\). The right half is then \(A^{-1}\):

\[ [\,A \mid I\,] \;\longrightarrow\; [\,I \mid A^{-1}\,]. \]

The allowed row operations are the ones you already know:

  1. Add a multiple of one row to another row (e.g. R2 \(-\) 2R1).
  2. Multiply a row by a nonzero number (e.g. \(\tfrac12\)R1).
  3. Swap two rows (R1 \(\leftrightarrow\) R2).

A good order for a \(2\times2\): make a zero below the diagonal, then make the diagonal entries \(1\), then make a zero above the diagonal.

Every operation is done to the whole row, both halves. Why it works: each row operation is the same as multiplying from the left by some matrix. When the left half has turned from \(A\) into \(I\), the product of all those matrices is \(A^{-1}\), and the right half, which started as \(I\), has been multiplied by exactly that product.

Worked example. \(A = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix}\).

\[ \left[\begin{array}{cc|cc} 2 & 1 & 1 & 0 \\ 1 & 1 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R2}\,-\,\frac12\text{R1}\;} \left[\begin{array}{cc|cc} 2 & 1 & 1 & 0 \\ 0 & \tfrac12 & -\tfrac12 & 1 \end{array}\right] \xrightarrow{\;2\,\text{R2}\;} \left[\begin{array}{cc|cc} 2 & 1 & 1 & 0 \\ 0 & 1 & -1 & 2 \end{array}\right] \]

\[ \xrightarrow{\;\text{R1}\,-\,\text{R2}\;} \left[\begin{array}{cc|cc} 2 & 0 & 2 & -2 \\ 0 & 1 & -1 & 2 \end{array}\right] \xrightarrow{\;\frac12\text{R1}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & -1 \\ 0 & 1 & -1 & 2 \end{array}\right] \]

The left half is \(I\), so \(A^{-1} = \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix}\).

Check: \(A A^{-1} = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I.\) Correct.

No inverse (singular). If the columns of \(A\) are parallel (one row is a multiple of the other), row reduction produces a row of zeros on the left. A zero row can never become a row of \(I\), so there is no inverse. For example, \(\left[\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 2 & 4 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R2}\,-\,2\text{R1}\;} \left[\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 0 & 0 & -2 & 1 \end{array}\right]\): stop here.

Shortcut: the 2×2 formula

For a \(2\times2\) there is also a formula, using the determinant \(ad - bc\): \[ A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}, \qquad A^{-1} = \frac{1}{ad - bc}\begin{bmatrix} d & -b \\ -c & a \end{bmatrix}. \] Swap \(a\) and \(d\), negate \(b\) and \(c\), divide every entry by \(ad - bc\). If \(ad - bc = 0\) the matrix is singular. For the worked example, \(ad - bc = 2 - 1 = 1\), giving the same inverse.

Step through it

The worked example in the demo below, one row operation at a time: the pivot is circled, the changed row is yellow and the new 0 or 1 is boxed in green. Type in any problem below (or a \(3\times3\)) to check your own steps after doing them on paper. no inverse gives a singular matrix.

Problems

Find the inverse by row-reducing \([\,A \mid I\,]\) (all come out with simple numbers).

  1. \(A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)
  2. \(A = \begin{bmatrix} 1 & 0 \\ 0 & 2 \end{bmatrix}\)
  3. \(A = \begin{bmatrix} 2 & 0 \\ 0 & 5 \end{bmatrix}\)
  4. \(A = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix}\)
  5. \(A = \begin{bmatrix} 3 & 1 \\ 2 & 1 \end{bmatrix}\)
  6. \(A = \begin{bmatrix} 2 & 1 \\ 3 & 2 \end{bmatrix}\)
  7. \(A = \begin{bmatrix} 4 & 3 \\ 1 & 1 \end{bmatrix}\)
  8. \(A = \begin{bmatrix} 3 & 2 \\ 2 & 2 \end{bmatrix}\)

Recognise the singular matrix (no inverse).

  1. \(A = \begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}\) — does an inverse exist?
  2. \(A = \begin{bmatrix} 3 & 6 \\ 1 & 2 \end{bmatrix}\) — does an inverse exist?

Verify \(A A^{-1} = I\).

  1. For problem 5, multiply \(A A^{-1}\) and confirm you get \(I\).
  2. For problem 6, multiply \(A A^{-1}\) and confirm you get \(I\).

Solve \(A\mathbf{x} = \mathbf{b}\), with \(\mathbf{x} = (x, y)\), using \(\mathbf{x} = A^{-1}\mathbf{b}\).

  1. \(A = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix}\), \(\mathbf{b} = \begin{bmatrix} 3 \\ 2 \end{bmatrix}\).
  2. \(A = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix}\), \(\mathbf{b} = \begin{bmatrix} 5 \\ 2 \end{bmatrix}\).
  3. \(A = \begin{bmatrix} 3 & 1 \\ 2 & 1 \end{bmatrix}\), \(\mathbf{b} = \begin{bmatrix} 4 \\ 3 \end{bmatrix}\).

Hints

Start from \([\,A \mid I\,]\). (1) Make the entry below the diagonal zero (R2 minus a multiple of R1; swap rows first if the top-left entry is \(0\) or awkward). (2) Divide each row by its diagonal entry, so the diagonal is \(1\). (3) Make the entry above the diagonal zero (R1 minus a multiple of R2). Always apply each operation to all four entries of the row.

For \(\begin{bmatrix} a & 0 \\ 0 & d \end{bmatrix}\) only step (2) is needed: multiply R1 by \(1/a\) and R2 by \(1/d\). The inverse is \(\begin{bmatrix} 1/a & 0 \\ 0 & 1/d \end{bmatrix}\); the off-diagonal zeros stay zero.

If one row of \(A\) is a multiple of the other (equivalently, the columns are parallel), subtracting that multiple gives a row of zeros on the left. A zero row cannot be turned into a row of \(I\): stop, there is no inverse.

Row \(i\) times column \(j\): multiply matching entries and add. The diagonal products should give \(1\) and the off-diagonal should give \(0\).

\(\mathbf{x} = A^{-1}\mathbf{b}\) is a matrix-times-vector product. Top entry of \(\mathbf{x}\) = (first row of \(A^{-1}\)) \(\cdot \mathbf{b}\); bottom entry = (second row) \(\cdot \mathbf{b}\).

Step-by-step solutions

Problem 1. \([\,I \mid I\,]\) is already finished: the left half is \(I\), so \(A^{-1} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}.\) The identity is its own inverse.

Problem 2. \[ \left[\begin{array}{cc|cc} 1 & 0 & 1 & 0 \\ 0 & 2 & 0 & 1 \end{array}\right] \xrightarrow{\;\frac12\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & \tfrac12 \end{array}\right], \qquad A^{-1} = \begin{bmatrix} 1 & 0 \\ 0 & \tfrac{1}{2} \end{bmatrix}. \]

Problem 3. \[ \left[\begin{array}{cc|cc} 2 & 0 & 1 & 0 \\ 0 & 5 & 0 & 1 \end{array}\right] \xrightarrow{\;\frac12\text{R1},\ \frac15\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 0 & \tfrac12 & 0 \\ 0 & 1 & 0 & \tfrac15 \end{array}\right], \qquad A^{-1} = \begin{bmatrix} \tfrac{1}{2} & 0 \\ 0 & \tfrac{1}{5} \end{bmatrix}. \]

Problem 4. Already zero below the diagonal and \(1\)s on it; only the entry above remains. \[ \left[\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 0 & 1 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R1}\,-\,2\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & -2 \\ 0 & 1 & 0 & 1 \end{array}\right], \qquad A^{-1} = \begin{bmatrix} 1 & -2 \\ 0 & 1 \end{bmatrix}. \]

Problem 5. A shortcut first: R1 \(-\) R2 gives a \(1\) in the top-left corner. \[ \left[\begin{array}{cc|cc} 3 & 1 & 1 & 0 \\ 2 & 1 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R1}\,-\,\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & -1 \\ 2 & 1 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R2}\,-\,2\text{R1}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & -1 \\ 0 & 1 & -2 & 3 \end{array}\right], \] so \(A^{-1} = \begin{bmatrix} 1 & -1 \\ -2 & 3 \end{bmatrix}.\)

Problem 6. \[ \left[\begin{array}{cc|cc} 2 & 1 & 1 & 0 \\ 3 & 2 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R2}\,-\,\text{R1}\;} \left[\begin{array}{cc|cc} 2 & 1 & 1 & 0 \\ 1 & 1 & -1 & 1 \end{array}\right] \xrightarrow{\;\text{R1}\,-\,\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 0 & 2 & -1 \\ 1 & 1 & -1 & 1 \end{array}\right] \xrightarrow{\;\text{R2}\,-\,\text{R1}\;} \left[\begin{array}{cc|cc} 1 & 0 & 2 & -1 \\ 0 & 1 & -3 & 2 \end{array}\right], \] so \(A^{-1} = \begin{bmatrix} 2 & -1 \\ -3 & 2 \end{bmatrix}.\)

Problem 7. Swap the rows first, so the top-left entry is \(1\). \[ \left[\begin{array}{cc|cc} 4 & 3 & 1 & 0 \\ 1 & 1 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R1}\,\leftrightarrow\,\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 1 & 0 & 1 \\ 4 & 3 & 1 & 0 \end{array}\right] \xrightarrow{\;\text{R2}\,-\,4\text{R1}\;} \left[\begin{array}{cc|cc} 1 & 1 & 0 & 1 \\ 0 & -1 & 1 & -4 \end{array}\right] \] \[ \xrightarrow{\;-\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 1 & 0 & 1 \\ 0 & 1 & -1 & 4 \end{array}\right] \xrightarrow{\;\text{R1}\,-\,\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & -3 \\ 0 & 1 & -1 & 4 \end{array}\right], \] so \(A^{-1} = \begin{bmatrix} 1 & -3 \\ -1 & 4 \end{bmatrix}.\)

Problem 8. \[ \left[\begin{array}{cc|cc} 3 & 2 & 1 & 0 \\ 2 & 2 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R1}\,-\,\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & -1 \\ 2 & 2 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R2}\,-\,2\text{R1}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & -1 \\ 0 & 2 & -2 & 3 \end{array}\right] \xrightarrow{\;\frac12\text{R2}\;} \left[\begin{array}{cc|cc} 1 & 0 & 1 & -1 \\ 0 & 1 & -1 & \tfrac32 \end{array}\right], \] so \(A^{-1} = \begin{bmatrix} 1 & -1 \\ -1 & \tfrac{3}{2} \end{bmatrix}.\)

Problem 9. \[ \left[\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 2 & 4 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R2}\,-\,2\text{R1}\;} \left[\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 0 & 0 & -2 & 1 \end{array}\right]. \] The left half has a row of zeros, which can never become \((0\ 1)\). No inverse: the matrix is singular (the second row is \(2\times\) the first; the columns \((1,2)\) and \((2,4)\) are parallel).

Problem 10. \[ \left[\begin{array}{cc|cc} 3 & 6 & 1 & 0 \\ 1 & 2 & 0 & 1 \end{array}\right] \xrightarrow{\;\text{R1}\,-\,3\text{R2}\;} \left[\begin{array}{cc|cc} 0 & 0 & 1 & -3 \\ 1 & 2 & 0 & 1 \end{array}\right]. \] A zero row on the left again: no inverse (the first row is \(3\times\) the second).

Problem 11. Using \(A = \begin{bmatrix} 3 & 1 \\ 2 & 1 \end{bmatrix}\) and \(A^{-1} = \begin{bmatrix} 1 & -1 \\ -2 & 3 \end{bmatrix}\): \[ A A^{-1} = \begin{bmatrix} (3)(1)+(1)(-2) & (3)(-1)+(1)(3) \\ (2)(1)+(1)(-2) & (2)(-1)+(1)(3) \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I. \checkmark \]

Problem 12. Using \(A = \begin{bmatrix} 2 & 1 \\ 3 & 2 \end{bmatrix}\) and \(A^{-1} = \begin{bmatrix} 2 & -1 \\ -3 & 2 \end{bmatrix}\): \[ A A^{-1} = \begin{bmatrix} (2)(2)+(1)(-3) & (2)(-1)+(1)(2) \\ (3)(2)+(2)(-3) & (3)(-1)+(2)(2) \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I. \checkmark \]

Problem 13. This \(A\) is the worked example, so \(A^{-1} = \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix}\). Then \[ \mathbf{x} = A^{-1}\mathbf{b} = \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix} \begin{bmatrix} 3 \\ 2 \end{bmatrix} = \begin{bmatrix} (1)(3)+(-1)(2) \\ (-1)(3)+(2)(2) \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \end{bmatrix}. \] So \(x = 1,\ y = 1\).

Problem 14. This \(A\) is problem 4, so \(A^{-1} = \begin{bmatrix} 1 & -2 \\ 0 & 1 \end{bmatrix}\). Then \[ \mathbf{x} = \begin{bmatrix} 1 & -2 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 5 \\ 2 \end{bmatrix} = \begin{bmatrix} (1)(5)+(-2)(2) \\ (0)(5)+(1)(2) \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}. \] So \(x = 1,\ y = 2\).

Problem 15. This \(A\) is problem 5, so \(A^{-1} = \begin{bmatrix} 1 & -1 \\ -2 & 3 \end{bmatrix}\). Then \[ \mathbf{x} = \begin{bmatrix} 1 & -1 \\ -2 & 3 \end{bmatrix} \begin{bmatrix} 4 \\ 3 \end{bmatrix} = \begin{bmatrix} (1)(4)+(-1)(3) \\ (-2)(4)+(3)(3) \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \end{bmatrix}. \] So \(x = 1,\ y = 1\). (You could also row-reduce \([\,A \mid \mathbf{b}\,]\) directly, as in Linear systems by hand; the answer is the same.)