If I take the basis $(\vec{e_x},\vec{e_y})$ and make a rotation counterclockwise of angle $\theta$, I end up with two new vectors $(\vec{u},\vec{v})$ such that :
$\vec{u} = \cos\theta \vec{e_x} + \sin\theta \vec{e_y}$
$\vec{v} = \cos\theta \vec{e_x} - \sin\theta \vec{e_y}$
so \begin{equation} \left( \begin{array}{ccc} \vec{u} \\ \vec{v}\end{array} \right) = \left( \begin{array}{ccc} \cos\theta & \sin\theta\\ -\sin\theta & \cos\theta\end{array} \right) \left( \begin{array}{ccc} \vec{e_x} \\ \vec{e_y}\end{array} \right) \end{equation}
I don't understand why the counterclockwise rotation is defined as : \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix}
EDIT:
When I look at my picture, it looks like a counterclockwise rotation...
2 Answers
$\begingroup$Suppose the rotation matrix is
$$\begin{bmatrix}a&b\\c&d\end{bmatrix}$$
Since it rotate every vector by angle $\theta$, we will look at what it does to the basis $\begin{bmatrix}1\\0\end{bmatrix}$, $\begin{bmatrix}0\\1\end{bmatrix}$.
$$\begin{bmatrix}a&b\\c&d\end{bmatrix}\begin{bmatrix}1\\0\end{bmatrix}=\begin{bmatrix}a\\c\end{bmatrix}$$
By the following picture, we could see that $a=\cos\theta,c=\sin\theta$.
Similarly, you can find $b,d$.
$\endgroup$ 2 $\begingroup$You can also do it in a more algebraic way. Since after rotation ($(x, y)$ is rotated to $(x', y')$), the length of the vector doesn't change, which means $n = \sqrt{x'^2 + y'^2} = \sqrt{x^2 + y^2}$ (see in figure attached).
Therefore we can get the following equation:
\begin{aligned} y' & = n \cdot \sin(\theta + \alpha) & (1)\\ y & = n \cdot \sin \alpha & (2) \end{aligned}
\begin{aligned} x' & = n \cdot \cos(\theta + \alpha) & (3) \\ x & = n \cdot \cos \alpha & (4) \end{aligned}
Then use the trigonometric identities to expand (1) and (3): \begin{aligned} y' & = n \cdot (\sin \theta \cos \alpha + \cos \theta \sin \alpha) & (5) \\ x' & = n \cdot (\cos \theta \cos \alpha - \sin \theta \sin \alpha) & (6) \end{aligned}
By substituting (2) and (4) into (5) and (6), we can get:\begin{aligned} y' & = x \cdot \sin \theta + y \cdot \cos \theta \\ x' & = x \cdot \cos \theta - y \cdot \sin \theta \end{aligned}
From here we can easily see:
$$\begin{bmatrix}x'\\y'\end{bmatrix} = \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix} \begin{bmatrix}x\\y\end{bmatrix}$$
$\endgroup$