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?

 A: 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.
A: 
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$.
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.
