Solution (source code)

= Solution

<Euler's formula> and its version with $-\theta$ give
$$
\cos\theta=\frac{e^{i\theta}+e^{-i\theta}}2,\qquad \sin\theta=\frac{e^{i\theta}-e^{-i\theta}}{2i}.
$$
Squaring $e^{i\theta}=\cos\theta+i\sin\theta$ and comparing real and imaginary parts with $e^{2i\theta}$ yields the <double-angle formulas>
$$
\boxed{\cos2\theta=\cos^2\theta-\sin^2\theta=2\cos^2\theta-1=1-2\sin^2\theta,\qquad \sin2\theta=2\sin\theta\cos\theta.}
$$