Matrix Calculator
This free matrix calculator lets you add, subtract, and multiply 2×2 or 3×3 matrices, and also find a matrix's determinant, transpose, and inverse — with the real numbers substituted into each formula so you can follow every step. If you only need to solve two linear equations rather than perform general matrix operations, the System of Equations Solver may be a faster fit. Matrices and polynomials both come up constantly in Algebra II and Precalculus coursework, so if you're working through a unit that also involves factoring or graphing higher-degree expressions, the Polynomial Calculator is a handy companion tool.
Matrix A
Matrix B
Matrix A
Matrix B
Step-by-Step
What Is a Matrix?
A matrix is simply a rectangular grid of numbers arranged in rows and columns. A matrix with 2 rows and 2 columns is called a "2×2" matrix; one with 3 rows and 3 columns is a "3×3" matrix. Matrices show up throughout algebra, precalculus, computer graphics, engineering, and economics as a compact way to represent systems of numbers — for example, the coefficients of a system of linear equations, the transformation applied to a shape on screen, or the inputs and outputs of a network. This calculator focuses on square matrices (same number of rows and columns) since that's what's needed for a determinant or an inverse to exist at all.
Matrix Addition and Subtraction
Adding or subtracting two matrices only works when they are the same size (same number of rows and the same number of columns). You simply add or subtract each entry with the entry in the exact same position in the other matrix: the top-left entry of A combines with the top-left entry of B, the entry in row 2, column 3 of A combines with the entry in row 2, column 3 of B, and so on. There's no cross-multiplying or shifting involved — it's entry-by-entry, which makes addition and subtraction the simplest of the matrix operations.
Scalar Multiplication
A scalar is just an ordinary single number (as opposed to a matrix). To multiply a matrix by a scalar k, you multiply every single entry in the matrix by k. If k = 2 and A = [[2, 1], [1, 3]], then 2A = [[4, 2], [2, 6]]. Scalar multiplication doesn't change the size of the matrix — it only scales every value inside it.
Matrix Multiplication
Matrix multiplication is the most involved of the four arithmetic operations, and it does not work the way addition does. To multiply A×B in general, the number of columns in A must match the number of rows in B — if that condition isn't met, the multiplication is undefined, full stop. Because this calculator only supports same-size square matrices (2×2 with 2×2, or 3×3 with 3×3), that requirement is always automatically satisfied here, but it's worth understanding as background since it becomes the limiting factor the moment you work with non-square or differently-sized matrices elsewhere.
Each entry in the product A×B is computed as a dot product: the entry in row i, column j of the result is found by multiplying each entry in row i of A by the corresponding entry in column j of B, then adding those products together. This is why matrix multiplication mixes rows and columns together, rather than just combining matching positions like addition does.
What Does the Determinant Tell You?
The determinant is a single number calculated from a square matrix that summarizes several important properties at once. For a 2×2 matrix [[a, b], [c, d]], the determinant is ad − bc. For a 3×3 matrix, it's typically found by cofactor expansion along the first row: det(A) = a(ei − fh) − b(di − fg) + c(dh − eg), using the matrix [[a, b, c], [d, e, f], [g, h, i]].
The most important thing the determinant tells you is whether the matrix is invertible. If the determinant is zero, the matrix is called singular, and it has no inverse — dividing by a zero determinant is exactly the reason the inverse formulas below break down. A zero determinant also has a direct connection to systems of linear equations: if the matrix of coefficients for a system has a determinant of zero, the system does not have exactly one unique solution (it either has no solution at all, or infinitely many). A nonzero determinant guarantees the opposite — a unique solution exists. This is exactly the check performed behind the scenes by tools like the System of Equations Solver.
Finding the Inverse of a Matrix
The inverse of a matrix A, written A⁻¹, is the matrix that "undoes" A — multiplying A by its inverse produces the identity matrix (1s down the diagonal, 0s everywhere else), the matrix equivalent of the number 1. Not every matrix has one; only matrices with a nonzero determinant do.
For a 2×2 matrix A = [[a, b], [c, d]], the inverse is calculated as A⁻¹ = (1 / det(A)) × [[d, −b], [−c, a]] — swap the two diagonal entries, negate the two off-diagonal entries, then divide everything by the determinant.
For a 3×3 matrix, the process is a bit longer: first calculate a cofactor for every entry (a signed minor determinant found by deleting that entry's row and column), assemble those into a cofactor matrix, then transpose it to get the adjugate matrix. Dividing the adjugate by the determinant gives the inverse: A⁻¹ = (1 / det(A)) × adj(A). If at any point the determinant turns out to be zero, this calculator stops and tells you directly that no inverse exists rather than attempting to divide by zero.
Transposing a Matrix
The transpose of a matrix, written AT, is formed by flipping the matrix over its main diagonal — every row becomes a column, and every column becomes a row. Unlike the other operations here, the transpose works on matrices of any shape (not just square ones), doesn't require a determinant, and is always defined. It's used constantly behind the scenes in the cofactor/adjugate method for finding an inverse, and it shows up throughout statistics, computer graphics, and machine learning as well.
Frequently Asked Questions
Can I multiply matrices of different sizes here?
No — this calculator only supports square matrices of the same size (2×2 with 2×2, or 3×3 with 3×3), since that covers the vast majority of introductory coursework. In general, matrix multiplication A×B requires the number of columns in A to equal the number of rows in B, which allows for non-square and differently-sized matrices, but supporting every possible combination is beyond the scope of this tool.
Why doesn't every matrix have an inverse?
A matrix fails to have an inverse whenever its determinant is exactly zero. Both inverse formulas on this page divide by the determinant, so a zero determinant would mean dividing by zero, which is undefined. Matrices without an inverse are called singular. Geometrically, a singular matrix "collapses" space into a lower dimension (for example, squishing a 2D plane down onto a single line), and that kind of information loss can't be undone.
What's the difference between a matrix and a determinant?
A matrix is a whole grid of numbers arranged in rows and columns. A determinant is a single number calculated from a square matrix. In other words, a matrix is the input, and the determinant is one specific piece of information you can extract from it — namely, whether it's invertible, and how it scales area or volume.
Do I need this for a specific class?
Matrix operations, determinants, and inverses are typically introduced in Algebra II and covered in more depth in Precalculus, and they reappear heavily in a first linear algebra course. If your assignment specifically involves solving two equations with two unknowns, the System of Equations Solver will usually get you to the answer faster than setting the problem up as a full matrix.
Is matrix multiplication commutative (does AB = BA)?
Generally, no. Unlike ordinary multiplication of numbers, where 3×5 always equals 5×3, matrix multiplication is not commutative in general — A×B and B×A can produce completely different results, or one order might not even be defined while the other is (though for the same-size square matrices supported here, both orders are at least defined). Try running Multiply on your own A and B, then swap which matrix you type into the A boxes versus the B boxes and multiply again — you'll typically get two different answers.
How many decimal places does the calculator show?
Results are rounded to up to four decimal places for readability. Internally, the calculator always works with your original, unrounded input values, so intermediate steps (like the determinant used inside the inverse formula) are computed from full precision, not from an already-rounded display value.