AI Math Solver

Matrix Calculator with Step-by-Step Solutions

Find determinants, inverses, products, transposes and eigenvalues with exact fractions and a clear explanation of every calculation.

How to use the matrix calculator

  1. Enter the matrix row by row. Use double square brackets, with each row in its own pair of brackets: [[1, 2], [3, 4]]. Two matrices can be joined with *, + or -.
  2. Add the operation if needed. A square matrix on its own gives the determinant. Start with inverse, transpose, eigenvalues or rank for other operations.
  3. Press Solve Now and read the steps. The calculator shows the formula it uses, the intermediate numbers and the final matrix or value, all with exact fractions.

Free Matrix Calculator for Determinants, Inverses and Products

A matrix is a rectangular array of numbers arranged in rows and columns. Matrices are a compact way to store and manipulate many numbers at once, and they sit at the heart of linear algebra. They are used to solve systems of equations, rotate and scale images in computer graphics, describe networks, and run the calculations behind modern statistics and machine learning. For students, the most common tasks are finding a determinant, finding an inverse and multiplying two matrices, and each of these involves several careful steps where a single slip changes the answer.

This matrix calculator does the arithmetic exactly and shows the method. Entries stay as fractions rather than rounded decimals, and each operation is explained with the formula that produced it, so you can follow the calculation and check your own working line by line.

How to enter a matrix

Write the whole matrix inside a pair of square brackets, and each row inside its own pair, separated by commas. For example, the 2×2 matrix with first row 1, 2 and second row 3, 4 is written [[1, 2], [3, 4]]. A 3×3 matrix looks like [[2, 0, 1], [1, 3, 2], [1, 1, 1]].

  • Every row must have the same number of entries.
  • Entries can be integers, decimals, fractions such as 1/2, or simple expressions such as sqrt(2).
  • Symbols are allowed too, so [[a, b], [c, d]] returns the general formula ad − bc.
  • To combine two matrices, write them next to each other with * for multiplication, + for addition or - for subtraction.

The determinant

The determinant is a single number calculated from a square matrix. It tells you whether the matrix can be inverted, how the matrix scales areas or volumes, and whether a system of linear equations has a unique solution. A determinant of zero means the matrix is singular: it squashes space into a lower dimension and has no inverse.

For a 2×2 matrix with entries a, b in the first row and c, d in the second, the determinant is ad − bc. You multiply along the main diagonal, multiply along the other diagonal and subtract. For [[3, 8], [4, 6]], the result is 3·6 − 8·4 = 18 − 32 = −14.

Matrix calculator showing the determinant of a 2 by 2 matrix as ad minus bc
The determinant of a 2×2 matrix is the product of the main diagonal minus the product of the other diagonal.

For a 3×3 matrix, the calculator uses cofactor expansion along the first row. Each entry in that row is multiplied by the determinant of the 2×2 minor left after deleting its row and column, with alternating signs +, −, +. The three products are added to give the determinant. The steps display each minor so you can check every small determinant separately. Larger matrices follow the same idea, and the calculator reports the final value directly.

The inverse of a matrix

The inverse of a square matrix A is the matrix A⁻¹ that gives the identity matrix when multiplied by A. Inverses are used to solve matrix equations: if Ax = b, then x = A⁻¹b. Only matrices with a non-zero determinant have an inverse.

The calculator finds the inverse with the adjugate method, which is the method taught in most courses:

  1. Calculate the determinant. If it is zero, stop: there is no inverse.
  2. Find the matrix of cofactors and transpose it to get the adjugate.
  3. Multiply the adjugate by 1/det(A).

For a 2×2 matrix this becomes a quick rule: swap a and d, change the signs of b and c, and divide every entry by ad − bc. For [[2, 1], [5, 3]], the determinant is 6 − 5 = 1, so the inverse is [[3, -1], [-5, 2]]. You can check the result by multiplying it by the original matrix and confirming that the product is the identity.

Matrix multiplication

Two matrices can be multiplied when the number of columns in the first equals the number of rows in the second. If A is m×n and B is n×p, the product AB is m×p. Each entry of the product is a dot product: take a row from the first matrix and a column from the second, multiply matching entries and add.

For [[1, 2], [3, 4]] * [[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-left is 3·5 + 4·7 = 43 and the bottom-right is 3·6 + 4·8 = 50. For matrices up to 3×3, the calculator writes out each dot product so you can see exactly how every entry was built.

Matrix calculator multiplying two 2 by 2 matrices row by column
Each entry of a matrix product is a row of the first matrix multiplied by a column of the second.

Remember that matrix multiplication is not commutative. In general AB is not equal to BA, and sometimes one product exists while the other does not. Always check the order and the dimensions before you start.

Addition, subtraction and transpose

Matrices of the same size are added or subtracted entry by entry, so [[1, 2], [3, 4]] + [[5, 6], [7, 8]] gives [[6, 8], [10, 12]]. The transpose swaps rows and columns: the first row becomes the first column and so on. A 2×3 matrix becomes 3×2. Transposes appear in the formula for the inverse, in statistics and in the definition of symmetric matrices, which equal their own transpose. Type transpose [[1, 2, 3], [4, 5, 6]] to see it.

Eigenvalues

An eigenvalue λ of a square matrix A is a number for which there is a non-zero vector v with Av = λv. In other words, the matrix only stretches that vector without changing its direction. Eigenvalues are found by solving the characteristic equation det(A − λI) = 0. The calculator forms the characteristic polynomial, factors it when possible and solves for λ. For a diagonal matrix such as [[2, 0], [0, 3]], the eigenvalues are simply the diagonal entries 2 and 3. Eigenvalues describe stability in differential equations, vibration frequencies in engineering and the principal components used in data analysis.

Rank

The rank of a matrix is the number of linearly independent rows, which equals the number of non-zero rows after row reduction. Rank tells you how many genuinely different equations a system contains. Type rank [[1, 2], [2, 4]] and the calculator shows the reduced row echelon form, where the second row becomes zero, so the rank is 1.

Using matrices to solve systems of equations

A system of linear equations can be written as a single matrix equation Ax = b, where A holds the coefficients, x the unknowns and b the constants. For 2x + y = 5 and 5x + 3y = 13, the coefficient matrix is [[2, 1], [5, 3]]. Its determinant is 1, so the system has exactly one solution, and multiplying the inverse by the constants gives x = 2 and y = 1. Cramer's rule is another option for small systems: each unknown equals a ratio of two determinants. If you prefer to solve the equations directly, the Equation Solver uses substitution and shows each step.

Row reduction and Gaussian elimination

Row reduction is the workhorse method of linear algebra. It uses three elementary row operations: swapping two rows, multiplying a row by a non-zero number, and adding a multiple of one row to another. None of these change the solutions of the system the matrix represents. The goal is to reach row echelon form, where each row starts further to the right than the row above, or reduced row echelon form, where each leading entry is 1 and is the only non-zero number in its column.

Gaussian elimination is useful for much more than solving systems. It finds the rank, it reveals whether a matrix is invertible, and applied to the augmented matrix [A | I] it produces the inverse on the right-hand side. For large matrices it is also far faster than cofactor expansion, which grows very quickly with the size of the matrix. When you ask for the rank, the calculator shows the reduced row echelon form so you can compare it with your own elimination.

Special matrices you will meet

  • Identity matrix I: ones on the main diagonal and zeros elsewhere. Multiplying by I leaves any matrix unchanged.
  • Zero matrix: every entry is zero. Adding it changes nothing.
  • Diagonal matrix: non-zero entries only on the main diagonal. Its determinant is the product of the diagonal, and its eigenvalues are the diagonal entries.
  • Triangular matrix: all zeros below or above the main diagonal. Like a diagonal matrix, its determinant is the product of the diagonal entries.
  • Symmetric matrix: equal to its own transpose. Symmetric matrices always have real eigenvalues, which is why they appear in physics and statistics.
  • Orthogonal matrix: its transpose is its inverse. Rotation matrices are orthogonal and have a determinant of 1.

Recognising these shapes lets you skip long calculations. For example, the determinant of [[2, 7, 1], [0, 3, 5], [0, 0, 4]] is simply 2·3·4 = 24, because the matrix is upper triangular.

A geometric picture of the determinant

In two dimensions, a 2×2 matrix transforms the unit square into a parallelogram, and the absolute value of the determinant is the area of that parallelogram. In three dimensions, a 3×3 determinant gives the volume of the transformed unit cube. A negative determinant means the transformation also flips orientation, like a mirror image. A zero determinant means the shape has been flattened into a line or a plane, which is exactly why such a matrix cannot be undone by an inverse.

Properties worth remembering

  • det(AB) = det(A)·det(B), so a product is invertible only if both factors are.
  • Swapping two rows changes the sign of the determinant.
  • A row of zeros, or two equal rows, makes the determinant zero.
  • The determinant of a triangular matrix is the product of its diagonal entries.
  • (AB)⁻¹ = B⁻¹A⁻¹, with the order reversed.
  • (Aᵀ)ᵀ = A and (AB)ᵀ = BᵀAᵀ.

These rules are useful shortcuts in exams and a good way to sanity-check a calculator result. For a deeper treatment, the matrix article on Wikipedia) covers the theory in detail.

Common mistakes with matrices

  • Multiplying entry by entry instead of using rows times columns.
  • Reversing the order of multiplication, since AB and BA are usually different.
  • Forgetting the alternating signs in cofactor expansion.
  • Dividing by the determinant too early or forgetting to transpose the cofactor matrix when finding an inverse.
  • Trying to invert a singular matrix. Check that the determinant is not zero first.
  • Mismatched dimensions when adding or multiplying.

Where matrices are used

Computer graphics use matrices to rotate, scale and project every pixel of a 3D scene onto your screen. Search engines and social networks use them to rank pages and recommend content. Economists use input-output matrices to model industries, engineers use stiffness matrices to analyse structures, and data scientists use them for everything from linear regression to neural networks. A solid grasp of determinants, inverses and multiplication is the foundation for all of these.

Practice problems with answers

Try each problem by hand, then type the matrix into the calculator to check every step.

  1. det [[5, 2], [3, 1]]. Answer: 5 − 6 = −1.
  2. det [[1, 0, 2], [0, 3, 0], [4, 0, 1]]. Answer: −21.
  3. Inverse of [[4, 7], [2, 6]]. Answer: (1/10)·[[6, −7], [−2, 4]].
  4. [[2, 0], [1, 3]] × [[1, 4], [2, 5]]. Answer: [[2, 8], [7, 19]].
  5. Transpose of [[1, 2, 3], [4, 5, 6]]. Answer: [[1, 4], [2, 5], [3, 6]].
  6. Eigenvalues of [[4, 1], [2, 3]]. Answer: λ = 2 and λ = 5.
  7. Rank of [[1, 2, 3], [2, 4, 6], [1, 1, 1]]. Answer: 2.
  8. det [[2, 3], [4, 6]]. Answer: 0, so the matrix has no inverse.

Study tips for matrices

Always write down the dimensions before you start. Many mistakes in multiplication come from trying to combine matrices that do not fit, or from reversing their order. For determinants, look for shortcuts first: a row of zeros, two equal rows or a triangular shape can save you a long calculation. When you find an inverse, check it by multiplying it with the original matrix; the identity matrix is your proof. Finally, keep fractions exact throughout. Converting to decimals in the middle of a calculation introduces rounding errors that grow with every step.

Related tools

Use the Equation Solver for systems of equations written in ordinary form, the Statistics Calculator for summary statistics of a data set, and the main AI Math Solver for anything that mixes topics. The Derivative Calculator and Integral Calculator cover calculus.

Frequently asked questions

How do I type a matrix into the calculator?

Use double square brackets with each row in its own brackets, for example [[1, 2], [3, 4]] for a 2×2 matrix. Separate entries with commas.

Why does my matrix have no inverse?

A matrix has an inverse only if its determinant is not zero. When the determinant is zero, the calculator explains that the matrix is singular and cannot be inverted.

Can the matrix calculator multiply matrices of different sizes?

Yes, as long as the number of columns in the first matrix equals the number of rows in the second. Otherwise the product is not defined and the calculator tells you.

Does it give exact fractions?

Yes. Calculations use exact arithmetic, so inverses and eigenvalues are shown as fractions and roots instead of rounded decimals.

What size of matrix is supported?

Any reasonable size works. Determinants of 2×2 and 3×3 matrices are shown with full cofactor steps, and larger matrices return the result directly.

Is the matrix calculator free?

Yes. It is completely free, needs no account and runs in your browser, so nothing you enter is stored.

Scroll to Top