Math & ScienceUp to 8×8

Matrix Calculator

Paste matrices as rows of numbers, one row per line. The calculator checks the dimensions agree before it computes, because a dimension mismatch is the mistake that produces most wrong matrix answers.

Matrices

One row per line, values separated by spaces or commas.

One row per line
Needed for +, − and ×
Scalar mode only
RESULT
Dimensions of A
Dimensions of B
Determinant of A
Rank of A
Trace of A
Invertible?

Dimensions decide what is possible

Addition and subtraction need identical dimensions — every entry pairs with exactly one other. Multiplication needs the inner dimensions to match: an m×n times an n×p gives an m×p. If the columns of A do not equal the rows of B, the product simply does not exist, and the calculator says so rather than returning something plausible-looking.

Matrix multiplication is not commutative

AB and BA are usually different matrices, and often only one of them is even defined. This is not a quirk — it is the whole point. Matrices represent transformations, and rotating then stretching is genuinely not the same as stretching then rotating. Treating matrix products like numbers is the most common source of wrong answers in linear algebra.

What the determinant tells you

The determinant is the factor by which the transformation scales area (in 2D) or volume (in 3D). A determinant of 2 doubles area; a determinant of −1 preserves area but flips orientation. A determinant of zero means the transformation collapses space into a lower dimension — information is destroyed, the mapping cannot be undone, and the matrix has no inverse. That single number answers the invertibility question outright.

Inverse, rank and singular matrices

The inverse undoes the transformation: AA⁻¹ = I. It exists only when the determinant is non-zero. The rank counts how many dimensions survive the transformation — a 3×3 matrix of rank 2 flattens 3D space onto a plane. Rank below the full size and determinant zero are the same condition stated two ways, and both mean the system of equations the matrix represents has either no solution or infinitely many.

This calculator uses Gaussian elimination with partial pivoting, which is numerically stable and is what production linear algebra libraries do. Near-singular matrices are flagged, because a determinant of 1×10⁻¹⁵ is zero for every practical purpose even though floating point reports it as non-zero.

Frequently Asked Questions

Why can I not multiply my two matrices?
The number of columns in A must equal the number of rows in B. A 2×3 can multiply a 3×4 to give a 2×4, but a 2×3 cannot multiply a 2×3. The dimension fields above show both so the mismatch is visible.
What does a determinant of zero mean?
The matrix is singular: it collapses space into fewer dimensions, so it cannot be inverted and the linear system it represents has either no solution or infinitely many rather than exactly one.
Is AB the same as BA?
Almost never. Matrix multiplication is not commutative, and frequently only one of the two products is even defined. The order you write them in changes the result.
How large a matrix can this handle?
Up to 8×8, which covers essentially all hand-worked problems. Beyond that, rounding in floating-point arithmetic starts to matter more than the algorithm, and a dedicated numerical library is the right tool.
Where these numbers come from

Sources

Official publications only. Links open the original document in a new tab.