Finding the width of an ellipse, given a target tangent angle at the intersection of the ellipse at a known vertical.

conic sectionstrigonometry

Given the following image (not quite to scale, the red lines for h should form a square):

Ellispe tangent angle problem

I need to find the length of the semi-major axis of this ellipse, notated on the diagram as w.

The semi-minor axis h and angle θ are known values. The side of the enclosing rectangle is also distance h from the center of the ellipse. The angle θ measures the angle to the ellipse tangent line at the point of intersection between the ellipse and enclosing rectangle.

I've tried various methods of getting this length w using a combination of trig and calculus, but I always end up with rational equations that I am not sure how to solve. Moreover, I'm not certain that my approach is even close to correct. So all that said:

How can I create a function f(h, θ) which produces the value w?


For those wondering about the motivation here: The enclosing rectangle is a phone screen. The top arc of the ellipse forms a curved border between page elements, and we want the apparent angle at which that border meets the screen edge to remain constant for all device widths.

Best Answer

Parametrize the ellipse as $$(x(t), y(t)) = (w \cos t, h \sin t), \quad 0 \le t < 2\pi, \quad w > h > 0. \tag{1}$$ Then the point of tangency corresponds to a value of $t$, say $t = t_0$, such that $x(t_0) = h$, or $$t_0 = \arccos \frac{h}{w}. \tag{2}$$ The slope $m(t)$ of the tangent line at $t = t_0$ is given by $$m(t_0) = \left[\frac{dy/dt}{dx/dt}\right]_{t=t_0} = \left[-\frac{h}{w} \cot t \right]_{t=t_0} = -\frac{h^2}{w \sqrt{w^2 - h^2}}. \tag{3}$$ The angle of the tangent line is the arctangent of the slope; i.e. $$\tan \theta = m(t_0). \tag{4}$$ So to obtain the semimajor axis $w$ in terms of a given fixed semiminor axis $h$ and desired tangent angle $\theta$, we solve the equation $(4)$ after substituting in $(3)$, giving $$w = \frac{h}{\sqrt{2}} \sqrt{1 + \sqrt{1 + 4 \cot^2 \theta}}.$$

Related Question