I have seen in diferent math posts that the following matrix: $$\begin{pmatrix}\cos t&-\sin t\\\sin t&\cos t\end{pmatrix}\begin{pmatrix}x \\y\end{pmatrix}$$ rotates a point $p$ in the plane counterclockwise by an angle of $t$. I was wondering if someone could explain why this matrix works as it does.
I'm not even sure if this is correct, nor if it relates to the matrix I'm trying to understand, but this is what I have tried:
Suppose you want to rotate the point $p = (p_x,p_y)$ by an angle of $t$. Let's call this new point $q = (q_x,q_y)$.
$q_x = p_x cos (t) + p_x sin (t)$,
$q_y= p_y cos (t+π/2) + p_y sin(t+π/2)$
and we have
$$\begin{pmatrix}\ p_x cos (t)&\ p_x sin (t)\\\ p_y sin (t+π/2)&\ p_ycos (t+π/2)\end{pmatrix}=\begin{pmatrix}q_x \\q_y\end{pmatrix}$$
With $q_x + q_y = q$
Any thoughts/ideas would be really appreciated.
Way 1
$$\begin{pmatrix}X \\ Y\end{pmatrix}=\begin{pmatrix}\cos t&-\sin t\\ \sin t&\cos t\end{pmatrix}\begin{pmatrix}x\\ y\end{pmatrix}\implies \begin{cases}X=\cos(t)x-\sin(t) y\\Y=\sin(t)x+\cos(t)y\end{cases}.$$
Now, one can show that $$X^2+Y^2=x^2+y^2,$$ what mean that $(x,y)$ and $(X,Y)$ belong to the same circle. Therefore, $(X,Y)$ is the image of $(x,y)$ by a rotation of center $(0,0)$. To find the angle, one can compute $$\frac{\left<\begin{pmatrix}x\\ y\end{pmatrix},\begin{pmatrix}X\\ Y\end{pmatrix}\right>}{\left\|\begin{pmatrix}x\\ y\end{pmatrix}\right\|\left\|\begin{pmatrix}X\\ Y\end{pmatrix}\right\|},$$ what gives the cosinus between $\begin{pmatrix}x\\ y\end{pmatrix}$ and $\begin{pmatrix}X\\ Y\end{pmatrix}$ and conclude.
Way 2
If you know complex number, you can prove that $$X+iY=\sqrt{x^2+y^2}e^{it}=\sqrt{x^2+y^2}(\cos(t)+i\sin(t)),$$ and it allow you to conclude.
Added
$$\frac{\left<\begin{pmatrix}x\\ y\end{pmatrix},\begin{pmatrix}X\\ Y\end{pmatrix}\right>}{\left\|\begin{pmatrix}x\\ y\end{pmatrix}\right\|\left\|\begin{pmatrix}X\\ Y\end{pmatrix}\right\|}=\frac{\cos(t)x^2-xy\sin(t)+xy\sin(t)+\cos(t)y^2}{x^2+y^2}=\frac{x^2+y^2}{x^2+y^2}\cos(t)=\cos(t).$$
Therefore the angle between $(x,y)$ and $(X,Y)$ is $t$.