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.

First off, let's parameterize a given ellipse in the following way:
For an ellipse whose major and minor axes are oriented in the same direction as the coordinate axes with side-to-side width $2a$ across; up-and-down height $2b$ high, and centered at the point $(h,k)$, we have
$$x(t) = a \cos(t) + h \\ y(t) = b \sin(t) + k \\ \qquad \qquad \text{where } 0 \leq t < 2\pi. \\ $$
Since we want to find the height of a given point on the lower edge of the curve, let's just assume that we have the ellipse translated to the center point $(0,b)$. Now we have the system $x(t) = a\cos(t)$ and $y(t) = b\sin(t)+b$ and without loss of generality we're interested in finding the height of a given $x$-coordinate along the region where $\frac{3\pi}{2} \leq t < 2\pi$. However, this corresponds to just the $x$-values in the range of $0 \leq x(t) \leq a$. So as long as we know the $x$-coordinate of the rectangle below (which will just be half of its total width), we can solve for the corresponding value of $t$ and plug that back in for $y$.
That is, if the rectangle below has width $2u$, then we have the right-hand side of its extension into the ellipse given as $x(t) = u = a \cos(t)$. This implies that $$t = \arccos(u/a).$$ Now we just plug this into the expression for the height with $y(t)$:
$$y(t) = b(\sin(t)+1) = b(\sin(\arccos(u/a))+1).$$
A word of caution: since we know that the value of $t$ corresponds to an angle terminating in Quadrant IV, we know that cosines will have positive sign while sines have negative sines. So we can automatically take care of this parity (taking reference angles appropriately) by expressing the height in the lower part of the ellipse as
$$\large y = b[1-\sin(2\pi-\arccos(u/a))].$$
As some test cases, when the width of the rectangle is zero ($u=0$), we get $$y = b[1-\sin(2\pi-\arccos(0/a)] \\ = b[1-\sin(2\pi-\arccos(0)] \\ = b[1-\sin(2\pi-3\pi/2)] \\ = b[1-\sin(\pi/2)] \\ = b[1-1] \\ = b[0] \\ = 0.$$ which seems right.
When the width of the rectangle is the entire width of the ellipse's horizontal distance (usually the major axis), we have $u=a$ so the corresponding height should be $b$:
$$y = b[1-\sin(2\pi-\arccos(a/a))] \\ = b[1-\sin(2\pi-\arccos(1))] \\ = b[1-\sin(2\pi-0)] \\ = b[1-\sin(2\pi)] \\ = b[1-0] \\ = b[1] \\ = b.$$