Let there be two completely coincident right-handed orthogonal frames and then one of them is rotated CCW by $\theta$ degrees around the z axis. Let the unit vectors of the rotated frame be denoted as $ x^{'} y^{'} z^{'} $ (those of stationary frame are $x y z$) The equations which express the rotated frame with respect to the stationary frame are
$x^{'}=x\cos\theta-y\sin\theta$
$y^{'}=x\sin\theta+y\cos\theta$
$z^{'}=z$
The rotation matrix is $$
\begin{bmatrix}
\cos \theta & -\sin\theta & 0 \\
\sin\theta & \cos \theta & 0 \\
0 & 0 & 1 \\
\end{bmatrix}
$$
We know that this matrix is also a rotational operator and the operation above is equivalent to rotating a vector CCW around the z axis by the same amount.
I want to derive the rotation equations by geometrical means considering the picture above. The components of the vector before and after rotation are as depicted.