Matrix Calculator

Perform matrix operations: addition, subtraction, multiplication, transpose, determinant, and inverse with step-by-step solutions.

For learning and homework help — verify critical calculations independently.

Reviewed by CalculatorDrive Math Editorial Board · Last updated

Calculator

×

Enter values separated by commas, rows by newlines

Select an operation and enter matrix values to perform matrix calculations with step-by-step solutions.

The short answer

A matrix is a rectangular grid of numbers. Adding or subtracting matrices works entry by entry, but multiplying two matrices combines rows of the first with columns of the second — nothing like regular multiplication. Two matrices can only be multiplied when the first matrix's number of columns matches the second matrix's number of rows.

Key takeaways

  • Matrix multiplication is not commutative — A × B usually doesn't equal B × A, and one order might not even be defined.
  • A matrix only has an inverse if it's square and its determinant is nonzero; a zero determinant means the matrix is "singular" and can't be inverted.
  • Multiplying a matrix by the identity matrix leaves it unchanged — the matrix equivalent of multiplying a number by 1.
  • The determinant of a 2×2 matrix [[a,b],[c,d]] is ad − bc — a single number that reveals whether the matrix can be inverted.

2×2 determinant and inverse formulas

det([[a,b],[c,d]]) = ad − bc

inverse = (1/det) × [[d,−b],[−c,a]]

If ad − bc equals 0, the matrix has no inverse — dividing by a determinant of 0 is undefined, just like dividing a number by 0.

Worked example: multiplying two 2×2 matrices

A = [[1,2],[3,4]] and B = [[5,6],[7,8]]:

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

B × A = [[5×1+6×3, 5×2+6×4], [7×1+8×3, 7×2+8×4]] = [[23,34],[31,46]]

A × B and B × A land on completely different matrices — concrete proof that matrix multiplication doesn't commute the way ordinary number multiplication does.

When matrix operations are undefined

Operation Requirement
Addition / subtractionBoth matrices must have identical dimensions
Multiplication (A × B)A's column count must equal B's row count
InverseMatrix must be square with a nonzero determinant

Common mistakes to avoid

  • Assuming A × B equals B × A the way it would for ordinary numbers — order changes the result, and sometimes only one order is even defined.
  • Trying to add or subtract matrices with different dimensions — both matrices need identical row and column counts.
  • Attempting to invert a non-square matrix, or one whose determinant is 0 — both cases have no valid inverse.
  • Confusing transpose (flip rows and columns) with inverse (an entirely different operation that undoes multiplication) — they solve different problems.

Frequently Asked Questions

What is a matrix?

A matrix is a rectangular array of numbers arranged in rows and columns. Matrices represent linear transformations, systems of equations, and data tables.

When can you multiply two matrices?

Matrix A (m×n) times B (n×p) is defined only when A's columns match B's rows. The result is m×p.

What is a matrix determinant used for?

The determinant tells whether a square matrix is invertible (nonzero determinant) and measures how the transformation scales area or volume.

What is an identity matrix?

The identity matrix has ones on the diagonal and zeros elsewhere. Multiplying any compatible matrix by the identity leaves it unchanged, like multiplying by 1.

How do I use this matrix calculator?

Enter matrix values, choose an operation such as add, multiply, determinant, or inverse, and click Calculate to see the result.

Why isn't matrix multiplication commutative?

Unlike regular number multiplication, A × B usually does not equal B × A for matrices — order matters. Beyond that, A × B might be defined while B × A isn't, or the two products can even come out as different sizes, since matrix multiplication requires the first matrix's column count to match the second matrix's row count.

More math calculators