A determinant and an inverse are the two matrix calculations most likely to appear on a linear algebra test, and the two where one wrong sign ruins everything that follows. This article works through a 2×2 and a 3×3 example completely by hand, with every intermediate number, and then shows the same calculation as the matrix calculator does it with row operations. All the numbers below were checked against that tool's exact-fraction arithmetic and, independently, by a second method.
The 2×2 case: ad − bc
Take
A = | 4 7 |
| 2 6 |For a 2×2 matrix [[a, b], [c, d]] the determinant is ad − bc: 4 × 6 − 7 × 2 = 24 − 14 = 10.
The inverse has an equally short recipe: swap the two diagonal entries, change the sign of the other two, and divide everything by the determinant.
A⁻¹ = 1/10 · | 6 −7 | = | 3/5 −7/10 |
| −2 4 | | −1/5 2/5 |In decimals that is [[0.6, −0.7], [−0.2, 0.4]]. Always check by multiplying back. The first row of A times the first column of A⁻¹ is 4 × 0.6 + 7 × (−0.2) = 2.4 − 1.4 = 1, and the first row times the second column is 4 × (−0.7) + 7 × 0.4 = −2.8 + 2.8 = 0. The other row gives 0 and 1 in the same way, so A·A⁻¹ = I.
If ad − bc is 0, there is nothing to divide by: the matrix is singular and has no inverse. [[1, 2], [2, 4]] is the classic example, because its second row is twice the first.
A 3×3 determinant by cofactors
Now a 3×3:
A = | 2 −3 1 |
| 2 0 −1 |
| 1 4 5 |Expanding along the first row, each entry is multiplied by the determinant of the 2×2 that remains when its row and column are crossed out, with the signs alternating + − +:
- 2 × det[[0, −1], [4, 5]] = 2 × (0·5 − (−1)·4) = 2 × 4 = 8
- −(−3) × det[[2, −1], [1, 5]] = 3 × (2·5 − (−1)·1) = 3 × 11 = 33
- 1 × det[[2, 0], [1, 4]] = 1 × (8 − 0) = 8
det(A) = 8 + 33 + 8 = 49.
The middle term is where most mistakes happen: the entry is −3 and its position carries a minus sign, so the two minuses make a plus.
The same determinant by row reduction
Cofactor expansion grows quickly (a full expansion of a 6×6 has 720 terms), so calculators and careful students use elimination instead. Only two kinds of move are allowed if you want the determinant to stay easy to track:
- adding a multiple of one row to another, which does not change the determinant;
- swapping two rows, which flips its sign.
For our A:
- R2 ← R2 − R1 gives row 2 = [0, 3, −2].
- R3 ← R3 − (1/2)R1 gives row 3 = [0, 11/2, 9/2].
- R3 ← R3 − (11/6)R2 gives row 3 = [0, 0, 49/6].
The matrix is now triangular with diagonal 2, 3 and 49/6. No rows were swapped, so det(A) = 2 × 3 × 49/6 = 49, the same as before. These are exactly the three steps the matrix calculator lists for this example.
When a pivot is 0 you must swap. For [[0, 2, 1], [1, 1, 1], [2, 1, 3]] the first entry is 0, so swap rows 1 and 2 first. One swap means the product of the diagonal has to be multiplied by −1; the determinant is −3, which you can confirm by cofactors: 0·(3 − 1) − 2·(3 − 2) + 1·(1 − 2) = −2 − 1 = −3.
A 3×3 inverse with Gauss–Jordan
Write A next to the identity matrix and reduce until the left half is I. Each step is applied to the whole row of six numbers:
- R1 ← (1/2)R1: [1, −3/2, 1/2 | 1/2, 0, 0]
- R2 ← R2 − 2R1: [0, 3, −2 | −1, 1, 0]
- R3 ← R3 − R1: [0, 11/2, 9/2 | −1/2, 0, 1]
- R2 ← (1/3)R2: [0, 1, −2/3 | −1/3, 1/3, 0]
- R1 ← R1 + (3/2)R2: [1, 0, −1/2 | 0, 1/2, 0]
- R3 ← R3 − (11/2)R2: [0, 0, 49/6 | 4/3, −11/6, 1]
- R3 ← (6/49)R3: [0, 0, 1 | 8/49, −11/49, 6/49]
- R1 ← R1 + (1/2)R3: [1, 0, 0 | 4/49, 19/49, 3/49]
- R2 ← R2 + (2/3)R3: [0, 1, 0 | −11/49, 9/49, 4/49]
So
A⁻¹ = 1/49 · | 4 19 3 |
| −11 9 4 |
| 8 −11 6 |The independent check is the adjugate formula: A⁻¹ is the transposed matrix of cofactors divided by det(A). The cofactors of the first row are 4, −11 and 8 (the numbers from the expansion above, with their signs), and they appear as the first column of the inverse, divided by 49. That transposition is easy to forget.
Notice that every entry has 49 in the denominator. That is no accident: the inverse is the adjugate divided by the determinant, so when the entries of A are whole numbers, the denominators of A⁻¹ divide det(A). It is a quick plausibility check for an answer on paper.
Why exact fractions matter
Typed into a calculator with decimals, 1/49 becomes 0.0204081632…, and after nine row operations the rounding errors pile up. For a well-behaved matrix like this one the error stays tiny, but for a nearly singular matrix it can decide whether the determinant reads 0 or 0.0000000001, which is the difference between "no inverse" and "an inverse with huge entries". The 3×3 Hilbert matrix, with entries 1, 1/2, 1/3, …, 1/5, has the whole-number inverse [[9, −36, 30], [−36, 192, −180], [30, −180, 180]]; exact fractions reproduce it digit for digit, while floating-point arithmetic typically returns values that are slightly off in the last digits. The matrix calculator keeps every value as a fraction of two whole numbers and only rounds when you ask it to show decimals.
Common mistakes
- Forgetting the checkerboard of signs. Cofactor signs follow + − + / − + − / + − +, regardless of the sign of the entry itself.
- Not flipping the sign after a row swap. Each swap multiplies the determinant by −1; two swaps cancel out.
- Scaling a row while computing a determinant. Multiplying a row by k multiplies the determinant by k. If you halve row 1 to get a leading 1, you must multiply your final answer by 2 again. Avoid scaling when you only need the determinant.
- Applying a row operation to half the row. In Gauss–Jordan, the operation applies to both sides of the bar.
- Forgetting to transpose the cofactors in the adjugate formula.
- Inverting a non-square or singular matrix. Only square matrices with a non-zero determinant have an inverse; for a 2×3 matrix the question does not make sense.
- Comparing intermediate matrices with a textbook. Different pivot choices give different intermediate rows. The final determinant, inverse and reduced row echelon form are unique, so compare those.
Checking your homework with the tool
Enter your matrix in the matrix calculator, pick Determinant or Inverse, and open Show the steps. Each row operation is written in the same notation as above (R3 ← R3 − (11/6)R2) with the matrix after it, so you can find the exact line where your working diverged. For systems of equations, the same elimination on [A | b] tells you whether there is one solution, none, or infinitely many, and the equation solver handles a single quadratic or cubic with its own step-by-step explanation.