How Matrix Products Behave

Matrix multiplication keeps some habits from ordinary numbers — and breaks one famous one. The good news first. It is associative, (AB)C = A(BC), and it distributes over addition, A(B+C) = AB + AC. So you can regroup and expand much as usual.

The shock: matrix multiplication is not commutative. In general

AB \neq BA.

Order matters! That's not a defect — it's the whole point. "Rotate then stretch" really is a different motion from "stretch then rotate", and the matrices remember the difference.

See the order matter

Here A is a shear and B a stretch. Flip the toggle between AB and BA and watch the product change. Same two matrices, different order, different answer.

The honest exceptions

A few special pairs do commute — any matrix with the identity, any matrix with its own inverse, and diagonal matrices with each other. But those are the exceptions you must earn; the default assumption is always AB \neq BA. When you manipulate matrix expressions, never silently swap a product's order — that single reflex prevents most beginner mistakes.