Matrix Calculator
Add, subtract, multiply, transpose matrices up to 5×5, or find the determinant of a square matrix — instant results as you type.
1,161 views
How It Works
Pick the size of Matrix A (and Matrix B, when the operation needs two matrices), type in the values, and choose an operation — addition, subtraction, multiplication, transpose, or determinant. Addition and subtraction simply combine matching positions and need identical dimensions on both sides. Transpose flips a matrix over its diagonal, turning rows into columns.
The determinant is computed by recursive cofactor expansion. For a 2×2 matrix [[a,b],[c,d]] it is just det = ad − bc. For anything larger, the calculator picks a row (or column), and for each entry multiplies it by the determinant of the smaller "minor" matrix left after deleting that entry's row and column, alternating + and − signs along the way, then sums the results. A 3×3 example: for A = [[2,0,1],[1,3,2],[0,1,1]], expanding along the first row gives det = 2×(3×1−2×1) − 0×(1×1−2×0) + 1×(1×1−3×0) = 2×1 − 0 + 1×1 = 3. The same recursive idea scales down to 2×2 minors no matter how large the matrix, up to the 5×5 limit supported here. A determinant of exactly zero means the matrix is singular — it has no inverse, because the system of equations it represents does not have a single unique solution.
What to Know
Matrix multiplication is not the same operation as multiplying ordinary numbers. Each entry of A×B is the dot product of a row from A with a column from B — multiply corresponding entries and add them up. This is why the dimensions must line up: A's column count must equal B's row count, and the result takes A's row count and B's column count. It also explains why matrix multiplication is generally not commutative: A×B usually does not equal B×A, and in fact B×A may not even be defined if the dimensions don't permit it in reverse.
- Addition and subtraction: both matrices must share the exact same dimensions, entry by entry.
- Multiplication: the inner dimensions must match (A's columns = B's rows); order changes the result.
- Determinant and inverse: only defined for square matrices; a zero determinant means no inverse exists.
- Transpose: works on any rectangular matrix, no dimension restrictions.
Frequently Asked Questions
Why can't I multiply my matrices?
Matrix multiplication A×B requires the number of columns in A to equal the number of rows in B, because each result entry is a dot product between a row of A and a column of B. Resize one of the matrices so the dimensions line up.
Does the determinant work for non-square matrices?
No — a determinant is only defined for square matrices (same number of rows and columns), since it measures how the matrix scales space, which only makes sense when input and output dimensions match. Resize Matrix A to a square shape first.
What size matrices are supported?
Up to 5×5 for both matrices — large enough for most coursework and quick checks, small enough that cofactor expansion stays exact and instant in the browser.
Why is A×B usually different from B×A?
Because each entry is built from a row of the first matrix and a column of the second — swapping the order changes which rows pair with which columns entirely. Only in special cases (like one matrix being the identity) do the two products match.
What does a zero determinant actually mean?
It means the matrix is singular: it has no inverse, and the linear system it represents either has no solution or infinitely many. Geometrically, a zero determinant means the matrix squashes space into a lower dimension — a plane onto a line, for example.
Similar Tools
Report a Problem
Matrix Calculator
Comments
No comments yet — be the first to write one!