Member-only story
Demystifying Rotation Matrix
How to rotate a vector in R²
A rotation matrix is like a magical tool in the world of linear algebra, designed to spin vectors around in space with precision and ease. Imagine you have a vector, a little arrow pointing somewhere in space, and you want to turn it around a certain point, like spinning a key around a keyring. That’s exactly what a rotation matrix helps you do.
To see how the rotation matrix emerges, lets start with a vector in R² and try to rotate it along horizontal axis.
Rotating a vector in R²
The figure below shows a vector v in R² that makes the angle a with horizontal axis. Let’s say that we want to rotate it ‘b degrees’ counter-clock wise along the horizontal axis, which is denoted by v’.
As we can see, the rotation just changes the direction of v and keeps the length(a.k.a ‘magnitude’) same.
In R², we can represent the vector v as the ordered tuple (m, n) with first element in horizontal axis, and the second element in the vertical axis. From trigonometry, we know that the coordinates of v=(m, n) can be represented as (||v||.cos(a), ||v||.sin(a)):