My notes on Transformations has the following formula for rotating a point counter-clockwise about the origin:

\begin{align*}x^\prime&=x\cos\theta - y\sin\theta\\y^\prime&=x\sin\theta + y\cos\theta\end{align*}

Why? And why does changing the direction mean that we change the signs before the sin values so that rotating a point around the origin clockwise can be found by:

\begin{align*}x^\prime&=x\cos\theta + y\sin\theta\\y^\prime&=-x\sin\theta + y\cos\theta\end{align*}

I am trying to work through an example, to rotate a point at (20, 0) $45^o$ clockwise, but I don't get the answer supplied by the notes.

My Workings

\begin{align*}x^\prime&=20\cos(45) + 0\sin(45) = 10.51\\y^\prime&=-20\sin(45) + 0\cos(45) = -17.01\end{align*}

but my notes give the answer as being:

\begin{align*}x^\prime&=14.14\\y^\prime&=-14.14\end{align*}

I don't want to just follow the formula (especially as I seem to be getting the wrong answer!). I really want to understand how the new position relates to the the addition and / or subtraction of sin and cos, but I don't have any intuitions about it.

Be grateful for any help.

Regards

-
For your second question: "rotate by $-\theta$ anticlockwise" is just another way of saying "rotate by $\theta$ clockwise". Note that the cosine is even and the sine is odd. –  Guess who it is. Apr 26 '11 at 16:40
To evaluate $\sin(45^\circ)$ and $\cos(45^\circ)$, notice that $45^\circ$ is half of a right angle, and so is the angle in an isosceles right triangle. Draw such a triangle, apply the Pythagorean theorem and use the fact that the smaller sides have the same length to conclude that $\cos(45^\circ)=\sin(45^\circ)=\frac{1}{\sqrt 2}$. As for your evaluations, your calculator was in radian mode with degree inputs. –  Jonas Meyer Apr 26 '11 at 16:46
The cheater's way of motivating the rotation formulae: convert your Cartesian coordinates to polar coordinates, add the rotation angle to the polar angle (corresponding to an anticlockwise rotation), and convert back, making use of the sum-of-angles formulae for trigonometric functions. –  Guess who it is. Apr 26 '11 at 16:48
"your calculator was in radian mode with degree inputs." - it's a very common mistake to make. Be very careful with your manipulations if you insist on having to use degrees. –  Guess who it is. Apr 26 '11 at 16:50
Thanks for your answers. Need a bit of time to absorb what you're saying. I'll post back once I'm done. –  Joe Apr 26 '11 at 17:38

If you accept that counterclockwise rotation by $\theta$ is a linear transformation, then the transformation is determined by its effect on the standard basis vectors $(1,0)$ and $(0,1)$. So, let's look at where those vectors are sent.

The formulas come from the trigonometry going on, and I encourage you to draw this out at least once. The vector $(1,0)$ points straight right along the $x$-axis, and after applying the transformation (rotating it by $\theta$), we get a new vector, still on the unit circle, with angle $\theta$ from the $x$-axis. Essentially by definition of cosine and sine, this means that the new $x$ coordinate is $\cos(\theta)$, and the new $y$ coordinate is $\sin(\theta)$

Similarly, when we look at what happens to $(0,1)$ on that picture, we see that it gets sent to a vector with $x$-coordinate $-\sin(\theta)$ and $y$-coordinate $\cos(\theta)$.

That means that the transformation by $\theta$ degrees can be enacted by the matrix $$\begin{pmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{pmatrix}$$

Consequently, we can figure out what this transformation does to an arbitrary vector $(x,y)^T$ by left-multiplying it by this matrix to get (assuming I did this right) $$\begin{pmatrix} x \cdot \cos(\theta) - y \cdot \sin(\theta) \\ x \cdot \sin(\theta) + y \cdot \cos(\theta) \end{pmatrix}$$

You could also check this in a less linear-algebra-ish way by just thinking about the rotation of the arbitrary vector to start with, but I think if you understand one way you'll be close to understanding the other.

Also, you can come up with the matrix for clockwise rotation in a similar way: it sends $(1,0)$ to $(\cos(\theta), -\sin(\theta))$ and sends $(0,1)$ to $(\sin(\theta),\cos(\theta))$, so the corresponding matrix for the transformation is $$\begin{pmatrix} \cos(\theta) & \sin(\theta) \\ -\sin(\theta) & \cos(\theta) \end{pmatrix}$$

and the result of applying this matrix to an arbitrary vector $(x,y)^T$ is $$\begin{pmatrix} x \cdot \cos(\theta) + y \cdot \sin(\theta) \\ -x \cdot \sin(\theta) + y \cdot \cos(\theta) \end{pmatrix}$$

As far as why you're getting the wrong answer: I strongly suspect that you're using a calculator that expects radian inputs to the trig functions. You're probably plugging in 45 thinking that's 45 degrees, but it's interpreting it as 45 radians and giving you a weird answer. Either try again using $\pi / 4$ radians, or change your calculator to work with degrees.

-
Thanks for your answer. It's going to take me a while to work through it. I'll post back once I'm done. :) –  Joe Apr 26 '11 at 17:37
Great Answer. I drew out the unit vector stuff and saw it working. Need to practice, practice, practice. –  Joe Apr 26 '11 at 18:06