

I got these graphs from Wolfram Alpha. Can anyone please explain why the result differs by the order of operations for square roots? I thought the rule only applied to division, multiplication and subraction algorithms. Thanks.


I got these graphs from Wolfram Alpha. Can anyone please explain why the result differs by the order of operations for square roots? I thought the rule only applied to division, multiplication and subraction algorithms. Thanks.
Copyright © 2021 JogjaFile Inc.
$\sqrt{-x}$ is not a real number unless $x\leq 0$. In that case $(\sqrt{-x})^2=-x$.
On the other hand, $\sqrt{(-x)^2}=\sqrt{x^2}=|x|$ for all real $x$.
When $x\leq 0$, $|x|=-x$, so the two expressions have the same value whenever $x\leq 0$. But when $x>0$, only one of the expressions can be evaluated while sticking with real numbers.
Wolfram alpha simplifies $(\sqrt{-x})^2$ to $-x$, but ignores the domain restriction of $x\leq 0$. It graphs the function $y=-x$, but this would only actually match to the left of the $y$ axis. This is a reason why you have to be careful with Wolfram Alpha.
The order in which you apply functions and operations is practically always important. Here you are seeing that if $f(x)= x^2$ and $g(x)=\sqrt{x}$, then the compositions $f(g(x))$ and $g(f(x))$ are not the same function. (Although they do at least agree where they are both defined, which is not typical for other functions.)