# Diameter of an Ellipse at an Angle

A standard ellipse with semi-major axis $$a$$, semi-minor $$b$$ has a "diameter" of $$2a$$ in one dimension ($$\phi=0$$) and $$2b$$ in the other ($$\phi=\pi/2$$). Is there a function to find the diameter for an arbitrary angle $$\phi$$? By "diameter", I mean the distance between two parallel tangents perpendicular to $$\phi$$. In everyday terms, how wide is the shadow cast by an ellipse when viewed from any angle.

Secondary related question: what's the proper mathematical term for what I mean by "diameter" above; projecting the shadow of the ellipse into 1D and finding the length?

• Regarding the word “diameter”, there are objects known as shapes of constant diameter, where “diameter” means exactly the same thing you asked about. So I think “diameter” is the word you want, but you do need to define it carefully. – David K Feb 3 at 4:34

This is quite easy to work out if you use homogeneous coordinates of points and lines and a matrix to represent the ellipse, and then work with the dual conic. Setting $$\mathbf x=(x,y,1)^T$$, we can write the equation of your standard-position ellipse as $$\mathbf x^TC\mathbf x=0$$, where $$C=\operatorname{diag}(1/a^2,1/b^2,-1)$$. (Multiply it out for yourself to verify.) At the same time, by setting $$\mathbf l=(a,b,c)^T$$, the general equation $$ax+by+c=0$$ of a line can be written $$\mathbf l^T\mathbf x=0$$, i.e., lines can also be represented as vectors of real numbers. A major advantage of this representation in my mind is that there are no special cases to worry about. Vertical lines, which are usually problematic if you’re basing things on slope, are accommodated in this framework with no fuss.

Now, if $$C$$ is the matrix of a nondegenerate conic, then tangent lines to the conic satisfy the dual equation $$\mathbf l^TC^{-1}\mathbf l=0$$. Also, all lines that have a normal that makes an angle of $$\phi$$ with the positive $$x$$-axis are of the form $$(\cos\phi,\sin\phi,\tau)^T$$, where the signed distance of the line from the origin is given by $$\tau$$. By symmetry, then, the distance between two parallel tangents is $$2|\tau|$$. Expanding the dual equation, we have $$\begin{bmatrix}\cos\phi&\sin\phi&\tau\end{bmatrix} \begin{bmatrix}a^2&0&0\\0&b^2&0\\0&0&-1\end{bmatrix} \begin{bmatrix}\cos\phi\\\sin\phi\\\tau\end{bmatrix} = a^2\cos^2\phi+b^2\sin^2\phi-\tau^2=0,$$ from which the distance between the two tangents is simply $$2\sqrt{a^2\cos^2\phi+b^2\sin^2\phi}.$$

• Thanks for this identical result to my second attempt, but via a more elegant route. Amazing the answers were posted within two minutes of each other. Well, almost identical: your $\phi$ is at right angles to mine. – James Ashton Feb 3 at 1:17
• @JamesAshton In your question, you ask about tangents “perpendicular to $\phi$.” That’s what I computed. Your solution is for tangents parallel to $\phi$, which is not what you asked for originally. – amd Feb 3 at 1:25
• Another way to approach this is to simply perform the projection onto a line through the origin perpendicular to $\phi$. The outline of the shadow of the ellipse will be a pair of points given by the same quadratic equation as above. – amd Feb 3 at 1:27

The equation for an eclipse in polar coordinates

$$r(\theta) = \frac {ab} {\sqrt {(b \cos\theta)^2 + (a \sin\theta)^2}}$$

When $$\theta = 0, r=a$$, and when $$\theta = \frac\pi 2, r = b$$

So the formula you’re looking for (where $$d = 2r$$) is

$$r(\theta) = \frac {2ab} {\sqrt {(b \cos\theta)^2 + (a \sin\theta)^2}}$$

EDIT: misunderstood the question

• Note that's not what is asked in the question. You answered what I would consider the "diameter", but what he question implies is the projection, not the diameter. There is a confusion in the terms. – Andrei Feb 2 at 3:35
• Thanks, but it does answer something different since the tangent at a point on an ellipse is not in general perpendicular to the line from the point to the centre. – James Ashton Feb 2 at 3:42

My previous answer was wrong, because I used the distance from the tangent point to the origin. What I should have used was the closest approach of the tangent line to the origin. Per distance from a point to a line, the line

$$Ax+By+C=0$$

approaches within

$$\frac{C}{\sqrt{A^2+B^2}}$$

of the origin. Per ellipse tangent slope as parameter, the ellipse

$$\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$$

has a tangent line at slope $$m$$ of

$$y=mx\pm\sqrt{m^2a^2+b^2}\quad\implies\quad mx-y\pm\sqrt{m^2a^2+b^2}=0\,.$$

Substituting gives the origin distance of the ellipse tangent of

$$\sqrt{\frac{m^2a^2+b^2}{m^2+1}}\,.$$

We simply double the above to find the width of the ellipse projected at angle $$\phi$$ such that the slope $$m=\tan\phi$$:

$$2\sqrt{\frac{a^2\tan^2\phi+b^2}{\tan^2\phi+1}}\,.$$

Noting that $$\tan\phi\cos\phi=\sin\phi$$ we can multiply denominator and numerator by $$\cos^2\phi$$ to give:

$$2\sqrt{\frac{a^2\sin^2\phi+b^2\cos^2\phi}{\sin^2\phi+\cos^2\phi}} \\= 2\sqrt{a^2\sin^2\phi+b^2\cos^2\phi}$$ and so remove the singularities at angles like $$\phi=\frac\pi2$$ which were an artefact of the parameterisation.

• This solution is for tangents parallel to $\phi$, not perpendicular to it as you asked originally. You need to use $m=-\cot\phi$ instead of $\tan\phi$. – amd Feb 3 at 1:30