Matrix calculator

Determinant, inverse, RREF and Ax = b up to 6×6, exact fractions and steps.

Matrix A

Integers, decimals or fractions such as 3/4. Blank cells count as 0.

Result

det(A) = 49

Row reduction to a triangular matrix with 0 row swap(s); det = (−1)^swaps × product of the diagonal = 49.

Method: only row swaps (each flips the sign) and “add a multiple of another row” (no change) are used.

Show the steps (3)
  1. Start
    Start
    2-31
    20-1
    145
  2. 1. R2 ← R2 − R1
    R2 ← R2 − R1
    2-31
    03-2
    145
  3. 2. R3 ← R3 − (1/2)R1
    R3 ← R3 − (1/2)R1
    2-31
    03-2
    011/29/2
  4. 3. R3 ← R3 − (11/6)R2
    R3 ← R3 − (11/6)R2
    2-31
    03-2
    0049/6

What this tool does

It works on one or two matrices of up to 6 rows and 6 columns and computes the determinant, the inverse, the rank, the reduced row echelon form (RREF), the transpose, A + B, A − B, A × B, a multiple k·A, and the solution of a linear system A·x = b. Cells take whole numbers, decimals or fractions such as 3/4; a blank cell counts as 0.

Every number is kept as an exact fraction of two whole numbers, however large they grow. Nothing is rounded during the calculation, so a singular matrix shows a determinant of exactly 0 instead of 2.2e-16, and the inverse of the 3×3 Hilbert matrix comes out as the whole numbers 9, −36, 30, … that the textbooks give. Tick Show decimals to read the same results rounded to the number of places you choose; the rounding happens only on screen.

How to use it

  1. Choose the operation. Matrix B appears for A + B, A − B and A × B; the column b appears for A·x = b; the number k for k·A.
  2. Set the number of rows and columns, then type into the cells. To bring in a matrix from a spreadsheet or a worksheet, use Paste into A: one row per line, cells separated by spaces, tabs, commas or semicolons.
  3. The result updates as you type. Copy puts it on the clipboard as tab-separated rows, which paste straight into a spreadsheet. Use result as A lets you chain operations, for example invert and then multiply.
  4. Open Show the steps to see each elementary row operation and the matrix after it.

How the results are computed

Determinant. The matrix is brought to triangular form using only two moves: swapping two rows, which flips the sign of the determinant, and adding a multiple of one row to another, which leaves it unchanged. The determinant is then (−1) to the number of swaps times the product of the diagonal. For the starting example, A = [[2, −3, 1], [2, 0, −1], [1, 4, 5]], the steps are R2 ← R2 − R1, R3 ← R3 − (1/2)R1 and R3 ← R3 − (11/6)R2, which leave the diagonal 2, 3 and 49/6, so det(A) = 2 × 3 × 49/6 = 49. Expanding along the first row by cofactors gives the same: 2·4 + 3·11 + 1·8 = 49. A 2×2 also shows the familiar ad − bc.

RREF, rank and inverse. Gauss–Jordan elimination: in each column the first non-zero entry at or below the current row becomes the pivot, its row is scaled so the pivot is 1, and that column is cleared in every other row. The rank is the number of pivots. The inverse is found by reducing [A | I]: if the left half turns into the identity, the right half is A⁻¹; if a column runs out of pivots, A is singular and has no inverse.

A·x = b. The tool reduces [A | b]. A row that reads 0 = 5 means the equations contradict each other and there is no solution. If every column of A has a pivot there is exactly one solution. Otherwise the columns without a pivot are free variables, written t1, t2, …, and the answer is given in parametric form such as x1 = 1 − t1 − t2, x2 = t1, x3 = t2: infinitely many solutions, one for each choice of the t's.

Tips and limits

  • Row operations are written R2 ← R2 − 3R1 (replace row 2 by row 2 minus three times row 1), R1 ↔ R3 (swap) and R1 ← (1/2)R1 (scale). Your textbook may choose a different pivot order and get different intermediate matrices; the final RREF, rank, determinant and inverse are unique, so they must agree.
  • Up to 60 operations are listed with their matrix; for large systems the rest are counted rather than shown.
  • In the cells a comma may be a decimal comma (2,5). In the paste box the comma separates cells, so use a dot there.
  • For a single equation, or a quadratic or cubic, the equation solver explains each step in words; to see what a function looks like, use the function grapher. The worked 2×2 and 3×3 examples in determinant and inverse by hand follow the same steps as this tool.

Frequently asked questions

Why does the tool show fractions instead of decimals?

Because the arithmetic is exact. Decimals would have to be rounded at every step, and rounding errors can turn a singular matrix into one with a tiny non-zero determinant, or change the rank. Tick Show decimals to see a rounded version of the same exact result.

My textbook shows different steps. Is the tool wrong?

Not necessarily. There are many valid sequences of row operations; this tool always takes the first non-zero entry in a column as the pivot. The reduced row echelon form, the rank, the determinant and the inverse do not depend on the order, so those final answers must match.

What does 'A is singular' mean?

Its determinant is 0, so its rows (and columns) are linearly dependent: at least one row is a combination of the others. Such a matrix has no inverse, and a system A·x = b with it has either no solution or infinitely many, never exactly one.

How do I read an answer like x1 = 1 − t1 − t2?

t1 and t2 are free parameters: pick any numbers for them and you get a solution. With t1 = 0 and t2 = 0 the solution is (1, 0, 0); with t1 = 2 and t2 = 1 it is (−2, 2, 1). Every solution of the system has this form.

Can I multiply matrices of different sizes?

Yes, when the number of columns of A equals the number of rows of B. A 2×3 matrix times a 3×4 matrix gives a 2×4 matrix. Adding and subtracting need both matrices to have exactly the same size.