How do I get rid of extraneous solutions? I was dealing with this equation today
$ x - k = \sqrt{x^2 + y^2} + \sqrt{(x-a)^2 + y^2}$
Where $a$ and $k$ are constants. I wanted to get rid of the square roots, so I squared the equation. Then I realised that squaring the above equation creates a set of extraneous solutions, so, my question is, is there a way that I can get rid of the extraneous solutions in this equation ? How do I do that ?
Thank you in advance.
 A: Direct answer
You can test each one to see which solutions are 'legitimate' and which solutions are extraneous.
But surely there are there other methods?
There are some methods to filter them out. For example in your case, $x-k > 0$ since it is the sum of two square roots. So the first filter you could apply is $x>k$.
Can you show me an example?
Consider the following.
$\begin{align*}\sqrt{4x+5}&=x \\ 
4x+5 &= x^2 \\
x^2-4x-5 &= 0 \\
x &= -1, \, 5
\end{align*}$
We have two conditions. The fact that $x$ is equal to a square root implies $x \geq 0$. But also the inside of the square root must be positive so $x \geq -\dfrac{5}{4}$. The intersection of these two conditions is $x \geq 0$ and so the only valid solution is $x=5$. Thus, we have filtered out the extraneous solution without brute force substituting.
A: You need to add condition before squaring.
$$x−k=\sqrt{x^2+y^2}+\sqrt{(x−a)^2+y^2}\Leftrightarrow$$
$$x-k-\sqrt{x^2+y^2}=\sqrt{(x−a)^2+y^2}\Leftrightarrow$$
$$\left(x-k-\sqrt{x^2+y^2}\right)^2=(x−a)^2+y^2 \land x-k-\sqrt{x^2+y^2}\geq 0\Leftrightarrow$$
$$x^2-2kx+k^2+x^2+y^2-2(x-k)\sqrt{x^2+y^2}=x^2-2ax+a^2+y^2 \land \\ x-k\geq\sqrt{x^2+y^2}\Leftrightarrow$$
$$x^2+2(a-k)x+k^2-a^2=2(x-k)\sqrt{x^2+y^2} \land x-k\geq\sqrt{x^2+y^2}\Leftrightarrow$$
$$(x^2+2(a-k)x+k^2-a^2)^2=4(x-k)^2(x^2+y^2) \land x^2+2(a-k)x+k^2-a^2 \geq 0 \land \\ x-k\geq\sqrt{x^2+y^2}$$
You can solve equation and check for inequalities. IMHO, the problem is too hard to solve it generally.
