Integrate ${\int\sqrt{1 + \sin\frac{x}2}\,\mathrm{d}x}$
Use $$\sqrt{1+\sin\frac{x}{2}}=\sqrt{1+\cos\left(\frac{\pi}{2}-\frac{x}{2}\right)}=\sqrt2\left|\cos\left(\frac{\pi}{4}-\frac{x}{4}\right)\right|$$
First, they used the double angle formula:
$$\sin u = \sin\left(2\frac{u}{2}\right) = 2\sin\frac{u}{2}\cos\frac{u}{2}.$$
Then they replaced the $1$ with $\sin^2\frac{u}{2}+\cos^2\frac{u}{2}.$