0
$\begingroup$

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$ ?

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

The answer is undisputably

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.