What can you calculate with matrices?

A matrix is a grid of numbers in rows and columns. Matrices describe systems of equations, transformations in computer graphics, networks, and data in statistics, and a few operations do most of the work:

  • Addition and subtraction work entry by entry, so both matrices must be the same size.
  • Multiplication A × B needs as many columns in A as rows in B. The result has the rows of A and the columns of B, and A × B is usually not the same as B × A.
  • The determinant of a square matrix is a single number. When it is 0, the matrix has no inverse.
  • The inverse A⁻¹ undoes A: A × A⁻¹ is the identity matrix, with 1s on the diagonal and 0s elsewhere.
  • The transpose Aᵀ turns the rows into columns.
  • A power Aⁿ multiplies A by itself n times. A⁰ is the identity matrix, and a negative power is a power of the inverse.

Tool description

Type or paste matrix A with one row per line and its entries separated by spaces, commas or tabs. Cells copied from a spreadsheet paste as they are, and so do bracketed arrays such as [[1, 2], [3, 4]] or MATLAB's [1 2; 3 4]. Pick an operation: matrix B appears for addition, subtraction and multiplication, and a power field for powers. The result updates as you type.

When every entry is a whole number or a fraction such as 1/2, the arithmetic is exact and the result comes in lowest terms, like 1/3 rather than 0.3333333333. Switch Numbers to Decimals to see the same result as decimals. A decimal entry such as 0.5 makes the whole calculation decimal, rounded to 10 significant digits.

The result shows in a table with its size. Copy it as text, with tabs between the entries, to paste it into a spreadsheet or back into the calculator for the next step, or export it as CSV or JSON. When something doesn't fit, such as matrices of different sizes or a matrix without an inverse, the tool tells you why.

Examples

Operation A B Result
Multiplication [1 2 3; 4 5 6] [7 8; 9 10; 11 12] [58 64; 139 154]
Inverse [1 2; 3 4] [-2 1; 3/2 -1/2]
Determinant [1/2 1/3; 1/4 1/5] 1/60
Power, n = 10 [1 1; 1 0] [89 55; 55 34]
Transpose [1 2 3; 4 5 6] [1 4; 2 5; 3 6]

Features

  • Addition, subtraction, multiplication, determinant, inverse, transpose and powers
  • Exact fractions in lowest terms, or decimals
  • Paste from spreadsheets, brackets or MATLAB notation
  • Copy the result as text, or export it as CSV or JSON
  • Clear messages for sizes that don't fit and matrices without an inverse
  • Runs in your browser, so your numbers never leave your device