All Tools

Matrix Calculator

Add, multiply, transpose, and find determinant/inverse of matrices

Settings

Input Matrices

Matrix A
Matrix B

About Matrix Operations

Matrices are rectangular arrays of numbers used in linear algebra, physics, computer graphics, and machine learning.

Matrix operations, with the formulas written out

For a 2×2 matrix [[a, b], [c, d]] the determinant is ad − bc, and the inverse is 1/(ad − bc) × [[d, −b], [−c, a]]. If the determinant is zero the matrix is singular and has no inverse — that is the check to run before anything else.

What each operation requires

OperationRequirementResult size
Addition / subtractionBoth matrices the same sizeSame size
Scalar multiplicationNoneSame size
Matrix multiplication A×BColumns of A = rows of Brows(A) × cols(B)
TransposeNoneRows and columns swapped
DeterminantSquare matrixA single number
InverseSquare and determinant ≠ 0Same size
RankNoneA single number ≤ min(rows, cols)

2×2 worked example

A = [[3, 8], [4, 6]]

det A = (3 × 6) − (8 × 4) = 18 − 32 = −14

Non-zero, so the inverse exists.

Swap a and d, negate b and c: [[6, −8], [−4, 3]]

Divide every entry by −14

A⁻¹ = [[−0.4286, 0.5714], [0.2857, −0.2143]]

3×3 determinant by cofactor expansion

B = [[6, 1, 1], [4, −2, 5], [2, 8, 7]]

Expand along the first row.

6 × det[[−2, 5], [8, 7]] = 6 × (−14 − 40) = 6 × (−54) = −324

−1 × det[[4, 5], [2, 7]] = −1 × (28 − 10) = −18

+1 × det[[4, −2], [2, 8]] = 1 × (32 + 4) = 36

det B = −324 − 18 + 36 = −306

Matrix multiplication, step by step

Entry (i, j) of the product is the dot product of row i of the first matrix with column j of the second. For [[1, 2], [3, 4]] × [[5, 6], [7, 8]]: the top-left entry is 1×5 + 2×7 = 19, top-right is 1×6 + 2×8 = 22, bottom-left is 3×5 + 4×7 = 43, bottom-right is 3×6 + 4×8 = 50 — giving [[19, 22], [43, 50]]. Note that matrix multiplication is not commutative: reversing the order here gives [[23, 34], [31, 46]], a completely different matrix.

Facts that save time

More questions people ask

How do you find the determinant of a 2x2 matrix?

Multiply the top-left by the bottom-right, then subtract the product of the top-right and bottom-left. For [[a, b], [c, d]] the determinant is ad minus bc.

When does a matrix have no inverse?

When its determinant is zero. Such a matrix is called singular, and it means at least one row is a linear combination of the others, so the transformation it represents collapses space and cannot be undone.

Is matrix multiplication commutative?

No. AB and BA are generally different matrices, and for non-square matrices one of the two products may not even be defined. Matrix multiplication is associative and distributive, but never assume it commutes.

What is the rank of a matrix?

The number of linearly independent rows, which always equals the number of linearly independent columns. It tells you the dimension of the space the matrix maps onto, and a square matrix is invertible exactly when its rank equals its size.

How do I solve a system of linear equations with matrices?

Write it as Ax = b. If A is square and invertible, x = A⁻¹b. In practice, row-reduce the augmented matrix [A | b] by Gaussian elimination — it is faster, and it also tells you immediately if the system has no solution or infinitely many.

Everything on this page runs in your browser — nothing you type is uploaded or stored.

Frequently Asked Questions

How do you multiply matrices?
Multiply each row element of matrix A by the corresponding column element of matrix B, sum the products for each result cell.
What is a determinant?
A scalar computed from a square matrix. For 2x2 [a,b;c,d]: det = ad - bc. Tells if matrix is invertible.
When is a matrix invertible?
When its determinant is not zero. The inverse A^(-1) satisfies A × A^(-1) = Identity matrix.

Answers, not just a number

Short, exact answers to the questions people ask alongside this tool — the number first, then the working.

For teams, not just visitors

Want this calculator on your own site?

We build the calculators on SnoopTool as embeddable widgets in your branding, wired to your own lead form — the same maths, your colours, your domain, your leads. Tell us which one and we will send back a working demo you can put in front of your team.

One reply from a person, within one business day. No newsletter, no sequence. See our privacy policy.