Rotation Matrix

Last Updated : 23 Jul, 2025

A Rotation Matrix is a type of transformation matrix used to rotate vectors in a Euclidean space. It applies matrix multiplication to transform the coordinates of a vector, rotating it around the origin without altering its shape or magnitude.

Rotation matrices are square matrices with real entries and an equal number of rows and columns. They belong to the class of orthogonal matrices and have a determinant equal to 1, which ensures no distortion occurs during rotation.

Key Concepts:
• A transformation matrix is a square matrix that transforms a vector into another vector through matrix multiplication.
• An orthogonal matrix is a square matrix whose rows and columns are orthonormal vectors, meaning they are both perpendicular and of unit length.

Example of Rotation Matrix

Suppose we have a square matrix A. Then A will be a rotation matrix if:

  • AT = A-1
  • |A| = 1.

Say we have a matrix A = \begin{bmatrix}cos\theta & sin\theta \\-sin\theta & cos\theta\end{bmatrix}.

A^T = \begin{bmatrix}cos\theta & -sin\theta \\sin\theta & cos\theta\end{bmatrix}\\A^{-1} = \begin{bmatrix}cos\theta & -sin\theta \\sin\theta & cos\theta\end{bmatrix}

Hence, AT = A-1

Now, |A| = (cos2θ + sin2θ) = 1.

Thus, A is a rotation matrix. We can say that A rotates the Cartesian coordinates in an anticlockwise direction through θ with respect to the x-axis in a 2-D system.

Representation of Rotations in Mathematics

In mathematics, rotations can be represented in various ways, including:

  1. Rotation Matrices: As discussed, rotation matrices are the most common and widely used representation of rotations.
  2. Quaternions: Quaternions are a four-dimensional representation of rotations that offer advantages in terms of computational efficiency and avoiding gimbal lock.
  3. Euler Angles: Euler angles represent rotations as a sequence of three rotations around the coordinate axes, which can be useful in certain applications but can also suffer from gimbal lock.

Each representation has its own advantages and disadvantages, and the choice of representation often depends on the specific requirements of the application.

2D Rotation Matrix

The process of rotating an object with respect to an angle in a two-dimensional plane is 2D rotation. We accomplish this rotation with the help of a 2 × 2 rotation matrix that has the standard form as given below:

B(\theta)=\begin{bmatrix}cos\theta & -sin\theta \\sin\theta & cos\theta\end{bmatrix}

If we want to rotate a vector with the coordinates (x, y) then we use matrix multiplication to perform the rotation as follows:

\begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}cos\theta & -sin\theta \\sin\theta & cos\theta\end{bmatrix} \begin{bmatrix}x\\y\end{bmatrix}

On solving this equation we get,

x' = xcosθ - ysinθ.
y' = xsinθ + ycosθ.

Here, θ is the angle of rotation in the anti-clockwise direction.

Derivation of the 2D Rotation Matrix

Let "V" be a vector in the x-y plane with a magnitude "L," forming an angle "a" with the x-axis. The vector is now rotated anti-clockwise by an angle θ. If (x, y) represents the initial coordinates of the tip of vector V, then (x', y') will denote the coordinates after the rotation.

_derivation_of_the_2d_rotation_matrix
2D Rotation Matrix Derivation

Expressing (x, y) in the polar form, we get:

  • x = L cos a . . . (1)
  • y = L sin a . . . (2)

Similarly, expressing (x', y') in polar form

x' = L cos (a + θ)
y' = L sin (a + θ)

Using trigonometric identities we get,

x' = L (cos a.cos θ - sin a.sin θ)
⇒ x' = L cos a.cos θ - L sin a.sin θ

Substituting the values from equation (1) and (2):

  • x' = x cos θ - y sin θ . . . (3)

For the y-coordinate,

y' = L (sin a.cos θ + cos a.sin θ)
⇒ y' = L sin a.cos θ + L cos a.sin θ

  • ⇒ y' = y cos θ + x sin θ . . . (4)

If we take the help of a 2 × 2 rotation matrix to denote (3) and (4) we get,

\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix} \cdot \begin{bmatrix} x \\ y \end{bmatrix}

Thus, R(\theta) = \begin{bmatrix} cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix} will be the rotation matrix.

Rotating Points in a 2D Plane

To rotate a point (x, y) in a 2D plane by an angle θ, you can multiply the point vector by the 2D rotation matrix:

\begin{bmatrix}x' \\y'\end{bmatrix} = \begin{bmatrix}cos(\theta) & -sin(\theta) \\sin(\theta) & cos(\theta)\end{bmatrix} \begin{bmatrix}x \\y\end{bmatrix}

The resulting vector (x', y') represents the rotated point.

3D Rotation Matrix

In 3D space, rotation can occur about the x, y, or z-axis. Such a type of rotation that occurs about any one of the axes is known as a basic or elementary rotation. Given below are the rotation matrices that can rotate a vector through an angle about any particular axis.

A(x, \gamma) = \begin{bmatrix}1 & 0 & 0 \\0 & cos(\gamma) & -sin(\gamma) \\0 & sin(\gamma) & cos(\gamma)\end{bmatrix}. This is also known as a roll and it's defined as the counterclockwise rotation of γ about the x axis.

A(y, \beta)=\begin{bmatrix}cos(\beta) & 0 & sin(\beta) \\0 & 1 & 0 \\-sin(\beta) & 0 & cos(\beta)\end{bmatrix}. Such a matrix is known as a pitch. Here, it represents the counterclockwise rotation of β about the y axis.

A(z, \alpha)=\begin{bmatrix}cos(\alpha) & -sin(\alpha) & 0 \\sin(\alpha) & cos(\alpha) & 0 \\0 & 0 & 1\end{bmatrix}. This rotation matrix is called a yaw and it is the the counterclockwise rotation of α about the z axis.

As per convention, a positive rotation by an angle θ represents a counter-clockwise rotation. However, by altering the signs based on the right-hand rule, clockwise rotations can also be described. According to the right-hand rule, if you curl your fingers around the axis of rotation in the direction of θ, your thumb will point perpendicular to the plane of rotation, indicating the axis's direction.

Now if we want to find the new coordinates (x', y', z') of a vector(x, y, z) after rotation about a particular axis we follow the formula given below:

\begin{bmatrix}x' \\y'\\z'\end{bmatrix} = A(x, y \space or \space z)\begin{bmatrix}x \\y\\z\end{bmatrix}

If an object is rotated about all three axes, the resulting rotation matrix is obtained by multiplying the individual rotation matrices for each axis: A(z, α), A(y, β), and A(x, γ). The general rotation matrix can be expressed as:

A =\begin{bmatrix}cos(\alpha) & -sin(\alpha) & 0 \\sin(\alpha) & cos(\alpha) & 0 \\0 & 0 & 1\end{bmatrix}\begin{bmatrix}cos(\beta) & 0 & sin(\beta) \\0 & 1 & 0 \\-sin(\beta) & 0 & cos(\beta)\end{bmatrix} \begin{bmatrix}1 & 0 & 0 \\0 & cos(\gamma) & -sin(\gamma) \\0 & sin(\gamma) & cos(\gamma)\end{bmatrix}

The coordinates of a vector rotated about all three axes can be determined by multiplying the rotation matrix A with the vector's original coordinates.

Derivation of the 3D Rotation Matrix

To derive the x, y, and z rotation matrices, we will follow the steps similar to the derivation of the 2D rotation matrix. A 3D rotation is defined by an angle and the rotation axis. Suppose we move a point Q given by the coordinates (x, y, z) about the x-axis to a new position given by (x', y,' z').

The x component of the point remains the same. Hence, this rotation is analogous to a 2D rotation in the y-z plane. For this reason, our 3 × 3 rotation matrix is given byQ(x, \gamma)=\begin{bmatrix}1 & 0 & 0 \\0 & cos(\gamma) & -sin(\gamma) \\0 & sin(\gamma) & cos(\gamma)\end{bmatrix}. The same concept is applied to the rotation of the object about the y and z axes in order to obtain the respective rotation matrices.

Rotating Points in 3D Coordinates

To rotate a point (x, y, z) in 3D space by an angle θ around a specific axis, you can multiply the point vector by the corresponding 3D rotation matrix:

\begin{bmatrix}x' \\y'\\z'\end{bmatrix} = \begin{bmatrix}1 & 0 & 0 \\0 & cos(\theta) & -sin(\theta) \\0 & sin(\theta) & cos(\theta)\end{bmatrix} \begin{bmatrix}x \\y \\z\end{bmatrix}

The resulting vector (x', y', z') represents the rotated point.

Properties of Rotation Matrices

Rotation matrices possess several important properties:

  • Orthogonality: The columns (or rows) of a rotation matrix form an orthonormal basis, meaning they are orthogonal to each other and have a magnitude of 1.
  • Determinant: The determinant of a rotation matrix is always equal to 1, indicating that the matrix preserves the orientation of the coordinate system.
  • Inverse and Transpose: The inverse of a rotation matrix is equal to its transpose, i.e., R-1 = RT.
  • Composition of Rotations: The product of two rotation matrices is also a rotation matrix, allowing for the composition of multiple rotations.

These properties make rotation matrices a powerful and versatile tool for representing and manipulating rotations in various applications.

Euler's Rotation Theorem

Euler's rotation theorem states that any rotation of a rigid body in three-dimensional space can be described as a single rotation around a fixed axis. This axis is known as the Euler axis, and the angle of rotation around this axis is called the Euler angle.

Applications of Rotation Matrices

Some of the most common applications of rotation of matrices are:

  • Computer Graphics: In 2D and 3D graphics, rotation matrices are used to rotate objects, cameras, and viewpoints.
  • Robotics: In robotics, rotation matrices are essential for representing the orientation of robotic arms and end-effectors.
  • Physics: Rotation matrices are employed in physics to describe the orientation of objects in space and analyze rotational motion.
  • Navigation Systems: In navigation systems, rotation matrices are utilized to track the orientation of vehicles and objects.

Solved Problems on the Rotation Matrix

Example 1: If A (1, -2) is rotated in the counterclockwise direction by 60°, what are the coordinate values?

Solution:

We know that, \begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}cos\theta & -sin\theta \\sin\theta & cos\theta\end{bmatrix} \begin{bmatrix}x\\y\end{bmatrix}

Thus, \begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}cos60 & -sin60 \\sin60 & cos60\end{bmatrix} \begin{bmatrix}1\\-2\end{bmatrix}

On solving we get, (x', y') = (1/2 + √3, √3/2 - 1)

Example 2: If B (2, 3) is rotated in the clockwise direction by 90°, what are the coordinate values?

Solution:

We know that \begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}cos\theta & -sin\theta \\sin\theta & cos\theta\end{bmatrix} \begin{bmatrix}x\\y\end{bmatrix}

Thus, \begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}cos(-90) & -sin(-90) \\sin(-90) & cos(-90)\end{bmatrix} \begin{bmatrix}2\\3\end{bmatrix}

\begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}0& 1\\-1& 0\end{bmatrix} \begin{bmatrix}2\\3\end{bmatrix}

On solving we get, (x', y') = (3, -2)

Example 3: If C (5, 2, 6) is rotated in the counterclockwise direction by 180° about the x-axis, what are the coordinate values?

Solution:

Since, \begin{bmatrix}x'\\y'\\z'\end{bmatrix}= \begin{bmatrix}1 & 0 & 0 \\0 & cos(\gamma) & -sin(\gamma) \\0 & sin(\gamma) & cos(\gamma)\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}

Therefore, \begin{bmatrix}x'\\y'\\z'\end{bmatrix}= \begin{bmatrix}1 & 0 & 0 \\0 & cos(180) & -sin(180) \\0 & sin(180) & cos(180)\end{bmatrix}\begin{bmatrix}5\\2\\6\end{bmatrix}

\begin{bmatrix}x'\\y'\\z'\end{bmatrix}= \begin{bmatrix}1 & 0 & 0 \\0 & -1 & 0 \\0 &0 & -1\end{bmatrix}\begin{bmatrix}5\\2\\6\end{bmatrix}

On solving we get (x', y', z') = (5, -2, -6)

Practice Problems

Question 1: State whether true or false: This is \begin{bmatrix}5 & -1\\2&0\end{bmatrix} a rotation matrix.

Question 2: If we rotate J(3, 4, -1) in a counter-clockwise direction by 45° about the z-axis, what are the new coordinates?
a) (-1, -3, -2)
b) (1, 4, 5)
c) (6, -1, -2)
d) (-0.71, 4.97, -1)

Answer Key

  • Answer 1: False
  • Answer 2: d) (-0.71, 4.97, -1)
Comment

Explore