Matrix Calculator

Enter one or two matrices and add, subtract, multiply, transpose, invert, raise to a power or find the determinant, with exact fraction answers.

Matrix A

×
Power of
Multiply by

Matrix B

×
Power of
Multiply by

How to use the calculator

Set the number of rows and columns for each matrix (up to 10 × 10), type the numbers into the boxes, then press an operation. The buttons under each matrix work on that matrix alone: transpose, determinant, inverse, rank, trace and reduced row echelon form (RREF), plus raising it to a power or multiplying every entry by a number. The buttons in the middle combine the two matrices. Entries can be whole numbers, decimals or fractions such as 1/3, and the answers are worked out exactly, so you never see a rounding error where a clean fraction exists.

Adding, subtracting and multiplying

You can only add or subtract matrices of the same size, and you do it entry by entry. Multiplication is different: A × B needs the number of columns of A to equal the number of rows of B, and each entry of the answer is a row of A multiplied term by term with a column of B and added up. With A = [1 2; 3 4] and B = [5 6; 7 8], the top-left entry of AB is 1×5 + 2×7 = 19, and the whole product is [19 22; 43 50]. Order matters: B × A gives [23 34; 31 46], a different matrix, so always check which one you need.

Determinant and inverse

The determinant is a single number that tells you a lot about a square matrix. For a 2 × 2 matrix [a b; c d] it is ad − bc, so [1 2; 3 4] has a determinant of (1)(4) − (2)(3) = −2. A matrix has an inverse only when its determinant is not zero. For A = [4 7; 2 6] the determinant is 10, and the inverse is [3/5 −7/10; −1/5 2/5]. Multiply the two together and you get the identity matrix. If the determinant is zero, the matrix is called singular and there is no inverse, and the calculator tells you so. For 2 × 2 and 3 × 3 matrices it also writes out the working.

Solving a system of equations with the inverse

A pair of equations such as 4x + 7y = 15 and 2x + 6y = 10 can be written as A · v = b with A = [4 7; 2 6] and b = [15; 10]. Multiply both sides by the inverse and v = A−1b. Using the inverse above gives x = (3/5)(15) − (7/10)(10) = 2 and y = (−1/5)(15) + (2/5)(10) = 1. You can check it: 4(2) + 7(1) = 15 and 2(2) + 6(1) = 10. Put b in as a second matrix B with one column and multiply A−1 by it. For a single equation with one unknown squared, the Quadratic Formula Calculator is faster.

Powers, rank and the other buttons

Raising a square matrix to a power multiplies it by itself, and a negative power uses the inverse. A famous example is [1 1; 1 0]. Its tenth power is [89 55; 55 34], and those numbers are Fibonacci numbers, which you can explore in the Number Sequence Calculator. The rank counts how many rows are truly independent: [1 2; 2 4] has rank 1, because the second row is just twice the first, and its determinant is 0. The trace is the sum of the diagonal entries, and RREF is the form you reach by row reduction, which shows the pivots and tells you whether a system has one solution, none or many.

Where matrices turn up, and where to go next

Matrices describe rotations and scaling in computer graphics, the transitions in probability models, networks of connections, and the data tables behind statistics. The determinant of a 2 × 2 matrix is also the signed area of the parallelogram its two rows describe, so half its absolute value is the area of a triangle, which you can cross-check with the Triangle Calculator. If your answers are fractions you would like to simplify or convert, use the Fraction Calculator, and if the entries get very large the Big Number Calculator keeps all the digits.

Quick check on any inverse: multiply the matrix by its inverse. If you do not get the identity matrix (ones on the diagonal, zeros elsewhere), there is a typo in one of the entries.

Common questions

How do you multiply two matrices?

Multiply each row of the first matrix by each column of the second, adding the products. This works only when the number of columns of the first equals the number of rows of the second.

When does a matrix have an inverse?

Only when it is square and its determinant is not zero. A matrix with a zero determinant is called singular.

What is the determinant of a 2×2 matrix?

For [a b; c d] it is ad − bc.

What does the rank of a matrix mean?

It is the number of linearly independent rows (or columns), which is also the number of pivots in the reduced row echelon form.

Can I use fractions and decimals?

Yes. Type entries as whole numbers, decimals or fractions like 3/4. The calculator works exactly and can show the answers as fractions or as decimals.

More Math Calculators

Pick another tool to jump straight to it.