In this tutorial, we provide a concise introduction to rotation matrices in robotics and aerospace engineering. We explain how to derive the rotation matrices for the 2D case. Everything explained in this tutorial can easily be generalized to the three-dimensional case. The YouTube tutorial accompanying this webpage is given below.
Problem Formulation
First, let us start with the problem formulation. We consider the figure shown below.
The top panel of the figure shows a body frame and the point in that body frame. The point is a point of a body that can rotate around the point . The vector is the distance vector of the point from the origin . The left superscript in the notation means that the projections of the distance vector are expressed in the coordinate frame (see Fig. 2 below):
(1)
Since the point is a fixed point, the vector rotates together with the body and the coordinate frame .
Next, we rotate the body for the angle of . The bottom panel of Fig. 1 above shows the situation after the rotation. The frame and the vector are rotated for the angle of with respect to the frame . The frame denoted by the magenta color is fixed and it does not rotate. The frame is the inertial or the fixed frame.
The next figure shows projections of the vector in the frames and :
The position vector has two representations:
- The representation of the position vector in the frame :
(2)
where and are the projections of the distance vector onto the axes of the frame . - The representation of the position vector in the frame :
(3)
where and are the projections of the distance vector onto the axes of the frame .
Problem formulation: Given the projections of the vector in the frame , and the angle of rotation , compute the projections of the vector in the frame .
This problem is solved by deriving a rotation matrix. The rotation matrix will be used to transform the projections of the distance vector from one coordinate frame to another.
Derivation of the Rotation Matrix and Solution of the Projection Transform Problem
For presentation clarity and to simplify the notation, let us first denote the intensity of the vector by . That is,
(4)
From the above figure, we have:
(5)
where is the angle that the vector creates with the axis . Next, let us recall the basic formulas for the cosine and sine of two angles:
(6)
By substituting these formulas in (5), we obtain
(7)
Next, from Fig.2, it follows
(8)
By substituting (8) in (7), we obtain
(9)
The last equation can be written in the matrix format
(10)
The last equation can be written compactly like this
(11)
where
(12)
The matrix
(13)
is called the rotation matrix. It transforms projections from the rotated frame to the frame . The subscript and superscript notation should be interpreted like that. The left superscript is the output frame and the left subscript is the input frame of the transformation.
The equation enables us to transform projections of a vector between two coordinate frames that are rotated with respect to one another.