# Square Root of an Expression in the form $a^2 +b^2-2ab$

According to the answer posted at ( is $\sqrt{x}$ always positive? ) the square root of any number should always give us a positive value, i.e. $\sqrt x = +a$ and $\sqrt x\ne - a$ (where $a\geq0$).

But if I have a case like $\sqrt {{a^2}+{b^2}-2ab}$

Since square roots are always positive the answer cannot be $\pm (a-b)$

Therefore answer would be either $(a-b)$ or $(b-a)$

But both answers should be correct as $(a-b)^2 = (b-a)^2 = a^2 + b^2 -2ab$

So my question is: What would the answer be: $a-b$ or $b-a$ ?

• You should note $\sqrt{x^2} = |x|$ not $x$. – Jacky Chong Oct 19 '16 at 7:02

$$|a-b|$$

or if you prefer

$$\begin{cases}a\ge b\to a-b\\a\le b\to b-a.\end{cases}$$

You can also evaluate it as

$$\max(a,b)-\min(a,b)$$

or

$$\max(a-b,b-a).$$