Understanding rotation matrix direction

matricesrotations

In this example I want to compute the distance of the red en blue line, which in this example is ~0.6 and ~3.1 respectively. I thought i might be able to use a rotation matrix for this problem.
$$
\begin{bmatrix}
x' \\
y' \\
\end{bmatrix}=
\begin{bmatrix}
cos(a) & -sin(a) \\
sin(a) & cos(a) \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
$$

So i rotate the original x and y-axis by 30 degree counter clockwise so the x-axis aligns with the dotted black line.

Now my question is as follows: when i enter a positive angle (+30) i don't get the values i expect to get (-0.6 and 3.1). However, when i enter a negative angle (-30) i get the correct values. Could someone explain this to me, because i assumed counter clockwise rotation counts as positive.

Thanks in advance!

Best Answer

The point of confusion seems to be between a matrix for a rotation versus a matrix for a change of coordinates.

The concept of a rotation matrix assumes that you want to leave the axes fixed in place. Taking a matrix $A$ for a $30$ degree counterclockwise rotation, for each pair of coordinates $[x\ y]^T$ you put the matrix on the left side of the coordinate vector, multiply, and obtain a new set of coordinates $[x'\ y']^T$. When you take these new coordinates and plot them relative to the original axes, you will plot an image of your original point which is $30$ degrees counterclockwise from the position of the original point.

In short: by putting the positive angle $30$ degrees (or $29.74$ degrees) into your rotation matrix and applying it to the coordinates $[3\ 1]^T,$ you obtain the coordinates of a point somewhere above and to the left of the point at $[3\ 1]^T,$ plotted according to the horizontal and vertical axes of your original coordinate system. The first coordinate will be less than $3$ (because it rotated to the left), and the second coordinate will be greater than $1$ (because it rotated upward).

The matrix for a change of coordinates is the exact opposite of the matrix for a rotation. In a $30$ degree counterclockwise rotation, you want points on the $x$ axis to end up above the $x$ axis. But in a $30$ counterclockwise change of coordinates, you want some of the points that started at locations above the $x$ axis -- specifically, the points that lie along the dotted black line in your figure -- to end up with coordinates on the axis. In other words, the change of coordinates that you need in order to rotate the $x$ axis up to the dotted line is the same as the change of coordinates that you need in order to rotate the dotted line down to the original $x$ axis.

So it turns out that the matrix to rotate the $x$ axis $30$ degrees counterclockwise (for a change of coordinates) is the same as the matrix to rotate a set of points $30$ clockwise (staying in the original coordinate system): the angle value to put in the formula is negative.

Keep in mind that matrices know nothing about coordinate systems or the positions of points on a graph. Multiplication of a column vector by a matrix merely takes one list of numbers and replaces them with a different list. You need to make sure that the interpretation of those lists are the ones you want.