Learn & Understand

Why Matrix Multiplication Works So Strangely

In a hurry? Skip straight to the numbers.

Open the Matrix Multiplication Calculator →

The matrix multiplication calculator multiplies two matrices using a rule that seems bizarre at first: instead of multiplying matching entries, each result comes from combining a whole row with a whole column. Why is matrix multiplication defined in this convoluted way, rather than the simple entry-by-entry manner of addition? The answer is one of the most illuminating ideas in mathematics: matrix multiplication represents the composition of transformations, doing one after another, and its strange rule is exactly what that composition demands.

An Unexpected Rule

Matrix addition is intuitive, adding corresponding entries, and one might expect multiplication to work the same way, multiplying corresponding entries. But it does not. Instead, matrix multiplication combines each row of the first matrix with each column of the second in a more elaborate way, summing products of paired elements. This rule looks arbitrary and is a notorious stumbling block. Yet it is not arbitrary at all; it is precisely the rule required for matrices to represent transformations applied in sequence.

Doing One Transformation After Another

Recall that a matrix can represent a transformation of space, a rotation, a stretch, a shear. Often we want to apply one transformation and then another: first rotate, then scale, for instance. The combined effect is itself a transformation, called the composition of the two. The remarkable fact is that the matrix representing this composition is exactly the product of the two individual matrices, under the strange multiplication rule. Matrix multiplication is defined the way it is precisely so that multiplying two matrices gives the matrix of their combined transformation.

What multiplication captures
Multiply two matricesGet
Transformation A times BThe matrix of doing B then A

Why Order Matters So Much

This composition view instantly explains one of matrix multiplication's most striking features: it is non-commutative, meaning the order of the matrices matters and cannot be freely swapped. This is obvious once you think in terms of transformations, because doing a rotation and then a stretch generally gives a different result than doing the stretch first and then the rotation. The sequence of transformations genuinely changes the outcome, and so the order of the matrices in the product genuinely changes the result. The rule's order-dependence mirrors the order-dependence of real transformations.

The Rule That Powers Modern Computation

Because matrix multiplication captures the chaining of transformations, it sits at the heart of an enormous range of applications. Combining rotations and movements in computer graphics and robotics, propagating probabilities through steps of a random process, and passing data through the layers of a neural network are all matrix multiplications. The seemingly awkward rule is, in fact, one of the most important operations in all of computation. The calculator applies it faithfully, and understanding it as composition, doing one transformation after another, transforms a confusing procedure into a deeply sensible and powerful idea.

To reverse a transformation, see the Matrix Inverse Calculator; to combine matrices additively, the Matrix Addition Calculator.

Ready to Put This Into Practice?

Now that you understand how it works, plug in your own numbers and get an instant, accurate result.

Use the Matrix Multiplication Calculator Now →