Skip to content
Toolora

Matrix Calculator

Work with matrices up to 4×4 — addition, subtraction, multiplication, transpose, determinant and inverse — with clear messages when an operation is not defined.

Student Runs in your browser Works offline
Loading tool…

How it works

Each operation has its own rule about dimensions, and most mistakes are dimension mistakes. Addition and subtraction need identical shapes. Multiplication needs the columns of A to match the rows of B, and the result takes A's rows and B's columns — so A × B and B × A are usually different, and often only one of them is even defined.

The determinant and inverse exist only for square matrices, and the inverse additionally requires a non-zero determinant. A zero determinant means the matrix is singular: its rows are linearly dependent and no inverse exists.

The formula

Multiplication

(AB)ᵢⱼ = Σₖ Aᵢₖ × Bₖⱼ

2×2 determinant

det = ad − bc

Inverse

A⁻¹ = adj(A) ÷ det(A), defined only when det(A) ≠ 0

Transpose

(Aᵀ)ᵢⱼ = Aⱼᵢ

Worked examples

ScenarioWorkingResult
[[2,1],[1,3]] × [[1,0],[4,2]]Row by column[[6,2],[13,6]]
det [[2,1],[1,3]]2×3 − 1×15
A 2×3 times a 2×23 columns vs 2 rowsNot defined — the tool says why

When you'd use it

  • Checking linear algebra homework
  • Solving a system of equations with an inverse
  • Applying a transformation matrix in graphics work
  • Testing whether a matrix is singular

Common questions

Why can't I multiply these two matrices?

The number of columns in the first must equal the number of rows in the second. A 2×3 can multiply a 3×2, but not a 2×2. The tool names the mismatch rather than failing silently.

Is AB the same as BA?

Almost never. Matrix multiplication is not commutative — the order changes the result, and often only one order is even defined. This is one of the most common sources of lost marks.

Why does my matrix have no inverse?

Its determinant is zero, which makes it singular — the rows are linearly dependent, so the transformation it represents cannot be undone. Only square matrices with a non-zero determinant are invertible.