What the Matrix Calculator does
This matrix calculator finds the determinant, inverse, rank, transpose, trace and reduced row echelon form of a matrix up to 6 x 6, adds, subtracts and multiplies two matrices, and solves a system of linear equations - with exact fractions and every row operation shown, so you can follow the working or check your own.
Most online calculators work in floating-point decimals, which is why they show an inverse entry as 0.333333 or a determinant of 1.0000000002. This one stores every entry as an exact fraction: type 0.25 and it is held as 1/4, type 1/3 and it stays 1/3. The answer is therefore exactly what you would get by hand, and you can switch the display to four decimal places when you need a number to plug in elsewhere. Everything runs in your browser and nothing you type is sent anywhere.
How to use it
- Choose the operation: determinant, inverse, RREF, rank, transpose, trace, a power, multiplying by a number, A x B, A + B, A - B, or solving A x = b.
- Set the size of matrix A with the Rows and Columns menus, then type the entries. Whole numbers, decimals and fractions such as -3/4 are all accepted; an empty cell counts as 0 once you have typed anything, and the page tells you when it has done that.
- For A x B, A + B or A - B fill in matrix B as well. To solve equations, put the coefficients in A and the right-hand side in the single column b that appears.
- Read the answer at the top of the result panel, then open the step list to see each row operation - such as R2 <- R2 - 4.R1 - with the matrix after it.
- Copy the result as plain text or LaTeX, download it as CSV or JSON (the JSON includes every step), or print the page for your notes.
Reading the results
A determinant of 0 means the matrix is singular: its rows are linearly dependent, it has no inverse, and a system A x = b with that matrix has either no solution or infinitely many. Any non-zero determinant, however small, means the inverse exists - with exact fractions there is no such thing as "nearly singular" here.
The rank is the number of pivots in the reduced row echelon form - the number of genuinely independent rows. The nullity, shown beside it, is the number of columns without a pivot, which is how many free variables a homogeneous system has.
For a linear system the page says which of the three possible outcomes you have. One solution is given as values; no solution quotes the row that reduced to an impossible statement such as 0 = 1; infinitely many is written as a general solution in terms of the free variables.
The steps follow the usual classroom method: in each column take the first non-zero entry at or below the pivot row, swap it up if needed, scale it to 1, then clear the rest of the column. Your teacher's steps may differ if they chose other pivots, but the reduced row echelon form is unique, so the final answer will be the same.
Worked example: a 3 x 3 determinant and an inverse with fractions
Take A = [[6, 1, 1], [4, -2, 5], [2, 8, 7]]. Expanding along the first row: 6 x ((-2)(7) - (5)(8)) - 1 x ((4)(7) - (5)(2)) + 1 x ((4)(8) - (-2)(2)) = 6 x (-54) - 18 + 36 = -324 - 18 + 36 = -306. The calculator reaches the same -306 by row reduction: it clears the entries below the diagonal and multiplies the diagonal that remains.
Now take B = [[2, 0, 1], [1, 1, 0], [0, 3, 1]]. Its determinant is 2(1 - 0) - 0 + 1(3 - 0) = 5, so it is invertible. The inverse is the adjugate divided by 5: [[1/5, 3/5, -1/5], [-1/5, 2/5, 1/5], [3/5, -6/5, 2/5]]. A decimal calculator would show 0.2, 0.6, -1.2 and so on, which is fine here, but a determinant of 3 or 7 would give recurring decimals that no longer multiply back to the identity exactly.
To check, multiply the first row of B, (2, 0, 1), by the first column of the inverse, (1/5, -1/5, 3/5): 2/5 + 0 + 3/5 = 1. The page performs that full check for every inverse it shows.
Formulas and scoring rules
- Matrix product
(A x B)[i][j] = sum over k of A[i][k] x B[k][j]Defined only when A has as many columns as B has rows. In general A x B is not equal to B x A.- 2 x 2 determinant
det [[a, b], [c, d]] = ad - bc- Determinant by elimination
det(A) = (-1)^s x u11 x u22 x ... x unnu are the diagonal entries after reducing A to upper-triangular form using row swaps (s of them) and adding multiples of rows, which leaves the determinant unchanged.- 2 x 2 inverse
[[a, b], [c, d]]^-1 = 1 / (ad - bc) x [[d, -b], [-c, a]]Exists only when ad - bc is not 0.- Inverse by Gauss-Jordan
[A | I] -> row operations -> [I | A^-1]If a column runs out of non-zero pivots first, A is singular and has no inverse.- Rank-nullity
rank(A) + nullity(A) = number of columns of A- Rounding
exact fractions; decimal view = round half away from zero to 4 placesRounding happens only for display. Decimal input is converted to the exact fraction it denotes, so 0.1 is 1/10.
Why exact fractions matter
Computers store ordinary decimals in binary floating point, in which 0.1 cannot be represented exactly. Row reduction multiplies and subtracts the same numbers many times, so small representation errors can grow: a matrix whose determinant is truly 0 may come out as 1e-16 and be reported as invertible, with an inverse full of enormous numbers. Exact rational arithmetic removes the problem for the sizes a student or engineer types by hand, because every intermediate value is a fraction of whole numbers with no rounding at all.
The trade-off is speed on very large matrices, where fractions can grow long. That is why the calculator stops at 6 x 6; for larger numerical work a library such as LAPACK, with pivoting strategies designed to control rounding error, is the right tool.
Reading the row operations
Three operations are used and each is labelled with its effect. Swapping two rows (R1 <-> R2) changes the sign of the determinant. Scaling a row (R1 <- (1/2).R1) multiplies the determinant by that number. Adding a multiple of one row to another (R3 <- R3 - 2.R1) leaves the determinant unchanged. For the determinant only swaps and additions are used, so the value can be read straight from the triangular matrix at the end.
For the inverse and for linear systems the identity or right-hand side is carried along to the right of a dashed line, which is the augmented matrix you would write on paper.
Limitations: what the result does not prove
- Matrices are limited to 6 rows and 6 columns, and each entry to 40 characters. That covers coursework and hand-sized problems, not large numerical models.
- Only real rational numbers are accepted. Complex numbers, symbols such as x or pi, and square roots cannot be typed; enter a decimal approximation if you must, knowing it will be treated as an exact fraction of that decimal.
- Eigenvalues and eigenvectors are not computed, because they are generally irrational and cannot be given exactly with fractions.
- The steps use one standard pivot rule. A different but equally correct sequence of operations is possible, so the intermediate matrices may not match your textbook line by line even though the final answer does.
Privacy: where your data goes
Everything you paste, type or drop is processed in this browser tab. It is not uploaded, logged, stored or sent to analytics. Session recording and tag-manager scripts are switched off on this page.
Standards and sources
- MIT OpenCourseWare 18.06 Linear Algebra (Gilbert Strang)
- Gilbert Strang, Introduction to Linear Algebra - book website
- LAPACK - Linear Algebra PACKage (numerical methods for large matrices)
Frequently asked questions
How do you find the determinant of a 3x3 matrix?
Expand along a row: for [[a, b, c], [d, e, f], [g, h, i]] the determinant is a(ei - fh) - b(di - fg) + c(dh - eg). The calculator instead row-reduces to a triangular matrix and multiplies the diagonal, showing each step, and both routes give the same number.
Why does my matrix have no inverse?
Because its determinant is 0, which means one row is a combination of the others. Row reduction then runs out of non-zero pivots before it reaches the identity. The page reports the rank so you can see how many rows are independent.
What is reduced row echelon form used for?
RREF shows the structure of a matrix at a glance: the number of pivots is the rank, the pivot columns identify independent columns, and for an augmented matrix the last column gives the solution of the linear system directly or shows that it has none.
Can I multiply a 2x3 matrix by a 3x2 matrix?
Yes. The inner sizes match (3 columns times 3 rows), so the product is 2 x 2. Multiplying in the other order, 3x2 times 2x3, is also defined but gives a 3 x 3 matrix, which is one reason the order of matrix multiplication matters.
How do I solve a system of equations with a matrix?
Write the coefficients as matrix A and the constants as column b, choose Solve A x = b, and the calculator row-reduces the augmented matrix [A | b]. It then tells you whether there is one solution, none or infinitely many, and gives the general solution in the last case.
Does the calculator accept fractions and decimals?
Yes. Type 3/4, -2/5, 0.125 or 1.5e-2 in any cell. Decimals are converted to the exact fraction they write, all arithmetic stays exact, and you choose whether answers are shown as fractions or rounded to four decimal places.
What is the difference between rank and determinant?
The determinant exists only for square matrices and is a single number that is zero exactly when the matrix is singular. The rank exists for any matrix and counts its independent rows; a square matrix is invertible precisely when its rank equals its size.
Last reviewed by the A2Z.Tools team against the sources listed above.