Maths Algebra

Matrix calculator

Operation
Matrix A
Matrix B
Result 19 22 43 50
Rows on separate lines, values separated by spaces
Size 2×2
Inner dimensions must match

A × B and B × A are generally different matrices, and often only one of the two is defined at all. A 2×3 times a 3×2 gives a 2×2; the same pair in the other order gives a 3×3, so even when both exist they are different sizes. The inner dimensions have to match and the result takes the outer ones. Non-commutativity is not a quirk of the notation: it is the property that lets a matrix describe a rotation, where two turns applied in the other order leave you facing somewhere else.

Enter matrices one row per line, values separated by spaces. Multiplication needs the columns of A to match the rows of B, and the result takes the outer dimensions. The determinant exists only for a square matrix, and a matrix inverts only when that determinant is non-zero.

How to use the matrix calculator

1 Type each matrix with one row per line and values separated by spaces or commas.
2 Pick the operation from the list.
3 Leave matrix B empty for determinant, inverse and transpose.
4 Read the size row. Nearly every failure here is a dimension that does not line up, and the panel names it.

The determinant has a geometric reading that makes it much less abstract: it is the factor by which the matrix scales area in two dimensions, or volume in three. A determinant of 2 doubles areas, a determinant of −1 reflects without changing size, and a determinant of zero flattens everything onto a line or a point. That flattening is what makes such a matrix impossible to invert, because two different inputs now land on the same output and no rule can send them back where they came from.

Zero is the theory; near-zero is the practice

In theory a matrix inverts if and only if its determinant is non-zero. In floating-point arithmetic that test barely survives contact with real numbers, and this panel shows why in two directions at once.

Put the 4×4 Hilbert matrix in, the classic ill-conditioned example whose entries are 1, 1/2, 1/3 and so on down the diagonals. Ask for its determinant and the answer comes back as 0, because the true value is 1.65 × 10⁻⁷ and the result is reported to six decimal places. Switch the operation to inverse and the same matrix returns 16, −120, 240, −140 across the top row and the rest of the exact integer inverse. It was never singular; its determinant was simply small, and small is not the same property.

It runs the other way as well. Two by two with 10⁻⁷ on the diagonal is a perfectly well-behaved scaling matrix whose inverse is 10⁷ on the diagonal, but its determinant is 10⁻¹⁴, and the panel treats anything under 10⁻¹² in magnitude as singular and declines. Both cases point the same way: the size of a determinant depends on the scale of the entries and says almost nothing on its own. What actually predicts whether an inverse can be trusted is the condition number, the ratio of the largest to the smallest singular value, and a determinant of any size is compatible with a terrible one.

Inverting is usually the wrong move

An inverse is the right thing to look at when you want to understand a transformation, and rarely the right thing to compute when you want to solve Ax = b. Multiplying b by A⁻¹ costs more arithmetic than eliminating directly and loses more precision, and for an ill-conditioned A the explicit inverse concentrates all of that loss into a matrix you then reuse. Elimination on the augmented system, which is what this panel does internally with partial pivoting before discarding the left half, is the shorter and steadier route.

Shapes, and how the panel refuses

Addition and subtraction need identical shapes. Transpose accepts anything and reports the shape it produced. Determinant and inverse both need a square: a non-square matrix comes back as "square matrices only" from the first and as "not invertible" from the second, both of which are true and neither of which is a number. Multiplication is the one with a rule worth memorising, that the inner dimensions must agree and the result takes the outer ones.

Every failure here answers in the result row rather than leaving it blank. Rows of unequal length, a missing second matrix, shapes that cannot be added, a product that does not exist: each returns its reason in the place the answer would have been, so the commonest mistake in linear algebra arrives as a sentence instead of a dash.

What people use it for

  • Linear algebra coursework
  • Solving small systems of simultaneous equations
  • Composing or reversing 2D and 3D transformation matrices
  • Checking a hand calculation before committing to it
  • Seeing whether a matrix is singular
  • Telling whether a system of equations has a unique solution

Questions

One row per line, values separated by spaces or commas. Every row has to have the same length or the panel rejects the whole thing.

Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding