Matrix Calculator

Determinants, inverses, row reduction, linear systems and eigenvalues — all in exact fractions, with every row operation shown. Nothing is rounded, and nothing is sent to a server.

Matrix A
Matrix A: 3 rowsMatrix A: 3 columns

Cells take whole numbers, fractions like 3/4, and decimals like 0.25. Decimals are read exactly, so 0.1 means one tenth rather than the nearest binary approximation to it.

Try:

Determinant, rank, inverse, and the four fundamental subspaces

Size
3×3
Rank
3
Nullity
0
Trace
3
Determinant
-1
Invertible
yes

Rank 3 + nullity 0 = 3, the number of columns. That is the rank-nullity theorem, and it always holds.

Reduced row echelon form

100
010
001
Pivot columns highlighted: 1, 2, 3

Inverse

43-1
-2-21
54-1
A⁻¹

Found by reducing [A | I] to [I | A⁻¹]. Multiply it by A in the Operations tab and you get the identity exactly, with no rounding to squint at.

The four subspaces

Column space — dimension 3

2
-3
-2
1
-1
1
-1
2
2

Taken from the pivot columns of the original A, not of the reduced form. Row operations change the column space, so a basis read off the reduced matrix would not lie in A's column space at all.

Null space — dimension 0

Only the zero vector solves Ax = 0, so the null space is trivial and the columns of A are linearly independent.

Row space — dimension 3

100
010
001

The non-zero rows of the reduced form. Unlike the column space, the row space is unchanged by row operations — which is exactly why the reduced rows can be used here and the reduced columns cannot.

Why exact arithmetic matters here

Most online matrix calculators work in floating point, and for a topic built almost entirely on division that is the wrong choice. Three things go wrong, and all three are visible to a student rather than buried.

Answers stop being recognisable. Invert a matrix of small whole numbers and the true answer is usually full of thirds and sevenths. In decimals you get 0.33333333333333331, and you are left to work out that the answer was 1/3. Here it is 1/3, with the decimal underneath if you want it.

Zero stops being zero. Eliminate a singular matrix in doubles and the pivot that should vanish comes out around 10⁻¹⁶ instead. The tool then has to guess whether that is a real number or rounding noise, and the rank, the determinant and the null space all depend on the guess. In exact arithmetic there is nothing to guess: a pivot is zero or it is not.

Errors compound. Every row operation multiplies and subtracts, so the small error from one step feeds into the next. By the bottom-right corner of a 6×6 the accumulated drift can be large enough to change the answer, and a determinant that should be exactly 1 comes back as 0.9999999999999964.

This calculator uses exact rational arithmetic throughout, with arbitrary precision integers underneath, because the intermediate values in elimination grow quickly even when the final answer is small. A decimal you type is read exactly too: 0.1 means one tenth, not the binary fraction nearest to it.

The extreme case makes the point. The 8×8 Hilbert matrix — the one with 1/(i+j−1) in every entry — is exactly invertible, and every entry of its inverse is a whole number. Its condition number is around 10¹⁰, so a double-precision inverse gets most of its digits wrong and multiplying back gives something visibly unlike the identity. Here the inverse is exact, the product is exactly the identity, and the determinant is the exact fraction 1/365356847125734485878112256000000. It takes about four milliseconds.

What this covers

Operations

Addition, subtraction, multiplication, scalar multiplication, integer powers including negative ones, the transpose, and reduction to row echelon form. Where two matrices have shapes that do not fit, the error names both sizes and what would have to be true instead — “dimension error” teaches nothing, and the reason a 2×3 cannot multiply a 2×3 is the whole content of the question.

Properties

Determinant, rank, nullity, trace and inverse, shown together rather than behind separate buttons, because they are one fact about the matrix. A matrix with a zero determinant has no inverse, has rank below its size, and has a non-trivial null space; those are four ways of saying the same thing and seeing them on one screen is what makes that connection visible.

The four fundamental subspaces come with bases. The column space basis is taken from the pivot columns of the original matrix, not of the reduced one — row operations change the column space, so a basis read off the reduced form need not lie in the original column space at all. That is one of the most common mistakes on this topic and it is worth being explicit about.

Solving Ax = b

The whole solution set, not one vector. A unique solution is reported as one. An inconsistent system is reported as having none, with the row of the reduced form that reads 0 = something non-zero quoted as the reason. And a system with infinitely many solutions gets what it actually has: a particular solution, a basis for the null space, and the parametric form written out with one parameter per free variable.

The rank test is shown alongside. Comparing rank(A) with rank of the augmented matrix [A | b] and with the number of unknowns decides the case every time, and it is the reasoning an exam question wants rather than the answer alone.

Cramer’s rule is available because courses ask for it explicitly. It is not the method used for the answer: it costs n+1 determinants where elimination costs one reduction, and it says nothing at all when the determinant is zero.

Eigenvalues and eigenvectors

The characteristic polynomial is computed exactly, so you can check your own expansion of det(λI − A) against it. It is built from traces rather than expanded symbolically, which is what makes it work past 3×3 — symbolic expansion of a determinant is unusable by 5×5.

Rational roots are then found exactly. This matters more than it sounds: the eigenvalues in nearly every exercise are small integers, and a tool that answers 1.9999999999999998 for an eigenvalue of 2 has failed at the one thing it was asked. Whatever remains after those are divided out is solved numerically and labelled as approximate, with the same treatment for its eigenvectors. A number on this page is either exact or it carries an approximation sign.

Both multiplicities are reported. The algebraic multiplicity is how often the eigenvalue repeats as a root; the geometric multiplicity is how many independent eigenvectors it actually has. When the second is smaller than the first, the matrix is defective and cannot be diagonalized — and seeing the two numbers side by side is a far better explanation of that than being told “not diagonalizable”.

The row operations

Every reduction on this page can show its working, in the notation a textbook uses:

Operation Written What it does to the determinant
Swap two rows R1 ↔ R2 Flips its sign
Multiply a row by k R2 → (1/3)R2 Multiplies it by k
Add a multiple of one row to another R2 → R2 − 3R1 Leaves it unchanged

That third row is why elimination is a sound way to find a determinant: the only operations that change it are swaps, which are counted, and scalings, which are not used during the forward pass. The determinant is then the product of the pivots with a sign flip for each swap — O(n³) instead of the O(n!) of cofactor expansion, and exactly the same answer.

Pivots are chosen as the first non-zero entry in the column rather than the largest. Partial pivoting exists to control rounding error, and in exact arithmetic there is no rounding to control; picking the first keeps the numbers small and produces the same sequence of steps a person working by hand would produce, which matters when the steps are the output.

Four mistakes this will catch

  1. Multiplying in the wrong order. AB and BA are different matrices, and often only one of them is even defined. If your answer disagrees with this one, check which way round you multiplied before checking the arithmetic.
  2. Reading the column space off the reduced matrix. Take the pivot positions from the reduced form, then the columns from the original. The reduced columns are not in the column space.
  3. Calling a system unsolvable because it has no unique solution. Infinitely many solutions is an answer, and writing it out is usually most of the marks.
  4. Assuming a repeated eigenvalue means a repeated eigenvector. Check the geometric multiplicity. If it is smaller than the algebraic one, the matrix is defective and no basis of eigenvectors exists.

What it does not do

Questions

Why does this give fractions where other calculators give decimals?

Because the answer is a fraction. The inverse of a matrix of small whole numbers is almost always full of thirds and sevenths, and a tool that prints 0.33333333333333331 has given you a rounded version of 1/3 and left you to guess that is what it meant. Everything here is computed in exact rational arithmetic, so 1/3 stays 1/3 all the way to the answer. A decimal is shown underneath any fraction that has one.

Is the determinant really exactly zero, or just close to it?

Exactly zero. That distinction is the main reason to use exact arithmetic here. In floating point, eliminating a singular 6x6 matrix of whole numbers typically ends with a pivot around 1e-16 rather than 0, and the tool then has to guess whether that is a real value or rounding noise. Working in fractions removes the guess: a pivot is zero or it is not, so the rank is right and the determinant is right.

What does it mean when a system has infinitely many solutions?

It means the equations do not pin down every unknown, so the solutions form a line, a plane, or something higher-dimensional. The complete answer is one particular solution plus any combination of the null space vectors, and that is what this shows — written out with a parameter for each free variable. "No unique solution" is not an answer to the question.

Why is my eigenvalue shown as a decimal?

Because it is irrational. Every rational eigenvalue is found exactly, by the rational root theorem applied to the characteristic polynomial, so integer and fractional eigenvalues come out as integers and fractions. What is left over — a root of something like λ² − 4λ + 2 — has no exact rational form, so it is given to nine figures and marked with an approximation sign. Its eigenvector is approximate for the same reason.

What does "defective" mean?

A matrix is defective when an eigenvalue is repeated as a root of the characteristic polynomial but does not have as many independent eigenvectors as that repetition suggests. A shear such as [[3,1],[0,3]] has λ = 3 twice but only one eigenvector direction, so there are not enough eigenvectors to form a basis and the matrix cannot be diagonalized. This tool reports both multiplicities so you can see the shortfall rather than being told a bare yes or no.

How large a matrix can it handle?

Up to 8x8, which covers essentially every exercise. The limit is readability rather than speed: exact arithmetic on a 20x20 is fine for a computer and produces fractions with numerators hundreds of digits long, which is no use to anybody on a screen.

Can I use this in an exam?

Almost certainly not. No web-based tool is allowed in a university exam, and the row operations are there so you can learn to reproduce them by hand rather than avoid doing so. Use it to check work and to see where your own elimination went wrong.