Rotations can be composed of multiple rotations. This page describes the relationship between composition of rotations and order of operation using examples. Suppose we have frame A and we first rotate it by rotation matrix R1 to make frame B, and then by another rotation matrix R2 to make frame C:
The rotation from frame A to C (that is, the composition of R1 and R2) can be calculated by multiplying the two matrices. The order of multiplication changes depending on how R2 applies the rotation on frame B:
The order of multiplication and its interpretation applies equally with quaternions.