Matrix Calculator: Determinant, Inverse, RREF and Multiplication
By FindMySum · Last reviewed
This matrix calculator finds the determinant, the inverse and the reduced row echelon form of a matrix, and multiplies two matrices, using exact fractions throughout. Every row operation is listed with the matrix after it, so the result can be followed and checked like a worked solution. This article explains each operation, the arithmetic behind it, and walks through the calculator's default example.
Entering a matrix
Type one row per line, or separate rows with semicolons, and separate entries with spaces or commas. "2 1 1; 1 3 2; 1 0 0" is the 3×3 matrix used as the default. Entries can be integers, decimals or fractions; 0.25 and 1/4 are the same number. Each row must have the same length, and the calculator accepts up to six rows.
Row operations: the one tool behind everything
Three elementary row operations are enough to compute determinants, inverses and solutions of linear systems:
- Swap two rows.
- Multiply a row by a non-zero number.
- Add a multiple of one row to another.
The calculator writes them as "Swap R1 and R2", "R1 → (1/2)·R1" and "R2 → R2 − 3·R1". Each operation is reversible, which is why it does not change the solutions of a system and changes the determinant only in a predictable way.
Determinant
For a 2×2 matrix the determinant is ad − bc. For larger matrices the textbook method is cofactor expansion, but that grows very quickly: a 6×6 matrix has 720 terms. Elimination is far more efficient. The calculator reduces the matrix to upper-triangular form using only swaps and "add a multiple" operations; the determinant is then the product of the diagonal entries, with the sign changed once for each swap.
Take the 3×3 matrix with rows (2, −3, 1), (2, 0, −1) and (1, 4, 5). Expanding along the first row gives 2(0·5 − (−1)·4) + 3(2·5 − (−1)·1) + 1(2·4 − 0·1) = 8 + 33 + 8 = 49. Elimination reaches the same 49 through the pivots on the diagonal.
A determinant of 0 means the matrix is singular: one row is a combination of the others, there is no inverse, and a system with that coefficient matrix has either no solution or infinitely many.
Inverse by Gauss–Jordan elimination
The inverse A⁻¹ is the matrix that gives the identity when multiplied by A. To find it, write A next to the identity matrix, [A | I], and apply row operations until the left half becomes I. The right half is then A⁻¹, because the operations together amount to multiplying by A⁻¹.
With the default matrix A = [[2, 1, 1], [1, 3, 2], [1, 0, 0]], the determinant is −1, so the inverse exists. Gauss–Jordan elimination produces
A⁻¹ = [[0, 0, 1], [−2, 1, 3], [3, −1, −5]]
Check one entry of A × A⁻¹: the first row of A times the first column of A⁻¹ is 2·0 + 1·(−2) + 1·3 = 1, as the identity requires. Because the determinant is −1, every entry of the inverse is an integer; in general the entries are fractions whose denominators divide the determinant, which is why exact arithmetic matters.
Reduced row echelon form and solving systems
Reduced row echelon form, RREF, is the end point of Gauss–Jordan elimination: every pivot is 1, each pivot is the only non-zero entry in its column, and each pivot sits to the right of the one above it. It is unique for each matrix, so two people working by hand should reach the same RREF even if they use different steps.
For an augmented matrix the RREF reads off the solution. The system 2x + y − z = 8, −3x − y + 2z = −11, −2x + y + 2z = −3 reduces to the identity with the column (2, 3, −1) beside it, so x = 2, y = 3 and z = −1. A row of zeros with a non-zero constant means the equations contradict each other; a column without a pivot means a free variable and infinitely many solutions.
The number of pivots is the rank. The singular matrix [[1, 2], [2, 4]] reduces to [[1, 2], [0, 0]]: rank 1, because the second row was just twice the first.
Matrix multiplication
The product AB is defined when A has as many columns as B has rows. Each entry is a dot product: row i of A times column j of B, entry by entry, summed. A 2×3 matrix times a 3×2 matrix gives a 2×2 result; [[1, 2, 3], [4, 5, 6]] × [[7, 8], [9, 10], [11, 12]] = [[58, 64], [139, 154]], since 1·7 + 2·9 + 3·11 = 58.
Order matters. BA here would be a 3×3 matrix, completely different from AB, and for many pairs only one of the two products exists at all.
Why exact fractions
Floating-point elimination introduces rounding at every step. The errors are usually small, but they can make a singular matrix look invertible, change the rank, or print 0.9999999999 where the answer is 1. With exact fractions none of that happens: the determinant is exactly 0 or it is not, and multiplying a computed inverse back by the original matrix gives the identity exactly. The decimal view is provided for convenience alongside the exact result.
More questions
Is there a quick formula for the inverse of a 2×2 matrix?
Yes. For A = [[a, b], [c, d]] with ad − bc ≠ 0, A⁻¹ = (1 ÷ (ad − bc)) × [[d, −b], [−c, a]]: swap the diagonal entries, change the signs of the other two and divide by the determinant. For [[1, 2], [3, 4]] the determinant is −2 and the inverse is [[−2, 1], [3/2, −1/2]]. For 3×3 and larger matrices elimination is quicker than the cofactor formula.
How do I solve a system of equations with this calculator?
Write the system as an augmented matrix, one equation per row with the constants in the last column, and choose RREF. For 2x + y − z = 8, −3x − y + 2z = −11 and −2x + y + 2z = −3, enter 2 1 -1 8; -3 -1 2 -11; -2 1 2 -3. The reduced matrix has 2, 3 and −1 in the last column: x = 2, y = 3, z = −1. If the coefficient matrix is square and invertible you can also multiply A⁻¹ by the column of constants.
What does the sign of a determinant mean?
Geometrically, the absolute value of the determinant is the factor by which the matrix scales areas (2×2) or volumes (3×3), and the sign says whether it preserves or reverses orientation. A negative determinant means the transformation includes a reflection; for example, swapping two rows of the identity gives determinant −1.
Can I multiply a matrix by a single number?
Scalar multiplication is not a separate option, but you can do it with the product: multiply A by k times the identity matrix of matching size, for example 3 0; 0 3 for a 2×2 matrix. Every entry of A is multiplied by k. The determinant scales by k raised to the power of the matrix size, which is a common exam question.
Why do online calculators sometimes give slightly different inverses?
Most use floating-point arithmetic, so 1/3 becomes 0.333333333333 and errors accumulate during elimination. On nearly singular matrices this can produce visibly wrong answers, or a tiny non-zero determinant where the exact value is 0. This calculator keeps every entry as an exact fraction, so its answers can be checked by multiplying back and getting exactly the identity.
What is the rank of a matrix?
The number of linearly independent rows, which equals the number of pivots (leading 1s) in its reduced row echelon form. A square n×n matrix is invertible exactly when its rank is n. In a system of equations the rank tells you how many of the equations carry new information.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.