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.

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.
