Hold a book, rotate it so the cover faces you, then tilt it to look down at the spine. The final orientation depends on which turn you do first. That is the whole idea: composing rotations means applying one after another, and in 3D the order matters.
Each rotation is a matrix, and doing two in sequence corresponds to multiplying their matrices. The subtlety is that matrix multiplication is generally not commutative: AB=BA.
The Rule
If you rotate first by R1, then by R2, the combined rotation is
Rcombined=R2R1.
Read right to left: a rotation acts on a column vector as Rv, so applying R1 then R2 gives R2(R1v)=(R2R1)v. The rotation done first sits on the right.
A 2D Example
In the plane, a counter-clockwise rotation by angle θ is
R(θ)=(cosθsinθ−sinθcosθ).
Here R(60∘)R(30∘)=R(90∘): the angles simply add. In 2D rotations do commute, because they all share the same axis (the axis pointing out of the plane).
Why 3D Is Different
In 3D, rotations are about different axes, and swapping the order changes the result. Use the standard right-handed matrices
Rx(90∘)v=(0,−1,0) — the point moves onto the y-axis.
Ry leaves the y-axis fixed, so the result stays (0,−1,0).
Order 2 — Ry first, then Rx (product RxRy):
Ry(90∘)v=(1,0,0) — the point moves onto the x-axis.
Rx leaves the x-axis fixed, so the result stays (1,0,0).
Watch out
Same two rotations, opposite order, different final point: (0,−1,0) versus (1,0,0). So RxRy=RyRx in general. (Notice each rotation leaves its own axis unmoved — a rotation about the y-axis can never shift a vector that already lies on the y-axis.) …