Free tool · Math and study
Matrix calculator
Enter matrix A (and B for sums and products) and pick an operation. The default pair gives A × B = [[19, 22], [43, 50]] and a determinant of A of -2.
- Free
- No sign-up
- Runs in your browser
| 19 | 22 |
| 43 | 50 |
Facts below describe matrix A.
- Determinant
- -2
- Rank
- 2
- Trace
- 5
How to use the Matrix Calculator
- Pick the Operation. Matrix B appears only when the operation needs two matrices.
- Set the Rows and Columns of A (and B), from 1 to 4.
- Type the entries. Use whole numbers, decimals such as 0.25, or fractions such as 1/4. A blank cell counts as 0.
- Press Calculate. The result grid shows exact fractions, and the facts list the determinant, rank and trace of A.
How do I use a matrix calculator?
Choose an operation, set the size of each matrix and fill in the entries. The result updates as you type. Sums, differences and products need two matrices. Determinant, inverse, transpose and rank use only matrix A, so B is hidden for those.
All the arithmetic is done with exact fractions, not rounded decimals. Typing 0.5 is read as 1/2, and the inverse of [[1, 2], [3, 4]] is shown as [[-2, 1], [3/2, -1/2]] instead of -2.0000000001. A decimal with more than 9 digits after the point is refused, and so are entries such as 1e3, which are not supported.
When the sizes do not fit the operation, the page says exactly why. Adding needs two matrices of the same size, multiplying needs the number of columns of A to equal the number of rows of B, and a determinant or inverse needs a square matrix.
How do you multiply two matrices?
Each entry of the product is a row of A paired with a column of B: multiply the pairs in order and add them. For A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], the top left entry is 1 × 5 + 2 × 7 = 19. The top right is 1 × 6 + 2 × 8 = 22. The full product is [[19, 22], [43, 50]].
Sizes matter. A matrix with 2 rows and 3 columns can be multiplied by one with 3 rows and 2 columns, and the answer has 2 rows and 2 columns. With [[1, 2, 3], [4, 5, 6]] and [[7, 8], [9, 10], [11, 12]] the product is [[58, 64], [139, 154]]. The same two matrices multiplied the other way round give a 3 by 3 result.
The order changes the answer. B × A is not the same as A × B for most pairs, so check which matrix goes on the left. Adding and subtracting are different: they work entry by entry, and A + B always equals B + A.
What do the determinant, inverse and rank tell me?
The determinant of a square matrix is one number that says whether it can be inverted. A determinant of 0 means the rows are not independent, so there is no inverse. For [[1, 2], [3, 4]] the determinant is 1 × 4 − 2 × 3 = -2, so an inverse exists. The rows of [[1, 2], [2, 4]] are multiples of each other, the determinant is 0 and the page reports that no inverse exists.
The rank is the number of independent rows. A square matrix has an inverse exactly when its rank equals its size. The trace is the sum of the diagonal entries and is shown for square matrices only. The table below runs five matrices through the same engine.
| Matrix | Determinant | Rank | Trace | Has an inverse |
|---|---|---|---|---|
| [[1, 2], [3, 4]] | -2 | 2 | 5 | Yes |
| [[1, 2], [2, 4]] | 0 | 1 | 5 | No |
| [[2, 0, 1], [1, 3, 2], [1, 1, 2]] | 6 | 3 | 7 | Yes |
| [[0, 1], [1, 0]] | -1 | 2 | 0 | Yes |
| [[1, 2, 3], [4, 5, 6], [7, 8, 9]] | 0 | 2 | 15 | No |
How do I transpose a matrix and check an inverse?
Transposing swaps rows and columns, so entry (row 1, column 3) moves to (row 3, column 1). The 2 by 3 matrix [[1, 2, 3], [4, 5, 6]] becomes the 3 by 2 matrix [[1, 4], [2, 5], [3, 6]]. A square matrix keeps its determinant when transposed.
To check an inverse, multiply the matrix by it. The product must be the identity matrix, with 1 on the diagonal and 0 elsewhere. Set A to your matrix, B to the inverse and choose A × B. Exact fractions mean the identity comes out exactly, with no 0.9999 left over.
The inverse of a 4 by 4 matrix is a lot of arithmetic by hand, which is where a calculator saves time. The method is Gauss-Jordan elimination: row operations turn the matrix into the identity while the same operations turn an identity matrix into the inverse.
Use it with
- Pythagorean Theorem Calculator: find a missing side.
- Quadratic Equation Solver: roots with steps.
- Fraction Calculator: add, subtract, multiply, divide fractions with steps.
Questions
How do I multiply matrices online?
Set A and B to compatible sizes, choose A × B and press Calculate. For [[1, 2], [3, 4]] times [[5, 6], [7, 8]] the answer is [[19, 22], [43, 50]].
Why does it say my matrix has no inverse?
A matrix has an inverse only when its determinant is not 0. Rows that are multiples or sums of other rows make the determinant 0, as in [[1, 2], [2, 4]].
What is the biggest matrix I can enter?
Up to 4 rows and 4 columns for each matrix.
Can I type fractions?
Yes. Type 1/2 or -3/4, or a decimal such as 0.25. The results stay exact fractions, so 1/3 is not turned into 0.3333.
Why can I not add two matrices of different sizes?
Addition works entry by entry, so every entry of A needs a partner in B. The page tells you both sizes when they do not match.
Are my numbers sent anywhere?
No. Every entry you type is used inside your browser tab only, and nothing leaves it.
The tool's results are computed in your browser by the code on this page; the explanations are checked against the tool's own output.