Matrix Calculator

What do you get when you multiply, add, or invert these matrices?

Enter two matrices and choose an operation to get the exact result. Supports addition, subtraction, multiplication, determinant, inverse, and transpose for up to 3x3 matrices.

Updated July 2026 · How this works

Example calculation — edit any field to use your own numbers

Worth knowing
How It Works
The formula, explained simply

Think of a matrix as a machine that reshapes space. When you multiply a matrix by a vector, you are not just scaling numbers — you are rotating, stretching, and reflecting every point in a geometric space simultaneously. That is why a 2x2 matrix multiplication shows up equally in a graphics renderer rotating a sprite and in an economics model projecting output from inputs.

The determinant is a single number that captures how much a matrix scales area (in 2D) or volume (in 3D). A determinant of 2 means the transformation doubles area. A determinant of -1 means it preserves area but flips orientation. A determinant of 0 means the transformation is irreversible — it collapses the space to a lower dimension and destroys information.

The inverse of a matrix is its undo operation. If A transforms vector x into y, then A-inverse transforms y back into x. This is the mathematical backbone of solving linear systems, computing least-squares fits, and decoding encrypted signals. The inverse only exists when the determinant is nonzero — a non-invertible matrix is one where information was lost and cannot be recovered.

When To Use This
Right tool, right situation

Use this calculator when you need to check matrix arithmetic by hand — during coursework, when debugging a linear algebra routine, or when setting up a small model and wanting to verify that the math works before coding it. It is well-suited for 2x2 and 3x3 problems that arise in 2D/3D geometry, basic circuit analysis, simple economic models, and stats problems involving covariance matrices.

This tool is not appropriate for larger matrices (4x4 and above), sparse matrices, or numerical methods that require iterative solvers. It is also not the right tool when you need symbolic algebra — all inputs are treated as floating-point numbers, so exact fractions like 1/3 will be approximated. For production code, use a library like NumPy or MATLAB.

The tool is particularly useful for a sanity check after computing by hand. Enter your answer as Matrix A and the original as Matrix B, then multiply — if the result is close to the identity matrix, your inverse is correct. You can also verify eigenvector relationships by checking whether Av equals lambda times v for small, concrete examples.

Common Mistakes
Why results sometimes look wrong

Confusing addition rules with multiplication rules. Addition is element-by-element and requires identical matrix sizes. Multiplication is a dot-product operation and requires the inner dimensions to match (columns of A equal rows of B). Many errors come from applying the wrong size rule to the wrong operation. The cause is usually pattern-matching to scalar arithmetic, where the same size rule applies to both. The consequence is either a dimension error or a numerically wrong result that looks plausible.

Assuming the result is square when it may not be. Multiplying a 2x3 matrix by a 3x2 matrix gives a 2x2 result, but multiplying a 3x2 by a 2x3 gives a 3x3. The output shape is always rows-of-A by columns-of-B, not the shape of the inputs. Missing this causes index errors in downstream code that assumed a fixed output size.

Computing the inverse without checking the determinant first. Inverting numerically without confirming a nonzero determinant can return a matrix full of very large floating-point numbers that are not mathematically meaningful. Always treat a determinant below about 1e-10 as effectively zero in floating-point arithmetic — near-singular matrices amplify errors dramatically in any subsequent calculation.

The Math
Worked examples and deeper derivation

For a 2x2 matrix with entries a, b, c, d arranged as rows [a b] and [c d], the determinant is ad minus bc. The inverse is (1 over the determinant) times the matrix [d, -b; -c, a]. This formula shows directly why det = 0 kills the inverse: you would be dividing by zero.

Matrix multiplication for two 2x2 matrices A and B gives a result where each entry (i, j) is the dot product of row i of A with column j of B. This is why the number of columns in A must equal the number of rows in B — the dot product only works when the two vectors being combined are the same length.

For a 3x3 matrix, the determinant expands along the first row using cofactor expansion: a11 times the 2x2 minor formed by removing row 1 and column 1, minus a12 times its minor, plus a13 times its minor. The 3x3 inverse uses the same cofactor matrix, transposed and divided by the determinant — a process called the adjugate method.

Transforming a 2D vector space with matrix multiplication
Matrix A: 2 0; 0 3 — Matrix B: 1 1; 1 0 — Operation: Multiply
The result is [ 2 2 ] / [ 3 0 ], a 2x2 matrix. This represents stretching the x-axis by 2 and the y-axis by 3 — a common operation when applying a linear transformation to a set of basis vectors in graphics or physics simulations.
Checking whether a 3x3 matrix is invertible before solving a linear system
Matrix A: 2 1 3; 1 0 2; 4 2 6 — Operation: Determinant
The determinant comes back as 0, meaning the matrix is singular. Before attempting to solve Ax = b using an inverse, checking the determinant reveals whether a unique solution even exists. A zero determinant means the system either has no solution or infinitely many — the inverse path is a dead end.
Engineering student verifying a covariance matrix transpose
Matrix A: 3 1 2; 1 4 0; 2 0 5 — Operation: Transpose
The transpose returns the identical matrix, confirming it is symmetric. Symmetric matrices arise in covariance matrices, mass matrices in FEA, and many optimization problems. A quick transpose check is a fast sanity test that your matrix construction code is working correctly.
Expert Unlock
The thing most explanations skip

The cofactor method used here for the 3x3 inverse is numerically stable for small exact integers but degrades for matrices with entries spanning several orders of magnitude. The condition number — roughly the ratio of the largest to smallest singular value — determines how much input error gets amplified. A matrix with a determinant close to zero but not zero can still be extremely ill-conditioned and give misleading inverses. For real engineering applications, LU decomposition with partial pivoting is preferred over the adjugate method because it bounds error propagation more tightly.

What do these matrix results actually mean for my problem?

Why does matrix multiplication not match when I swap A and B?
Matrix multiplication is not commutative — A times B almost never equals B times A. The order matters because each output cell is computed as a dot product of a row from A and a column from B. Swapping the inputs changes which row meets which column, producing different numbers or even a differently sized result if the matrices are non-square.
What does a determinant of zero mean for my matrix?
A zero determinant means the matrix is singular — its rows or columns are linearly dependent, so it squashes space into fewer dimensions. Practically, this means you cannot invert it, and any linear system Ax = b using this matrix either has no solution or infinitely many. If you hit a zero determinant while solving a real problem, revisit your model setup.
How do I enter a 3x3 matrix correctly?
Separate values within each row using spaces, and separate rows using semicolons. For example, a 3x3 identity matrix looks like: 1 0 0; 0 1 0; 0 0 1. Every row must have the same number of values, and non-numeric characters other than spaces and semicolons will cause a parse error.

Need something this doesn't cover?

Suggest a tool — we'll build it →