# Determine angular coordinate of contact point between a rotated ellipse and its tangent

$\newcommand{\eps}{\epsilon}$I tried to illustrate the problem in the picture below. An ellipse is rotated by the angle $\alpha$. Since the distance $L$ is given, the tangent to the ellipse can be determined. The angular coordinate $\beta$ is used to describe the tangent point. $\beta$ is measured from the the body-fixed $x$-axis of the ellipse.

For further calculations I want to determine $\frac{d\beta}{d\alpha}$. Therefore I tried to calculate $\beta = f(\alpha)$ or at least $\cos(\beta) = f(\alpha)$ and $\sin(\beta) = f(\alpha)$.

My approach is to solve the following equation $-y \frac{dx}{d \beta}+x \frac{dy}{d \beta}=0$, where $x = L + r\cos(\beta+\alpha)$ and $y = r \sin(\beta+\alpha)$. $(x,y)$ is the tangent point. The equation follows from the scalar product of $(\frac{dx}{d \beta},\frac{dy}{d \beta})$ and the vector between $0$ and $(x,y)$ rotated by $90°$. I simplified the equation using Mathematica to: $$(-1 + \eps^2) L \cos(\alpha)\cos(\beta) - b \sqrt{1 - \eps^2 \cos(\beta)^2} + L \sin(\alpha)\sin(\beta) = 0,$$ where $\eps$ is the numerical eccentricity of the ellipse.

However, the solution Mathematica provides to this equation is not practical, since I have to do a case distinction. I feel like that my approach uses too much calculus and a different approach would simplify the solution.

Summarizing: What is $\beta = f(\alpha)$, when the parameters $a$ and $b$ of the ellipse are given?

• Your equation cannot be right: for $\epsilon=1$ it gives $\alpha=0$, while the right result should be $\sin\beta=b/L$. Jul 15, 2017 at 21:22
• You're right. I made a mistake. The + before the square root has to be a minus. However, for $\epsilon = 1$ and $\alpha = 0$, the result is $cos(\beta) = -\frac{b}{L}$, isn't it? $sin(\beta) = \frac{b}{L}$ would only be right, if $\beta$ is measured from the left-hand side. Jul 15, 2017 at 21:51
• Yes, of course: I had taken the wrong $\beta$. Jul 16, 2017 at 6:14

I think you made an error somewhere, because I used exactly the same method but came up with a different result: $$\cos\beta={ac(\alpha)\over\sqrt{a^2c^2(\alpha)+b^2s^2(\alpha)}}, \quad \sin\beta={bs(\alpha)\over\sqrt{a^2c^2(\alpha)+b^2s^2(\alpha)}}.$$ where: $$c(\alpha)=\frac{a \sin\alpha \sqrt{a^2 \sin ^2\alpha+b^2 \cos ^2\alpha -{a^2 b^2/L^2}} -{a b^2 \cos\alpha}/{L}}{a^2 \sin ^2\alpha +b^2 \cos ^2\alpha}$$ and $$s(\alpha)=\frac{b \cos\alpha \sqrt{a^2 \sin ^2\alpha+b^2 \cos ^2\alpha -{a^2 b^2/L^2}} +{a^2 b \sin\alpha}/{L}}{a^2 \sin ^2\alpha+b^2\cos^2\alpha}.$$ To get there, I started with parametric equations for a point on the ellipse: $$\tag{1} r\cos\beta=a\cos t,\quad r\sin\beta=b\sin t,$$ and the corresponding cartesian equations: $$x=r\cos(\alpha+\beta)=a\cos\alpha\cos t-b\sin\alpha\sin t,\\ y=r\sin(\alpha+\beta)=a\sin\alpha\cos t+b\cos\alpha\sin t.$$ Imposing the scalar product between $(L+x, y)$ and $(\dot y,-\dot x)$ to vanish (dot indicates derivative with respect to $t$) one gets the simple equation $$b\cos\alpha\cos t-a\sin\alpha\sin t =-{ab\over L},$$ which can be solved for $\cos t$ and $\sin t$. Then we can express $\cos\beta$ and $\sin\beta$ in terms of $t$, using $(1)$, and substitute there the solutions thus found: $$\cos\beta={a\cos t\over\sqrt{a^2\cos^2t+b^2\sin^2t}}, \quad \sin\beta={b\sin t\over\sqrt{a^2\cos^2t+b^2\sin^2t}}.$$ As a check, I plotted $\beta$, taken from the formula for $\cos\beta$, as a function of $\alpha$ (for $a=2$, $b=1$, $L=5$), and then with GeoGebra made the same plot as computed by the software itself (see picture). The two graphs turn out to be identical.

EDIT.

Notice that in GeoGebra (and in my formula, due to the presence of $\arccos$) I forced $0\le\beta\le\pi$. If $\alpha_0$ is the point where $\beta=0$, for $\alpha>\alpha_0$ point $H$ in the diagram is to the right of $B$, so it could be advisable to allow $\beta<0$ there.

If you want to do that, you simply have to replace $\beta$ as given by formula above with $-\beta$ for all $\alpha_0<\alpha<\alpha_\pi$, where $\alpha_\pi$ is the point where $\beta=\pi$. To ensure continuity you should also substitute $\beta$ with $\beta-2\pi$ for $\alpha>\alpha_\pi$. In doing so, kinks at $\alpha_0$ and $\alpha_\pi$ do disappear and the curve turns out to be smooth.

• Could you show some steps on how to get to your equation for $cos \beta$. I tried it, using $sin \beta = \sqrt{1-cos^2 \beta}$, but that wasn't successfull. Jul 16, 2017 at 15:09
• I will gladly do, but before doing that I would like to know the expression you used for $r$, because you didn't explicitly write it. Jul 16, 2017 at 15:19
• I used $r = \frac{b}{\sqrt{1 - \epsilon^2 cos^2 \beta}}$. You probably used $r=\frac{ab}{ \sqrt{a^2 sin^2\beta + b^2 cos^2 \beta}}$. Using that expression I get: $0 = L(b^2 cos \alpha sin \alpha -a^2 sin \alpha sin \beta)+ab \sqrt{b^2 cos^2 \beta +a^2 sin^2 \beta}$ Jul 16, 2017 at 15:27
• Yes, I used that. I also noticed an error in my EDIT: I'll correct it. Jul 16, 2017 at 15:32
• There is an error my comment above. It is supposed to be: $0 = L(a^2 sin \alpha sin\beta -b^2 cos \alpha cos \beta) +ab \sqrt{ a^2 sin^2 \beta + b^2 cos^2 \beta}$ Jul 16, 2017 at 15:38

Say you have an ellipse $Ax^2+Bxy+Cy^2+Dx+Ey+F=0$ and you want to find points of tangent to the origin. The tangent line is generally $y=mx$. Eliminating $y$ between these two equations resulrs in the following quadratic equation for $x$:

$(Cm^2+Bm+A)x^2+(Em+D)x+F=0$

The condition for tangent is that this should have a double root for $x$ meaning the discriminant of the quadratic equation should be zero. This leads to a quadratic equation for $m$:

$(E^2-4CF)m^2+(2DE-4BF)m+(D^2-4AF)=0$

Note that if $E^2=4CF$ one root for $m$ goes to infinity meaning one tangent line is the $y$ axis. Otherwise, in general there are two roots for $m$ from which the tangent lines can be determined, provided that $A, C, F$ all have the same sign.

• Would one tangent go to the upper part of the ellipse and the other tangent to the lower part? Jul 16, 2017 at 13:05
• If the ellipse is centered on the $x$-axis, you could say that. Such a scenario implies $m=0$ gives two roots for $x$ so the tangents must straddle the $x$-axis. Jul 16, 2017 at 13:24

It seemed to me that it might be easier to rotate the point instead of the ellipse. Let the ellipse be in standard position with half-axis lengths $a$ and $b$, and let $P=(L\cos\theta,L\sin\theta)$ be the point from which the tangents are drawn. (I’m using $\theta$ instead of $\alpha$ to avoid confusion in the formulas below.) Using the result from here or via the method described here for finding the intersection of the ellipse and the polar line to $P$ we have the following points at which the tangents through $P$ intersect the ellipse $$\left({a^2\left(b^2\cos\theta\mp\sin\theta\sqrt{L^2b^2\cos^2\theta+L^2a^2\sin^2\theta-a^2b^2}\right) \over L(b^2\cos^2\theta+a^2\sin^2\theta)},{b^2\left(a^2\sin^2\theta\pm\cos\theta\sqrt{L^2b^2\cos^2\theta+L^2a^2\sin^2\theta-a^2b^2}\right) \over L(b^2\cos^2\theta+a^2\sin^2\theta)}\right)$$ The first of these points in the one in the upper half-plane when $\theta=0$, as per your diagram. Using that tangent point, we have $$\tan\beta=-{b^2\left(a^2\sin^2\theta+\cos\theta\sqrt{L^2b^2\cos^2\theta+L^2a^2\sin^2\theta-a^2b^2}\right) \over a^2\left(b^2\cos\theta-\sin\theta\sqrt{L^2b^2\cos^2\theta+L^2a^2\sin^2\theta-a^2b^2}\right)}.$$