Matrix Calculator: Inverse, Determinant & More, With Steps
Type or paste a matrix and pick an operation. You get the answer in exact fractions, with the row operations or row-times-column sums written out.
- Determinant & inverse
- Transpose & powers
- A × B, A ± B, kA
- A, row 12 3 1
- A, row 23 3 1
- A, row 32 4 1
- det A1
A matrix has an inverse only if it's square and its determinant isn't 0. To find the inverse, write the matrix next to the identity matrix, [A | I], and use row operations until the left side is I; the right side is then A⁻¹. For OpenStax's 3 × 3 example with rows 2 3 1, 3 3 1 and 2 4 1, the determinant is 1 and the inverse has the rows −1 1 0, −1 0 1 and 6 −2 −3.
This matrix calculator finds determinants, inverses, transposes and powers for matrices up to 8 × 8, and also adds, subtracts and multiplies two matrices. It keeps fractions exact, shows decimals as well when an entry isn't a whole number, and writes out every row operation and every row-times-column sum (for a power, the sums for A²).
How to Find the Determinant
A determinant is a single number found from a square matrix. For a 2 × 2 matrix with rows a b and c d, it's ad − bc (OpenStax Algebra and Trigonometry 2e, 11.8). OpenStax's example:
| 5 | 2 |
| −6 | 3 |
det = 5(3) − 2(−6) = 15 + 12 = 27
For a 3 × 3 matrix, OpenStax repeats the first two columns to the right of the matrix. You add the products down the three diagonals, then subtract the products up the three diagonals:
| 0 | 2 | 1 |
| 3 | −1 | 1 |
| 4 | 0 | 1 |
Down: 0(−1)(1) + 2(1)(4) + 1(3)(0) = 0 + 8 + 0 = 8
Up: 4(−1)(1) + 0(1)(0) + 1(3)(2) = −4 + 0 + 6 = 2
det = 8 − 2 = 6
For 4 × 4 and larger, the calculator uses elimination, which is how computers find large determinants (MIT 18.06SC, Properties of determinants). Subtracting a multiple of one row from another doesn't change the determinant, and swapping two rows flips its sign. Once the matrix is triangular, the determinant is the product of the pivots on the diagonal, times −1 for each row swap. A determinant of 0 means the matrix is singular and has no inverse.
Here's one worked by the calculator. Three row operations clear column 1, then two clear column 2 and one clears column 3. No swaps are needed, and the pivots are 1, −4, −6 and 3:
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
| 2 | 6 | 4 | 8 |
| 3 | 1 | 1 | 2 |
det = 1 × (−4) × (−6) × 3 = 72
Checked against cofactor expansion in our test suite.
How to Find the Inverse of a Matrix
The inverse A⁻¹ is the matrix with AA⁻¹ = A⁻¹A = I, the identity matrix. Only square matrices can have one, and not every square matrix does (OpenStax 11.7).
- 2 × 2: for rows a b and c d, A⁻¹ = 1/(ad − bc) × the matrix with rows d −b and −c a. Swap a and d, change the signs of b and c, then divide by the determinant. OpenStax's rows 1 −2 and 2 −3 have ad − bc = −3 + 4 = 1, so the inverse is the matrix with rows −3 2 and −2 1. If ad − bc = 0, there's no inverse: OpenStax's rows 3 6 and 1 2 give 3(2) − 6(1) = 0.
- 3 × 3 and larger: write A next to the identity matrix, [A | I]. Use row operations to turn the left side into I; the right side becomes A⁻¹. There are three row operations: swap two rows, multiply a row by a nonzero number, and add a multiple of one row to another (OpenStax 11.6). If a column has no nonzero entry on or below the diagonal, there's no pivot, the left side can't become I, and the matrix has no inverse.
| 1 | −2 |
| 2 | −3 |
→
| −3 | 2 |
| −2 | 1 |
The calculator multiplies A by its answer to check that the product is I. One use of an inverse is solving a system of equations: write it as AX = B, and then X = A⁻¹B (OpenStax 11.7).
Adding, Subtracting, Scalars, Transposes and Powers
- A + B and A − B: add or subtract the entries in matching positions. A and B must be the same size. OpenStax adds rows 4 1 and 3 2 to rows 5 9 and 0 7 to get 9 10 and 3 9 (11.5).
- kA: multiply every entry by the number k. Three times rows 8 1 and 5 4 is 24 3 and 15 12 (11.5).
- Transpose Aᵀ: rows become columns, so the entry in row i, column j of Aᵀ is the entry in row j, column i of A. A matrix is symmetric when Aᵀ = A (MIT 18.06SC, Transposes).
- Aⁿ: multiply n copies of A. A has to be square, because otherwise A × A isn't defined. Matrix multiplication is associative, so it doesn't matter how the copies are grouped (11.5). A⁰ is taken to be the identity matrix, just as any nonzero number to the power 0 is 1. The steps show A² entry by entry; each higher power is one more product with A.
| 1 | 3 |
| 2 | 3 |
| 4 | 1 |
ᵀ →
| 1 | 2 | 4 |
| 3 | 3 | 1 |
Multiplying Two Matrices
"Finding the product of two matrices is only possible when the inner dimensions are the same" (OpenStax 11.5). If A is m × r and B is r × n, then AB is m × n, and each entry is a row of A times a column of B. AB and BA are usually different. The step-by-step matrix multiplication calculator covers products in more depth, with a table of which sizes can be multiplied.
Frequently Asked Questions
Why can't I multiply these two matrices?
AB needs the number of columns of A to equal the number of rows of B. A 2 × 3 matrix times a 2 × 3 matrix isn't defined. A 2 × 3 matrix times its transpose, which is 3 × 2, is defined.
Does every square matrix have an inverse?
No. A square matrix has an inverse exactly when its determinant isn't 0 (MIT 18.06SC). A matrix with a row of zeros, or with two equal rows, has a determinant of 0, so it has no inverse.
What does a determinant of 0 mean?
The matrix is singular: it has no inverse, and elimination leaves a row of zeros (MIT 18.06SC). For a system of equations, a determinant of 0 means there's either no solution or infinitely many (OpenStax 11.8).
Can I enter fractions or decimals?
Yes. Type 3/4, −2/3 or 0.25. The answer stays exact: 0.25 becomes 1/4, and a decimal version is shown next to any answer with fractions.
What size matrices does it handle?
Up to 8 × 8 for every operation. The steps list every entry of a sum, scalar multiple or product, and every row operation for a determinant or inverse. For a power, they show A² entry by entry.
More tools: the matrix multiplication calculator, the quadratic formula calculator, the exponent calculator, the decimal to fraction calculator and all the math calculators.
Sources
- OpenStax, Algebra and Trigonometry 2e: 11.5 Matrices and Matrix Operations, 11.6 Gaussian Elimination, 11.7 Solving Systems with Inverses and 11.8 Cramer's Rule
- MIT OpenCourseWare 18.06SC Linear Algebra (Strang), lecture summaries: Transposes, permutations, spaces Rⁿ and Properties of determinants
- Formulas and test cases: how we calculate