Matrix Calculator

Six operations, two sizes, and the working shown — not just the answer.

Values are rounded to 4 decimal places. Inverting a nearly singular matrix magnifies rounding error, so treat very small entries as noise.

Matrix arithmetic, with the working shown

This calculator handles the two sizes that come up in almost every first linear algebra course and most engineering coursework: 2x2 and 3x3 square matrices. Pick a size, pick an operation — multiply, add, subtract, transpose, determinant or inverse — type the entries and read the answer. Alongside the result you get the determinant where it matters and one line of arithmetic showing how the first entry was produced, because a number you cannot check is a number you cannot learn from.

Worked example: multiplying two 2x2 matrices

Take A = [1 2; 3 4] and B = [5 6; 7 8]. Every entry of the product is a row of A paired against a column of B. The top-left entry uses row 1 of A and column 1 of B: 1x5 + 2x7 = 19. The top-right uses row 1 against column 2: 1x6 + 2x8 = 22. The bottom row repeats the pattern: 3x5 + 4x7 = 43 and 3x6 + 4x8 = 50. So A x B = [19 22; 43 50].

Now swap the order. B x A = [23 34; 31 46] — a completely different matrix. Matrix multiplication is not commutative because each matrix is a transformation, and doing a stretch after a shear is not the same as doing the shear after the stretch. If you are checking homework and your answer is a permutation of the expected one, you probably multiplied in the wrong order.

What the determinant is telling you

For A = [1 2; 3 4] the determinant is ad - bc = 1x4 - 2x3 = -2. Read that as a scale factor: any shape you feed through A comes out with twice the area, and the minus sign means the plane has been flipped over, as if reflected. A determinant of exactly 0 means the matrix has crushed the plane onto a line, so area is gone entirely. In three dimensions the same story runs with volume: a 3x3 determinant of 6 means volumes are multiplied by six, and 0 means space has been flattened onto a plane or a line.

The 2x2 inverse shortcut

For a 2x2 matrix there is a formula worth memorising: swap the diagonal entries, negate the off-diagonal entries, and divide everything by the determinant. For A = [1 2; 3 4] that gives (1/-2) x [4 -2; -3 1] = [-2 1; 1.5 -0.5]. Check it by multiplying: A x A inverse = [1 0; 0 1], the identity. If your check does not produce the identity, the usual culprit is forgetting to negate b and c, or dividing by det before the swap.

3x3 by cofactor expansion

For three by three matrices the tool expands along the first row. With A = [1 2 3; 3 4 5; 6 7 9]: det = 1x(4x9 - 5x7) - 2x(3x9 - 5x6) + 3x(3x7 - 4x6) = 1x1 - 2x(-3) + 3x(-3) = 1 + 6 - 9 = -2. Notice the alternating plus, minus, plus signs — that sign pattern is the single most common source of errors when this is done by hand. The inverse then comes from the adjugate: build the 3x3 matrix of cofactors, transpose it, and divide every entry by the determinant.

Solving a system of equations

Suppose 2x + 3y = 8 and x + 4y = 9. Write the coefficients as A = [2 3; 1 4], with determinant 8 - 3 = 5, so the inverse is (1/5) x [4 -3; -1 2] = [0.8 -0.6; -0.2 0.4]. Multiply that by the constants column [8; 9]: x = 0.8x8 - 0.6x9 = 6.4 - 5.4 = 1, and y = -0.2x8 + 0.4x9 = -1.6 + 3.6 = 2. Substituting back, 2(1) + 3(2) = 8 and 1 + 4(2) = 9, so the solution checks out. In this tool, compute the inverse first, then use the multiply mode with your constants in the first column of matrix B and zeros elsewhere; the first column of the product is your solution.

Limits worth knowing

Results are rounded to four decimal places for readability, which is plenty for coursework but not for numerically delicate work. When the determinant is very close to zero the matrix is ill-conditioned: a tiny change in an input entry can swing the inverse wildly, and floating point rounding gets amplified along with it. In that situation Gaussian elimination with partial pivoting, or a least-squares solver, is the honest tool.

The calculator is deliberately limited to square 2x2 and 3x3 matrices, so rectangular products such as a 2x3 times a 3x2 are out of scope, as are eigenvalues, rank, LU decomposition and systems with more than three unknowns. For those, a computer algebra package or a numerical library is the right next step — but for checking a hand calculation, spotting a sign slip, or seeing why a determinant of zero kills the inverse, everything you need is on this page.

Sources & further reading

Frequently asked questions

Why is matrix multiplication done row by column?

Because a matrix is a recipe for transforming vectors, and multiplying two of them means doing one transformation after the other. Entry (i, j) of the product asks what row i of A does to column j of B, so you pair them term by term and add. That is also why A × B and B × A are usually different: applying a rotation then a stretch is not the same as stretching then rotating.

When does a matrix have no inverse?

Exactly when its determinant is 0. Geometrically the matrix squashes space flat — a 2x2 with det 0 maps the whole plane onto a single line, and a 3x3 maps space onto a plane or a line. Once that information is lost there is no way to undo the map, so no inverse exists. This tool reports that case as a result rather than an input error, because the matrix is perfectly valid — it just is not invertible.

What does the determinant actually measure?

It is the factor by which the matrix scales area (2x2) or volume (3x3). A determinant of 3 means every shape comes out three times bigger; a determinant of 0.5 halves it. A negative determinant means the transformation also flips orientation, like reflecting in a mirror, and the absolute value is still the scale factor.

Can I use this to solve a system of equations?

Yes, for small systems. Write the coefficients as matrix A and the constants as a column, then multiply the inverse of A by that column to get the solution. Compute the inverse here, then use the multiply mode with your constants in the first column of B. For anything bigger than 3x3, or when the determinant is near 0, Gaussian elimination is more accurate than inverting.