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}}.$$

Rather than focus on the specifics of this one question, let's try to figure out the general case that this is an instance of.
We are given an expression of the form $$\sqrt{a + b} + \sqrt{a - b}$$
and we would like to somehow write this as the square root of a single quantity.  So, let's give it a name:
$$X = \sqrt{a + b} + \sqrt{a - b}$$
Square both sides, carefully using the identity $(u + v)^2 = u^2 + 2uv + v^2$.  We get
$$X^2 = (a + b) + 2\sqrt{a+b}\sqrt{a-b} + (a-b)$$
which simplifies (slightly) as
$$X^2 = 2a + 2\sqrt{a+b}\sqrt{a-b}$$
Now let's focus on the product of those two square roots.  We know that
$$\begin{aligned} \sqrt{a+b}\sqrt{a-b} &= \sqrt{(a+b)(a-b)} \\ &= \sqrt{a^2 - b^2} \end{aligned}$$
which allows us to write our main result as
$$X^2 = 2a + 2\sqrt{a^2 - b^2}$$
and finally we obtain
$$X = \sqrt{2\left( a + \sqrt{a^2 - b^2} \right) }$$
So we have shown the identity
$$\sqrt{a+b} + \sqrt{a-b} = \sqrt{2\left( a + \sqrt{a^2 - b^2} \right) }$$
The question in the OP is a specific instance of this, in which $a = 2$ and $b = \sqrt{2}$; in this case, the identity just discovered reads
$$\sqrt{2 + \sqrt{2}} + \sqrt{2 - \sqrt{2}} = \sqrt{2\left(2 + \sqrt{4-2} \right)}$$
which is exactly what we were asked to show.
But there are other interesting applications of the general identity.  For example, let $a = 5$ and $b = 3$.  Then our identity reads
$$\sqrt{5+3} + \sqrt{5-3} = \sqrt{2\left( 5 + \sqrt{5^2 - 3^2} \right) }$$
or equivalently
$$\sqrt{8} + \sqrt{2} = \sqrt{2\left( 5 + \sqrt{25-9} \right)}$$
which can, of course, be simplified further as
$$\sqrt{8} + \sqrt{2} = \sqrt{2\left( 5 + 4 \right)}$$
which is easily seen to be true.
