# Rotation Matrices - Rotating a point on a graph

I'm trying to understand how rotation matrices work in Linear Algebra... I don't think I'm visualizing it correctly though...

I'd like to rotate a point (-2, 1) around a graph... the point (-2, 1) translates to vector $$\begin{bmatrix} -2 \\ 1 \end{bmatrix}$$

So the way I was told to do that is multiply R(180 degrees)

$$\begin{bmatrix} -1 & 0\\ 0 & 1 \end{bmatrix} * \begin{bmatrix} -2 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ 1 \end{bmatrix}$$

Which correctly gives me a 180 rotations (mirroring) about the x axis- with a green origin But something seems weird with R(90):

$$\begin{bmatrix} 0 & -1\\ 1 & 0 \end{bmatrix} * \begin{bmatrix} -2 \\ 1 \end{bmatrix} = \begin{bmatrix} -1 \\ -2 \end{bmatrix}$$

It seems to rotate 90... but the origin of the circle changes... Shouldn't the point of rotation (green) stay the same as the point rotates around the circle? Like this? Or is it not rotating around the origin at all? What is the origin?

Also, I don't understand how sin and cos are plotted in this matrix. R(-theta... aka rotation counter clockwise) is given as:

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

Why is cos0 plotted at the first position of the matrix? Why is sin0 at the next position? How do these equate to the 1's and 0's above?

Thanks!

The matrix $$\begin{bmatrix} -1 & 0\\ 0 & 1 \end{bmatrix}$$ is not the matrix of a rotation, but rather a reflection about the $y$-axis. The rotation through 180 degrees is given by the matrix $$\begin{bmatrix} -1 & 0\\ 0 & -1 \end{bmatrix}.$$ The second matrix $$\begin{bmatrix} 0 & -1\\ 1 & 0 \end{bmatrix}$$ is indeed the matrix of a rotation through 90 degrees in the positive (counterclockwise) direction, with center of rotation at the origin $(0,0)$. So it's not surprising that your red and green points moved while the blue point (origin) remained fixed!
In general, to compute the matrix of a linear transformation $T$ (such as a reflection or rotation fixing the origin), you compute its effect on the basis vectors---the matrix of $T$ has columns $T(e_1)$ and $T(e_2)$ (or, in higher dimensions, $T(e_1),...,T(e_n)$). Using a little geometry and the definitions of sine and cosine, a rotation by $\theta$ degrees fixing the origin maps the vectors $$\begin{bmatrix} 1 \\ 0 \end{bmatrix} \quad \text{and} \quad \begin{bmatrix} 0 \\ 1 \end{bmatrix}$$ to the vectors $$\begin{bmatrix} \mathrm{cos}(\theta) \\ \mathrm{sin}(\theta) \end{bmatrix} \quad \text{and} \quad \begin{bmatrix} -\mathrm{sin}(\theta) \\ \mathrm{cos}(\theta) \end{bmatrix}.$$ So the formula you give in the question is off by a little (and doesn't match the correct matrix you gave for rotation through 90 degrees).