# Computing a point having distances from 2 points respectively

I want to compute a point $p$ which has distances $d1$ and $d2$ from points $q1$ and $q2$ respectively. As I wanted a general answer, I used Maxima inputting the following script ,

$solve($ $[sqrt((num1-x)^2+(num2-y)^2)=num3,$ $sqrt((num4-x)^2+(num5-y)^2)=num6]$ $,[x,y]);$

Where all variables of the format $num$_ were constants in my mind and $p=(x,y)$. I expected an output like , x= ... ; y= ..... . Though,the output was just an empty bracket $[]$. Is the script mathematically wrong or lacking some information or just a problem of the software ,Maxima?

(*Optionally, I am glad if you let me know a script which works well.)

Thank you in advance.

-
There won't be a point satisfying your problem for every $q_1$, $q_2$, $d_1$, and $d_2$. Have you tried your script with values that you know have a solution? – Austin Mohr Nov 9 '11 at 4:48
@AustinMohr: Supposing I understand your comment correctly,p=(0,0),q1=(1,0),q2=(-1,0),d1=d2=1.And the result was the same , just an empty bracket $[ ]$. – seven_swodniw Nov 9 '11 at 5:34

As @AustinMohr noted, this problem has no solution in general case (i.e., for arbitrary values of the inputs). It will have a solution (there exists $p$) if and only if anyone of the following two conditions is satisfied:

1. $\quad d_0=|q_1q_2|=d_1+d_2$,

2. $\quad d_0=|d_1-d_2|$,

3. $\quad d_0, d_1, d_2$ are the sides of a triangle which is true iff $d_i\le s~\forall i=1,2,3; s=\text{ half-perimeter" }=\frac{d_0+d_1+d_2}{2}$

Case1: In this case $p$ is the (unique) lies inside $|q_1q_2|$ and is given by $p=\frac{d_2.q_1+d_1.q_2}{d_1+d_2}$.

Case2: In this case $p$ lies on the extended $|q_1q_2|$ and is given by $p=\frac{d_2.q_1-d_1.q_2}{d_2-d_1}$.

Case3: $p$ is the two intersecting points of the two circles $C_1(q_1,d_1)$ and $C_2(q_2,d_2)$.

Edit: Yes, $p$ is always the intersecting point(s) of the two circles $C_1(q_1,d_1)$ and $C_2(q_2,d_2)$. I think the result holds in higher dimensions as well.

-
Case3 may be considered as the general solution...? May be someone will clarify things better. – Tapu Nov 9 '11 at 7:21
No, the three cases together form the general solution. The set of solutions (for two distinct circles) has either zero, one, or two points. – user5137 Nov 9 '11 at 8:44
@JackManey: No, (the answer in) case3 is the general answer. Please see the Edited part of my answer. – Tapu Nov 9 '11 at 9:05

Thinking in purely geometrical terms, you're given two circles $C_1$ and $C_2$ with distinct centers, and you want to find the points of intersection of the circles (here, the points $q_1$ and $q_2$ are the centers and the radii are $d_1$ and $d_2$). By Book III, Proposition 10 of Euclid's Elements, circles that are not concentric intersect in at most two points. Therefore your solution set will consist of either zero (in your case above), one, or two points.

-
You can ease computations a bit by first computing the radical line of the two circles, and then checking if the line intersects any of the two circles... – J. M. Nov 9 '11 at 8:06
@J.M. - The point of my answer, though, is to show in purely geometrical terms--without direct computation--that the solution set the OP wants contains at most two points. It's merely another way to think about the problem. – user5137 Nov 9 '11 at 8:29

Maple code that calculates coordinates $(x,y)$ of the point $P$ :

The second variant of the code is the same as this above,only difference is that you should change a sign $+$ into sign $-$ in front of the $sqrt$

-