askvity

How do you rotate a vector by an angle clockwise?

Published in Vector Rotation 2 mins read

To rotate a vector (x, y) clockwise by an angle θ, you can use the following rotation matrix:

|  cos(θ)   sin(θ) |
| -sin(θ)   cos(θ) |

Applying this matrix to the vector (x, y) results in the new vector (x', y'):

x' = x cos(θ) + y sin(θ)
y' = -x sin(θ) + y cos(θ)

Therefore, the rotated vector is (x cos(θ) + y sin(θ), -x sin(θ) + y cos(θ)).

Explanation:

The rotation matrix is derived from trigonometry. It transforms the original vector into a new vector that has been rotated clockwise around the origin (0, 0) by the specified angle θ.

Example:

Let's say you have a vector (1, 0) and you want to rotate it 90 degrees (π/2 radians) clockwise.

  • cos(π/2) = 0
  • sin(π/2) = 1

So the rotated vector (x', y') becomes:

  • x' = 1 0 + 0 1 = 0
  • y' = -1 1 + 0 0 = -1

The rotated vector is (0, -1), which is the expected result of rotating (1, 0) 90 degrees clockwise.

Special Case: 90 Degree Clockwise Rotation

A simple case is a 90-degree clockwise rotation. For a vector (x, y), rotating it 90 degrees clockwise results in the vector (y, -x). This avoids the need to calculate trigonometric functions and can be useful in certain applications.

Summary

Rotating a vector (x, y) clockwise by an angle θ is achieved using the formula (x cos(θ) + y sin(θ), -x sin(θ) + y cos(θ)). For a 90-degree clockwise rotation, the simplified formula (y, -x) can be used.

Related Articles