Matrix Calculator
Find the determinant, inverse, rank, reduced row echelon form, product, sum and eigenvalues of matrices up to 6 × 6. Every answer is exact — fractions stay fractions — and each row operation is written out step by step.
Enter the matrices
A cell takes an integer, a decimal (0.25) or a fraction (3/4); an empty cell counts as 0. Enter moves to the next cell and, after the last one, to the operations; the arrow keys move between cells. Paste a table copied from a spreadsheet into any cell to fill the grid from there.
Choose an operation
This calculator needs JavaScript to run.
Decimals are rounded to 6 significant digits. The calculation itself always uses exact fractions, so rounding never affects the steps.
Show stepsHide steps
How to read the steps
| Notation | Meaning |
|---|---|
R1 ↔ R2 | Swap rows 1 and 2. The determinant changes sign. |
R2 ← R2 − 3·R1 | Replace row 2 by row 2 minus 3 times row 1. The determinant does not change. |
R1 ← (1/2)·R1 | Multiply every entry of row 1 by 1/2. The determinant is multiplied by 1/2 as well. |
[A | I] | Matrix A with the identity matrix written to its right. |
Calculations run locally in your browser — nothing you enter is sent to a server.
How to use the matrix calculator
- Set the size of matrix A with the Rows and Columns lists (1 to 6 each) and type the entries: integers, decimals such as 0.25 or fractions such as 3/4. An empty cell counts as 0.
- To fill the grid quickly, copy cells from a spreadsheet and paste them into any cell. The grid grows to fit, up to 6 × 6.
- Pick an operation. A · B, A + B and A − B also use matrix B.
- Switch between Fractions and Decimals, open "Show steps" to see every row operation, or copy the answer as plain text or LaTeX.
- Press "Use result as A" to keep working with the answer.
How it works
All arithmetic uses exact fractions. Each number is stored as a whole-number numerator and denominator, so 1/3 stays 1/3 and no rounding error builds up.
Most answers come from row reduction (Gaussian elimination), which uses
three row operations: swap two rows, R1 ↔ R2; multiply a row by a non-zero
number, R1 ← (1/2)·R1; and add a multiple of one row to another,
R2 ← R2 − 3·R1.
Determinant. The calculator turns A into an upper triangular matrix using only swaps and the third operation. The third operation leaves the determinant unchanged and each swap flips its sign, so
det(A) = (−1)^s × (product of the diagonal entries)
where s is the number of swaps. For 2 × 2 and 3 × 3 matrices the direct
formula is shown too: ad − bc, and
a(ei − fh) − b(di − fg) + c(dh − eg) for a matrix with rows (a, b, c),
(d, e, f) and (g, h, i).
Inverse. Gauss–Jordan elimination is applied to the block
[A | I], where I is the identity matrix. Once the left half has become I,
the right half is the inverse. If a column has no pivot, A is singular: its determinant
is 0 and no inverse exists.
RREF and rank. The same elimination, carried out on a matrix of any shape, gives the reduced row echelon form: every pivot is 1, each pivot is the only non-zero entry in its column, and zero rows sit at the bottom. The rank is the number of pivots.
Product. Entry (i, j) of A · B is row i of A times column j of B: multiply the entries in matching positions and add the results. The number of columns of A must equal the number of rows of B.
Eigenvalues. These are the roots of the characteristic polynomial
det(λI − A). For a 2 × 2 matrix it is λ² − (trace)·λ + det(A),
solved with the quadratic formula; the trace is the sum of the diagonal entries. For
3 × 3 the calculator looks for a rational root, divides it out and solves the remaining
quadratic exactly. A cubic with no rational root is solved numerically.
Examples
Example 1 — determinant. For A with rows (1, 2) and (3, 4):
det(A) = 1·4 − 2·3 = −2.
Example 2 — inverse. A with rows (4, 7) and (2, 6) has determinant
4·6 − 7·2 = 10, so it is invertible. Its inverse has rows (3/5, −7/10) and
(−1/5, 2/5) — in the Decimals view, (0.6, −0.7) and (−0.2, 0.4).
Example 3 — a singular matrix. A with rows (1, 2, 3), (4, 5, 6) and (7, 8, 9) reduces to the RREF with rows (1, 0, −1), (0, 1, 2) and (0, 0, 0). There are only two pivots, so the rank is 2, the determinant is 0 and the Inverse button reports that A is not invertible.
Example 4 — eigenvalues. A with rows (4, 1) and (2, 3) has trace 7 and
determinant 10, so the characteristic polynomial is λ² − 7λ + 10 and the
eigenvalues are 2 and 5.
Solving a linear system with RREF
To solve a system of linear equations, write its augmented matrix: one row per equation, the coefficients first and the constant term as the last column. Then choose RREF & rank. Take the system
2x + y − z = 8
−3x − y + 2z = −11
−2x + y + 2z = −3
Enter it as a 3 × 4 matrix with rows (2, 1, −1, 8), (−3, −1, 2, −11) and (−2, 1, 2, −3).
The RREF has rows (1, 0, 0, 2), (0, 1, 0, 3) and (0, 0, 1, −1), which reads
x = 2, y = 3, z = −1. In general:
- a pivot in every variable column and none in the last column — exactly one solution;
- a pivot in the last column (a row that says 0 = 1) — no solution;
- a variable column without a pivot and no such contradiction — infinitely many solutions, because that variable is free.
What the determinant, rank and eigenvalues tell you
A square matrix is invertible exactly when its determinant is not 0. The absolute value of the determinant is the factor by which the matrix scales area (2 × 2) or volume (3 × 3); a negative sign means the orientation is flipped.
The rank is the number of linearly independent rows. An n × n matrix is invertible exactly when its rank is n.
An eigenvalue λ belongs to a non-zero vector v with
Av = λv: the matrix only stretches v by the factor λ. The eigenvalues add up to the trace and multiply to the determinant. A real
matrix can have complex eigenvalues: the quarter-turn rotation with rows (0, −1) and
(1, 0) has ±i, because it keeps no real direction in place.
Common mistakes to avoid:
- Matrix multiplication is not commutative: A · B and B · A are usually different.
- Multiplying an n × n matrix by k multiplies its determinant by kⁿ, not by k.
- The inverse of a product reverses the order: (AB)⁻¹ = B⁻¹A⁻¹.
Frequently asked questions
Why are the answers fractions and not decimals?
Fractions are exact. A decimal such as 0.333333 is only close to 1/3, and small errors grow during elimination. The Decimals view rounds to 6 significant digits for display only.
What does "not invertible" mean?
The matrix is singular: its determinant is 0, its rows are linearly dependent and no matrix multiplies it into the identity.
Which matrix sizes are supported?
Any size from 1 × 1 to 6 × 6, square or not. The determinant and inverse need a square matrix, and eigenvalues are offered for 2 × 2 and 3 × 3 matrices.
Can I paste a matrix from a spreadsheet?
Yes. Copy the cells, click the cell where the block should start and paste. Values separated by tabs, spaces, commas or semicolons are accepted, one row per line.
Why are some eigenvalues shown only as rounded numbers?
A 3 × 3 matrix has a cubic characteristic polynomial. When that cubic has no rational root, its exact roots are long expressions with nested cube roots, so the calculator gives numeric values and labels them as rounded.
Is my data sent anywhere?
No. Everything is calculated in your browser. The matrices and settings are saved only in this browser's local storage, and nothing is uploaded.
Related tools
- Matrix Transformations — see what a 2 × 2 matrix does to the plane.
- Quadratic Equation Solver — roots, discriminant and steps for any quadratic.
- GCF & LCM Calculator — greatest common factor and least common multiple.
- Correlation & Covariance Calculator — correlation and covariance of two data sets.
- Permutation & Combination Calculator — count arrangements and selections.
- Percentage Calculator — percent of, percent change and reverse percentages.