Simplifying the surd $\sqrt{3 - \sqrt{8}}$ Recently I was solving a math problem and I came across the following ( Only part of the problem ):
$$\sqrt{3 - \sqrt{8}}$$
Here's is what I did to simplify the above:
$$(a-b)^2=a^2+b^2-2ab$$
$$\sqrt{1+2-2\sqrt{2}}$$
$$\sqrt{(1-\sqrt{2})^2}$$
$$=1-\sqrt{2}$$
When you expand $(1-\sqrt{2})^2$ you do get $3 - \sqrt{8}$. However, I found that upon the expansion of $(\sqrt{2}-1)^2$ I also arrive at the same answer as before  $3 - \sqrt{8}$.
Yet the in the solution of the problem I was doing it required me to use the latter $(\sqrt{2}-1)^2$ to find the correct answer. $(1-\sqrt{2})^2$ did not help to solve the problem. Why is this the case? Why does the latter only hold true?
I suspect this might have something to do with the square root function only returning a positive value. Might this be the case? If so, could someone explain why a square root function can only return a positive value. My working above seems to give a negative answer ( As $\sqrt{2}>1 )$ in the square root function, but I can't seem to find what I'm doing wrong.
 A: 
$(1-\sqrt{2})^2$
I found that upon the expansion of $(\sqrt{2}-1)^2$ I also arrive at the same

This is not surprising, since $$(-a)^2=(-1)^2\times a^2=a^2.$$

$$\sqrt{3 - \sqrt{8}}$$ $$=\sqrt{(1-\sqrt{2})^2}\\\color{red}{=1-\sqrt2}$$
it required me to use $(\sqrt{2}-1)^2$ to find the correct answer. $(1-\sqrt{2})^2$ did not help, seems to give a negative answer

Not true: the second line that I quoted above is perfectly fine, however, you can replace that erroneous final line with $$=\sqrt{(1-\sqrt{2})^2}\\=\sqrt{(\sqrt{2}-1)^2}\\=\sqrt{2}-1.$$ Here, you were falsely believing that $\color{red}{\text{regardless of whether $a$ is negative or nonnegative, $\sqrt{a^2}=a$}}.$ But $$\sqrt{(-5)^2}=\sqrt{25}=5\ne-5.$$

If so, could someone explain why a square root function can only return a positive value.

We've established that $\sqrt{\quad}$ is never negative. It is always just a nonnegative value because it means "the nonnegative square root" instead of "the square roots". This is because the $n$th-root (surd) symbol $\sqrt[n]{\quad}$ is defined to mean "the principal† $n$th root" instead of "the $n$th roots".
This is just to avoid the untidiness of dealing with multiple-valued expressions. If we really need to consider both square roots of $25,$ we can write $\pm\sqrt{25},$ like in the quadratic formula. On the other hand, if we were to let $\sqrt{25}=\pm5,$ then how do we symbolically indicate that we want to pick just the negative (or just the positive) square root?
Summary: $$\pm5\ne\sqrt{(-5)^2}\ne-5,\\\sqrt{a^2}=|a|.$$
†In the complex world, principal root has no universal definition and $\sqrt[3] {-1}$ could mean either $e^{i \frac\pi3}$ (smallest nonnegative argument) or $-1$ (real), so it is common to allow surd symbols only inputs from $[0,\infty)$. If you adopt this convention (in which case principal root just means nonnegative root), then $$\sqrt[n]{a^n}\equiv|a|\quad\quad(n\in\mathbb N).$$
A: We have $\sqrt {3-\sqrt 8 }=\sqrt {3-2\sqrt 2 }.$ We ask whether there exist rational $a,b$ such that that $$3-2\sqrt 2=(a+b\sqrt 2)^2=(a^2+2b^2)+2ab\sqrt 2.$$ Since $a,b\in\Bbb Q$, this requires $$ (\bullet) \quad a^2+2/a^2=3 \land -2ab=2.$$ So $b=-1/a$ from the 2nd equation of $(\bullet).$ So $3=a^2+2b^2=a^2+2/a^2.$
Let $a^2=x.$ Then $3=x+2/x.$ So $x^2-3x+2=0.$ Take the solution $x=1.$ Now if $a=-1$ then $a^2=1=x,$ and with $b=-1/a=1,$ we see that $(\bullet)$ must hold.
