Home›Math›Matrix Calculator

Matrix Calculator — Add, Subtract, Multiply, Determinant & Inverse

Work with matrices up to 6×6 — rectangular shapes like 2×3 included — without the arithmetic slips: add, subtract and multiply two matrices in either order, scale them by a scalar, solve A x = b, and get the determinant, inverse, transpose and powers of A — every result drawn as a clean grid the moment you type.

100% FreeNo sign-up neededInstant results

Your matrices

Matrix A ×
Matrix B ×
Scalar k

k multiplies every entry of A and B — the k × A and k × B results appear with the result matrices below.

🔒 All calculations happen in your browser — no data leaves your device.

Determinant & inverse of A

Determinant of A
−2
det(A) ≠ 0, so A has an inverse
Inverse of A (A⁻¹)
−211.5−0.5
Determinant of B−2
Trace of A (diagonal sum)5
Result size2 × 2
Changing a size loads the worked example for that shape — the 3×3 example is the one from the math section below, so you can check the working against the results.

The result matrices

A + B, A − B, A × B and B × A, the scalar multiples k × A and k × B, and a solver for A x = b — all drawn as grids.

A + B

681012

A − B

−4−4−4−4

A × B

19224350

B × A

k × A — scalar multiple

k × B — scalar multiple

Aᵀ — transpose of A

Aⁿ — power of A

Exponent n (0–10):

Solve A x = b

One b entry per row of A. b starts as the row sums of A, so x comes out as all ones — edit b, then press Update result or Calculate Matrices.

Key takeaways
  • Addition and subtraction are entry-by-entry; multiplication is different — each entry of A × B is a whole row of A dotted with a whole column of B, which is why A × B is usually not B × A.
  • The determinant compresses A into one number: det(A) = 0 means the matrix is singular and has no inverse. At the defaults det(A) = −2, so the inverse exists.
  • Work with matrices up to 6×6, rectangles included: alongside A + B, A − B, A × B and B × A you get scalar multiples, the determinant, inverse, transpose and powers of A — every result drawn as a clean grid.

Keep exploring

Three companion tools for algebra and beyond.

How it works

Three steps from two grids of numbers to every standard result.

1

Pick a size, fill the grids

Set the rows and columns for A and B (up to 6 each — rectangles like 2×3 are fine), then type your numbers in — decimals and negatives are fine.

2

Read the determinant

One number that says whether A can be undone: det(A) = 0 means the matrix is singular and has no inverse.

3

Use the grids

A + B and A − B work entry by entry; A × B multiplies rows by columns. The inverse satisfies A × A⁻¹ = I.

The math behind matrices

Addition and subtraction are entry-by-entry: each position in the result is the sum (or difference) of the same positions in A and B. Multiplication is different — each entry of A × B is a whole row of A dotted with a whole column of B, which is why order matters and A × B is usually not B × A. The determinant compresses A into one number; the inverse exists exactly when that number is not zero.

det(A) = a₁₁a₂₂ − a₁₂a₂₁ · A⁻¹ = (1 ÷ det A) × adj(A) · (A × B)ᵢⱼ = row i of A · column j of B

Worked examples:

OperationWith A = [1, 2; 3, 4], B = [5, 6; 7, 8]Result
A + B1+5, 2+6, 3+7, 4+8[6, 8; 10, 12]
A × B (top-left)1×5 + 2×7 = 19A × B = [19, 22; 43, 50]
det(A) and A⁻¹1×4 − 2×3 = −2A⁻¹ = [−2, 1; 1.5, −0.5]

Go deeper

Two facts that explain most matrix surprises.

Multiplication mixes rows of the left matrix with columns of the right one, so swapping the order mixes different numbers:

  • With the defaults: A × B = [19, 22; 43, 50], but B × A = [23, 34; 31, 46] — every entry differs.
  • The exception: a matrix always commutes with its own inverse and with the identity: A × A⁻¹ = A⁻¹ × A = I.
  • Size rule: A × B only exists when A’s column count equals B’s row count. With two square matrices of one shared size that is automatic; with rectangular sizes the calculator checks the shapes and tells you when a product (or a sum) does not exist.
  • Practical upshot: in graphics, physics and data work, the order of transformations is part of the meaning — rotate then move is not move then rotate.

The determinant measures how A stretches space. Zero means it flattens it — and flattened information cannot be un-flattened:

  • Geometrically: det(A) is the area (2D) or volume (3D) scaling factor. Zero means every shape is squashed onto a line or a plane.
  • Algebraically: one row is a combination of the others — in [1, 2; 2, 4] the second row is double the first, so det = 1×4 − 2×2 = 0.
  • Consequence: A⁻¹ does not exist (the calculator says so plainly), and the system A x = b has either no solution or infinitely many.
  • Near-zero counts too: a tiny determinant means a technically invertible but numerically touchy matrix — results can swing wildly with small input changes.

Matrix types at a glance

Square, identity, diagonal, symmetric, zero, and triangular: the names that keep recurring.

A square matrix has the same number of rows and columns, and only square matrices have determinants and inverses. The identity matrix, written I, has ones on the main diagonal and zeros everywhere else, and it plays the role of the number 1: multiplying any matrix by the identity of matching size leaves it unchanged. A diagonal matrix has non-zero entries only on its main diagonal. A symmetric matrix equals its own transpose, so its entries mirror across the main diagonal, and only square matrices can be symmetric. The zero matrix has every entry zero. A triangular matrix has zeros either below the diagonal (upper triangular) or above it (lower triangular), and its determinant is simply the product of its diagonal entries.

Size rules: when two matrices cannot be combined

Addition needs matching sizes; multiplication needs matching inner dimensions.

Addition and subtraction demand identical sizes: a 2 by 3 matrix can only be added to another 2 by 3 matrix, entry by entry, and any other pairing is not defined, not merely awkward. Multiplication is more permissive but still strict: A of size m by n can multiply B only if B has n rows, and the result is m by p, where p is the number of columns of B. The inner dimensions must match, and the outer dimensions give the result size. Order matters as well: with A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], A times B is [[19, 22], [43, 50]] while B times A is [[23, 34], [31, 46]], so A times B is not B times A in general. Square matrices of the same size can always be added and multiplied together, which is why most textbook examples use them.

Frequently asked questions

Quick answers about matrix operations.

How do you multiply two matrices?

Each entry of the result is a row of the first matrix dotted with a column of the second: multiply across, then add. The top-left entry of A × B with the defaults is 1×5 + 2×7 = 19, and the full product is [19, 22; 43, 50].

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

Multiply the main diagonal and subtract the product of the other diagonal: det = a₁₁a₂₂ − a₁₂a₂₁. For A = [1, 2; 3, 4] that is 1×4 − 2×3 = −2.

How do you invert a 2×2 matrix?

Swap the diagonal entries, negate the off-diagonal entries, and divide everything by the determinant. For A = [1, 2; 3, 4], det = −2, so A⁻¹ = [−2, 1; 1.5, −0.5]. Multiply A by A⁻¹ and you get the identity matrix.

When does a matrix have no inverse?

When its determinant is 0 — such a matrix is called singular. Example: [1, 2; 2, 4] has det = 1×4 − 2×2 = 0 because the second row is exactly double the first, so no inverse exists.

Is matrix addition commutative?

Yes. Addition and subtraction work entry by entry, so A + B = B + A always. Multiplication is the odd one out: A × B and B × A are usually different matrices.

How do you transpose a matrix, and what is a matrix power?

The transpose Aᵀ flips a matrix over its main diagonal: rows become columns, so entry (i, j) moves to (j, i). A matrix power Aⁿ means multiplying A by itself n times — A² = A × A — and it only works for square matrices. Both are shown under the result matrices: set the size, type your matrix, and pick the exponent for Aⁿ (0 gives the identity matrix).

What is the identity matrix?

The matrix equivalent of the number 1: ones on the main diagonal, zeros everywhere else. Multiplying any matrix by the identity (of the matching size) leaves it unchanged, and A × A⁻¹ = I is the test that an inverse is correct.

Can you divide matrices?

There is no division operation for matrices. Instead of dividing by B, you multiply by the inverse of B, when it exists: A divided by B means A times B inverse. If B is singular, with determinant zero, it has no inverse, and the division is not possible, just as division by zero is not possible for numbers.

What is a symmetric matrix?

A matrix that equals its own transpose: A equals A transpose, so each entry mirrors across the main diagonal, and the entry in row i, column j always equals the entry in row j, column i. Only square matrices can be symmetric, because a transpose swaps rows and columns, and a non-square matrix cannot equal its own transpose. Symmetric matrices appear wherever a quantity depends on a pair of things in either order.

How do you find the inverse of a 3 by 3 matrix?

By the adjugate method: form the matrix of cofactors, transpose it to get the adjugate, and divide by the determinant. For M = [[2, 1, 0], [1, 3, 1], [0, 1, 2]], the determinant is 8, the cofactor matrix is [[5, -2, 1], [-2, 4, -2], [1, -2, 5]], which is symmetric so the adjugate is the same, and the inverse is one eighth of it: [[0.625, -0.25, 0.125], [-0.25, 0.5, -0.25], [0.125, -0.25, 0.625]]. Multiply M by its inverse to check: the result is the identity.

More tools for math and study.

Disclaimer

This calculator is for information and study only. Inverse entries are rounded to 4 decimal places for display; internally the full-precision values are used for the determinant and products. For graded work, show your own row-by-column working alongside the result.

↑