askvity

How to Multiply Rotation Matrices?

Published in Rotation Matrices Multiplication 3 mins read

To multiply rotation matrices, you combine individual rotation matrices through standard matrix multiplication in a specific order.

Multiplying rotation matrices is a fundamental operation in 3D graphics, robotics, and physics. It allows you to represent a sequence of rotations as a single combined rotation.

Combining Multiple Rotations

When an object or coordinate system undergoes multiple successive rotations, you can find a single matrix that achieves the final orientation. This is done by multiplying the individual rotation matrices together.

The Process

  1. Identify Individual Rotations: Determine the axis and angle for each rotation you want to combine (e.g., rotation around the X-axis, then the Y-axis, then the Z-axis).
  2. Find Individual Matrices: Obtain the corresponding rotation matrix for each individual rotation. These are standard 3x3 matrices.
  3. Multiply the Matrices: Multiply the individual matrices together. The order of multiplication is crucial and depends on the order in which the rotations are applied.

Understanding Multiplication Order

The order of matrix multiplication for transformations is generally the reverse of the order in which the transformations are applied. If you apply rotation A then rotation B, the combined matrix is B * A.

Example from Reference:

As stated in the reference, if you have separate transformation matrices for rotations, say tranX, tranY, and tranZ, representing rotations around the X, Y, and Z axes respectively, and these rotations are applied sequentially, the combined matrix is calculated by multiplying them in a specific order.

According to the reference:

  • Combined Matrix: combined
  • Individual Matrices: tranX, tranY, tranZ
  • Multiplication Order: combined = tranZ * tranY * tranX

This example shows that if rotations corresponding to tranX, tranY, and tranZ were applied in sequence (e.g., X first, then Y, then Z), the matrices are multiplied as Z * Y * X. The matrix for the last rotation applied comes first in the multiplication chain, and the matrix for the first rotation applied comes last.

Matrix Multiplication Basics

Remember that matrix multiplication is not commutative (A * B is generally not equal to B * A). Therefore, the order of multiplication significantly affects the final combined rotation.

Multiplying two 3x3 rotation matrices results in another 3x3 matrix. This resulting matrix is also a rotation matrix and represents the composite transformation.

Here's a simplified view of combining two rotation matrices, R1 and R2:

Step Description Calculation Example
1. Apply R1 then R2 Apply rotation R1, then apply rotation R2 Combined = R2 * R1
2. Apply R2 then R1 Apply rotation R2, then apply rotation R1 Combined = R1 * R2

As you can see, swapping the application order requires swapping the multiplication order.

By finding the individual rotation matrices and multiplying them in the reverse order of their application, you obtain a single matrix that represents the combined effect of all the rotations.

Related Articles