The Inverse of a 2 × 2 Matrix

Swap the diagonal, flip two signs, divide.

The matrix that undoes A

The inverse of a square matrix A is the matrix that undoes it. It is written A⁻¹, and multiplying the two together in either order gives the identity: A A⁻¹ = I and A⁻¹ A = I. It plays the part that 1/5 plays for 5, since 5 × 1/5 = 1.

The determinant decides whether there is one. A 2 × 2 matrix whose determinant ad − bc is 0 has no inverse, because it sends different points to the same place and nothing can send them back apart. Every other 2 × 2 matrix has exactly one inverse, and three moves find it.

Three moves

Start from A = (a b; c d). First, swap the two entries on the main diagonal, so that a and d change places. Second, change the signs of the other two entries, b and c, and leave them where they are. That gives the matrix (d −b; −c a).

Last, divide every entry of (d −b; −c a) by the determinant of A, which is ad − bc. The result is the inverse.

Aabcdd−b−ca→

The main diagonal of A, a and d, swaps places, and the other two entries keep their places with their signs changed. Dividing this matrix by ad − bc gives the inverse.

Why the three moves work

The determinant lesson multiplied A by (d −b; −c a). The top left entry is a × d + b × (−c) = ad − bc, the top right is a × (−b) + b × a = 0, the bottom left is c × d + d × (−c) = 0, and the bottom right is c × (−b) + d × a = ad − bc. So the product is (ad − bc)I, the identity with every 1 replaced by ad − bc.

Dividing every entry of (d −b; −c a) by ad − bc divides that product by ad − bc as well, which leaves I. Multiplying in the other order, (d −b; −c a) times A, gives (ad − bc)I too, so the same matrix undoes A from either side. And the division is only possible when ad − bc is not 0, which is why a matrix with determinant 0 has no inverse.

An inverse found and checked

Take A = (3 5; 1 2). Its determinant is 3 × 2 − 5 × 1 = 6 − 5 = 1. Swapping the 3 and the 2 gives (2 5; 1 3), and changing the signs of the 5 and the 1 gives (2 −5; −1 3). Dividing by 1 changes nothing, so the inverse of A is the matrix (2 −5; −1 3).

Check it by multiplying back, row by column. Row 1 of A with column 1 of the inverse gives 3 × 2 + 5 × (−1) = 6 − 5 = 1. Row 1 with column 2 gives 3 × (−5) + 5 × 3 = −15 + 15 = 0. Row 2 with column 1 gives 1 × 2 + 2 × (−1) = 0, and row 2 with column 2 gives 1 × (−5) + 2 × 3 = 1. The product is (1 0; 0 1), which is I.

A3512A⁻¹2−5−13I1001×=

Row 1 of A meets column 2 of the inverse: 3 × (−5) + 5 × 3 = 0, the top right entry of I.

When the determinant is not 1

Take B = (4 2; 5 3). Its determinant is 4 × 3 − 2 × 5 = 12 − 10 = 2. Swapping and changing signs gives (3 −2; −5 4), and now the division matters: every entry is divided by 2. The inverse of B has top row 3/2 and −1, and bottom row −5/2 and 2.

Check the top row of the product: 4 × 3/2 + 2 × (−5/2) = 6 − 5 = 1, and 4 × (−1) + 2 × 2 = −4 + 4 = 0. The bottom row gives 5 × 3/2 + 3 × (−5/2) = 0 and 5 × (−1) + 3 × 2 = 1, so B times its inverse is I.

It is often tidier to leave the division outside, writing the inverse as one half times (3 −2; −5 4). The two forms are the same matrix.

½3−2−54B⁻¹3/2−1−5/22×=

Dividing by the determinant 2 is multiplying every entry by one half, so the 3 in the top left becomes 3/2.

A negative determinant

For C = (2 3; 1 1), the determinant is 2 × 1 − 3 × 1 = −1. Swapping and changing signs gives (1 −3; −1 2), and dividing by −1 changes the sign of every entry, so the inverse of C is the matrix (−1 3; 1 −2). Check the top left entry of the product: 2 × (−1) + 3 × 1 = 1.

Sending a point back

A matrix moves points, and its inverse moves them back. A = (3 5; 1 2) sends the column (1; 1) to (8; 3), since 3 × 1 + 5 × 1 = 8 and 1 × 1 + 2 × 1 = 3. The inverse sends (8; 3) back to (1; 1), the point it started from, since 2 × 8 + (−5) × 3 = 16 − 15 = 1 and (−1) × 8 + 3 × 3 = −8 + 9 = 1.

That is A⁻¹ A = I at work: doing A and then its inverse leaves every point where it was.

A⁻¹2−5−138311=

The inverse takes (8; 3), where A sent (1; 1), back to (1; 1). The top entry is 2 × 8 + (−5) × 3 = 1.

The usual mistakes

Changing the signs without swapping the diagonal. For (3 5; 1 2) that gives (3 −5; −1 2), and the top left entry of the product is 3 × 3 + 5 × (−1) = 4, not 1.

Swapping the diagonal without changing the signs. (2 5; 1 3) times A has top left entry 2 × 3 + 5 × 1 = 11, so it is not the inverse either.

Changing the signs on the main diagonal instead of the other one. The entries that swap keep their signs; only b and c change sign.

Forgetting to divide. For B = (4 2; 5 3), the matrix (3 −2; −5 4) multiplies B to 2I, not I: its top left entry should be 3/2, not 3.

Looking for an inverse when the determinant is 0. The division by ad − bc cannot be done, and no matrix undoes A.

A message in code

In the application below, two friends code each pair of letters by multiplying it by a matrix E with determinant 1. The inverse of E, found by the three moves and checked against I, turns the numbers that arrive back into the letters that were sent.

Worked example: A Secret Message Sent in Pairs of Numbers and Decoded with the Inverse Matrix

Question Two friends send messages in code. Each letter is replaced by its place in the alphabet, A = 1, B = 2 and so on up to Z = 26. The numbers are taken in pairs, each pair is written as a column, and the column is multiplied by E = 3152 before it is sent. (a) Find det E and the inverse E−1, and check that EE−1 = I. (b) A message arrives as the numbers 36, 65, 15, 29. Decode it.

  1. 1.The determinant of E is ad − bc = 3 × 2 − 1 × 5 = 6 − 5 = 1. It is not 0, so E has an inverse and every coded pair can be decoded.

    received3665× E−1decoded??letters??1529× E−1????E =3152det E = 3 × 2 − 1 × 5 = 6 − 5 = 1
    received3665× E−1decoded??letters??1529× E−1????E =3152det E = 3 × 2 − 1 × 5 = 6 − 5 = 1
    The code matrix is E = 3152, and det E = 3 × 2 − 1 × 5 = 1, which is not 0.
  2. 2.Swap the 3 and the 2, change the signs of the 1 and the 5, and divide by the determinant: E−1 = 112−1−53 = 2−1−53.

    received3665× E−1decoded??letters??1529× E−1????E−1=2−1−53swap 3 and 2, change the signs of 1 and 5then divide by det E, which is 1
    received3665× E−1decoded??letters??1529× E−1????E−1=2−1−53swap 3 and 2, change the signs of 1 and 5then divide by det E, which is 1
    Swap the diagonal entries, change the signs of the other two and divide by 1: E−1 = 2−1−53.
  3. 3.(a) Check: EE−1 = 3 × 2 + 1 × (−5)3 × (−1) + 1 × 35 × 2 + 2 × (−5)5 × (−1) + 2 × 3 = 1001 = I.

    received3665× E−1decoded??letters??1529× E−1????3152×2−1−53=10013 × 2 + 1 × (−5) = 1, 3 × (−1) + 1 × 3 = 0
    received3665× E−1decoded??letters??1529× E−1????3152×2−1−53=10013 × 2 + 1 × (−5) = 1, 3 × (−1) + 1 × 3 = 0
    (a) EE−1 = 1001 = I, so E−1 undoes the code.
  4. 4.Multiply the first coded pair by the inverse: E−13665 = 2 × 36 − 1 × 65−5 × 36 + 3 × 65 = 715, which is the letters G and O.

    received3665× E−1decoded715lettersGO1529× E−1????2−1−53×3665=7152 × 36 − 65 = 7, −5 × 36 + 3 × 65 = 15
    received3665× E−1decoded715lettersGO1529× E−1????2−1−53×3665=7152 × 36 − 65 = 7, −5 × 36 + 3 × 65 = 15
    The first pair received, times E−1: E−13665 = 715, the letters G and O.
  5. 5.Then the second pair: E−11529 = 2 × 15 − 1 × 29−5 × 15 + 3 × 29 = 112, which is A and L.

    received3665× E−1decoded715lettersGO1529× E−1112AL2−1−53×1529=1122 × 15 − 29 = 1, −5 × 15 + 3 × 29 = 12
    received3665× E−1decoded715lettersGO1529× E−1112AL2−1−53×1529=1122 × 15 − 29 = 1, −5 × 15 + 3 × 29 = 12
    The second pair: E−11529 = 112, the letters A and L.
  6. 6.(b) The message is GOAL. Check by coding the first pair again: E715 = 3 × 7 + 155 × 7 + 2 × 15 = 3665, the numbers that were sent.

    received3665× E−1decoded715lettersGO1529× E−1112AL7, 15, 1, 12 spells G, O, A, Lcheck: 3 × 7 + 15 = 36 and 5 × 7 + 2 × 15 = 65
    received3665× E−1decoded715lettersGO1529× E−1112AL7, 15, 1, 12 spells G, O, A, Lcheck: 3 × 7 + 15 = 36 and 5 × 7 + 2 × 15 = 65
    (b) The message is GOAL. Coding G and O again with E gives 36 and 65, the numbers that were sent.

Answer: (a) det E = 1 and E−1 = 2−1−53, and EE−1 = I; (b) the pairs decode to 7, 15, 1, 12, which is GOAL

Common mistakes

  • Multiplying the coded pairs by E again. That codes the message a second time; only E−1 undoes E, because E−1E = I.
  • Swapping the other two entries as well, or changing the signs on the leading diagonal. The inverse swaps a and d and changes the signs of b and c, and the check EE−1 = I catches the slip before any message is decoded.

More determinants and inverses problems, worked step by step →

Practice The Inverse of a 2 × 2 Matrix in the app