Skip to content
ToolBoxGeniehome

Matrix Calculator

Calculators · Added

Type a matrix one row per line and pick an operation. The determinant and the inverse come from Gaussian elimination with partial pivoting rather than cofactor expansion, and where a matrix is close to singular the result says so instead of returning digits it cannot support.

One row per line, entries separated by spaces or commas. Up to 6×6.

How to use the matrix calculator

  1. 1Choose the operation. Ones needing a second matrix reveal the B field.
  2. 2Type each matrix with one row per line, values separated by spaces or commas. Brackets are ignored, so pasting from code works.
  3. 3Press Calculate.
  4. 4For a determinant, read the rank and trace alongside it — they say more about a singular matrix than the zero does.

Examples

A 2×2 determinant

Input
4 7 / 2 6
Result
10 — the matrix scales area by a factor of 10

A singular matrix

Input
1 2 / 2 4
Result
Determinant 0, rank 1 — no inverse exists, and the matrix collapses the plane onto a line

About the matrix calculator

What the determinant measures

Treat a square matrix as a transformation of space. The determinant is the factor by which it scales volume — area in two dimensions, volume in three. A determinant of 3 triples volume; one of 0.5 halves it.

A negative determinant means the transformation also flips orientation, turning a right-handed set of axes into a left-handed one. And a determinant of zero means volume has gone entirely: the transformation has squashed space flat, which is precisely why it cannot be undone and why no inverse exists.

Pivoting, and why it is not optional

Gaussian elimination divides a row by its pivot at each step. If that pivot happens to be very small, the row is multiplied by a very large number and every rounding error already in it grows to match.

Partial pivoting swaps the largest available entry in the column into the pivot position before dividing, which keeps those multipliers no greater than one. It costs a row swap and it is the difference between an answer good to fifteen digits and one good to five — which is why every serious implementation does it and why this one does too.

Frequently asked questions

Why not use the cofactor method for the determinant?
Because it costs on the order of n! operations against n³ for elimination, and is no more accurate. At 6×6 the difference is already large, and by 10×10 the cofactor expansion would be three and a half million terms. Elimination gives the same answer with the same digits and finishes immediately.
What does a determinant of zero tell me?
That the matrix is singular: it has no inverse, its columns are linearly dependent, and as a transformation it collapses space onto a lower dimension. The rank says how far it collapses — a 3×3 of rank 2 flattens space onto a plane, one of rank 1 onto a line — which is why both figures are shown together.
Why does it warn about being close to singular?
Because in floating-point arithmetic exactly zero almost never happens; a singular matrix produces something like 3.4e−17 instead. Rather than picking a fixed threshold, the elimination compares each pivot against the largest entry the matrix started with, so the judgement scales with the size of the numbers. Where the answer is near that line, an inverse computed from it is mostly rounding noise and the page says so.
Why does AB work but BA fail?
Because matrix multiplication is not commutative and the shapes have to line up. AB exists when A's column count equals B's row count; swapping them asks a different question, which may have a different answer or none at all. A 2×3 times a 3×2 gives a 2×2, while the reverse gives a 3×3.