Matrix Inverse
calculator.
Get the inverse of a square matrix, worked by Gauss-Jordan elimination or the adjugate.
- det(A)
- −2
- det(A⁻¹)
- −12
- Largest entry of A⁻¹
- 7
- Pivots found
- 3 of 3
A⁻¹ undoes A: multiplying either way gives the identity. Its determinant is 1 over det(A), here −1/2.
From [A | I] to [I | A⁻¹]
The identity starts on the right, with its 1s marked. 5 row operations later it sits on the left, and the right block, shaded where it is not 0, is A⁻¹. Each operation is done to both blocks at once.
Working
- 1Write the augmented matrix [A | I]Row operations that turn A into I turn I into A⁻¹.
- 2Swap rows 1 and 2Column 1 has a zero in row 1, so swap in row 2 to get a nonzero pivot.
- 3R3 → R3 − 4 × R1Clear every other entry in pivot column 1.
- 4R3 → R3 + 3 × R2Clear every other entry in pivot column 2.
- 5R3 → R3 ÷ 2Scale row 3 so the pivot in column 3 becomes 1.
- 6R1 → R1 − 3 × R3, R2 → R2 − 2 × R3Clear every other entry in pivot column 3.
- 7Read off the inverseThe left block is now I, so the right block is A⁻¹.
- 8Check: multiply both ways and get the identityA × A⁻¹ =A⁻¹ × A =
Type or paste a matrix
How it's worked out
The inverse of a square matrix A is the matrix that undoes it. Interactive Linear Algebra asks for both orders to give the identity I, the matrix with 1s down the diagonal and 0s elsewhere.
Gauss-Jordan elimination writes A and I side by side as [A | I]. Then it uses row operations to turn the left block into I: swap two rows, scale a row, or add a multiple of one row to another. Every operation is done to the whole row, so the right block changes too. When the left block reaches I, the right block is the inverse.
If some column has no pivot, which is a nonzero entry to scale to 1, the left block can never become I and A has no inverse.
The adjugate method builds a cofactor for every entry. That is the determinant left after crossing out the entry's row and column, with a checkerboard sign. Turn rows of that cofactor matrix into columns and you have the adjugate. Divide it by det(A). Section 4.2 of the same book gives this formula and calls it a very inefficient way to compute an inverse next to row reduction.
For a 2 by 2 matrix this is the short rule: swap the two diagonal entries, change the sign of the other two, and divide by ad − bc.
Worked examples
Sam uses the 2 by 2 shortcut
Sam works out ad − bc as 6 − 4 = 2. Swapping 3 and 2 and changing the signs of 4 and 1 gives the adjugate. Dividing by 2 gives the inverse.
The halves come from dividing by 2. When the determinant is 1 or −1, a whole-number matrix has a whole-number inverse.
Lena inverts a 3 by 3 that starts with a zero
The top left entry is 0, so it cannot be a pivot. Lena swaps rows 1 and 2 first. After 5 row operations in all, the left block is I.
The determinant is −2, which is where the halves come from. She then needs x in Ax = b for b = (1, 2, 3). Multiplying the inverse by b gives x = (5, 3, −1), and the inverse is ready for any other b too.
A matrix that is nearly singular
The two rows are almost the same, and det(A) is only 0.0001. The inverse exists, but its largest entry is 10001.
Change 1.0001 to 1.0002 and the top left entry of the inverse drops to 5001. A tiny change in A moved A⁻¹ by thousands, so a measured matrix like this one gives an inverse you should not trust.
Reading your result
No inverse is an answer too. In the matrix with rows 1, 2, 3 and 2, 4, 6 and 1, 0, 1, row 2 is twice row 1. Elimination finds only 2 pivots for 3 columns, so A is singular and det(A) = 0.
det(A⁻¹) is 1 over det(A). A matrix that stretches areas by 10 has an inverse that shrinks them by the same factor, so its determinant is 1/10.
Watch the size of the entries. Large entries in A⁻¹ next to small ones in A mean the matrix is close to singular. Rounding in your inputs then shows up, many times larger, in the inverse.
One answer for Ax = b. If A is invertible, Ax = b has exactly one solution, x = A⁻¹b. That holds for every b.
Common mistakes
- Doing a row operation to one block only. The left and right blocks are one long row. Scale or add the whole row, or the right block is not the inverse.
- Forgetting to transpose the cofactors. The adjugate is the cofactor matrix with rows turned into columns. For the matrix with rows 1, 2 and 3, 4 the inverse has 1 in the top right, not the cofactor in that spot.
- Multiplying in the wrong order. The inverse of AB is B⁻¹A⁻¹, with the order reversed. Matrix products do not commute, so A⁻¹B⁻¹ is usually a different matrix.
- Swapping rows of A and keeping the old inverse. Swapping the rows of A swaps the columns of the inverse. With the rows of Sam's matrix swapped, the inverse starts −2, 1.