Horje
Rotation Matrix

Rotation Matrix is a matrix used to perform a rotation in a coordinate space. Rotation matrices are widely used in various fields, including computer graphics, robotics, physics, and navigation systems, to describe and manipulate the orientation of objects in space. In this article, we will discuss Rotation Matrices including 2D and 3D rotation matrices.

What is a Rotation Matrix?

A rotation matrix is a matrix used to perform a rotation in a Euclidean space. For 2D and 3D spaces, which are the most common cases in applications across different fields, rotation matrices rotate points or vectors about an origin without changing their magnitude.

A rotation matrix is a mathematical representation of the rotation of a coordinate system or a set of vectors in a Euclidean space. It is a square matrix that, when multiplied with a vector, results in the rotation of that vector around the origin. This implies that it will always have an equal number of rows and columns.

Moreover, rotation matrices are orthogonal matrices with a determinant equal to 1. Suppose we have a square matrix P. Then P will be a rotation matrix if and only if PT = P-1 and |P| = 1.

Definition of Rotation Matrix

A rotation matrix is a square matrix with real entries that represents a rotation in Euclidean space. It is used to transform the coordinates of a vector, rotating it around the origin without changing its shape.

Example of Rotation using Matrix

Say we have a matrix [Tex]P= \begin{bmatrix} cos\theta & sin\theta \\ -sin\theta & cos\theta \end{bmatrix}[/Tex] . This is a 2 × 2 matrix.

[Tex]P^T = \begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix} P^-1 = \begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix}[/Tex]

Hence, PT = P-1

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

Thus, P is a rotation matrix. We can say that P 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:

[Tex]M(\theta)=\begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix}[/Tex]

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

[Tex]\begin{bmatrix} x’\\ y’ \end{bmatrix}=\begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix}[/Tex]

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 G be a vector in the x-y plane with a length r and it traces out an angle v with respect to the x-axis. We now rotate G in the counter-clockwise direction by an angle θ. If (x, y) were the original coordinates of the tip of the vector G, then (x’, y’) will be the new coordinates after rotation.

Expressing (x, y) in the polar form we have;

  • x = r cos v . . . (1)
  • y = r sin v . . . (2)

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

x’ = r cos (v + θ)

y’ = r sin (v + θ)

Expanding the brackets using trigonometric identities we get,

x’ = r (cos v.cos θ – sin v.sin θ)

⇒ x’ = r cos v.cos θ – r sin v.sin θ

From (1) and (2) we have,

x’ = x cos θ – y sin θ . . . (3)

y’ = r (sin v.cos θ + cos v.sin θ)

⇒ y’ = r sin v.cos θ + r cos v.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,

[Tex]\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}[/Tex]

Thus, [Tex] R(\theta) = \begin{bmatrix} cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix}[/Tex] 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:

[Tex]\begin{bmatrix} x’ \\ y’ \end{bmatrix} = \begin{bmatrix} cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}[/Tex]

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 axis 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.

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

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

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

According to the convention, a positive rotation given by angle θ is used to denote a counter-clockwise rotation. However, if we change the signs according to the right-hand rule, we can also represent clockwise rotations. The right-hand rule states that if you curl your fingers around the axis of rotation, where the fingers point to the direction of θ then the thumb points perpendicular to the plane of rotation in the direction of the axis of rotation.

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:

[Tex]\begin{bmatrix} x’ \\ y’\\ z’ \end{bmatrix} = P(x, y \space or z)\begin{bmatrix} x \\ y\\ z \end{bmatrix} [/Tex]

Suppose an object is rotated about all three axes, then such a rotation matrix will be a product of the three aforementioned rotation matrices [P (z, α), P (y, β) and P (x, γ)]. The general rotation matrix is represented as follows:

[Tex]P=\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}[/Tex]

To find the coordinates of the rotated vector about all three axes we multiply the rotation matrix P with the original coordinates of the vector.

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 by [Tex]Q(x, \gamma)=\begin{bmatrix} 1 & 0 & 0 \\ 0 & cos(\gamma) & -sin(\gamma) \\ 0 & sin(\gamma) & cos(\gamma) \end{bmatrix}[/Tex]. 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:

[Tex]\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}[/Tex]

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.

Conclusion

Rotation matrices are a fundamental concept in mathematics and have numerous applications in various fields, including computer graphics, robotics, physics, and navigation systems. Understanding the properties and representations of rotation matrices is crucial for working with spatial transformations and orientation-related problems.

This article has provided a comprehensive overview of rotation matrices, covering their definition, 2D and 3D representations, properties, and the Euler rotation theorem. By mastering the concepts presented here, you can effectively work with rotations and apply them in your own projects and research.

Read More,

Solved Problems on 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, [Tex]\begin{bmatrix} x’\\ y’ \end{bmatrix}=\begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix}[/Tex]

Thus, [Tex]\begin{bmatrix} x’\\ y’ \end{bmatrix}=\begin{bmatrix} cos60 & -sin60 \\ sin60 & cos60 \end{bmatrix} \begin{bmatrix} 1\\ -2 \end{bmatrix}[/Tex]

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

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

Solution:

We know that [Tex]\begin{bmatrix} x’\\ y’ \end{bmatrix}=\begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix}[/Tex]

Thus, [Tex]\begin{bmatrix} x’\\ y’ \end{bmatrix}=\begin{bmatrix} cos(-90) & -sin(-90) \\ sin(-90) & cos(-90) \end{bmatrix} \begin{bmatrix} 2\\ 3 \end{bmatrix}[/Tex]

[Tex]\begin{bmatrix} x’\\ y’ \end{bmatrix}=\begin{bmatrix} 0& 1\\ -1& 0 \end{bmatrix} \begin{bmatrix} 2\\ 3 \end{bmatrix}[/Tex]

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, [Tex]\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}[/Tex]

Therefore, [Tex]\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}[/Tex]

[Tex]\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}[/Tex]

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

Practice Problems

Q1: State whether true or false: Is [Tex]\begin{bmatrix} 5 & -1\\2&0 \end{bmatrix}[/Tex] a rotation matrix.

Q2: If we rotate J(3, 4, -1) in a counterclockwise 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)

Q3: Prove that the product of two rotation matrices is also a rotation matrix.

FAQs on Rotation Matrix

What is the difference between a rotation matrix and a transformation matrix?

A rotation matrix is a specific type of transformation matrix that represents a rotation in Euclidean space. Transformation matrices can include other types of transformations, such as scaling, shearing, and translation.

How can I convert between different representations of rotations (e.g., rotation matrices, quaternions, Euler angles)?

There are well-established mathematical formulas and algorithms for converting between different representations of rotations. The choice of representation often depends on the specific requirements of the application.

How can I compose multiple rotations using rotation matrices?

To compose multiple rotations, you can multiply the corresponding rotation matrices in the order of the rotations. The resulting matrix will represent the combined rotation.

What is the difference between a clockwise and a counterclockwise rotation?

The direction of rotation is determined by the sign of the angle. A positive angle represents a counterclockwise rotation, while a negative angle represents a clockwise rotation.




Reffered: https://www.geeksforgeeks.org


Mathematics

Related
Real Life Applications of Cube and Cuboid Real Life Applications of Cube and Cuboid
Associative Law for Addition Associative Law for Addition
Coincident Lines Coincident Lines
Point Estimation Point Estimation
Alternative Hypothesis: Definition, Types and Examples Alternative Hypothesis: Definition, Types and Examples

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
14