Matrix Calculator

Enter a 2x2 or 3x3 matrix and find its determinant and inverse, multiply two matrices, add, subtract, scale or transpose, with every entry's arithmetic shown step by step.

What you get
  • Determinant & inverseCofactor expansion and adjugate, fully worked.
  • Products & sumsEvery entry computed as an explicit dot product.
  • Identity checkInverses are verified against A × A⁻¹ = I.

Set up the matrices

Results update as you type

The determinant turns a square matrix into a single number. A determinant of zero means the matrix is singular and has no inverse.

Matrix A

Runs entirely in your browser. Nothing you type is sent or saved

Matrix guide

What a matrix is

A matrix is a rectangular grid of numbers with a stated number of rows and columns: a 2x2 matrix has two rows and two columns, holding four entries. The entry in row i and column j is written aij, with rows counted from the top. Matrices pack many numbers into one object so that whole systems of equations, transformations and datasets can be manipulated with a single operation.

This page works with square matrices up to 3x3, which covers the most common classroom and graphics cases, and keeps every step of the arithmetic visible.

The determinant

The determinant condenses a square matrix into one number that measures how the corresponding transformation scales area (2x2) or volume (3x3). A determinant of 2 doubles areas; a determinant of 0 collapses space onto a line, which is why such matrices have no inverse. For a 2x2 matrix the formula is:

det = a×d - b×c   for   [a b; c d]

multiply the main diagonal, subtract the product of the other diagonal

Worked examples, both checkable above: det [[4, 7], [2, 6]] = 4×6 - 7×2 = 24 - 14 = 10, and det [[1, 2], [3, 4]] = 4 - 6 = -2. The negative sign means the transformation flips orientation, like a reflection.

For 3x3 matrices the determinant expands along the first row, pairing each entry with the determinant of the small 2x2 matrix left after deleting its row and column (its minor), with alternating signs:

det = a11M11 - a12M12 + a13M13

each M is the 2x2 minor, computed by the same ad - bc rule

The calculator's example matrix [[2, 0, 1], [1, 3, 2], [1, 1, 1]] gives 2×(3 - 2) - 0×(1 - 2) + 1×(1 - 3) = 2 - 0 - 2 = 0. A zero determinant means the three columns do not span full 3D space; the matrix is singular and no inverse exists, which the calculator reports rather than dividing by zero.

The inverse, and when it exists

The inverse A⁻¹ is the matrix that undoes A: multiplying A by its inverse returns the identity matrix, which has ones on the diagonal and zeros elsewhere. It exists only when the determinant is nonzero. For a 2x2 matrix the recipe is short: swap the main diagonal entries, negate the other two, and divide everything by the determinant.

For the example [[4, 7], [2, 6]] with determinant 10, the inverse is [[6/10, -7/10], [-2/10, 4/10]] = [[0.6, -0.7], [-0.2, 0.4]]. The calculator goes further and verifies the claim: it multiplies A by the inverse it produced and shows the identity matrix that results, so you never have to take the answer on faith.

Singular means no undo: when det = 0, some input direction gets flattened to nothing, and no matrix can restore it. Systems of equations with a singular coefficient matrix have either no solution or infinitely many, never exactly one.

Matrix multiplication

Matrix multiplication is not entry-wise. Each entry of the product is a dot product of one row of A with one column of B:

cij = (row i of A) · (column j of B)

the shapes must chain: columns of A must equal rows of B

Worked example: [[1, 2], [3, 4]] × [[2, 0], [1, 2]]. The top-left entry is 1×2 + 2×1 = 4, the top-right is 1×0 + 2×2 = 4, the bottom-left is 3×2 + 4×1 = 10, and the bottom-right is 3×0 + 4×2 = 8, giving [[4, 4], [10, 8]]. The calculator writes out all four dot-product lines.

Two consequences surprise everyone once. First, order matters: A×B and B×A are usually different matrices. Second, two nonzero matrices can multiply to zero, exactly because a determinant-zero matrix crushes space.

Addition, subtraction and the transpose

Unlike multiplication, addition and subtraction are entry-wise and need matrices of exactly the same shape: [[1, 2], [3, 4]] + [[5, 6], [7, 8]] = [[6, 8], [10, 12]]. There is no rearranging to do, which is why the calculator shows one line per entry.

The transpose Aᵀ flips a matrix over its main diagonal: rows become columns. Transposing twice returns the original, and (A×B)ᵀ equals Bᵀ×Aᵀ, a rule worth knowing because it appears constantly in statistics and machine learning formulas.

Where matrices are used

  • Computer graphics: every rotation, scaling and camera view on screen is a matrix multiplying the coordinates of every point, which is why 3x3 and 4x4 matrices dominate game engine code.
  • Systems of equations: three linear equations in three unknowns can be written as A×x = b and solved with x = A⁻¹b, when the determinant is nonzero.
  • Statistics: covariance matrices, regression's normal equations and correlation all live in matrix algebra.
  • Markov chains: a transition matrix multiplied repeatedly predicts long-run probabilities, from page ranking to board games.

Using the calculator well

  • Match the dimensions first: A×B only exists when A's column count equals B's row count. The calculator enforces this and explains the mismatch instead of producing a wrong shape.
  • Decimals are welcome: every entry accepts values like 0.6 or -1.25, and results display to four decimal places while computing at full precision.
  • Read the steps: each operation shows its own working, from the cofactor terms of a 3x3 determinant to the dot-product lines of a product. Comparing your hand work against these lines is the fastest way to find an arithmetic slip.
  • Trust the identity check: whenever an inverse is computed, the page multiplies A by it and shows the result. If you ever build an inverse by hand, run the same check.
  • Scope note: this tool covers square matrices up to 3x3, the size where every step stays visible. Larger systems need software built for them, but the mathematics here transfers unchanged.

Common questions

Because its determinant is zero, which means the matrix is singular: it flattens some direction of space to nothing, and no operation can undo that. In equation terms, the system it represents has either no solution or infinitely many. Check for one row being a multiple of another; that is the most common cause.

Each product entry pairs a row of the left matrix with a column of the right one, so swapping the operands pairs entirely different numbers. With [[1, 2], [3, 4]] and [[2, 0], [1, 2]], one order gives [[4, 4], [10, 8]] and the other gives [[2, 4], [5, 8]]. Matrix multiplication is associative but not commutative, which is why the calculator labels its operand buttons A and B explicitly.

The matrix flips orientation: what a positive determinant scales, a negative one also mirrors. In 2D, det [[1, 2], [3, 4]] = -2 means the transformation doubles areas and acts like a reflection combined with that scaling. The magnitude is the scaling factor; the sign records the flip.

The inner dimensions must match: an m-by-n matrix times an n-by-p matrix gives an m-by-p result. This calculator keeps both matrices square (2x2 or 3x3), where the rule is simple, and rejects anything that violates it. For rectangular products, the same dot-product rule applies but the shapes need care that is easier to manage in dedicated software.

It is the number 1 of matrix algebra: multiplying any matrix by the identity of the right size leaves it unchanged. That property is exactly what makes the check in this calculator meaningful, since A times a true inverse must land back on the identity. It is also the starting point of many matrix algorithms, which repeatedly apply transformations to it.

Every entry of the inverse formula ends up divided by the determinant, so a zero determinant would mean dividing by zero. The determinant is also the quick test: computing it first tells you whether an inverse exists before you spend effort building one. For 2x2 matrices the whole inverse is the swapped-and-negated matrix over the determinant.

Yes. Any real number works in any cell, including values like 0.6, -1.25 or 2.0. Results are shown to four decimal places for reading, while all internal arithmetic runs at full double precision, so chained steps stay accurate.

No. Every calculation runs in your browser. Nothing is stored or transmitted.

Row times column, every step shown.

Browse all math calculators