Skip to content
CornerTools

Matrix Calculator

Determinant, inverse, RREF, rank and products of matrices with exact fractions and every step, and systems of equations solved.

Calculate

Matrix A

Working by
Show answers as

Inverse, A⁻¹

43−1
−2−21
54−1
Determinant
−1
Rank
3
Trace
3

Type a matrix, or paste one from a spreadsheet, and the calculator finds its inverse, determinant, reduced row echelon form, rank, trace, transpose, powers, adjugate and cofactors. Two matrices can be added, subtracted and multiplied in either order, and a system of linear equations, typed as it is written, is solved with its unique solution, its general solution or the reason it has none.

Every entry is an exact fraction, so 1/3 stays 1/3 through any number of steps, and every row operation is shown with the matrix after it and its pivot marked.

How to use it

The grid takes whole numbers, decimals and fractions (3/4 or 1 1/2) in up to 8 rows and columns, set with the + and − beside it. The arrow keys move between cells, and Enter moves down a column. A blank cell is an error rather than 0, so a missed entry is never read as one; Fill blanks with 0 fills them on request.

Pasting into the first cell sizes the grid to what was pasted: rows from a spreadsheet, numbers separated by tabs, commas or spaces, or a LaTeX matrix. Pasting into another cell fills from there, growing the grid as needed.

One matrix finds what Find names, with the determinant, rank and trace beside it. Power takes whole powers from -1 to 20, −1 being the inverse. The determinant can be worked by cofactor expansion and the inverse by the adjugate, as taught for matrices up to 4 × 4; row reduction works at any size.

System of equations takes one equation per line, such as 2x + y − z = 8, with variables named by a letter or a letter and a number (x1 or x₁), and terms on either side, or the coefficients in a grid with the constants in its last column. It is worked by Gaussian elimination with back substitution, by Gauss–Jordan elimination, or by Cramer's rule for square systems up to 4 × 4 with a non-zero determinant.

Show answers as switches the answer between fractions and decimals; the working stays in fractions. A matrix answer copies as aligned text, which pastes back into the grid, as LaTeX, or as a spreadsheet range in decimals, since a spreadsheet reads 1/2 as a date.

How it works

Row reduction uses three operations: swapping two rows, multiplying a row by a number other than 0, and adding a multiple of one row to another. Working down the columns, the first non-zero entry becomes the pivot and the entries below it are cleared, giving row echelon form; Gauss–Jordan also scales each pivot to 1 and clears above it, giving the reduced form. The number of pivots is the rank.

Clearing below the pivots leaves an upper triangle whose diagonal multiplies to the determinant, with the sign changed once for each swap. Row reducing [A | I] turns A into I and I into A⁻¹; a column with no pivot on the way shows A is singular, with determinant 0 and no inverse. The determinant's value is also found by Bareiss's fraction-free elimination, which divides exactly at every step, so even an 8 × 8 matrix of fractions stays exact.

A system has one solution when every variable has a pivot, none when a row reduces to 0 = a number other than 0, and infinitely many otherwise: each variable without a pivot is free, and the others are written in terms of it.

det A = (−1)ˢ × (product of the diagonal after row reduction), s = number of swaps
[A | I] → [I | A⁻¹] by row operations
A⁻¹ = adj A ÷ det A, where adj A is the transposed cofactor matrix
Cramer's rule: xᵢ = det Aᵢ ÷ det A
(AB)ᵢⱼ = row i of A · column j of B

Examples

A 3 × 3 determinant

Matrix A
 2   1  −1
−3  −1   2
−2   1   2

With Find set to Determinant, row reduction to an upper triangle gives det A = −1:

  1. Row reduce to an upper triangle; adding a multiple of one row to another keeps the determinant
     2   1  −1
    −3  −1   2
    −2   1   2
  2. Clear the entries below the pivot in column 1 R₂ → R₂ + (3/2)R₁; R₃ → R₃ + R₁
    2    1   −1
    0  1/2  1/2
    0    2    1
  3. Clear the entries below the pivot in column 2 R₃ → R₃ − 4R₂
    2    1   −1
    0  1/2  1/2
    0    0   −1
  4. Multiply the diagonal det = 2 × 1/2 × (−1) = −1

A 2 × 2 inverse

Matrix A
4  7
2  6
Inverse
 3/5  −7/10
−1/5    2/5

The determinant is 10, so every entry of the inverse is a tenth of a whole number: the adjugate's entries over 10.

Three equations, one solution

Equations
2x + y − z = 8
−3x − y + 2z = −11
−2x + y + 2z = −3

Gauss–Jordan elimination reduces the augmented matrix to the identity beside the solution: x = 2, y = 3, z = −1.

Infinitely many solutions

Equations
x + y + z = 3
x − y + 2z = 1

Two equations cannot pin down three unknowns: z has no pivot, so it is free, and every value of it gives a solution, x = 2 − 3z/2, y = 1 + z/2, z is free. With z = 0, for one, x = 2 and y = 1.

Frequently asked questions

Each entry of a product is a row of the first matrix times a column of the second, so swapping them pairs different rows with different columns. For A with rows 1 2 and 3 4 and B with rows 5 6 and 7 8, A × B has first row 19 22 but B × A has first row 23 34. When the sizes differ, one order may not even be defined: a 2 × 3 times a 3 × 3 works, the other way round does not.
A determinant of 0 means the rows are dependent: one is a combination of the others, so the matrix flattens space onto a line or a plane, and the points it sends to the same place cannot be told apart again. Row reduction shows it as a column with no pivot.

See also