<s>[INST] Height of Line Segment on an Ellipsis I'm trying to find the equation for getting the height of the black line I show in the image below. The end point of the black line is the intersection point between the width of the square below and the ellipse itself. I know the value of the width and the height of the ellipse, and the width of the square. I need to know the value of the height of the line I show below.
Also, the square is always centered below the ellipse.
My ellipse can be either vertical or horizontal, how would that affect the result?
Thank you very much.

 [/INST] Let's suppose that the width of the ellipse is $2w$ and the width of the rectangle is $2u$. Let's also suppose that the height of the ellipse is $2h$. Then if we scale the horizontal axis by a factor of $h/w$, the ellipse becomes a circle of radius $h$ and the rectangle half-width becomes $uh/w$ instead of $u$. 
So you're asking for the distance from the tangent to the bottom of that circle -- that's at $y = -h$ -- to the point above the right-hand side of the rectangle, which is at $x = uh/w$. Well, the points on the circle (assuming we center it at the origin) satisfy
$$
x^2 + y^2 = h^2
$$
so we have
\begin{align}
(uh/w)^2 + y^2 &= h^2 \\
\frac{u^2h^2}{w^2} + y^2 &= h^2 \\
y^2 &= h^2 - \frac{u^2h^2}{w^2} \\
y^2 &= h^2( 1  - \frac{u^2}{w^2} )\\
y &= -h \sqrt{ 1  - \frac{u^2}{w^2}},
\end{align}
where in the last step I've chosen the negative square root because we want the lower value of $y$. 
The difference between this and the $y$-value at the bottom, namely $y = -h$, is
\begin{align}
-h \sqrt{ 1  - \frac{u^2}{w^2}} - (-h) &= h\left(1 - \sqrt{1 - \frac{u^2}{w^2}}\right)
\end{align}
When $u = 0$, i.e., when the rectangle is just a very thin vertical line, this gives
\begin{align}
 h\left(1 - \sqrt{1 - \frac{u^2}{w^2}}\right) &= h\left(1 - \sqrt{1 - \frac{0^2}{w^2}}\right)\\
&= h\left(1 - \sqrt{1}\right)\\
&= h\left(0\right)\\
&= 0,
\end{align}
which looks right, and when $u = w$ (so that the square is the same width as the ellipse), it gives
\begin{align}
 h\left(1 - \sqrt{1 - \frac{u^2}{w^2}}\right) &= h\left(1 - \sqrt{1 - \frac{w^2}{w^2}}\right)\\
&= h\left(1 - \sqrt{0}\right)\\
&= h\left(1\right)\\
&= h,
\end{align}
which also looks right. So I'm fairly confident that I didn't mess up the algebra. :)
</s>