<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] Alternatively
We want
$\sqrt{2+\sqrt 2} + \sqrt {2-\sqrt 2}=\sqrt{something}$ so
$\sqrt{2+\sqrt 2} + \sqrt {2-\sqrt 2}=$
$\sqrt{(\sqrt{2+\sqrt 2} + \sqrt {2-\sqrt 2})^2}=$
$\sqrt{(2+\sqrt 2) + (2-\sqrt 2) + 2\sqrt{2+\sqrt 2}\sqrt {2-\sqrt 2}}=$
$\sqrt{4 + 2\sqrt{(2+\sqrt 2)(2-\sqrt 2)}}=$
$\sqrt{4 + 2\sqrt{4 - 2}}=$
$\sqrt{4 + 2\sqrt 2}=$
$\sqrt {2(2+\sqrt 2)}$
Or we could go the other way
We want some to get $\sqrt{2(2+\sqrt 2)} = \sqrt{\sqrt{2+\sqrt 2} + \sqrt{2-\sqrt 2}}$ so we try to get it into expresions that look closer and closer to it.
$\sqrt{2(2+\sqrt 2)} = \sqrt{(2+\sqrt 2) + (2 + \sqrt 2)}=$
$\sqrt{(2+\sqrt 2) +2\sqrt 2 +(2-\sqrt 2)}=$
$\sqrt{\sqrt{2+\sqrt 2}^2 + 2\sqrt 2+ {\sqrt{2-\sqrt 2}}^2}$
Now if we can prove that $\sqrt 2 = {\sqrt{2+\sqrt 2}}{\sqrt{2-\sqrt 2}}$ we'd be golden.
So side track: $ {\sqrt{2+\sqrt 2}}{\sqrt{2-\sqrt 2}}=$
${\sqrt{(2+\sqrt 2)(2-\sqrt 2}}=$
${\sqrt{2^2 - \sqrt 2^2}}=$
${\sqrt{4-2}} = \sqrt 2$.
so.... back on track:
$\sqrt{\sqrt{2+\sqrt 2}^2 + 2\sqrt 2+{\sqrt{2-\sqrt 2}}^2}=$
$\sqrt{\sqrt{2+\sqrt 2}^2 + 2\sqrt{2+\sqrt 2}{\sqrt{2-\sqrt 2}+ {\sqrt{2-\sqrt 2}}^2}}=$
$\sqrt{(\sqrt{2+\sqrt 2} + \sqrt{2-\sqrt 2})^2}=$
$\sqrt{2+\sqrt 2} + \sqrt{2-\sqrt 2}$
</s>