askvity

How to Find Rotation Matrices?

Published in Linear Algebra 3 mins read

Finding rotation matrices depends on the dimension and the axis of rotation. The fundamental principle involves understanding how a rotation affects coordinate axes and expressing this transformation mathematically.

2D Rotation Matrices

In two dimensions, a rotation matrix rotates a point around the origin by an angle θ. The general form of a 2D rotation matrix is:

R(θ) = [ cos(θ) -sin(θ) ]
[ sin(θ) cos(θ) ]

  • θ: The angle of rotation (counter-clockwise).

Example: Rotation by 90 degrees (θ = 90°)

R(90°) = [ cos(90°) -sin(90°) ]
[ sin(90°) cos(90°) ] = [ 0 -1 ]
[ 1 0 ]

3D Rotation Matrices

In three dimensions, rotation matrices rotate a point around a specific axis. Common rotations are around the X, Y, and Z axes.

Rotation around the X-axis (Rx)

Rx(θ) = [ 1 0 0 ]
[ 0 cos(θ) -sin(θ) ]
[ 0 sin(θ) cos(θ) ]

Example: Rotation around the X-axis by 90 degrees (θ = 90°)

Rx(90°) = [ 1 0 0 ]
[ 0 0 -1 ]
[ 0 1 0 ]

Rotation around the Y-axis (Ry)

Ry(θ) = [ cos(θ) 0 sin(θ) ]
[ 0 1 0 ]
[ -sin(θ) 0 cos(θ) ]

Example: Rotation around the Y-axis by 90 degrees (θ = 90°)

Ry(90°) = [ 0 0 1 ]
[ 0 1 0 ]
[ -1 0 0 ]

Rotation around the Z-axis (Rz)

Rz(θ) = [ cos(θ) -sin(θ) 0 ]
[ sin(θ) cos(θ) 0 ]
[ 0 0 1 ]

Example: Rotation around the Z-axis by 90 degrees (θ = 90°)

Rz(90°) = [ 0 -1 0 ]
[ 1 0 0 ]
[ 0 0 1 ]

General Procedure for Finding Rotation Matrices:

  1. Determine the dimension: Is it a 2D or 3D rotation?
  2. Identify the axis of rotation: In 3D, specify whether you're rotating around the X, Y, or Z-axis (or a custom axis - see below). In 2D, rotation is always around the origin.
  3. Determine the angle of rotation (θ): Specify the angle in degrees or radians.
  4. Apply the appropriate formula: Use the correct rotation matrix formula for the dimension and axis.
  5. Substitute the angle (θ): Replace the angle variable in the formula with the given angle value.
  6. Calculate the matrix elements: Compute the cosine and sine values to get the numerical values for the matrix elements.

Rotation around an Arbitrary Axis (Rodrigues' Rotation Formula)

For rotations around an arbitrary axis in 3D, you can use Rodrigues' rotation formula. Let k be a unit vector representing the axis of rotation, and θ be the angle of rotation. The rotation matrix R is given by:

R = I + sin(θ) * K + (1 - cos(θ)) * K2

Where:

  • I is the identity matrix.

  • K is the skew-symmetric matrix of k:

    K = [ 0 -kz ky ]
    [ kz 0 -kx ]
    [ -ky kx 0 ]

    Where k = [kx, ky, kz]

Key Takeaways

  • Rotation matrices are fundamental in computer graphics, robotics, and linear algebra.
  • Understanding the trigonometric relationships between the angle of rotation and the matrix elements is crucial.
  • In 2D, the rotation is always about the origin. In 3D, you must specify the axis of rotation.
  • Rodrigues' formula allows rotation around any arbitrary axis in 3D space.

Related Articles