# Plot of $y=x+0\sqrt{-x}$ (and WolframAlpha vs Desmos)

To plot the graph of $$y=x+0\sqrt{-x}$$ :

Do we have to first find out the domain of $$y$$ which is $$y \in ( -\infty,0 ]$$ ? $$\color{blue}{\text{[Case 1]}}$$ (that's what I do)

Or do we solve the equation first resulting in $$y=x$$ ? $$\color{blue}{\text{[Case 2]}}$$

When plotted in WolframAlpha, it does it through Case 2 as :

But when plotted in Desmos, it goes via Case 1 as: (Which I think is correct)

So which is correct?

Thanks!

• What does $\;0\sqrt{-x}\;$ mean? Zero times the square root of minus $\;x\;$ ? That's just zero... Jul 3, 2015 at 19:08

If $x,y$ are restricted to be real (or rational) numbers, then $\sqrt{-x}$ is undefined for $x>0$. Once we have an undefined quantity, we cannot proceed further, even multiplying it by zero. Hence with this restriction Desmos is correct.
However, if $x,y$ are allowed to be complex numbers, then $\sqrt{-x}$ is (multiply) defined for real $x>0$. It is natural to take the principal value of the square root, but it doesn't matter, with any branch you end up multiplying the result by zero. Hence if $y$ is allowed to be complex, then Alpha gives the correct solution. Note that if you ask Alpha for properties of the function (like this), it tells you that as a real function the domain and range are both $(-\infty,0]$.
• I like this answer, I think it really gives the full story - that we need to choose whether we allow complex square roots, or only real-valued ones, before we can say which is correct. They're really plotting different $\sqrt{x}$ functions. Jul 3, 2015 at 16:30
Either order is fine. The issue with Desmos is that it is restricting the domain (artificially) to non-positive numbers because $\sqrt{-x}$ is complex for other numbers. In reality, having complex numbers is fine, and indeed, the next step, which is to multiply by zero makes the number real again. Wolfram alpha's plot is more correct, while Desmos' plot is incomplete.