Free tool
Matrix calculator, exact answers with steps.
Type or paste two matrices up to 6 × 6 and add, subtract, multiply, scale, transpose, find the determinant, inverse, rank, trace or a power, row reduce to RREF, or solve a system of equations. Answers are exact fractions or decimals, and every step and formula is written out. Singular and mismatched matrices get a clear message.
Options
Click a box and paste numbers copied from a spreadsheet. Enter and the arrow keys move between boxes.
Worked out in your browser. Nothing is sent anywhere.
Guide
How to use a matrix calculator, with worked examples.
A matrix calculator does the arithmetic of grids of numbers: adding, multiplying, finding a determinant, inverting, row reducing and solving equations. This one takes matrices up to 6 × 6, keeps every answer as an exact fraction, and writes out each step and the formula behind it, so you can check your homework or see where a number came from. Switch to decimals whenever you want.
How to use the matrix calculator
- Pick the size of Matrix A with the Rows and Columns boxes, then type its numbers. You can type whole numbers, decimals such as 2.5, or fractions such as 3/4. An empty box counts as 0.
- To paste a table from a spreadsheet, click the top left box and paste. The grid grows to fit, up to 6 × 6.
- For a two matrix sum, fill Matrix B the same way. Operations that use one matrix grey B out.
- Choose what to do with the buttons above the grids. The answer and its steps appear under the grids at once.
- Use Use as A or Use as B to carry an answer into the next calculation, Copy result to paste it back into a spreadsheet, or Copy link to share the matrices.
What each operation does
- A + B and A − B need the same size. Each entry is added or subtracted with the entry in the same place.
- A × B needs the columns of A to equal the rows of B. Entry (i, j) is row i of A times column j of B. A 2 × 3 times a 3 × 4 is a 2 × 4. Order matters: A × B and B × A are usually different, so both buttons are there.
- Determinant, inverse, trace and power need a square matrix. A has an inverse only when its determinant is not 0.
- Rank is the number of independent rows, found as the number of pivots after row reduction.
- Row reduce (RREF) shows every swap, scaling and subtraction until each pivot is 1 and alone in its column.
- Solve Ax = b uses Matrix A for the coefficients and the first column of Matrix B as b. It tells you if there is one solution, none or infinitely many.
Worked example: multiply two 2 × 2 matrices
With 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 bottom row is 3·5 + 4·7 = 43 and 3·6 + 4·8 = 50. So A × B = [19 22; 43 50]. Press B × A and you get [23 34; 31 46], which shows the order matters.
Worked example: determinant and inverse
For A = [1 2; 3 4] the determinant is ad − bc = 1·4 − 2·3 = −2. It is not 0, so A has an inverse: (1 ÷ −2) × [4 −2; −3 1] = [−2 1; 3/2 −1/2]. Multiply A by that and the calculator checks you get the identity matrix. For [2 0 1; 1 3 2; 1 1 1] the determinant is 2(3 − 2) − 0 + 1(1 − 3) = 0, so it is singular and the calculator says it has no inverse instead of giving a wrong answer.
Worked example: solve three equations
Take x + y + z = 6, 2y + 5z = −4 and 2x + 5y − z = 27. Put the coefficients in A as [1 1 1; 0 2 5; 2 5 −1] and the right sides in the first column of B as 6, −4, 27. Choose Solve Ax = b. Row reduction gives x = 5, y = 3 and z = −2. Check the first equation: 5 + 3 − 2 = 6.
Matrix power
Aⁿ means A multiplied by itself n times. For A = [1 1; 1 0], A¹⁰ = [89 55; 55 34], whose entries are Fibonacci numbers. A negative power uses the inverse first, so A⁻² = (A⁻¹)². A power of 0 gives the identity matrix.
Common problems
- Sizes do not match. The message tells you the two sizes and what must agree. For a product, check columns of the first against rows of the second.
- A box is not a number. The message names the row and column. Use a point for decimals, not a comma.
- The inverse does not exist. A singular matrix has determinant 0 and rank below its size. The steps show which row turned into zeros.
- Long decimals. Fractions are exact. Switch Show answers as to Decimals and pick the places you need.
For plain fractions use the fraction calculator, for a single sum the scientific calculator, and to draw a function try the graphing calculator.
Questions
Good to know.
How do I multiply matrices?
Each entry of A × B is a row of A times a column of B, added up. The columns of A must equal the rows of B. A 2 × 3 times a 3 × 2 gives a 2 × 2.
How do I find the inverse of a matrix?
Check the matrix is square and its determinant is not 0. Then put it next to the identity matrix and row reduce until the left side is the identity. The right side is the inverse. This calculator does it and shows the steps.
What does a determinant of 0 mean?
The matrix is singular. It has no inverse, its rows are not independent and its rank is below its size.
Can I paste a table from Excel or Google Sheets?
Yes. Copy the cells, click the top left box of a grid and paste. The grid grows to fit, up to 6 × 6.
Why are the answers fractions?
The maths is exact, so 1 divided by 3 stays 1/3 instead of 0.3333. Choose Decimals under Show answers as if you want rounded numbers.
How does Solve Ax = b work?
Matrix A holds the coefficients and the first column of Matrix B is b. The calculator row reduces [A | b] and tells you if there is one solution, none, or infinitely many, with free variables t1, t2 and so on.
What is the biggest matrix I can use?
6 × 6 for each matrix. Powers go from −50 to 50.
Is anything sent anywhere?
No. The numbers stay in your browser, and your last inputs are remembered on this device only.