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.
This is not surprising, since $$(-a)^2=(-1)^2\times a^2=a^2.$$
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.$$
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).$$