# Equation of the line that lies tangent to both circles

Consider the two circles determined by $$(x-1)^2 + y^2 = 1$$ and $$(x-2.5)^2 + y^2 = (1/2)^2$$. Find the (explicit) equation of the line that lies tangent to both circles.

I have never seen a clean or clever solution to this problem. This problem came up once at a staff meeting for a tutoring center I worked at during undergrad. I recall my roommate and I - after a good amount of time symbol pushing - were able to visibly see a solution by inspection, then verify it by plugging in. I have never seen a solid derivation of a solution to this though, so I would like to see what MSE can come up with for this!

I took a short stab at it today before posting, and got that it would be determined by the solution to the equation $$\left( \frac{\cos(\theta)}{\sin(\theta)} + 2\cos(\theta) + 3 \right)^2 -4\left( \frac{\cos(\theta)^2}{\sin(\theta)^2}+1 \right)\left(\frac{-\cos(\theta)^3}{\sin(\theta)^2}+\frac{\cos(\theta)^4}{\sin(\theta)^2}+3 \right).$$

The solution $$\theta$$ would then determine the line $$y(x) = \frac{-\cos(\theta)}{\sin(\theta)}(x) + \frac{\cos(\theta)^2}{\sin(\theta)} + \sin(\theta).$$

Not only do I not want to try and solve that, I don't even want to try expanding it out :/

• not $x=2$ :-) ? – J. W. Tanner May 9 at 0:32
• "the line"? I see 3 common tangents after plotting the circles. – peterwhy May 9 at 0:32
• math.stackexchange.com/questions/211538/… – lab bhattacharjee May 9 at 0:44
• @peterwhy Hi Peter. One of those 3 solutions is so trivial, I am offended you would even bring it up. For the remaining 2, one is clearly the other ones mirror image. So I am going to stick to my wording of 'find the line' since there is clearly one difficult one to find, which is what I am interested in seeing solutions for. Let me know when you have one, you can post answers below. – Prince M May 9 at 4:47

As peterwhy points out in the comments, there are three tangent lines. By inspection, one is $$x = 2$$, as pointed out by J.W. Tanner in the comments.

The other two can be identified by similar triangles. Suppose that we have a line tangent to both circles, and let the points of tangency be $$T_1$$ and $$T_2$$. Let the circle centers be $$O_1$$ and $$O_2$$. Finally, let the point where this line intersects the $$x$$-axis be called $$P$$. Then $$\triangle PO_1T_1$$ and $$\triangle PO_2T_2$$ are similar (do you see why?). Since $$O_1T_1 = 2O_2T_2$$, we must have $$PO_1 = 2PO_2$$, and therefore $$P$$ must be at $$(4, 0)$$. Note that $$PT_1 = \sqrt{3^2-1^2} = \sqrt{8}$$, and therefore our tangent line must have slope $$\pm \frac{1}{\sqrt{8}}$$.

(For simplicity, I only show one of the tangent lines; the other is its mirror image across the $$x$$-axis.) From this, we get the equation of the two remaining tangent lines

$$y = \pm \frac{x-4}{\sqrt{8}}$$

• This is a clean solution. Nice – Prince M May 9 at 4:52

The equation of the second circle can be written as $$x^2+y^2-5x+6=0$$.

Let $$P(h,k)$$ be a point on the second circle.

Then the equation of the tangent to the second circle at $$P$$ is $$hx+ky-\dfrac52(x+h)+6=0$$.

If it is also a tangent to the first circle, the distance from $$(1,0)$$ to this line is $$1$$.

\begin{align*} \frac{|h-\frac52(1+h)+6|}{\sqrt{(h-\frac52)^2+k^2}}&=1\\ \frac{|-\frac32h+\frac72|}{\sqrt{(\frac12)^2}}&=1\\ -3h+7&=\pm1 \end{align*} So, we have $$h=2$$ or $$h=\frac83$$.

If $$h=2$$, $$k=\pm\sqrt{(\frac12)^2-(2-\frac52)^2}=0$$ and the common tangent is $$x-2=0$$.

If $$h=\frac83$$, $$k=\pm\sqrt{(\frac12)^2-(\frac83-\frac52)^2}=\pm\frac{\sqrt{2}}{3}$$ and the common tangents are $$x\pm2\sqrt{2}y-4=0$$.

Use dual conics: If we represent a circle (in fact, any nondegenerate conic) with the homogeneous matrix $$C$$ so that its equation is $$(x,y,1)C(x,y,1)^T=0$$, lines $$\lambda x+\mu y+\tau=0$$ tangent to the circle satisfy the dual conic equation $$(\lambda,\mu,\tau)\,C^{-1}(\lambda,\mu,\tau)^T=0$$. (This equation captures the fact that the pole of a tangent line lies on the line.)

The matrix that corresponds to the circle $$(x-h)^2+(y-k)^2=r^2$$ is $$C=\begin{bmatrix}1&0&-h\\0&1&-k\\-h&-k&h^2+k^2-r^2\end{bmatrix}$$ with inverse $$C^{-1}=\frac1{r^2}\begin{bmatrix}r^2-h^2&-hk&-h\\-hk&r^2-k^2&-k\\-h&-k&-1\end{bmatrix}.$$ For the circles in this problem, the resulting dual equations are $$\mu^2-\tau^2-2\lambda\tau = 0 \\ -24\lambda^2+\mu^2-4\tau^2-20\lambda\tau = 0.$$ Both circles’ centers lie on the $$x$$-axis but their radii differ, so no common tangent is horizontal. Thus, we can set $$\lambda=1$$ and solve the slightly simpler system to obtain the solutions $$\mu=0$$, $$\tau=-2$$ and $$\mu=\pm2\sqrt2$$, $$\tau=-4$$, i.e., the three common tangent lines are $$x=2 \\ x\pm2\sqrt2 y=4.$$

This general method works for any pair of nondegenerate conics: it finds their common tangents by solving a dual problem of the intersection of two (possibly imaginary) conics. For a pair of circles, however, there’s a simple way to find common tangents via similar triangles, as demonstrated in Brian Tung’s answer.

To find a common tangent to two arbitrary circles, you can use the following trick: "deflate" the smaller circle (let $$1$$) so that it shrinks to a point, while the second shrinks to the radius $$r_2-r_1$$. Doing this, the direction of the tangent doesn't change and the tangency point forms a right triangle with the two centers.

By elementary trigonometry, the angle $$\phi$$ between the axis through the centers and the tangent is drawn from

$$d\sin\phi=r_2-r_1,$$ where $$d$$ is the distance between the centers. The direction of the axis is such that

$$\tan\theta=\frac{y_2-y_1}{x_2-x_1}.$$

So the equation of the tangent is given by

$$(x-x_1)\sin(\theta+\phi)-(y-y_1)\cos(\theta+\phi)=0.$$

The original tangent is a parallel at distance $$r_1$$, hence

$$(x-x_1)\sin(\theta+\phi)-(y-y_1)\cos(\theta+\phi)=r_1.$$

• Caution: quadrant discussion is missing. – Yves Daoust May 9 at 20:30

As already stated, there are three lines that can be drawn that are tangent to both circles. One is the trivial line $$x = 2,$$ which is tangent at the point $$(2,0)$$, which is also the common point of tangency of the two circles.

The other two lines are reflections of each other in the $$x$$-axis; these can be found by noting that a homothety that takes the point $$(0,0)$$ to $$(2,0)$$ and $$(2,0)$$ to $$(3,0)$$ will map the first circle to the second, and the center of this homothety will be a fixed point of this map.

To this end, let $$(x',y') = (a x + b, a y + d)$$, so we now solve the system $$(b, d) = (2,0) \\ (2a + b, d) = (3,0).$$ That is to say, $$b = 2$$, $$d = 0$$, $$a = 1/2$$, and the desired homothety is $$(x',y') = (x/2 + 2, y/2).$$ The unique fixed point is found by setting $$(x',y') = (x,y)$$ from which we obtain $$(x,y) = (4,0)$$. Thus the tangent lines pass through this point and have the form $$y = m(x - 4)$$ where $$m$$ is the slope. Such a line will be tangent if the system of equations $$(x-1)^2 + y^2 = 1, \\ y = m(x-4)$$ has exactly one solution. Eliminating $$y$$ gives the quadratic $$(m^2+1)x^2 - 2(4m^2+1)x + 16m^2 = 0,$$ for which the solution has a unique root if the discriminant is zero; i.e., $$0 = 4(4m^2+1)^2 - 4(m^2+1)(16m^2) = 4 - 32m^2.$$ Therefore, $$m = \pm 1/\sqrt{2}$$ and the desired lines are $$y = \pm \frac{x-4}{2 \sqrt{2}},$$ in addition to the previous line $$x = 2$$ described.

Beside the obvious solution of $$x=2$$ you also have two more common tangent lines, namely $$y= \pm \frac {\sqrt {2}}{4} (x-4)$$

The two non-obvious tangent lines pass through $$(4,0)$$ and their y-intercepts are respectively $$(0,\pm \sqrt {2})$$