# Calculation of the touching point of two circles given limited data

I am trying to calculate the touching point of two circles. I have the following information.

Circle $1$:

• Centre $(h,k)$
• Radius $r_1$

Circle $2$:

• Point on Circumference $(x_1,y_1)$
• Radius $r_2$

From this I would like to calculate the centre point of circle $2$: $(s,r)$ and the point where they touch: $(x,y)$.

I have worked out that to find the second centre point I can express the formulas like this:

$$(x_1-s)^2+(y_1-r)^2=r_2^2$$

$$(s-h)^2+(r-k)^2=(r_1+r_2)^2$$

Unforunately my maths skills are not up to the task of solving these equations for $s$ and $r$, and ultimately for $x$ and $y$.

I would appreciate any help that can be provided.

Regards

Martin.

-
Are the circles supposed to be tangent, so there is only one point where they touch? If not, I don't think there is enough information. Even so, I believe there are two solutions. –  Ross Millikan Feb 21 '11 at 18:21
Yes They are tangential. I am looking to find that point of tangentiality. I think there can only be one solution if it is tangential. - Martin. –  user7322 Feb 21 '11 at 20:18
@Isaac. Thank you for help. You've given me the answer I needed. Regards Martin. –  user7409 Feb 23 '11 at 13:27
@Martin: please do not use answers to make comments. You should be able to comment on answers to your own questions even at low reputation. –  Qiaochu Yuan Feb 23 '11 at 13:28

For the two equations you have, expand the squares on the left sides. You'll have $s^2$ and $r^2$ on the left side in both equations. Subtracting the two equations gives an equation that is linear in $s$ and $r$. Solve the linear equation for one variable and substitute into one of your original two equations to solve for the other variable. I believe that there are two solutions (by symmetry over the line through the known center and the known circumference point).

edit Let me redefine your variables, then go through some of the algebra. I'll continue to call the known center $(h,k)$ and the radius of that circle $r_1$ and the radius of the other circle $r_2$; I'll call the known point on the circumference of the other circle $(a,b)$, the desired point of tangency $(c,d)$, and the unknown center of the other circle $(m,n)$. The system of equations you had, written in my variables, is: \begin{align} (a-m)^2+(b-n)^2&=r_2^2 \\ (m-h)^2+(n-k)^2&=(r_1+r_2)^2 \end{align} We want to solve for $(m,n)$. Expand the squares (use $(x+y)^2=x^2+2xy+y^2$) on the left sides of both equations: \begin{align} a^2-2am+m^2+b^2-2bn+n^2&=r_2^2 \\ m^2-2mh+h^2+n^2-2nk+k^2&=(r_1+r_2)^2 \end{align} Subtract the two equations (I'm subtracting the first from the second): $$(m^2-2mh+h^2+n^2-2nk+k^2)-(a^2-2am+m^2+b^2-2bn+n^2)=(r_1+r_2)^2-r_2^2$$ $$m(2a-2h)+n(2b-2k)+(h^2+k^2-a^2-b^2)=r_1^2+2r_1r_2$$ I've grouped the terms on the left side into $m$ times some constant, $n$ times some constant, and a constant term (only $m$ and $n$ are variables here); I'll continue to group terms in this way. Solve for one of the variables ($m$): \begin{align} m(2a-2h) &=r_1^2+2r_1r_2-n(2b-2k)-(h^2+k^2-a^2-b^2) \\ &=(r_1^2+2r_1r_2-h^2-k^2+a^2+b^2)-n(2b-2k) \end{align} $$m=\frac{(r_1^2+2r_1r_2-h^2-k^2+a^2+b^2)-n(2b-2k)}{2a-2h}$$ Now, substitute this expression for $m$ in one of the two original equations (I'll use the first): $$(a-\frac{(r_1^2+2r_1r_2-h^2-k^2+a^2+b^2)-n(2b-2k)}{2a-2h})^2+(b-n)^2=r_2^2$$ This is a (very messy) quadratic equation in $n$ (it can be written in the form $()n^2+()n+()=0$; $n$ is the only variable; the rest are constants). While it's possible to continue to solve by hand, the symbolic manipulation is messy (though I can fill in more detail if necessary). The two solutions for $n$ (note the $\pm$) that result are:

$n=\scriptstyle\frac{a^2 (b+k)-2 a h (b+k)+h^2 (b+k)+(b-k) \left(b^2-k^2+r_1^2+2 r_1r_2\right)\pm\sqrt{-(a-h)^2 \left((a-h)^2+(b-k)^2-r_1^2\right) \left(a^2-2 a h+(b-k)^2+(h-r_1-2 r_2) (h+r_1+2 r_2)\right)}}{2 \left((a-h)^2+(b-k)^2\right)}$

The next step would be to take this, put it back into the expression for $m$ to get two values of $m$. Here are the results I get using Mathematica:

$(m,n)=$ \begin{matrix}\scriptstyle{\left( \frac{1}{2 (a-h) \left((a-h)^2+(b-k)^2\right)} \left(\scriptstyle{\begin{align} a^4&-2 a^3 h+2 a h^3-h^2 \left(h^2+(b-k)^2\right)+a^2 (b-k)^2+(a-h)^2 r_1 \left(r_1+2 r_2\right)\\ &+b \sqrt{-(a-h)^2 \left((a-h)^2+(b-k)^2-r_1^2\right) \left((a-h)^2+(b-k)^2-\left(r_1+2 r_2\right){}^2\right)}\\ &-k \sqrt{-(a-h)^2 \left((a-h)^2+(b-k)^2-r_1^2\right) \left((a-h)^2+(b-k)^2-\left(r_1+2 r_2\right){}^2\right)} \end{align}}\right)\right.},\\ \quad\quad\scriptstyle{\left. \frac{\left((a-h)^2+(b-k)^2\right) (b+k)+(b-k) r_1 \left(r_1+2 r_2\right)-\sqrt{-(a-h)^2 \left((a-h)^2+(b-k)^2-r_1^2\right) \left((a-h)^2+(b-k)^2-\left(r_1+2 r_2\right){}^2\right)}}{2 \left((a-h)^2+(b-k)^2\right)}\right)}\end{matrix}

or $(m,n)=$ \begin{matrix}\scriptstyle{\left( \frac{1}{2 (a-h) \left((a-h)^2+(b-k)^2\right)} \left(\scriptstyle{\begin{align} a^4&-2 a^3 h+2 a h^3-h^2 \left(h^2+(b-k)^2\right)+a^2 (b-k)^2+(a-h)^2 r_1 \left(r_1+2 r_2\right)\\ &-b \sqrt{-(a-h)^2 \left((a-h)^2+(b-k)^2-r_1^2\right) \left((a-h)^2+(b-k)^2-\left(r_1+2 r_2\right){}^2\right)}\\ &+k \sqrt{-(a-h)^2 \left((a-h)^2+(b-k)^2-r_1^2\right) \left((a-h)^2+(b-k)^2-\left(r_1+2 r_2\right){}^2\right)} \end{align}}\right)\right.},\\ \quad\quad\scriptstyle{\left. \frac{\left((a-h)^2+(b-k)^2\right) (b+k)+(b-k) r_1 \left(r_1+2 r_2\right)+\sqrt{-(a-h)^2 \left((a-h)^2+(b-k)^2-r_1^2\right) \left((a-h)^2+(b-k)^2-\left(r_1+2 r_2\right){}^2\right)}}{2 \left((a-h)^2+(b-k)^2\right)}\right)}\end{matrix}

Since we know the two circles are tangent at the point $(c,d)$, the point $(c,d)$ is on the line connecting the centers of the circles and $\frac{r_1}{r_1+r_2}$ of the way from $(h,k)$ to $(m,n)$, so $$(c,d)=\left(\frac{r_2}{r_1+r_2}h+\frac{r_1}{r_1+r_2}m,\frac{r_2}{r_1+r_2}k+\frac{r_1}{r_1+r_2}n\right).$$

Mathematica isn't generating any nice simplification of that expression with $m$ and $n$ substituted in, so I'll stop here.

-
Hello @Isaac, Thank you for your answer, unfortunately the mathematical solution you suggest is beyond my skill level, hence my posting here. I am from a non mathematical background. Regards Martin. –  user7322 Feb 22 '11 at 12:41
@Martin: I added a bunch more detail, but about a third to half way into the problem, the algebra gets pretty nasty, so I went to using Mathematica. The expressions for a final answer are sufficiently messy that I didn't actually include the expressions. –  Isaac Feb 22 '11 at 19:04

EDIT: This is not entirely correct since the radius of the second circle is given.

If I'm reading your question correctly, your second circle is not uniquely determined. Here are some examples:

The point on the circumference of your (non-unique) second circle is labeled A, but there are infinitely many circles through A that are tangent to the first circle (centered at Q).

-
But we are given the radius of the circle that passes through A. I think that is enough to define it as one of two circles, one "each side" of A. –  Ross Millikan Feb 23 '11 at 5:52
Oops. Thanks for pointing that out –  Chester Feb 23 '11 at 6:03