Skip to content
Popular Calculators
Browse Math calculators

Matrix Calculator

Add, subtract and multiply matrices, or find the determinant, inverse and transpose of a 2×2 or 3×3, with the working shown.

What do you want to work out?
Matrix size

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

About the Matrix Calculator

A matrix is a grid of numbers, and on the face of it that is all it is. What makes matrices worth a branch of mathematics is what they do: a matrix is a recipe for transforming space — stretching it, rotating it, shearing it, flattening it.

Multiply a point by a matrix and it moves somewhere else. Multiply every point and the whole plane deforms in a consistent way. Every rotation on a screen, every perspective in a 3D scene, every step of a neural network is a matrix doing exactly that.

This calculator adds, subtracts and multiplies 2×2 and 3×3 matrices, and finds the determinant, inverse and transpose — with the working shown and every result checked.

How to Use the Matrix Calculator

Choose the operation and the size, then enter the matrices with one row per line, values separated by spaces or commas:

  1 2
  3 4

Commas, extra spaces, negatives and decimals are all fine. Addition, subtraction and multiplication need a second matrix; the others work on matrix A alone.

Addition and Multiplication Are Nothing Alike

Addition is entry by entry. Matching positions combine and nothing moves:

  [1 2]   [5 6]   [ 6  8]
  [3 4] + [7 8] = [10 12]

Straightforward, and it requires both matrices to be the same size, because every entry needs a partner.

Multiplication is not. Each entry of the result comes from pairing a row of the first matrix with a column of the second, multiplying term by term and adding:

  [1 2]   [5 6]   [19 22]
  [3 4] × [7 8] = [43 50]

  top-left:  (1×5) + (2×7) = 5 + 14 = 19
  top-right: (1×6) + (2×8) = 6 + 16 = 22

That definition looks arbitrary until you know what it is for: it is exactly what you need so that multiplying by A then by B is the same as multiplying by the single matrix BA. Matrix multiplication is the composition of transformations, and the row-times-column rule is what makes that work.

Order matters

  A×B = [19 22]        B×A = [23 34]
        [43 50]              [31 46]

Different matrices. In ordinary arithmetic 3 × 5 and 5 × 3 are the same; with matrices they usually are not, and this is the first real surprise in linear algebra.

It makes sense once you think of them as actions: rotating then stretching does not generally give the same result as stretching then rotating. This calculator computes both and says whether they happen to agree.

The Determinant

One number that captures what a matrix does to size.

  2×2:  det = ad − bc

  [1 2]
  [3 4]  →  (1×4) − (2×3) = 4 − 6 = −2

What it means geometrically: the two rows are arrows from the origin, and the determinant is the area of the parallelogram they span. So:

  • det = 2 — areas double
  • det = 1 — areas are preserved, as with a pure rotation
  • det = −3 — areas triple and the space is flipped over
  • det = 0 — areas collapse to nothing

For a 3×3 it is volume rather than area, and the calculation expands along the first row with alternating signs:

  det = a(ei − fh) − b(di − fg) + c(dh − eg)

Each term is an entry multiplied by the 2×2 determinant left when its row and column are crossed out. The plus-minus-plus pattern is not decoration; it is what keeps the result consistent.

Why a Zero Determinant Has No Inverse

This is the part worth understanding properly, because "you can't divide by zero" is a true but unsatisfying answer.

A determinant of zero means the transformation flattens space. A 2×2 with det = 0 squashes the whole plane onto a single line; a 3×3 squashes 3D onto a plane or a line.

Once that has happened, information is gone. Many different starting points land on the same result, so if you are told where a point ended up, there is no way to say where it came from. The transformation cannot be undone — not because the arithmetic is awkward, but because the answer genuinely is not unique.

Such a matrix is called singular. This calculator says so, and says why, rather than dividing by zero and printing a grid of infinities.

  [1 2]
  [2 4]   det = (1×4) − (2×2) = 0

The second row is twice the first, so both rows point along the same line and enclose no area at all. Any two rows that are multiples of each other give a zero determinant.

The Inverse

The matrix that undoes another. A × A⁻¹ gives the identity — ones on the diagonal, zeros elsewhere — which is the matrix that changes nothing, playing the same role that 1 plays in ordinary arithmetic.

For a 2×2 there is a genuine shortcut: swap the two diagonal entries, negate the other two, and divide everything by the determinant.

  [1 2]⁻¹      1  [ 4 −2]     [  −2    1 ]
  [3 4]    =  ───  [−3  1]  =  [ 1.5 −0.5]
              −2

Check it:

  [1 2]   [  −2    1 ]   [1 0]
  [3 4] × [ 1.5 −0.5] = [0 1]   ✓

That check is not optional decoration — it is how you know the answer is right, and this calculator performs it on every inverse it produces.

For a 3×3 the method is the adjugate: replace each entry with its signed minor, transpose the result, and divide by the determinant. More arithmetic, same idea.

The Transpose

Reflect the matrix along its main diagonal — rows become columns:

  [1 2]ᵀ   [1 3]
  [3 4]  = [2 4]

The diagonal stays put and everything else swaps across it. Transposing twice returns the original, and the determinant never changes.

A matrix that equals its own transpose is symmetric, which turns up constantly in statistics — a covariance matrix is always symmetric, because the relationship between A and B is the same as between B and A.

Step-by-Step Example

Multiplying.

  [2 0]   [1 3]
  [1 3] × [4 2]

  row 1 × col 1:  (2×1) + (0×4) = 2
  row 1 × col 2:  (2×3) + (0×2) = 6
  row 2 × col 1:  (1×1) + (3×4) = 13
  row 2 × col 2:  (1×3) + (3×2) = 9

  = [ 2  6]
    [13  9]

Determinant and inverse.

  [4 7]
  [2 6]

  det = (4×6) − (7×2) = 24 − 14 = 10

  inverse = 1/10 × [ 6 −7]  =  [ 0.6 −0.7]
                   [−2  4]     [−0.2  0.4]

  Check: [4 7] × [ 0.6 −0.7] = [1 0]  ✓
         [2 6]   [−0.2  0.4]   [0 1]

Understanding Your Result

The result is the matrix produced, or the determinant as a single number.

The detail explains how it was built — for multiplication, it shows the top-left entry being assembled from a row and a column.

The determinant appears on every result, with the relationships that hold: det(A×B) = det(A) × det(B), and det(A⁻¹) = 1 ÷ det(A).

The properties note whether the matrix is symmetric, singular, or the identity, and give its trace — the diagonal added up, which turns out to matter in eigenvalue work.

The check is the verification. For an inverse it multiplies back to the identity. For multiplication it shows B×A so you can see whether order mattered.

When Should You Use This Calculator?

Linear algebra coursework. Determinants, inverses and multiplication are the core early exercises.

Solving simultaneous equations. A system can be written as a matrix equation, and the inverse solves it in one step — the same ground as the system of equations calculator, approached differently.

Computer graphics. Every rotation, scale, translation and projection is a matrix, and combining them means multiplying them.

Statistics. Covariance matrices, regression, and principal component analysis are matrix operations throughout.

Engineering. Structural analysis, circuit networks and control systems all reduce to matrices.

Machine learning. A neural network layer is a matrix multiplication followed by a simple function, repeated.

Cryptography. Some classical ciphers use matrix multiplication, with decryption requiring the inverse — which is why the determinant must be non-zero.

Common Mistakes

Multiplying entry by entry. That is addition's rule. Multiplication pairs rows with columns, and the two give completely different answers.

Assuming A×B equals B×A. It usually does not. Always keep the order the problem gave you.

Forgetting to divide by the determinant. The adjugate is not the inverse until every entry has been divided.

Getting the 2×2 shortcut wrong. Swap a and d; negate b and c. Negating all four, or swapping the wrong pair, is a common slip.

Treating a zero determinant as an arithmetic error. It is a real answer, and it means no inverse exists.

Losing the alternating signs in a 3×3. Plus, minus, plus. Dropping the minus is the most frequent 3×3 error.

Adding matrices of different sizes. It cannot be done — every entry needs a partner.

Skipping the check. Multiply an inverse back against the original. If it is not the identity, something went wrong, and it takes seconds to find out.

Frequently Asked Questions

Why is matrix multiplication not commutative?

Because each entry comes from pairing a row of the first matrix with a column of the second, and swapping the order pairs different things together. A times B and B times A are usually different matrices entirely, which is unlike ordinary multiplication and is one of the first surprises in linear algebra.

What does the determinant tell me?

How much the matrix scales area or volume, and whether it can be undone. A determinant of 2 doubles areas; a negative one flips orientation as well. A determinant of zero means the transformation flattens space onto a line or a point, and nothing flattened can be unflattened.

Why does a zero determinant mean there is no inverse?

Because the inverse divides by the determinant, and because the transformation has genuinely lost information. Two different starting points can be squashed onto the same result, so there is no way to work backwards to a single answer. Such a matrix is called singular.

What is the transpose for?

It reflects the matrix along its main diagonal, turning rows into columns. It appears throughout statistics and geometry, and a matrix that equals its own transpose is called symmetric, which is a property with useful consequences.

What does the identity matrix do?

Nothing, which is the point. It has ones along the diagonal and zeros elsewhere, and multiplying by it leaves any matrix unchanged. It plays the role that 1 plays in ordinary arithmetic, and a matrix times its inverse gives exactly the identity.

Last reviewed September 18, 2026 by the CalculatorPeak editorial team.