<s>[INST] How does $\sqrt{2+\sqrt{2}}+\sqrt{2-\sqrt{2}}$ become $\sqrt{2(2+\sqrt{2})}$? I'd like to know how can one simplify the following expression
$$\sqrt{2+\sqrt{2}}+\sqrt{2-\sqrt{2}}$$
into
$$\sqrt{2(2+\sqrt{2})}.$$
Wolfram alpha suggests it as an alternative form, and numerically it's easy to verify, but I can't find the right algebra to show they are indeed equivalent.
Note I ran into this problem, trying to do: $2\cos(\pi/8)+2\sin(\pi/8)$, where
$$2\cos(\pi/8)=\sqrt{2+\sqrt{2}},$$
$$2\sin(\pi/8)=\sqrt{2-\sqrt{2}}.$$
 [/INST] 
$2\cos(\pi/8)=\sqrt{2+\sqrt{2}}$


$2\sin(\pi/8)=\sqrt{2-\sqrt{2}}$

Start from your work,
$$2\cos(\pi/8)=2\sin(\frac{\pi}2-\frac{\pi}8)=2\sin(\frac{3\pi}8)$$
So
$$S=2\cos(\pi/8)+2\sin(\pi/8)=2\sin(\frac{3\pi}8)+2\sin(\frac{\pi}8)$$
Use formula:
$$\sin(x)+\sin(y)=2\sin({\frac{x+y}{2}})\cos(\frac{x-y}2)$$
We have
$$S=4\sin(\frac{\pi}4)\cos(\frac{\pi}8)=2\sqrt{2}\cos(\frac{\pi}8)=\sqrt{4+2\sqrt{2}}$$
</s>