Skip to content
thecalculatorstudio

Matrix Calculator: Determinant, Inverse, Product and More

Type a matrix with one row per line, choose what to calculate and read the answer in exact fractions. You can enter whole numbers, decimals like 2.5 or fractions like 3/4.

Last reviewed

Determinant of A

-2

Size of A
2 × 2

Exact arithmetic in fractions, so the answers are not rounded. Up to 6 × 6, with entries of at most 12 digits. Decimals shown are rounded to six places.

How to use it

Type a matrix in the box, one row per line, with the entries of a row separated by spaces or commas. Choose what to calculate. The answer appears as a grid, in exact fractions, with a decimal approximation under any entry that is not a whole number. For the operations that need two matrices (A + B, A − B and A × B) a second box appears for B.

The calculator works with matrices up to 6 × 6, and every entry may be a whole number, a decimal such as 2.5 or a fraction such as 3/4. Because the arithmetic is done in fractions, nothing is rounded along the way: the determinant of a matrix of thirds is a fraction of thirds, not a long decimal, and an inverse multiplied back gives exactly the identity.

What each operation means

  • Sum and difference. Add or subtract matching entries. A and B must be the same size.
  • Product A × B. Entry (i, j) of the answer is row i of A times column j of B: the sum of the products of matching entries. A needs as many columns as B has rows. The answer has A’s rows and B’s columns, and the order matters: matrix multiplication is generally not commutative.
  • Transpose. Rows become columns.
  • Trace. The sum of the entries on the main diagonal of a square matrix.
  • Determinant. A single number from a square matrix. For [a b; c d] it is ad − bc. It is zero exactly when the rows are linearly dependent.
  • Inverse. The matrix A⁻¹ with A × A⁻¹ equal to the identity. It exists exactly when the determinant is not zero. For [a b; c d] it is 1 ÷ (ad − bc) times [d −b; −c a].
  • Rank. The number of independent rows, found by row reduction.
  • Row reduced form. The matrix after Gauss-Jordan elimination, with a 1 leading each non-zero row and zeros above and below it.
  • Times a number k, and powers. Multiply every entry by k, or multiply A by itself a whole number of times. A⁰ is the identity.

Worked examples

Take A = [1 2; 3 4] and B = [5 6; 7 8].

Calculation Result
Determinant of A −2
Trace of A 5
A + B [6 8; 10 12]
A × B [19 22; 43 50]
B × A [23 34; 31 46]
A² [7 10; 15 22]
Transpose of A [1 3; 2 4]
Inverse of A [−2 1; 3/2 −1/2]

The product of A and B shows why order matters: A × B and B × A are different. The determinant of A is 1 × 4 − 2 × 3 = −2, which is not zero, so A has an inverse, and 1 ÷ (−2) × [4 −2; −3 1] gives [−2 1; 3/2 −1/2]. Check: the first row of A times the first column of the inverse is 1 × (−2) + 2 × (3/2) = 1.

A matrix of fractions. [1/2 1/3; 1/4 1/5] has determinant 1/2 × 1/5 − 1/3 × 1/4 = 1/10 − 1/12 = 1/60.

A 3 × 3 matrix. [2 −1 0; −1 2 −1; 0 −1 2] has determinant 4 and inverse [3/4 1/2 1/4; 1/2 1 1/2; 1/4 1/2 3/4].

No inverse. [1 2; 2 4] has determinant 1 × 4 − 2 × 2 = 0 and rank 1: its second row is twice the first. The calculator says it has no inverse.

Rank and row reduction. [1 2 3; 4 5 6; 7 8 9] has determinant 0 and rank 2, because the third row is twice the second minus the first. Its row reduced form is [1 0 −1; 0 1 2; 0 0 0].

Common mistakes

  • Multiplying entry by entry. The product of two matrices is not the product of matching entries.
  • Assuming A × B = B × A. It usually does not.
  • Inverting a matrix with determinant zero. There is no inverse, and the calculator says so instead of showing a wrong one.
  • Entering rows of different lengths. Every row must have the same number of entries.
  • Using the wrong sizes. Addition needs equal sizes. A product needs the columns of A to equal the rows of B.

For arithmetic with fractions see the fraction calculator. The quadratic formula calculator and the slope calculator cover other algebra, the statistics calculator summarises data, and the big number calculator handles very large integers exactly.

Frequently asked questions

How do I enter a matrix?

Type one row per line with the entries separated by spaces or commas. For a 2 × 2 matrix, type "1 2" on one line and "3 4" on the next. Entries can be whole numbers, decimals such as 2.5 or fractions such as 3/4.

How is the determinant worked out?

For a 2 × 2 matrix [a b; c d] it is ad − bc, so [1 2; 3 4] has determinant 1 × 4 − 2 × 3 = −2. Larger ones are found by row reduction, which keeps track of sign changes from row swaps. A determinant of 0 means the matrix has no inverse.

When does a matrix have an inverse?

Only when it is square and its determinant is not zero. The inverse of [a b; c d] is 1 ÷ (ad − bc) × [d −b; −c a]. For [1 2; 3 4] that is [−2 1; 3/2 −1/2]. Multiplying a matrix by its inverse gives the identity matrix.

Why can I not multiply some matrices?

A × B needs the number of columns of A to equal the number of rows of B. A 2 × 3 matrix can multiply a 3 × 4 matrix to give a 2 × 4, but not another 2 × 3. The calculator tells you the sizes when they do not match.

Is A × B the same as B × A?

Usually not. Matrix multiplication is generally not commutative. With A = [1 2; 3 4] and B = [5 6; 7 8], A × B = [19 22; 43 50] but B × A = [23 34; 31 46]. Swap the order and the answer changes.

Why are the answers fractions, not decimals?

The calculator works in exact fractions so nothing is rounded along the way. A decimal approximation is shown under each fraction that is not a whole number. An inverse that you multiply back gives exactly the identity, with no tiny errors.

Related calculators

Sources