I have an aviation-like coordinate system where the green, blue, and red arrows represents the unit vectors on the x-, y-, and z-axis and oriented in a way that obeys the right-hand-rule.
If I yaw a vector (e.g. the blue, y-unit vector) by 20° (i.e. to rotate the y-unit vector CW by 20°, I can either rewrite the new, rotated vector in terms of the original frame (the linear combination way):
$$ \mathbf{v}=-\sin(20°)\,\hat{x} + \cos(20°)\,\hat{y} = -0.34\,\hat{x} + 0.94\,\hat{y}$$
or, I can apply a full rotational matrix on the y-unit-vector instead:
$$ \begin{align} \mathbf{v}_x &= \cos(20°)\,\hat{x} + \sin(20°)\,\hat{y} \\ \mathbf{v}_y &= -\sin(20°)\,\hat{x} + \cos(20°)\,\hat{y} \\ \mathbf{v}_z &= \hat{z} \end{align} \;\;\;\implies\;\;\; \mathbf{v} = \begin{bmatrix} \cos(20°) & \sin(20°) & 0 \\ -\sin(20°) & \cos(20°) & 0 \\ 0 & 0 & 1 \end{bmatrix}\hat{y} = \begin{bmatrix} 0.34 \\ 0.94 \\ 0 \end{bmatrix}$$
Either calculation should provide me with the same result - but I get one resulting vector rotated CCW opposite to the direction of rotation under the right-hand convention. I couldn't find any error individually in the linear combination or in the rotational matrix, nor can I find any discrepancy between the two ... after all, the linear combination is just a piece of the system of equations (precisely the 2nd equation) that forms the 3x3 rotational matrix.
Could someone explain why their angle of rotation are different, and when should I use which to know I will get the correct direction of rotation?
