<s>[INST] How to make use of angle sum and difference identities to find the value of sine and cosine? 
Calculate: $\cos\left({5\pi\over12}\right)$ and $\cos\left({\pi\over12}\right)$

What is the easiest way to find $\cos\left({5\pi\over12}\right)$ and $\cos\left({\pi\over12}\right)$ (without a calculator)? If I know that $\frac{5\pi }{12}=\frac{\pi }{4}+\frac{\pi }{6}$ and $\frac{\pi }{12}=\frac{\pi }{3}-\frac{\pi }{4}$, then I can apply angle sum and difference identities. But how do I know $\frac{5\pi }{12}= \frac{\pi }{4}+\frac{\pi }{6}$ and $\frac{\pi }{12}= \frac{\pi }{3}-\frac{\pi }{4}$ in the first place. I know $ \frac{\pi }{4}+\frac{\pi }{6} = \frac{5\pi }{12}$ and $ \frac{\pi }{3}-\frac{\pi }{4}=\frac{\pi }{12}$ but I can't go the other way round.
I gave $\frac{5\pi}{12}$ and $\frac{\pi}{12}$ as an example, I want the general solution for any value in pi rational form $\frac{\pi p}{q}$.
 [/INST] We want to find the values of $\displaystyle\cos\frac{5\pi}{12}$ and $\displaystyle\cos\frac{\pi}{12}$.
Recall the sum to product formulae below:
$$\begin{align}\cos A+\cos B&=2\cos\frac{A+B}{2}\cos\frac{A-B}{2}\\
\cos A-\cos B&=-2\sin\frac{A+B}{2}\sin\frac{A-B}{2}\\\end{align}.$$
In our case, let $A=5\pi/12$ and $B=\pi/12$. Then we find that
$$\begin{align}\cos\frac{5\pi}{12}+\cos\frac{\pi}{12}&=2\cos\frac{\frac{5\pi}{12}+\frac{\pi}{12}}{2}\cos\frac{\frac{5\pi}{12}-\frac{\pi}{12}}{2}=2\cos\frac{\pi}{4}\cos\frac{\pi}{6}\\
&=\frac{\sqrt6}{2}\tag{1}\\
\cos\frac{5\pi}{12}-\cos\frac{\pi}{12}&=-2\sin\frac{\frac{5\pi}{12}+\frac{\pi}{12}}{2}\sin\frac{\frac{5\pi}{12}-\frac{\pi}{12}}{2}=-2\sin\frac{\pi}{4}\sin\frac{\pi}{6}\\
&=-\frac{\sqrt2}{2}\tag{2}.\end{align}$$
Adding equations $(1)$ and $(2)$ together and dividing by $2$, we find that
$$\cos\frac{5\pi}{12}=\frac{\sqrt6-\sqrt2}{4}$$
and subtracting equation $(2)$ from equation $(1)$ and dividing by $2$ gives
$$\cos\frac{\pi}{12}=\frac{\sqrt6+\sqrt2}{4}.$$

However, this method is not always guaranteed to work, for the simple reason that $\cos x\pi$ does not always have a closed form for  rational $x$.

I hope that helps. If you have any questions please don't hesitate to ask :)
</s>