# coordinate transformation geometry and rotation sense

I have the situation depicted in the figure below. Horizontal and vertical axes are $$(x,y)$$ respectively. The axes $$(x',y')$$ are denoted by dotted lines and they are rotated by $$-31^\circ$$ and their origin is shifted from the center point $$C$$ to the point $$A$$. The vectors $$\vec{r0}=\vec{CA}$$, $$\vec{r}=\vec{CB}$$, $$\vec{\rho}=\vec{AB}$$ are given in the picture. I want to find the coordinates of the vector $$\rho$$ with respect to the primed axes. This should simply be $$\rho_A = \mathbb{R}(-\theta)\rho_C = \mathbb{R}(-\theta)(\vec{r}-\vec{r0})$$ where $$\mathbb{R}(\theta)$$ is the rotation matrix

$$\begin{bmatrix} \cos{\theta} & -\sin{\theta} \\ \sin{\theta} & \cos{\theta} \end{bmatrix}$$

and the minus sign is because we rotate the system clockwise. And $$\cos{\theta} = \frac{-\vec{r0}\cdot(1,0)}{|\vec{r0}|} = \cos{31^\circ}$$. The problem is that it does not work. The only way, it works is that $$\rho_A = \mathbb{R}(\theta)\rho_C$$ that is if I rotate counterclockwise. Why?

Just to show in Mathematica that clockwise rotation will not lead to the result:

r0 = {-5, 3};
r = {7, 7};
\[Theta] = ArcCos[-r0.{1, 0}/Norm[r0]]
rot = RotationMatrix[-\[Theta]];
rot.(r - r0)
N@%


Good news is that all your computations are correct; but the correct rotation matrix to apply is indeed $$R(\theta)$$, because since you are rotating the coordinate axes an angle $$\theta$$ *clockwise*, the vector $$\rho$$ is now rotated by $$\theta$$ *counterclockwise*, relative to the rotated axes. The problem can be boiled down to: given a vector $$\rho$$ in one coordinate basis, what is $$\rho$$ expressed in rotated coordinate basis?
$$\rho$$ in original/rotated coordinate system
For simplicity, assume $$\rho$$ is simply a vector in the $$x$$ direction. Do you see that whereas it forms an angle of $$0$$ with the $$x$$-axis, it forms an angle of $$\theta$$ with the $$x'$$-axis?