Skip to content
Explore tools

Algebra

Matrix Calculator: Add, Multiply, Invert And Find Determinants

Last updated: October 2026

A matrix calculator performs operations on grids of numbers called matrices. It can add and multiply matrices, find the transpose, determinant and inverse, reduce to RREF, and solve systems of equations. For example, the 2×2 matrix [[1, 2], [3, 4]] has a determinant of 1 × 4 − 2 × 3 = −2.

  • Free, no sign-up
  • Shows the working
  • Runs on your device

Algebra

Matrix Calculator

2×2 matrices: add, multiply, or find the determinant and inverse.

Result

—

Matrices can look intimidating, but every operation follows a few simple rules. This guide explains what a matrix is, how to use the matrix calculator above, and how to do each operation by hand with a worked example. It also covers solving systems of equations, eigenvalues, and how to work with matrices in Excel and Python. Every example was checked in Python.

What Is A Matrix?

A matrix is a rectangular grid of numbers arranged in rows and columns. Its size is written as rows × columns, so a matrix with 2 rows and 3 columns is a 2×3 matrix (read "2 by 3").

Each number in the matrix is an entry or element. The entry in row i and column j is written aᵢⱼ. In the matrix A = [[1, 2], [3, 4]], the entry a₂₁ is 3, because it sits in row 2, column 1.

In this guide, matrices are written row by row inside brackets. So [[1, 2], [3, 4]] means:

Column 1Column 2
Row 112
Row 234

Common Types Of Matrices

Some matrices have special shapes or patterns, and many operations depend on knowing which type you have.

TypeWhat it looks likeExample
SquareSame number of rows and columns3×3
Row matrixOne row[[1, 5, 2]]
Column matrix (vector)One column[[4], [7]]
Zero matrixEvery entry is 0[[0, 0], [0, 0]]
Identity matrix (I)1s on the main diagonal, 0s elsewhere[[1, 0], [0, 1]]
DiagonalNonzero entries only on the main diagonal[[3, 0], [0, 5]]
SymmetricEqual to its own transpose[[2, 7], [7, 1]]

The identity matrix works like the number 1. Multiplying any matrix by I leaves it unchanged, so AI = IA = A.

How To Use The Matrix Calculator

The matrix calculator above has three tabs, and every answer shows its steps.

  1. Two-Matrix Operations: set the size of matrices A and B, type the entries, and choose an operation: add, subtract, multiply, scalar multiply, power or transpose.
  2. Single Matrix: enter one matrix to find its determinant, inverse, rank, row echelon form, RREF, trace or eigenvalues.
  3. Solve a System: type the coefficients of your linear equations, and the tool builds the augmented matrix and solves it.

You can type whole numbers, decimals, negatives and fractions like 3/4. Answers stay as exact fractions unless you switch to decimals.

Matrix Addition And Subtraction

To add or subtract two matrices, add or subtract the entries in matching positions. Both matrices must be the same size.

Example: A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]

Addition is commutative, so A + B = B + A. Subtraction is not, since B − A gives the opposite signs. You cannot add a 2×2 matrix to a 2×3 matrix, because some entries would have no partner.

Scalar Multiplication

To multiply a matrix by a single number, called a scalar, multiply every entry by that number.

Example: 3A = [[3 × 1, 3 × 2], [3 × 3, 3 × 4]] = [[3, 6], [9, 12]]

Scalar multiplication works on a matrix of any size. Multiplying by −1 flips every sign, and multiplying by 0 gives the zero matrix.

Matrix Multiplication

To multiply two matrices, multiply each row of the first matrix by each column of the second, then add the products. The number of columns in the first matrix must equal the number of rows in the second.

The size rule: an m×n matrix times an n×p matrix gives an m×p matrix. The inside numbers (n and n) must match, and the outside numbers give the size of the answer.

A sizeB sizeCan you multiply A × B?Result size
2×22×2Yes2×2
2×33×2Yes2×2
3×22×4Yes3×4
2×32×3No (3 ≠ 2)None

Example: A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]

  1. Row 1 of A times column 1 of B: (1 × 5) + (2 × 7) = 19.
  2. Row 1 of A times column 2 of B: (1 × 6) + (2 × 8) = 22.
  3. Row 2 of A times column 1 of B: (3 × 5) + (4 × 7) = 43.
  4. Row 2 of A times column 2 of B: (3 × 6) + (4 × 8) = 50.
  5. So AB = [[19, 22], [43, 50]].

Order matters. Multiplying in the other order gives BA = [[23, 34], [31, 46]], a different answer. Matrix multiplication is not commutative, so AB and BA are usually not equal. Sometimes only one order is even possible.

Example with different sizes: a 2×3 matrix [[2, 3, 1], [4, 1, 0]] times a 3×2 matrix [[1, 2], [0, 1], [5, 3]] gives a 2×2 result, [[7, 10], [4, 9]]. The first entry is (2 × 1) + (3 × 0) + (1 × 5) = 7.

Matrix Powers

A matrix power means multiplying a square matrix by itself. A² = A × A, A³ = A × A × A, and so on.

Example: A² for A = [[1, 2], [3, 4]] is A × A = [[7, 10], [15, 22]].

Two things to watch:

By definition, A⁰ = I, the identity matrix. A⁻¹ is the inverse, covered below.

Transpose Of A Matrix

The transpose flips a matrix over its main diagonal, so rows become columns and columns become rows. It is written Aᵀ.

Example: the transpose of A = [[1, 2], [3, 4]] is Aᵀ = [[1, 3], [2, 4]].

A 2×3 matrix becomes a 3×2 matrix when transposed. Transposing twice brings you back to the original, so (Aᵀ)ᵀ = A. One useful rule: the transpose of a product reverses the order, so (AB)ᵀ = BᵀAᵀ. A matrix equal to its own transpose is called symmetric.

Determinant Of A Matrix

The determinant is a single number calculated from a square matrix. It tells you whether the matrix has an inverse: if the determinant is 0, there is no inverse. It is written det(A) or |A|.

The determinant also has a geometric meaning. For a 2×2 matrix, its absolute value is how much the matrix stretches the area of a shape. A determinant of 0 means the matrix squashes everything flat onto a line or a point.

2×2 Determinant

For a 2×2 matrix [[a, b], [c, d]], the determinant is ad − bc. Multiply down the main diagonal, then subtract the product of the other diagonal.

MatrixCalculationDeterminant
[[1, 2], [3, 4]](1 × 4) − (2 × 3)−2
[[3, 8], [4, 6]](3 × 6) − (8 × 4)−14
[[6, 2], [3, 1]](6 × 1) − (2 × 3)0

The last matrix has a determinant of 0, so it has no inverse. Notice that its second row is exactly half of the first row. When one row is a multiple of another, the determinant is always 0.

3×3 Determinant

For a 3×3 matrix, expand along the first row. Multiply each entry by the 2×2 determinant left after crossing out its row and column, and alternate the signs +, −, +.

Example: C = [[2, −1, 0], [1, 3, 2], [0, 1, 4]]

  1. First entry, 2: cross out row 1 and column 1 to get [[3, 2], [1, 4]]. Its determinant is (3 × 4) − (2 × 1) = 10. Term: +2 × 10 = 20.
  2. Second entry, −1: cross out row 1 and column 2 to get [[1, 2], [0, 4]]. Its determinant is 4. Term: −(−1) × 4 = 4.
  3. Third entry, 0: the term is 0, no matter what is left.
  4. Add the terms: 20 + 4 + 0 = 24.

Shortcut: expand along the row or column with the most zeros, since each zero removes a whole term. For larger matrices, row reduction to a triangular form is faster. The determinant of a triangular matrix is just the product of its diagonal entries.

Inverse Of A Matrix

The inverse of a square matrix A, written A⁻¹, is the matrix that gives the identity when multiplied by A: A × A⁻¹ = I. Only square matrices with a nonzero determinant have an inverse. A matrix with no inverse is called singular.

2×2 Inverse Formula

For A = [[a, b], [c, d]], swap a and d, change the signs of b and c, and divide everything by the determinant:

A⁻¹ = (1 ÷ (ad − bc)) × [[d, −b], [−c, a]]

Example: A = [[1, 2], [3, 4]], with det A = −2.

  1. Swap and change signs: [[4, −2], [−3, 1]].
  2. Divide each entry by −2: A⁻¹ = [[−2, 1], [3/2, −1/2]].
  3. Check: A × A⁻¹ = [[1, 0], [0, 1]]. ✔

Inverses often contain fractions, so keeping exact values matters. The fraction calculator helps when you simplify entries by hand.

Inverse Of A 3×3 Matrix With Gauss-Jordan

For a 3×3 or larger matrix, the Gauss-Jordan method is the most reliable way by hand.

  1. Write the matrix next to the identity matrix, as [A | I].
  2. Use row operations to turn the left side into I.
  3. Whatever the right side becomes is A⁻¹.

For C = [[2, −1, 0], [1, 3, 2], [0, 1, 4]], this gives C⁻¹ = [[5/12, 1/6, −1/12], [−1/6, 1/3, −1/6], [1/24, −1/12, 7/24]]. The calculator shows every row operation along the way, which is the part most students need to check.

Row Echelon Form, RREF And Rank

Row reduction rewrites a matrix into a simpler form using three allowed row operations. These forms reveal the rank of a matrix and the solutions of a system.

The three row operations are:

  1. Swap two rows.
  2. Multiply a row by a nonzero number.
  3. Add a multiple of one row to another row.

Row echelon form (REF) has all zero rows at the bottom, and each row's first nonzero entry (its pivot) sits to the right of the pivot above it. Reduced row echelon form (RREF) goes further: every pivot is 1, and each pivot is the only nonzero entry in its column.

Example: M = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] reduces to the RREF [[1, 0, −1], [0, 1, 2], [0, 0, 0]].

The rank is the number of nonzero rows in the echelon form. Here the rank is 2, not 3, because the third row became all zeros. That also means det M = 0. A square matrix has an inverse only when its rank equals its size.

Solving Systems Of Equations With Matrices

A system of linear equations can be written as one matrix equation, Ax = b. A holds the coefficients, x holds the unknowns, and b holds the constants. There are three common ways to solve it.

Example system:

Method 1: inverse matrix. If A = [[2, 1], [1, −1]] and b = [[5], [1]], then x = A⁻¹b. Since det A = −3, the inverse exists, and A⁻¹b = [[2], [1]]. So x = 2 and y = 1.

Method 2: row reduction. Write the augmented matrix [[2, 1 | 5], [1, −1 | 1]] and reduce it to RREF: [[1, 0 | 2], [0, 1 | 1]]. Read the answers straight from the last column.

Method 3: Cramer's rule. Replace one column of A with b and divide determinants. For x, the determinant of [[5, 1], [1, −1]] is −6, and −6 ÷ −3 = 2. For y, the determinant of [[2, 5], [1, 1]] is −3, and −3 ÷ −3 = 1.

A 3-variable example: for x + y + z = 6, 2x − y + z = 3 and x + 2y − z = 2, the coefficient matrix has a determinant of 7, so there is exactly one solution: (1, 2, 3).

When the determinant is 0, the system has either no solution (the equations contradict each other) or infinitely many solutions (some equations repeat information). Row reduction tells you which: a row like [0, 0 | 5] means no solution, and a row of all zeros means infinitely many.

Eigenvalues And Eigenvectors

An eigenvector of a square matrix is a nonzero vector that the matrix only stretches or shrinks, without turning it. The stretch factor is the eigenvalue, written λ. In symbols, Av = λv.

To find the eigenvalues of a 2×2 matrix, solve det(A − λI) = 0.

Example: A = [[4, 1], [2, 3]]

  1. Subtract λ from the diagonal: [[4 − λ, 1], [2, 3 − λ]].
  2. Take the determinant: (4 − λ)(3 − λ) − 2 = λ² − 7λ + 10.
  3. Set it to 0 and factor: (λ − 5)(λ − 2) = 0.
  4. The eigenvalues are λ = 5 and λ = 2.

For λ = 5, an eigenvector is [[1], [1]], since A × [[1], [1]] = [[5], [5]]. For a 2×2 matrix, step 3 is always a quadratic, so the quadratic equation solver can finish it when it does not factor neatly.

Two quick checks: the eigenvalues add up to the trace (4 + 3 = 7) and multiply to the determinant (4 × 3 − 1 × 2 = 10).

Where Matrices Are Used

Matrices are the standard way to store and transform many numbers at once. That makes them central to computing, science and economics.

Matrices On Calculators, Excel And Python

You can work with matrices on a graphing calculator, in a spreadsheet or in code. Each tool has its own commands.

ToolMultiplyInverseDeterminantTranspose
TI-84 (MATRIX menu: 2nd, then x⁻¹)[A]*[B][A]⁻¹det([A])[A]ᵀ
Excel, Google Sheets=MMULT(A, B)=MINVERSE(A)=MDETERM(A)=TRANSPOSE(A)
Python (NumPy)A @ Bnp.linalg.inv(A)np.linalg.det(A)A.T

Practical tips:

Common Matrix Mistakes

Most matrix errors come from mismatched sizes, treating matrix multiplication like regular multiplication, and sign slips.

MistakeExampleFix
Multiplying entry by entryAB = [[5, 12], [21, 32]]Use rows times columns: [[19, 22], [43, 50]]
Assuming AB = BASwapping the orderKeep the order as written
Ignoring the size ruleMultiplying 2×3 by 2×3Columns of A must equal rows of B
Squaring each entry for A²A² = [[1, 4], [9, 16]]A² = A × A = [[7, 10], [15, 22]]
Mixing up the 2×2 inverse signsChanging the signs of a and dSwap a and d, negate b and c
Inverting a singular matrixTrying to invert [[6, 2], [3, 1]]Check the determinant first. If it is 0, there is no inverse
Dividing matricesWriting A ÷ BMultiply by the inverse: A × B⁻¹

Summary

Next step: enter your matrices in the matrix calculator at the top of this page, or browse more math tools on the Calc Solver homepage.

Frequently Asked Questions

Can you divide two matrices?

Not directly. There is no matrix division operation. Instead, you multiply by the inverse. To "divide" A by B, compute A × B⁻¹ or B⁻¹ × A, and the two usually give different answers because order matters. This only works when B is square and has a nonzero determinant. If B has no inverse, the division has no meaning.

What is the trace of a matrix?

The trace is the sum of the entries on the main diagonal of a square matrix. For [[1, 2], [3, 4]], the trace is 1 + 4 = 5. The trace also equals the sum of the matrix's eigenvalues, which makes it a fast check when you find eigenvalues by hand. Like the determinant, it is only defined for square matrices.

What does a determinant of 0 mean?

A determinant of 0 means the matrix is singular. It has no inverse, its rows (and columns) depend on each other, and its rank is less than its size. Geometrically, the matrix flattens space into a lower dimension, like squashing a square into a line. If the matrix comes from a system of equations, the system has no solution or infinitely many.

Is a vector a matrix?

Yes. A vector is a matrix with one row or one column. A column vector like [[3], [5]] is a 2×1 matrix, and a row vector like [[3, 5]] is a 1×2 matrix. Matrix rules apply to vectors too, so multiplying a 2×2 matrix by a 2×1 vector gives another 2×1 vector. This is how matrices move points in graphics.

How big can a matrix be?

There is no size limit in math. A matrix can have any number of rows and columns. In practice, hand calculations get slow past 3×3 or 4×4, which is why calculators help. Computers routinely handle matrices with thousands or even millions of rows, such as large data sets or the weight matrices inside machine learning models.

What is the difference between REF and RREF?

Both are simplified forms from row reduction. In row echelon form (REF), zero rows sit at the bottom and each pivot is to the right of the one above, but pivots can be any nonzero number. Reduced row echelon form (RREF) also requires every pivot to be 1 and to be the only nonzero entry in its column. A matrix has many REFs but only one RREF.

Try it with your own numbers

Use a free CalcSolver tool to check the examples in this guide.

Open the equation solver guide