# Tangent II

I had a thought about another way to approach that ellipse and circles problem and thought I’d try it on a generalization. Suppose the circle is of arbitrary radius and sitting at an arbitrary point? (You can turn it into a unit radius just by rescaling, but let’s put the radius in explicitly. If nothing else it helps check for errors via dimensional analysis.)

This time instead of working with x and y let’s use the parametric equations

$x=a\cos t$

$y=b\sin t$

And now let’s write down the distance D between a point on the ellipse and the center (xc, yc) of the circle:

$D(t) = \sqrt{(x-x_c)^2+(y-y_c)^2}=\sqrt{(a\cos t-x_c)^2+(b\sin t-y_c)^2}$

The idea here is that if D(t) has a local extremum at t=tt and if D(tt)=r (the radius of the circle) then tt  corresponds to a tangent point. So the plan is to solve dD/dt=0 to get values of tt, and then solve D(tt)=r to get the relation between a and b required for tangency.

Well, easier said than done. The requirement dD/dt=0 leads to

$(b^2-a^2)\sin t\cos t-by_c\cos t+ax_c\sin t=0$

which I think can be solved in the sense that it can be converted to a cubic in cos t. Ah, no thanks.

So how about a milder generalization? Keep the arbitrary radius and the arbitrary xbut require the circle to sit on the x axis: yc=0. In that case

$(b^2-a^2)\sin t\cos t+ax_c\sin t=0$

with solutions

$\sin t=0$ (case [i]) or

$\cos t=\frac{ax_c}{a^2-b^2}$ (case [ii])

(If sin t ≠0 and a2=b2, then the case [ii] formula doesn’t work. But if so, the ellipse is a circle, and dD/dt≠0 unless x= 0: both circles are concentric and every point on the “ellipse” is equidistant from the center of the other circle, and to make that distance be r you have to make the two circles be identical, which isn’t really what I mean by a tangent ellipse. So I’ll only consider a2≠b2.)

For case [i], plug sin t=0 and cos t=±1 into the formula for D and set it equal to r, and the legal (positive) values for a are |xc+r| and |xc–r|. Obviously if a has either of these values then the left or the right end of the ellipse will be tangent to the circle. To find out if it’s exterior or interior requires checking whether the extremum is a minimum or a maximum, for which you need the sign of the second derivative. I haven’t gone there yet. It looks messy.

Case [ii] starts messy and gets messier, until a whole lot of cancellation happens and you’re left with a simple answer. The equation to be solved is

$\sqrt{\left(\frac{a^2x_c}{a^2-b^2}-x_c\right)^2+b^2\left(1-\frac{a^2x_c^2}{(a^2-b^2)^2}\right)}=r$

which turns into

$a^4(b^2-r^2)+a^2(2r^2b^2-2b^4-b^2x_c^2)+(x_c^2b^4+b^6-r^2b^4)=0$

and when you solve for ausing the quadratic formula, amazingly everything under the radical sign except b4xccancels and the result is

$a^2=b^2\frac{x_c^2\pm x_c^2+2(b^2-r^2)}{2(b^2-r^2)}$

The minus sign just gives you a2=b2, which we saw above isn’t allowed for this case so we discard that, and the plus sign gives

$a^2=b^2\left(1+\frac{x_c^2}{b^2-r^2}\right)$

which, if you set xc=r=1, reproduces the result I got previously. Note that this means if b2–ris negative then |xc| must be less than |b2–r2| to make a2 positive. This just says the y intercept of the circle, which is √(r2xc2), must be greater than b for the ellipse to fit inside the circle. That is, if the ellipse is shorter (vertically) than the circle, then the circle must be close to centered on the origin in order to get two point tangency:

Here r is 5, b is 4, so |xc| must be less than 3 (and it’s about 2.9). Of course in the limit as the ellipse becomes infinitesimally narrow, xc approaches 3 with the tangent point going to (0, 4) and xc, the origin, and the tangent point approaching a right triangle.

Once again, for case [ii] generally, one has to test whether the extremum is a minimum or a maximum to determine if the tangent is interior or exterior. I wonder how horrible that is. I don’t want to find out right now.