Why the order of matrix operations matters

A matrix can describe a transformation: it might rotate, stretch, or reflect a point. Multiplying matrices combines transformations, but the product records their order. With the usual convention, in ABv, matrix B acts on the point v first, and A acts on the result. Read the operations from right to left.

That order becomes visible with a simple example. Start at the origin, shift the point one unit to the right, and rotate it 90 degrees counterclockwise. The shift-then-rotate route ends one unit above the origin. Reverse the steps: the origin stays put during the rotation, then shifts one unit right. The destination is different.

The same rule applies to the matrices

To represent the shift as a matrix operation, coordinates can be written in an expanded form called homogeneous coordinates. This adds an extra coordinate so that translation—a move by a fixed amount—can be handled alongside rotations and other matrix transformations. In that representation, multiplying the shift and rotation matrices in one order gives the first route; reversing them gives the second.

This is why matrix multiplication is called noncommutative: in general, AB is not the same as BA. The matrices are not being multiplied incorrectly; each product describes a different sequence of actions. Some particular matrices do commute, but there is no general license to swap them.

Where the distinction matters

Computer graphics uses ordered transformations to place and orient objects: rotating an object before moving it can send it along a different path than moving it before rotating it. The same bookkeeping matters anywhere a calculation chains several transformations. Reversing two steps can change the final result even when both steps, considered separately, are perfectly familiar.