Fill in matrices A and B above and press A × B. The button is disabled when the sizes do not fit, with a note telling you which dimensions must match. Open the steps to see each entry expanded as a sum of products, which is exactly how you would write it out by hand. The same tab also holds addition, subtraction and transpose, and the Scalars and Power tabs cover k·A and Aⁿ — all of them explained below.
The dimension rule
To multiply an m×n matrix by an n×p matrix, the inner numbers must be equal: columns of A must match rows of B. The result is m×p — the outer numbers. This is why A × B can be perfectly valid while B × A is not even defined.
The row-by-column rule
Entry (i, j) of the product is the dot product of row i of A with column j of B:
c(i,j) = a(i,1)·b(1,j) + a(i,2)·b(2,j) + … + a(i,n)·b(n,j)
| 1 | 2 |
| 3 | 4 |
| 5 | 6 |
| 7 | 8 |
| 19 | 22 |
| 43 | 50 |
Check the first entry: 1·5 + 2·7 = 19. Each of the four entries is its own little dot product, and the calculator prints all four expansions in the steps panel.
AB is not BA
Matrix multiplication is not commutative. Often BA is not even defined, and when both products exist they are usually different matrices. Reversing the order of a product of transformations genuinely changes what happens — rotate then reflect is not reflect then rotate. Try both buttons on the same pair and compare.
One more warning: A·B = 0 does not imply that A or B is zero. Matrices have zero divisors, unlike ordinary numbers.
What does hold
- Associative:
(A·B)·C = A·(B·C) - Distributive:
A·(B + C) = A·B + A·C - Identity:
I·A = A·I = A - Transpose reverses:
(A·B)ᵀ = Bᵀ·Aᵀ - Determinants multiply:
det(A·B) = det(A)·det(B) - Rank cannot grow:
rank(A·B) ≤ min(rank(A), rank(B))
Addition, subtraction and scaling
Addition and subtraction are the operations that behave exactly as you would hope: entry by entry, no surprises. Both matrices must have the same dimensions — a 2×3 can be added to another 2×3 and to nothing else — and the result keeps those dimensions.
| 1 | 2 |
| 3 | 4 |
| 5 | 6 |
| 7 | 8 |
| 6 | 8 |
| 10 | 12 |
Because it works positionally, addition inherits the arithmetic you already know: A + B = B + A, and the grouping of a three-way sum does not matter. That is a genuine contrast with multiplication. Subtraction is addition of the negative, so A − B is A + (−1)·B and the order matters in the ordinary way that 5 − 3 differs from 3 − 5.
Scalar multiplication scales every entry by the same number, with no shape requirement at all. One consequence surprises almost everyone: scaling a matrix does not scale its determinant by k. For an n×n matrix, det(k·A) = kⁿ·det(A), because each of the n rows is scaled and the determinant is multiplied once for each. Doubling a 3×3 matrix multiplies its determinant by eight. The trace, being a plain sum, behaves as expected: tr(k·A) = k·tr(A).
Transpose
Transposing reflects a matrix across its main diagonal: the entry at row i, column j moves to row j, column i. An m×n matrix becomes n×m, so the operation is defined for every shape. A column vector becomes a row vector, which is why xᵀy is the standard way to write a dot product.
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 1 | 4 |
| 2 | 5 |
| 3 | 6 |
Three identities are worth memorising. Transposing twice returns the original: (Aᵀ)ᵀ = A. Transposing a sum distributes: (A + B)ᵀ = Aᵀ + Bᵀ. But transposing a product reverses it: (A·B)ᵀ = Bᵀ·Aᵀ, not Aᵀ·Bᵀ. The reversal is forced by the shapes — if A is 2×3 and B is 3×4, then Aᵀ is 3×2 and Bᵀ is 4×3, and only Bᵀ·Aᵀ has dimensions that agree. A matrix equal to its own transpose is called symmetric, and symmetric matrices are unusually well behaved: their eigenvalues are always real, and they are the ones Cholesky decomposition applies to.
Powers
Aⁿ means multiplying A by itself n times, and only makes sense for square matrices.A⁰ is the identity, not a matrix of zeros, and A¹ is A itself.
| 1 | 1 |
| 0 | 1 |
| 1 | 2 |
| 0 | 1 |
| 1 | n |
| 0 | 1 |
Squaring is not entrywise: the top-right entry is 1·1 + 1·1 = 2, not 1² = 1. The calculator uses exponentiation by squaring, so A¹⁶ costs four multiplications rather than fifteen. Powers show up wherever a process repeats: in a Markov chain, if P holds the transition probabilities for one step, Pⁿ holds them for n steps. In an adjacency matrix, entry (i, j) of Aⁿ counts the walks of length n from vertex i to vertex j. For very large exponents, diagonalise instead — if A = P·D·P⁻¹ with D diagonal then Aⁿ = P·Dⁿ·P⁻¹, which starts from the eigenvalues.
Common mistakes
- Multiplying entry by entry. Matrix multiplication is not
a(i,j)·b(i,j). That operation exists — the Hadamard product — but it is not whatA × Bmeans. - Assuming AB = BA. Matrix multiplication is not commutative.
- Concluding a factor is zero.
A·B = 0does not mean A or B is zero. - Writing (A·B)ᵀ = Aᵀ·Bᵀ. The order reverses. This is the most common slip involving transposes.
- Raising each entry to the power. A² is A·A, not the matrix of squared entries. The two agree only for diagonal matrices.
- Adding a scalar to a matrix. A + 3 has no meaning. To add 3 along the diagonal, add 3·I.