MATRIX CALCULATOR

Matrix calculator

Type a matrix, get its determinant, inverse and more.

How do I 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.

How do I find the inverse of a matrix?

For a 2 × 2 matrix, swap a and d, change the signs of b and c, and divide by the determinant: [[4, 7], [2, 6]] has determinant 10, so its inverse is [[0.6, −0.7], [−0.2, 0.4]]. Larger matrices use row reduction, which the calculator does for you.

When does a matrix have no inverse?

When its determinant is 0 — the rows are not independent. [[1, 2], [2, 4]] has no inverse, because the second row is twice the first.

How do I multiply two matrices?

Each entry is a row of A times a column of B, added up. [[1, 2], [3, 4]] × [[5, 6], [7, 8]] = [[19, 22], [43, 50]]. A needs as many columns as B has rows.

How do I type a matrix?

One row per line, numbers separated by spaces or commas. Up to 6 × 6.

Is A × B the same as B × A?

Usually not. Matrix multiplication is not commutative, and one order can exist when the other does not. A 2 × 3 matrix times a 3 × 2 matrix gives a 2 × 2 result ([7, 8], [16, 17] for the matrices [[1, 2, 3], [4, 5, 6]] and [[1, 0], [0, 1], [2, 2]]); reversed, the same two matrices give a 3 × 3 result.

What does the determinant tell me?

Whether the matrix can be inverted (determinant not 0) and, for a 2 × 2 matrix, the factor by which it scales areas — a determinant of −2 doubles areas and flips orientation. A determinant of 0 means the rows or columns are dependent, so a system of equations with that coefficient matrix has no single solution.

Size rules for each operation

Addition needs two matrices of the same size, and it works entry by entry. Multiplication needs the number of columns of A to equal the number of rows of B: an m × r matrix times an r × n matrix is m × n. The transpose swaps rows and columns, so an m × n matrix becomes n × m. The determinant and inverse exist only for square matrices. If the sizes do not fit, the calculator says which dimension disagrees instead of returning a number.

Worked example: a 3 × 3 determinant and inverse

Take A = [2, 1, 3], [0, 4, 1], [1, 0, 2]. Expanding along the first row, det A = 2 × (4 × 2 − 1 × 0) − 1 × (0 × 2 − 1 × 1) + 3 × (0 × 0 − 4 × 1) = 16 + 1 − 12 = 5. Because the determinant is not 0, A has an inverse.

The inverse has the first row [1.6, −0.4, −2.2], the second [0.2, 0.2, −0.4] and the third [−0.8, 0.2, 1.6]. As a check, multiplying A by its inverse returns the identity matrix [1, 0, 0], [0, 1, 0], [0, 0, 1] — ones on the diagonal and zeros elsewhere.

Common mistakes

Multiplying entry by entry is the most common error: the product of two matrices is rows times columns, not a grid of products. Reversing the order is the second; A × B and B × A are different matrices (and for the 2 × 3 and 3 × 2 example above, B × A is 3 × 3 while A × B is 2 × 2).

Do not expect the determinant of a sum to be the sum of the determinants; only products behave that way, det(AB) = det A × det B. Finally, type exactly the same number of values on every row, with spaces or commas between them — a ragged row is rejected, and results are rounded to six decimal places.

Sources: OpenStax, College Algebra 2e, section 7.5 “Matrices and Matrix Operations” (sizes for addition and multiplication, multiplication not commutative). Related: system of equations calculator, vector calculator. The determinant, geometric and product rules are standard linear algebra.