Suppose I have
$\sqrt{r-x}-\frac{x}{\sqrt{r-x}}-o=0$ with $r,x$ and $o$ real.
To solve I multiply by $\sqrt{r-x}$. I assume therefore $r>x$
$r-x-x-o\sqrt{r-x}=0$
$r-2x=o\sqrt{r-x}$
Squaring
$(r-2x)^2=o^2(r-x)$
This is a second order equation,whose solutions are
$x= \frac{r}{2} -\frac{o^2}{8} \pm \frac{o\sqrt{o^2+8r}}{8}$
However, for instance, for $r=1$ and $o=1/2$ I get two solutions. For both $x<1$, however only one is actually a solution.
How can I avoid to introduce a spurious solution?