# Solving $x + \sqrt{x(x-a)} = b + a/2$

This algebraic equation came up in some work I was doing, and I haven't been able to solve it. I know what the solution is, but I'm quite bothered by not knowing the techniques to get there.

$$x + \sqrt{x(x-a)} = b + \frac{a}{2}$$

My attempts:

$$x + \sqrt{x(x-a)} = \frac{x^2 - x(x-a)}{x - \sqrt{x(x-a)}}$$ This led to the same issues in the denominator that I was having previously.

$$(x + \sqrt{x(x-a)})^2= x^2 + x(x-a) + 2x \sqrt{x(x-a)} = \frac{(a + 4b^2)^2}{2}$$ This RHS looks fairly close to the actual solution for $x$, but I don't see how to work with this unruly equation

• Hint: isolate the radical and square both sides, then you get a simple equation in $x$. – dxiv Mar 12 '17 at 19:50
• Ahhh so simple too. Thank you, I got it now. – infinitylord Mar 12 '17 at 19:51
• Do not forget to report in the initial equation, as squaring the equation may introduce false solutions. – zwim Mar 12 '17 at 19:54

Well, we have that:

$$x+\sqrt{x\left(x-\text{a}\right)}=\text{b}+\frac{\text{a}}{2}\tag1$$

Subtract $x$ from both sides:

$$\sqrt{x\left(x-\text{a}\right)}=\text{b}+\frac{\text{a}}{2}-x\tag2$$

Square both sides:

$$\left(\sqrt{x\left(x-\text{a}\right)}\right)^2=\left(\text{b}+\frac{\text{a}}{2}-x\right)^2=x\left(x-\text{a}\right)=\frac{\text{a}^2}{4}+\text{a}\text{b}+\text{b}^2-x\left(\text{a}+2\text{b}\right)+x^2\tag3$$

So:

$$x\left(x-\text{a}\right)-\frac{\text{a}^2}{4}-\text{a}\text{b}-\text{b}^2+x\left(\text{a}+2\text{b}\right)-x^2=$$ $$\text{a}^2-4\text{a}\text{b}-4\text{b}^2+8\text{b}x=0\tag4$$

• As mentioned in the comments, I was able to get the answer with the help of dxiv's comment, but thank you for the reply nonetheless. I'm going to mark this as best answer to close the thread now. – infinitylord Mar 12 '17 at 20:12
• sign of $a^2$ is wrong. – zwim Mar 12 '17 at 20:19
• When does this give a solution? – Did Mar 13 '17 at 16:35

$x+\sqrt{x(x-a)}=b+\frac a2\iff 2\sqrt{x(x-a)}=2b+a-2x\quad$ we square this

$\require{cancel}\implies 4x(x-a)=\cancel{4x^2}-\cancel{4ax}=4b^2+a^2+\cancel{4x^2}-8bx+4ab-\cancel{4ax}$

$\implies 8bx=4b^2+a^2+4ab=(2b+a)^2$

First if $b=0$ then $a=0$ is forced and the equation reduces to $x+|x|=0$ which gives whole $x\in\mathbb R^-$ solution.

Then for $b\neq 0$ we have $\displaystyle{x=\frac{(2b+a)^2}{8b}}$.

But as I stated in the comment, finding this does not end the resolution of the problem, we have to check for two conditions :

$\begin{cases}x(x-a)\ge 0 \\[2ex] b+\frac a2-x\ge 0\end{cases}$

So let's calculate them :

$\displaystyle{x(x-a)=\frac{(a+2b)^2(a-2b)^2}{64b^2}\ge 0}\quad$ this is ok.

$\displaystyle{b+\frac a2-x=\frac{4b^2-a^2}{8b}}\quad$ we need $|a|\le |2b|$ for $b>0$ and the opposite when $b<0$.

So to conclude :

• If $a=b=0$ then any $x\in\mathbb R^-$ is solution.
• If $b>0$ and $|a|\le |2b|$ then $x=\frac{(2b+a)^2}{8b}$
• If $b<0$ and $|a|\ge |2b|$ then $x=\frac{(2b+a)^2}{8b}$
• In all other cases there are no solutions in $\mathbb R$

As I said, this really important to report in the original equation (in this case, it means checking the signs of various stuff). You cannot just state that $x=f(a,b)$ might be solution, you have to verify for which values of $a,b$ this is really true.