# A circle inside an ellipse

Consider an ellipse with semi-axes $a$ and $b$, taller than it is wide with a small circle of radius $r$ inside. Assume the circle falls to the lowest point possible while staying inside the ellipse.

If $2r\le a-c$ then the circle and ellipse will meet at a single point at the bottom. If $2r>a-c$ the circle and ellipse will intersect at two points on the opposite side, leaving a space between the bottom of the circle and the bottom of the ellipse. For this case, given the radius of the circle and the dimensions of the ellipse how do I calculate the distance $d$ between the bottom of the circle and the bottom of the ellipse?

• What is c? The semi-axes are a and b and the circle radius is r. Is this correct? – ja72 Oct 17 '16 at 18:43
• @ja72 2c is the distance between two focii – iamgr007 Oct 17 '16 at 19:04
• The circle will only have one contact point if the radius is less than the minimum radius of curvature which equals to $\frac{a^2}{b}$. – ja72 Oct 17 '16 at 19:50
• With an horizontal scalling the ellipse may be transformed in a circle and we get this (slightly more general) treatment in accord with the fine answers here. – Raymond Manzoni Oct 18 '16 at 12:01

I got $$w =b - \sqrt{\frac{(b^2-a^2)(a^2-r^2)}{a^2} }-r$$

Start with polar coordinates for the ellipse $$\begin{pmatrix}x \\ y \end{pmatrix} = \tfrac{a b}{\sqrt{b^2-(b^2-a^2) \cos^2 \varphi}} \begin{pmatrix} \sin \varphi \\ -\cos\varphi \end{pmatrix}$$ where $(x,y)$ are the contact point coordinates relative to the center of the ellipse

The contact angle $\eta$ (see below) is found from the tangent vector of the ellipse as $$\eta = \varphi - \tan^{-1} \left( \frac{ (a^2-b^2) \sin\varphi \cos\varphi}{b^2 - (b^2-a^2)\cos^2 \varphi} \right)$$

the location of the circle is found from the relationships \begin{aligned} r \sin \eta = s \sin \varphi \\ z+r \cos \eta = s \cos \varphi \end{aligned}

This is solved for $$\varphi = \frac{\pi}{2} - \tan^{-1} \left( \frac{b^2}{a} \sqrt{ \frac{a^2-r^2}{b^2 r^2-a^4} } \right)$$

and $$z = s \cos\varphi - r \cos \eta$$

Finally, the gap is $$\boxed{w = b -z - r}$$ and with a lot of simplifications (thank you CAS) I got the answer above.

• Not that you can also arrive at this using the radius of curvature (equal to circle) $$\frac{1}{r}=a b \frac{\left(b^{2}-(b^{2}-a^{2})\cos^{2}\varphi\right)^{\frac{3}{2}}}{\left(b^{4}-(b^{4}-a^{4})\cos^{2}\varphi\right)^{\frac{3}{2}}}$$ – ja72 Oct 17 '16 at 19:55
• If you swap $a$ and $b$ so that $a$ is the semi-major axis and $b$ is the semi-minor axis, then your answer matches mine. I was getting bizarre results plugging in the $a$, $b$, and $r$ I had for my test ellipse. – robjohn Oct 18 '16 at 11:34
• Sorry, I must have used a different convention. – ja72 Oct 18 '16 at 13:21
• cartesian coordinates gives a much quicker result, with much less basic knowledge, and no CAS help necessary. – dfnu Jan 24 at 15:08

By the Law of Sines, we have that $$\frac{|CF_1|}{|PF_1|}=\frac{\sin(\alpha)}{\sin(\theta)}=\frac{\sin(\alpha)}{\sin(\pi-\theta)}=\frac{|CF_2|}{|PF_2|}\tag{1}$$ and by the defining property of an ellipse, $$\frac{|CF_1|+|CF_2|}{|PF_1|+|PF_2|}=e=\frac{\sqrt{a^2-b^2}}{a}\tag{2}$$ Thus, $(1)$ and $(2)$ imply $$\frac{|CF_1|}{|PF_1|}=\frac{|CF_2|}{|PF_2|}=e\tag{3}$$ The Law of Cosines says that $$|PC|^2+|PF_1|^2-2|PC||PF_1|\cos(\alpha)=e^2|PF_1|^2\tag{4}$$ and $$|PC|^2+|PF_2|^2-2|PC||PF_2|\cos(\alpha)=e^2|PF_2|^2\tag{5}$$ Therefore, since $|PF_1|+|PF_2|=2a$, subtracting $(5)$ from $(4)$ and dividing by $|PF_1|-|PF_2|$ yields $$\frac{b^2}a=a\left(1-e^2\right)=|PC|\cos(\alpha)\tag{6}$$ Plugging $(6)$ into $(4)$ and solving for $|PF_1|$ gives $$|PF_1|=a\left(1-\sqrt{1-\frac{|PC|^2}{b^2}}\right)\tag{7}$$ and therefore, $$|CF_1|=\sqrt{a^2-b^2}\left(1-\sqrt{1-\frac{|PC|^2}{b^2}}\right)\tag{8}$$ Letting $r=|PC|$, the distance from the right end of the circle to the right end of the ellipse is $|CF_1|+a-\sqrt{a^2-b^2}-r$, that is $$\bbox[5px,border:2px solid #C0A000]{d=a-r-\sqrt{a^2-b^2}\sqrt{1-\frac{r^2}{b^2}}}\tag{9}$$ for $\frac{b^2}a\le r\le b$ and $d=0$ for $r\le\frac{b^2}a$.

Never underestimate the power of cartesian coordinates

Consider the problem of finding the intersection points between ellipse and circle of radius $$r$$ centered in $$(0,y_c)$$, which leads to the system of equations $$\begin{cases}\frac{x^2}{a^2}+\frac{y^2}{b^2} = 1\\ x^2 + (y-y_c)^2 = r^2.\end{cases}$$ By substitution you obtain the following quadratic equation. $$y^2\left(\frac{1}{b^2} -\frac{1}{a^2} \right) + 2y\left(\frac{y_c}{a^2}\right) + \frac{r^2-y_c^2-a^2}{a^2}=0.$$ Since you want the two curves to intersect at only two points with the same ordinate, than this equation must have discriminant equal to $$0$$, which gives you $$\begin{eqnarray} \left(\frac{y_c}{a^2}\right)^2-\left(\frac{1}{b^2} -\frac{1}{a^2} \right)\left(\frac{r^2-y_c^2-a^2}{a^2}\right) = 0. \tag{1}\label{discr} \end{eqnarray}$$ Now you just need to solve the quadratic equation \eqref{discr} with respect to the unknown $$y_c$$. This rapidly gives $$y_c^2 = \frac{(b^2-a^2)(a^2-r^2)}{a^2}.$$ The desired distance is $$w = b-|y_c| - r,$$ that is

$$w = b - \frac{\sqrt{(b^2 - a^2)(a^2-r^2)}}{a} -r,$$

as, of course, in the other proposed solutions.

• Are you sure? I am getting $y_c^2 = \frac{(a^2-b^2)(r^2-a^2)}{a^2}$ when I try to solve the two quadratics while matching tangents (slopes). Dang you fixed it before I submitted the comment. – ja72 Jan 24 at 15:28
• @ja72, yep, corrected error in text. thanks! – dfnu Jan 24 at 15:30
• @ja72 still a sign error, hold on :))) – dfnu Jan 24 at 15:31