Matrix calculator

Multiply, add, invert and find the determinant of 2×2, 3×3 and 4×4 matrices with exact fractions.

  • 🇺🇸 US federal & state rules

Numbers separated by spaces, rows by ; or a new line. Fractions like 1/2 and decimals work.

Example

A × B

19 22; 43 50

Rows separated by ;

det(A)
−2
rank(A)
2
Trace of A
5

This is an example. Enter your numbers above and press the button to see your own result.

Result text

[ 19  22 ]
[ 43  50 ]

A × B (2×2)

Row 119 22
Row 243 50
  • Order matters in matrix multiplication. AB is usually not equal to BA.
Show the math
Entry (i, j)Row i of A times column j of B, multiplied pairwise and added
Entry (1, 1)1×5 + 2×7 = 19
Entry (2, 1)3×5 + 4×7 = 43

What to do next

How it works

Every entry is kept as an exact fraction. The determinant comes from row reduction, and the inverse of a 3×3 or 4×4 matrix comes from Gauss-Jordan elimination on [A | I]. The steps list each row operation.

Rank is the number of nonzero rows after row reduction. The trace is the sum of the diagonal entries.

Things to keep in mind

Only square matrices up to 4×4 are supported. Matrix multiplication is not commutative, so A × B and B × A usually give different answers.

Frequently asked questions

How do you multiply two matrices?

Each entry of AB is a row of A times a column of B, multiplied pair by pair and added. For [1 2; 3 4] × [5 6; 7 8] the top left entry is 1×5 + 2×7 = 19.

How do you find the determinant of a 2×2 matrix?

For [a b; c d] it is ad - bc. The determinant of [1 2; 3 4] is 1×4 - 2×3 = -2.

When does a matrix have no inverse?

When its determinant is 0. That happens when one row is a multiple of another, as in [1 2; 2 4].

How is the inverse of a 2×2 matrix found?

Swap a and d, change the signs of b and c, and divide by the determinant. The inverse of [1 2; 3 4] is [-2 1; 3/2 -1/2].

Related tools