To rotate a point, \((x_1, y_1)\) around the origin, by an angle \(\phi\), resulting in a new point, \((x_2, y_2)\):

$$ \begin{eqnarray*} x_2 & = & x_1 \cos \phi - y_1 \sin \phi\\ y_2 & = & y_1 \cos \phi + x_1 \sin \phi \end{eqnarray*} $$

How to derive the rotation formulas:

Start with a point: $$p_1 = (x_1, y_1)$$

Consider its representation in terms of polar coordinates: $$ \begin{eqnarray*} x_1 = r \cos \theta_1\\ y_1 = r \sin \theta_1 \end{eqnarray*} $$

The rotated point will be: $$ \begin{eqnarray*} x_2 & = & r \cos \left(\theta_1 + \phi\right) \\ y_2 & = & r \sin \left(\theta_1 + \phi\right) \end{eqnarray*} $$

Remember the trigonometric identities for addition of angles: $$ \begin{eqnarray*} \sin \left(a + b\right) & = & \sin a \cos b + \cos a \sin b \\ \cos \left(a + b\right) & = & \cos a \cos b - \sin a \sin b \end{eqnarray*} $$

Substituting these in, we get: $$ \begin{eqnarray*} x_2 & = & r \cos \left(\theta_1 + \phi\right) \\ x_2 & = & r \left( \cos \theta_1 \cos \phi - \sin \theta_1 \sin \phi \right) \end{eqnarray*} $$

Using the equations for \(x_1\) and \(y_1\), we can simplify this to: $$x_2 = x_1 \cos \phi - y_1 \sin \phi$$

Likewise, for \(y_2\): $$ \begin{eqnarray*} y_2 & = & r \sin \left(\theta_1 + \phi\right) \\ y_2 & = & r \left( \sin \theta_1 \cos \phi + \cos \theta_1 \sin \phi \right) \\ y_2 & = & y_1 \cos \phi + x_1 \sin \phi \end{eqnarray*} $$

How to derive the addition-of-angles formulas:

A complex number on the unit circle, in exponential form: $$e^{\theta i} = \cos \theta + i \sin \theta$$

Multiplying two such complex numbers: $$e^{ai} \times e^{bi} = e^{\left(a+b\right)i}$$

So: $$ \begin{eqnarray*} e^{\left(a+b\right)i} = \cos\left(a+b\right) + i \sin\left(a+b\right)\\ e^{ai} \times e^{bi} = \left(\cos a + i \sin a\right) \times \left(\cos b + i \sin b\right)\\ = \cos a \cos b + i \cos a \sin b + i \sin a \cos b - \sin a \sin b \end{eqnarray*} $$

Separating the real and complex components: $$ \begin{eqnarray*} \cos\left(a+b\right) & = & \cos a \cos b - \sin a \sin b\\ \sin\left(a+b\right) & = & \cos a \sin b + \sin a \cos b \end{eqnarray*} $$