1. Home
  2. Calculate
  3. Matrix Calculator

Matrix Calculator

Matrix arithmetic, determinant and inverse, computed exactly.

Runs in your browser · No upload
One row per line. Separate numbers with spaces or commas; decimals and fractions (3/4) work. Up to 5×5.
One row per line. Separate numbers with spaces or commas; decimals and fractions (3/4) work. Up to 5×5.
Result (2 × 2 matrix)
Result
Col 1Col 2
2536
2028
All arithmetic is exact with fractions; decimals are rounded to 6 places only for display.

How to use

  1. Pick an operation above. Add, subtract and multiply use two matrices (A and B); transpose, determinant and inverse use A alone.
  2. Type one row per line. Separate numbers with spaces or commas, or paste straight from a spreadsheet. Decimals (0.5) and fractions (3/4) work too, up to 5×5.
  3. The result appears as a table, and you can switch between decimals and fractions. The copy button puts tab-separated text on your clipboard so it pastes cleanly into a spreadsheet.

Rules for each operation

Operation Requirement How it works
A + B, A − B Same size Add or subtract entries in the same position
A × B Columns of A = rows of B Entry (i, j) is the sum of products of row i of A and column j of B
Aᵀ None Swap rows and columns (m×n becomes n×m)
Determinant |A| Square matrix Gaussian elimination, flipping the sign for each row swap
Inverse A⁻¹ Square, determinant not 0 Gauss-Jordan elimination turns [A | I] into [I | A⁻¹]

Order matters in multiplication. A × B and B × A usually differ, and with non-square shapes one of them may not exist at all.

Examples

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

Operation Result
A × B [[25, 36], [20, 28]]
|A| 4 × 6 − 7 × 2 = 10
A⁻¹ [[0.6, −0.7], [−0.2, 0.4]] (as fractions 3/5, −7/10, −1/5, 2/5)
Determinant of [[6, 1, 1], [4, −2, 5], [2, 8, 7]] −306

For a 2×2 matrix [[a, b], [c, d]] the inverse is 1 ÷ (ad − bc) × [[d, −b], [−c, a]]. For the A above that is 1 ÷ 10 × [[6, −7], [−2, 4]], the same answer.

Exact arithmetic

Every decimal and fraction you type is converted to an exact fraction before the calculation. That avoids floating-point drift such as 0.1 + 0.2 = 0.30000000000000004, so a matrix whose determinant should be exactly 0 does not show up as 0.0000001. Decimals are rounded to 6 places only when displayed, and the fractions view shows the reduced exact value.

Things to keep in mind

  • A determinant of 0 means no inverse exists. This happens when one row is a multiple of another or a sum of other rows, like [[1, 2], [2, 4]].
  • Each number can have up to 15 digits. Exponent notation such as 1e3 is not accepted; type 1000.
  • Matrices larger than 5×5 are not calculated.
  • To solve a linear system you can compute A⁻¹ × b by entering b as a one-column matrix and using multiply.

For expressions with functions use the scientific calculator, and for arithmetic on fractions the fraction calculator.

FAQ

Why does it say the matrices cannot be multiplied?

The number of columns in A must equal the number of rows in B. A 2×3 matrix multiplies with a 3×2 or 3×4 matrix, but not with another 2×3.

What does “no inverse” mean?

The matrix is singular, meaning its determinant is 0. As a system of equations, it has either no solution or infinitely many.

Is my input stored anywhere?

No. Your matrices are processed in your browser only and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.