Matrix Calculator with Step-by-Step Solutions
Compute determinants, inverses, products, transposes, rank and eigenvalues with exact fractions and every step explained.
More math tools
How to use the matrix calculator
- Write the matrix row by row. Use double square brackets, with commas between entries and between rows:
[[1, 2], [3, 4]]. Fractions such as1/2and negative numbers are allowed. - Say what you want. Start with
determinant,inverse,transpose,rankoreigenvalues, or put two matrices on either side of*,+or-to multiply, add or subtract them. - Read the method and the result. The steps show the formula used, such as ad − bc or cofactor expansion, the intermediate products and the final matrix or number in exact form.
Free Matrix Calculator for Determinants, Inverses and Products
A matrix is a rectangular array of numbers arranged in rows and columns. Matrices are the central objects of linear algebra: they represent systems of linear equations, geometric transformations such as rotations and reflections, networks, data tables and much more. This matrix calculator performs the operations you meet in school and first-year university courses and explains each one step by step, using exact fractions rather than rounded decimals so the results match what you would write by hand.
The calculator works with square and rectangular matrices of practical size, checks that the dimensions are compatible before it multiplies or adds, and tells you clearly when an operation is impossible, for example when a matrix has no inverse because its determinant is zero.
Why use this matrix calculator
Matrix calculations are long, and one arithmetic slip in a cofactor or a row operation ruins the whole answer. This matrix calculator does the arithmetic exactly, with fractions instead of rounded decimals, and shows each step: the ad − bc formula, cofactor expansion, the determinant check before an inverse and every row-by-column sum in a product. It covers determinants, inverses, multiplication, transposes, rank and eigenvalues in one tool and warns you clearly when an operation is impossible.
Who the matrix calculator is for
- High school students meeting matrices in further mathematics, A level or Bachillerato courses.
- University students in linear algebra, engineering mathematics, economics and computer science.
- Data science and machine learning learners who want to understand the matrix operations behind their models.
- Teachers and tutors preparing exact answer keys for matrix exercises.
- Engineers and programmers who need a fast exact check of a determinant or inverse.
Benefits of using the matrix calculator
- No arithmetic slips: long sums and signs are computed exactly every time.
- Exact fractions: inverses match what you would write by hand, not rounded decimals.
- Understand the method: cofactor expansion and row-by-column products are written out.
- Know when an inverse exists: the determinant is checked first.
- One tool for every operation: switch between determinant, inverse, product, rank and eigenvalues with a single keyword.
Matrix vocabulary and notation
A matrix with m rows and n columns has size or order m × n. The entry in row i and column j is written aᵢⱼ. A matrix with the same number of rows and columns is square, and its main diagonal runs from the top-left to the bottom-right corner. Some special matrices appear constantly:
- The identity matrix I has 1s on the main diagonal and 0s elsewhere; multiplying by I leaves a matrix unchanged.
- The zero matrix has every entry equal to 0.
- A diagonal matrix has non-zero entries only on the main diagonal, and a triangular matrix has zeros above or below it.
- A symmetric matrix equals its own transpose, so aᵢⱼ = aⱼᵢ.
- A row vector is a 1 × n matrix and a column vector is an n × 1 matrix.
The word matrix was introduced by the English mathematician James Joseph Sylvester in 1850, and his colleague Arthur Cayley developed matrix algebra, including multiplication and inverses, a few years later.
Determinant of a 2×2 matrix
The determinant is a single number computed from a square matrix. For a 2×2 matrix with rows (a, b) and (c, d), the determinant is ad − bc: the product of the main diagonal minus the product of the other diagonal. For [[2, 1], [5, 3]], the determinant is 2·3 − 1·5 = 1.
The determinant has a clear geometric meaning. A 2×2 matrix transforms the unit square into a parallelogram, and the absolute value of the determinant is the area of that parallelogram. A negative sign means the transformation flips orientation, like a mirror image. A determinant of zero means the square is flattened onto a line, so information is lost and the transformation cannot be undone.
Determinants of 3×3 and larger matrices
For larger matrices the calculator uses cofactor expansion, also called Laplace expansion after Pierre-Simon Laplace. Choose a row, usually the first. For each entry, delete its row and column to form a smaller matrix called the minor, compute that minor's determinant, attach a sign from the chessboard pattern + − + and multiply by the entry. The sum of these products is the determinant. A 3×3 determinant becomes three 2×2 determinants, a 4×4 becomes four 3×3 determinants, and so on.
For 3×3 matrices there is also a shortcut known as the rule of Sarrus: add the three products along the diagonals running down to the right and subtract the three products along the diagonals running up to the right. It gives the same answer but does not generalise to 4×4.
Useful properties speed up hand calculations: swapping two rows changes the sign of the determinant, multiplying a row by k multiplies the determinant by k, adding a multiple of one row to another leaves it unchanged, and the determinant of a triangular matrix is the product of its diagonal entries. Also, det(AB) = det(A)·det(B) and det(Aᵀ) = det(A).
Inverse of a matrix
The inverse of a square matrix A is the matrix A⁻¹ such that A·A⁻¹ = A⁻¹·A = I. It exists only when det(A) ≠ 0; a matrix with determinant zero is called singular and has no inverse. For a 2×2 matrix the formula is short: swap a and d, change the signs of b and c, and divide every entry by the determinant. For [[4, 7], [2, 6]], the determinant is 24 − 14 = 10, so the inverse is (1/10)·[[6, −7], [−2, 4]] = [[3/5, −7/10], [−1/5, 2/5]].
For larger matrices the inverse equals the adjugate divided by the determinant, where the adjugate is the transpose of the matrix of cofactors. An equivalent method, often taught for hand calculation, is Gauss–Jordan elimination: write A next to the identity matrix and apply row operations until A becomes I; the identity has then turned into A⁻¹. The calculator shows the determinant check first, so you can see immediately whether an inverse exists.
Matrix multiplication
Two matrices can be multiplied when the number of columns of the first equals the number of rows of the second. An m × n matrix times an n × p matrix gives an m × p matrix. Each entry of the product is the dot product of a row of the first matrix with a column of the second: multiply corresponding 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. The calculator writes each of these sums out.
Matrix multiplication is not commutative: in general AB ≠ BA, and one of the two products may not even be defined. It is associative, (AB)C = A(BC), which is why a chain of transformations can be combined into a single matrix. Addition and subtraction, by contrast, work entry by entry and need matrices of exactly the same size.
Transpose and rank
The transpose Aᵀ turns rows into columns, so an m × n matrix becomes n × m. A useful identity is (AB)ᵀ = BᵀAᵀ, with the order reversed.
The rank of a matrix is the number of linearly independent rows, which always equals the number of linearly independent columns. It tells you how many dimensions the transformation actually reaches. A square n × n matrix has full rank n exactly when its determinant is non-zero. The rank–nullity theorem adds that the rank plus the dimension of the null space equals the number of columns, which explains why a system with a rank-deficient matrix has either no solution or infinitely many.
Eigenvalues and eigenvectors
An eigenvector of a square matrix A is a non-zero vector v whose direction does not change when A acts on it: Av = λv. The scalar λ is the corresponding eigenvalue, the factor by which the vector is stretched or shrunk. Eigenvalues are found from the characteristic equation det(A − λI) = 0. For a 2×2 matrix this is the quadratic λ² − (trace)λ + det = 0, where the trace is the sum of the diagonal entries.
For [[2, 1], [1, 2]], the trace is 4 and the determinant is 3, so λ² − 4λ + 3 = 0 gives λ = 1 and λ = 3, with eigenvectors along (1, −1) and (1, 1). Two quick checks always hold: the eigenvalues add up to the trace and multiply to the determinant. The Cayley–Hamilton theorem adds that every square matrix satisfies its own characteristic equation.
Eigenvalues describe the long-run behaviour of many systems: vibration frequencies in engineering, stability of equilibria in differential equations, principal components in data analysis and the ranking of web pages.
Powers of a matrix and diagonalisation
A square matrix can be multiplied by itself, so A² = A·A and A³ = A·A·A. Powers appear whenever a process repeats, such as population models, Markov chains of weather or customer behaviour, and compound transformations in graphics. Computing a high power directly is slow, but if A has a full set of eigenvectors it can be diagonalised as A = PDP⁻¹, where D is the diagonal matrix of eigenvalues and P holds the eigenvectors as columns. Then Aⁿ = PDⁿP⁻¹, and raising a diagonal matrix to a power only requires raising each diagonal entry to that power. This is also why the largest eigenvalue controls the long-term behaviour of a repeated process.
Row operations and row echelon form
Three elementary row operations are the building blocks of most hand methods in linear algebra: swapping two rows, multiplying a row by a non-zero number, and adding a multiple of one row to another. None of them changes the solution set of the system that the matrix represents. Applied systematically, they reduce a matrix to row echelon form, a staircase shape in which each row starts with more zeros than the one above, and then to reduced row echelon form, in which each leading entry is 1 and is the only non-zero entry in its column.
From the echelon form you can read the rank directly, as the number of non-zero rows, and solve a system by back substitution. Row operations also track the determinant: a swap changes its sign, scaling a row scales it, and adding a multiple of a row leaves it alone. That is why reducing to triangular form and multiplying the diagonal is a fast way to compute large determinants by hand.
Solving systems of equations with matrices
A system of linear equations can be written compactly as Ax = b, where A holds the coefficients, x the unknowns and b the constants. If A is square and invertible, the unique solution is x = A⁻¹b. Cramer's rule, published by Gabriel Cramer in 1750, gives each unknown as a ratio of two determinants, which is practical for 2×2 and 3×3 systems. For larger systems, Gaussian elimination reduces the augmented matrix [A | b] to row echelon form and then uses back substitution; this is the method computers use, usually in the form of an LU decomposition. If det(A) = 0 the system has no unique solution. To solve the equations directly with substitution steps, use the Equation Solver.
Worked examples
Determinant 3×3. For [[1, 2, 3], [0, 1, 4], [5, 6, 0]], expanding along the first row gives 1·(0 − 24) − 2·(0 − 20) + 3·(0 − 5) = −24 + 40 − 15 = 1.
Inverse 2×2. For [[3, 1], [5, 2]], the determinant is 6 − 5 = 1, so the inverse is [[2, −1], [−5, 3]].
Product of different sizes. A 2×3 matrix times a 3×2 matrix gives a 2×2 result; reversing the order gives a 3×3 result, a clear example that AB and BA differ.
Singular matrix. For [[2, 4], [1, 2]], the determinant is 4 − 4 = 0, so the calculator reports that no inverse exists; the second row is half the first.
Rank. [[1, 2, 3], [2, 4, 6], [1, 0, 1]] has rank 2, because the second row is twice the first.
Applications of matrices
- Computer graphics and games: rotations, scalings and projections of 2D and 3D objects are matrix multiplications, and a rotation by angle θ in the plane is [[cos θ, −sin θ], [sin θ, cos θ]].
- Search and networks: Google's original PageRank algorithm treats the web as a large matrix and ranks pages using its dominant eigenvector, an application of Markov chains.
- Economics: Wassily Leontief's input-output model, which earned a Nobel Prize, describes how industries depend on each other with a matrix equation.
- Data science and machine learning: data sets are matrices, neural networks are sequences of matrix multiplications, and principal component analysis uses eigenvectors of a covariance matrix, connecting this page with the Statistics Calculator.
- Physics and engineering: quantum mechanics represents observables as matrices, structural analysis solves large stiffness systems, and electrical circuits are analysed with matrix equations.
- Cryptography: the classical Hill cipher encrypts blocks of letters by multiplying them by an invertible matrix.
Common mistakes with matrices
- Multiplying entry by entry instead of row by column.
- Ignoring dimensions: the inner sizes must match before multiplying.
- Assuming AB = BA. The order of multiplication matters.
- Forgetting the alternating signs in cofactor expansion.
- Inverting a singular matrix. Always check the determinant first.
- Writing the 2×2 inverse incorrectly: a and d swap places, while b and c only change sign.
Practice problems with answers
Try each one by hand, then enter it in the calculator to compare your steps.
- Determinant of [[3, 8], [4, 6]]. Answer: 18 − 32 = −14.
- Inverse of [[2, 1], [7, 4]]. Answer: the determinant is 1, so the inverse is [[4, −1], [−7, 2]].
- Product [[1, 0], [2, 1]] · [[3, 4], [5, 6]]. Answer: [[3, 4], [11, 14]].
- Transpose of [[1, 2, 3], [4, 5, 6]]. Answer: [[1, 4], [2, 5], [3, 6]].
- Determinant of [[2, 0, 0], [0, 3, 0], [0, 0, 4]]. Answer: 24, the product of the diagonal.
- Eigenvalues of [[4, 1], [2, 3]]. Answer: trace 7 and determinant 10 give λ² − 7λ + 10 = 0, so λ = 2 and λ = 5.
Study tips for linear algebra
Always write the size of each matrix next to it before multiplying; checking that the inner dimensions match prevents the most common error. Learn the 2×2 determinant and inverse formulas by heart, because larger calculations reduce to them. When computing a determinant by cofactor expansion, expand along the row or column with the most zeros to save work. Use the built-in checks: A times its inverse must give the identity, and the eigenvalues must add up to the trace and multiply to the determinant. Finally, try to picture what a 2×2 matrix does to the unit square; the geometric view makes determinants, inverses and eigenvectors far easier to remember.
How to enter matrices
- Use double square brackets and write the matrix row by row:
[[1, 2, 3], [4, 5, 6]]. - Separate entries and rows with commas; every row must have the same number of entries.
- Fractions such as
1/3, decimals and negative numbers are accepted. - Start with a keyword:
determinant,inverse,transpose,rankoreigenvalues. - For products, sums and differences, write two matrices with
*,+or-between them.
Related tools
Use the Equation Solver for systems written as equations, the Statistics Calculator for data summaries and the AI Math Solver for mixed questions. For a broader introduction to the theory, see the matrix article on Wikipedia).
Frequently asked questions
How do I type a matrix into the calculator?
Write it row by row inside double square brackets, for example [[1, 2], [3, 4]], and put a keyword such as determinant or inverse in front.
Why does my matrix have no inverse?
A matrix has an inverse only when its determinant is not zero. If the determinant is zero, at least one row depends on the others and the matrix is singular.
Can the calculator multiply matrices of different sizes?
Yes, as long as the number of columns of the first matrix equals the number of rows of the second. The result has the rows of the first and the columns of the second.
Does it give exact fractions?
Yes. Inverses and eigenvalues are shown as exact fractions and radicals, with decimal approximations only where they help.
Can it find eigenvalues and eigenvectors?
Yes. Type eigenvalues before a square matrix to see the characteristic polynomial, the eigenvalues and their eigenvectors.
Is the matrix calculator free?
Yes. It is free, needs no account and runs in your browser, so your matrices are never stored.