# find a circle tangent to an ellipse

As shown in the figure, the circle is moving upwards along the line $x=x_0$

suppose we know the following parameters: $a,b,x_0,r$

The ellipse equation is $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$;

The circle equation is $(x-x_0)^2+(y-y_0)^2=r^2$

how to find the tangent point and the $y_0$

-
The gradient only depends on the x-coordinate. Equate the two to find the x-coordinate of the point of tangency. – Calvin Lin Jan 8 '13 at 3:52
can you please provide more details? we have three variables $y_0, x_1, y_1$. Supposing $x_1$ and $y_1$ is the tangent point – 96742zs Jan 13 '13 at 9:27
Eliminate x and set the discriminant of resulting quadratic equation in y to zero. – Narasimham Jun 1 at 21:47

(I'm taking up this old problem, since I think there are some aspects of interest to it.) It is somewhat unclear from the description of the problem, along with one of the comments, as to which way to formulate a solution, so I will set out two different approaches.

We will call the common tangent point of the ellipse and the circle $\ (X, Y) \ ;$ at that point, the two curves share a normal line. The vertical line and the ellipse are fixed objects, the equations for which are $\ x \ = \ x_0 \ \$ and $\ \ b^2 x^2 \ + \ a^2 y^2 \ = \ a^2 b^2 \ ,$ respectively. We will use a line to the right of the $\ y-$ axis ( $x_0 > 0$ ) throughout this discussion ; there are symmetrical results for $\ x_0 \ < \ 0 \ .$

In one approach [see added note below], the center of the circle lies on this vertical line, with the $\ y-$ coordinate, $\ y_0 \ ,$ being permitted to vary. It will be somewhat more convenient here to use the slope $\ m \$ of a radius extending toward the ellipse as the variable. The equation for the line containing this radius, which is also the normal line to the ellipse at the common tangent point, is then $\ y \ - \ y_0 \ = \ m \ (x \ - \ x_0 ) \ .$ It follows directly from the equation of the circle that

$$( X \ - \ x_0 )^2 \ + \ ( Y \ - \ y_0 )^2 \ = \ r^2 \ \ \Rightarrow \ \ (m^2 \ + \ 1 ) \ ( X \ - \ x_0 )^2 \ = \ r^2 \ .$$

We will leave $\ y_0 \$ and $\ r \$ undetermined for the present and return to them shortly.

By implicit differentiation of the equations for the curve, we find the slope of a tangent line to a point on the ellipse to given by

$$2 b^2 x \ + \ 2 a^2 y y’ \ = \ 0 \ \ \Rightarrow \ \ y’ \ = \ - \ \left( \frac{b^2 x}{a^2 y} \right) \ .$$

The slope of the normal line at the common tangent point is then $\ m \ = \ \left( \frac{a^2 Y}{b^2 X} \right) \ .$ We obtain at once the relation $\ Y \ = \ m \ \left(\frac{b^2}{a^2} \right) \ X \ .$ Inserting this into the equation for the ellipse yields

$$b^2 X^2 \ + \ a^2 \ \left[ m \ \left(\frac{b^2}{a^2} \right) \ X \right]^2 \ = \ a^2 b^2 \ \ \Rightarrow \ \ \left[ \ 1 \ + \ m^2 \ \left(\frac{b^2}{a^2} \right) \ \right] \ X^2 \ = \ a^2 \ .$$

From this, we can now compute $\ X \$ and $\ Y \$ ; here, we choose $\ X \ > \ 0 \ ,$ and the sign of $\ m \$ tells us which quadrant $\ Y \$ is in. We can then solve the normal (or radial) line equation for the circle to find $\ y_0 \ ,$ since $\ x_0 \$ is known; hence, $\ y_0 \ = \ Y \ - \ m \ ( X - x_0 ) \ .$ The radius of the circle can now be computed as well from the equation derived above, $\ (m^2 \ + \ 1 ) \ ( X \ - \ x_0 )^2 \ = \ r^2 \ .$

[EDIT (6/1/16): The comment below from Jens points up something I had unfortunately missed at the time, since I never used this method to make computations. The difficulty in using $\ m \$ as the independent variable is exactly that it is proportional to the ratio $\ \frac{Y}{X} \$ and there is not enough independent information available from the equation for the ellipse and the equation for the tangent or the normal line at $\ (X, \ Y) \$ to isolate the values of these coordinates. I have recently looked at other properties of ellipses -- such as the interesting aspect that the tangent and normal lines intersect the line containing the minor axis of the ellipse at points that lie on a circle passing through the tangent point and the foci -- but none of them appear to serve in producing information that is not redundant. So I must retract this part of the discussion with the caution noted here.]

$\ \$

The other approach I took (actually the first one I worked out) is to make one of the coordinates, say, $\ Y \$ , of the common tangent point on the ellipse and the circle the “free variable”; the coordinate $\ X \$ is then determined by the equation of the ellipse. Referring to our results above, the equation of the common normal line is then $\ y \ - \ Y \ = \ \left( \frac{a^2 Y}{b^2 X} \right) \ ( x - X ) .$

The center of the circle is thus the intersection of this line with the vertical line $\ x \ = \ x_0 \ ,$ with its $\ y-$ coordinate given by

$$y_0 \ = \ Y \ + \ \left( \frac{a^2 Y}{b^2 X} \right) \ ( x_0 - X ) \ ;$$

Hence, the circle has the equation $\ ( x - x_0 )^2 \ + \ ( y - y_0)^2 \ = \ r^2 \ ,$ with the radius found from

$$r^2 \ = \ ( X - x_0 )^2 \ + \ ( Y - y_0)^2 \ = \ ( X - x_0 )^2 \ + \ \left( \frac{a^2 Y}{b^2 X} \right)^2 \ ( X - x_0 )^2$$

$$= \ \left[ \ 1 \ + \ \left( \frac{a^2 Y}{b^2 X} \right)^2 \ \right] \ ( X - x_0 )^2 \ \ \text{or} \ \ \left[ \ 1 \ + \ m^2 \ \right] \ ( X - x_0 )^2 \ .$$

$$\ \$$

To illustrate the latter method, we will look at circles with their centers on the vertical line $\ x \ = \ 4 \$ which are tangent to the ellipse $\ 9x^2 \ + \ 4y^2 \ = \ 36 \ .$ Choosing a tangent point coordinate $\ Y \ = \ -2 \ ,$ there are two locations on the ellipse, $\ X^2 \ = \ \frac{20}{9} \ \Rightarrow \ X \ = \ \pm \frac{2 \sqrt{5}}{3} \ .$ The normal lines to the points are, for the tangent point in the fourth quadrant,

$$y \ - \ (-2) \ = \ \left( \frac{4 \ (-2)}{9 \cdot \frac{2 \sqrt{5}}{3}} \right) \ ( x - \frac{2 \sqrt{5}}{3} )$$

$$\Rightarrow \ \ y \ = \ - \frac{4}{3 \sqrt{5}} x \ - \ \frac{10}{9} \ \approx \ -0.5963 x \ - \ 1.1111$$

and, for that in the third quadrant,

$$y \ - \ (-2) \ = \ \left( \frac{4 \ (-2)}{9 \cdot \frac{-2 \sqrt{5}}{3}} \right) \ ( x - \frac{-2 \sqrt{5}}{3} )$$

$$\Rightarrow \ \ y \ = \ \frac{4}{3 \sqrt{5}} x \ - \ \frac{10}{9} \ \approx \ 0.5963 x \ - \ 1.1111 \ .$$

These lines intersect the vertical line at $\ ( 4 , \ - \frac{16}{3 \sqrt{5}} - \frac{10}{9} \ \approx \ -3.4963 ) \$ and $\ ( 4 , \ \frac{16}{3 \sqrt{5}} - \frac{10}{9} \ \approx \ 1.2740 ) \ ,$ respectively. The radii of the tangent circles are given by

$$r^2 \ = \ \left[ \ 1 + ( - \frac{4}{3 \sqrt{5}} )^2 \ \right] \ ( \frac{2 \sqrt{5}}{3} - 4)^2 \ \approx \ 8.5353 \ \ \text{and}$$

$$r^2 \ = \ \left[ \ 1 + ( \frac{4}{3 \sqrt{5}} )^2 \ \right] \ ( \frac{-2 \sqrt{5}}{3} - 4)^2 \ \approx \ 40.8672 \ .$$

This produces two tangent circles,

$$\ ( x - 4 )^2 \ + \ ( y + 3.4963 )^2 \ = \ 8.5353 \ \ \text{and} \ \ ( x - 4 )^2 \ + \ ( y - 1.2740 )^2 \ = \ 40.8672 \ .$$

Using $\ Y \ = \ 2 \$ produces a second pair arranged symmetrically about the $\ x-$ axis; the shared normal lines are $\ y \ = \ \pm \frac{4}{3 \sqrt{5}} x \ + \ \frac{10}{9} \$ . An interesting aspect of this geometry is that the normal lines constitute two pairs of parallel lines (again, this is for a single value of $\ x_0 \$ ; there is a symmetrical set of normal lines and tangent circles on the left side of the $\ y-$ axis. This is perhaps not an overly surprising consequence of the four-fold symmetry of the ellipse. The graph below shows two of the normal lines and the four tangent circles; a grid is omitted to reduce the diagrammatic clutter.

There is nothing about this description that requires the vertical line to lie outside the ellipse. Everything presented above works equally well for the choice, say, of $\ x_0 \ = \ 1 \ .$ (I will not show all the calculations for this, but will simply present the graph.)

For $\ Y \ = \ 0 \ , \ X \ = \ \pm a \ ,$ and the formulas reduce, as expected, to ones yielding two tangent circles with radii $\ r \ = \ | x_0 \pm a | \ .$

One other situation of interest, shown in 96742zs’ diagram, is that for which the circle is tangent to two points symmetrical about the $\ x-$ axis, $\ (X , \ \pm Y) \ .$ This requires the two common normal-lines/radii to intersect on the $\ x-$ axis, so we must have $\ y_0 \ = \ 0 \ .$ From the foregoing, we have

$$0 \ = \ Y \ + \ \left( \frac{a^2 Y}{b^2 X} \right) \ ( x_0 - X ) \ \ \Rightarrow \ \ x_0 \ = \ \left[ \ 1 - \left( \frac{b^2 }{a^2} \right) \ \right] \ X$$

and

$$r^2 \ = \ \left[ \ 1 \ + \ \left( \frac{a^2 Y}{b^2 X} \right)^2 \ \right] \ ( X - x_0 )^2 \ \ \Rightarrow \ \ r^2 \ = \ \left( \frac{b^2 }{a^2} \right)^2 \cdot \ X^2 \ + \ Y^2 \ .$$

For our ellipse, the circle with tangent points at $\ (\frac{-2 \sqrt{5}}{3} , \ \pm 2) \$ is thus $\ ( x - \frac{5 \sqrt{5}}{6} )^2 \ + \ y^2 \ = \ \frac{61}{4} \ .$

-
I was using your first approach above to help me determine the equations for an ellipse tangent to a circle, but got stuck where you said "From this, we can now compute $X$ and $Y$..". I don't see how we know $m$ at this point, except as a function of $X$ and $Y$. I realize this is an old post but I hope you'll reply. – Jens May 23 at 21:44
@Jens Thank you for your note. I needed to find some time to reconstruct my thinking on this, hence the delay in responding. I'm afraid I have to conclude on that first portion that I apparently misled myself at some point into thinking that I knew the value of one of the coordinates of the tangent point. In fact, there is indeed an oversight in that method that does not appear to have a "fix". As I did not use that approach to obtain tangent circles, I failed to notice the deficiency at the time. So I withdraw that idea with appreciation for your comment. – RecklessReckoner Jun 1 at 21:25
Thanks for the update! I'm glad to know that I wasn't just missing something obvious, but a little sad that no "fix" was available. Anyway, your second approach was solid. – Jens Jun 2 at 15:01