# Unclear step in half-angle formula derivation (trigonometric identities)

In deriving the half-angle formulas, my textbook first says: "Let's take the following identities:"

$$\cos^2\left(\frac a2\right)+\sin^2\left(\frac a2\right)=1;$$

$$\cos^2\left(\frac a2\right)-\sin^2\left(\frac a2\right)=\cos(a);$$

These identities I know. But then the texbook says "through addition and subtraction, we respectively arrive at:"

$$2\cos^2\left(\frac a2\right)=1+\cos(a)$$ $$2\sin^2\left(\frac a2\right)=1-\cos(a)$$

I failed to catch what exactly is added and what is substracted to arrive from the first two formulas to the second pair. Give me a hint, please.

The "addition" means that $$\left(\cos^2\left(\frac a2\right)+\sin^2\left(\frac a2\right)\right)+\left(\cos^2\left(\frac a2\right)-\sin^2\left(\frac a2\right)\right)=1+\cos (a).$$ The "subtraction" means that $$\left(\cos^2\left(\frac a2\right)+\sin^2\left(\frac a2\right)\right)-\left(\cos^2\left(\frac a2\right)-\sin^2\left(\frac a2\right)\right)=1-\cos (a).$$
In general, if you have $$A+B=C$$ $$D+E=F$$ then you can have $$(A+B)+(D+E)=C+F$$ $$(A+B)-(D+E)=C-F.$$
Let $a, b$ be real numbers. Recall that $$e^{ia}=\cos a + i \sin a$$ where $i^2=1.$
Then $$e^{i(a+b)}=\cos (a+b) + i \sin (a+b)$$ But \begin{align} e^{i(a+b)}&=e^{ia}e^{ib}\\\\&=(\cos a + i \sin a)(\cos b + i \sin b) \\\\&=(\cos a\cos b-\sin a\sin b) + i (\sin a\cos b+\sin b\cos a). \end{align} Consequently \begin{align} \cos (a+b)&=\cos a\cos b-\sin a\sin b\\ \sin (a+b)&=\sin a\cos b+\sin b\cos a. \end{align} Putting $a=b$ gives \begin{align} \cos (2a)&=\cos^2 a-\sin^2 a \tag1\\ \cos (2a) &=2\cos^2 a-1 \tag2 \end{align} since $$\cos^2 a+\sin^2 a=1. \tag3$$ From $(2)$ we easily get $$\cos^2 a=\frac{1+\cos (2a)}{2} \tag4$$ From $(1)$ you also have $$\cos (2a) =1-2 \sin^2 a \tag5$$ giving $$\sin^2 a=\frac{1-\cos (2a)}{2}.\tag6$$