Matrix Calculator

Add, subtract and multiply matrices, or find the determinant, inverse, transpose and rank, with exact fraction answers.

Enter your matrices

One row per line. Separate the values in a row with spaces or commas. Fractions such as 1/2, decimals and negatives are fine. Up to 10×10.

Show values as

Two matrices

One matrix: pick the matrix, then the operation

How to use the matrix calculator

  1. Type or paste Matrix A and Matrix B, one row per line with the values separated by spaces or commas. Fractions such as 1/2, decimals and negatives all work, and so do brackets like [[1,2],[3,4]]. The limit is 10×10.
  2. For two matrices, press A + B, A - B, A × B or B × A. For one matrix, pick Matrix A or Matrix B, then Determinant, Inverse, Transpose, Rank or Row reduce (RREF). The Scalar k and Power n fields feed the two buttons beside them.
  3. The answer updates as you edit. Choose Decimals or Fractions next to Show values as.
  4. Press Copy result to paste into a spreadsheet, or Use as Matrix A to chain the result into the next step.

How each operation works

All arithmetic uses exact fractions, so a determinant of 0 really is 0, not "close to zero". See matrix multiplication, determinants and matrix inverses for the theory.

Worked example with the default matrices

With A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], the tool shows A × B:

  • 1×5 + 2×7 = 19 and 1×6 + 2×8 = 22
  • 3×5 + 4×7 = 43 and 3×6 + 4×8 = 50
  • Result: [[19, 22], [43, 50]]

Now pick Matrix A and press Determinant: 1×4 - 2×3 = -2. Press Inverse to get 1 ÷ (-2) × [[4, -2], [-3, 1]] = [[-2, 1], [1.5, -0.5]], which Fractions shows as -2, 1, 3/2 and -1/2.

Limits and edge cases

For single-fraction arithmetic use the fraction calculator, and for another common algebra step try the quadratic equation solver.

Frequently asked questions

How do I enter a matrix?

Put one row on each line and separate the values with spaces or commas. For a 2×2 matrix type 1 2, press Enter, then type 3 4. Brackets and semicolons between rows also work.

When does a matrix have no inverse?

When its determinant is 0, which happens when one row is a combination of the others. For [[1, 2], [2, 4]] the determinant is 1×4 - 2×2 = 0, so the matrix is singular.

Can I multiply a 2×3 matrix by a 3×2 matrix?

Yes. The first matrix has 3 columns and the second has 3 rows, so the product exists and is 2×2. A 2×3 matrix times another 2×3 matrix is undefined.

Why is A × B different from B × A?

Matrix multiplication is not commutative. With the default matrices, A × B is [[19, 22], [43, 50]] but B × A is [[23, 34], [31, 46]].

What is the determinant used for?

It tells you whether a matrix is invertible (nonzero) and how much it scales area or volume. For a 2×2 matrix, its absolute value is the area of the parallelogram formed by the columns.

Sources: Wolfram MathWorld, Matrix Multiplication; Wolfram MathWorld, Determinant; Wolfram MathWorld, Matrix Inverse; MIT OpenCourseWare 18.06 Linear Algebra.