# Finding the major and minor axis vertices for an ellipse given two conjugate diameters?

I've been googling, searching forums and looking in my old algebra/trig books to try to understand how to find the end points to the major and minor axis of an ellipse given the end points of two conjugate diameters (assume ellipse centered at the origin). I want to be able to recast an ellipse given that data into a form acceptable for use in an SVG diagram which requires the major(x) and minor(y) axis radii. I can calculate any rotation necessary from the major axis end point.

See for example the below image. I have conjugate points P and Q and need to find (a) and (b). Example showing conjugate points P and Q (I couldn't upload an image(rep !> 10 yet)).

I hope someone here can help shed some light on this for me.

• Do you have any question for which you want to find end points of axis? Jun 14, 2013 at 9:56
• Can you just elaborate with the example? Jun 14, 2013 at 9:59
• Here's how Pappus did it. Jun 14, 2013 at 10:12

Perhaps added since this question was answered, Wikipedia has good information on this problem. There is an interesting geometric construction which contrasts with the algebraic solutions offered here: Rytz's construction.

(I have been told to add information to the answer rather than just posting links. Unfortunately as my rep is less than 50 I can't make comments yet)

The setting in which I found Rytz's construction useful was in drawing the elevation of a circle in a plan oblique projection. In this case, as in the other conjugate tangent problems that arise in parallel projection, the ellipse is tangent to the midpoints of the edges of a parallelogram. This is a slightly more constrained and regular situation than the diagram referenced in the original question, though a tangent parallelogram could easily be constructed around the ellipse shown in that image.

Rytz's construction is apparently the last refinement of a long series of solutions to this problem, starting with Pappus. It relies on the fact that conjugate diameters are affine images of perpendicular diameters of a circle. In particular, the perpendiculars from the foci to any tangent intersect the tangent on the auxiliary circle, the circle centered at the centre of the ellipse with the major axis as diameter. As I understand it Rytz's construction is a carefully minimized (in terms of number of steps) derivative of the earlier techniques, intended for practical use in drafting, etc.

So that we're clear on definitions: A pair of diameters of an ellipse are conjugate if (and only if) the tangents at the endpoints of one diameter are parallel to the other diameter.

Let $P(a \cos\theta, b \sin\theta)$ be a point on an ellipse in standard position (for now). The tangent line at $P$ has slope vector $(-a\sin\theta, b\cos\theta)$; because this can be written $(a\cos(\theta+\pi/2), b\sin(\theta+\pi/2))$, we see that it is also the position vector of a point, say $Q$, on the ellipse. The diameter through $P$ is conjugate to the diameter through $Q$.

Therefore, if we have $P(p_x, p_y)$ and $Q(q_x, q_y)$ as endpoints of conjugate diameters of an ellipse in standard position (with $\angle POQ < \pi$ a counterclockwise angle), we can write:

\begin{align} p_x = \phantom{-}a \cos\theta &\qquad p_y = b \sin\theta \\ q_x = -a\sin\theta &\qquad q_y = b\cos\theta \end{align} for some $\theta$, so that $$a^2 = p_x^2 + q_x^2 \qquad\qquad b^2 = p_y^2 + q_y^2 \qquad\qquad (\text{and}\quad p_x q_y - p_y q_x = a b)$$

If the ellipse in question is rotated, things are a little more complicated.

We take $P$ and $Q$ to be the images of $(a\cos\theta, b\sin\theta)$ and $(-a\sin\theta, b\cos\theta)$ under rotation by angle, say, $\phi$. Using an appropriate rotation matrix, we have

\begin{align} p_x = \phantom{-}a \cos\theta \cos\phi - b \sin\theta \sin\phi &\qquad p_y = \phantom{-}a \cos\theta \sin\phi + b \sin\theta \cos\phi \\ q_x = -a \sin\theta \cos\phi - b \cos\theta \sin\phi &\qquad q_y = -a \sin\theta \sin\phi + b \cos\theta \cos\phi \end{align}

These provide relations

\begin{align} p_x^2 + p_y^2 + q_x^2 + q_y^2 &= a^2 + b^2 &=: r \\ p_x q_y - p_y q_x &= a b &=: s \end{align} (The latter actually re-captures a result, cited by Isaac Newton, that all "bounding parallelograms" of an ellipse have the same area.)

Thus, \begin{align} a + b &= \sqrt{a^2 + b^2 + 2 a b} = \sqrt{r + 2 s} \\ |a - b| &= \sqrt{a^2 + b^2 - 2 a b} = \sqrt{r - 2 s} \end{align} so that $$\{a,b\} = \frac{1}{2}\left(\sqrt{r + 2 s} \pm \sqrt{r - 2 s}\right)$$

Taking $a \ge b$, we eliminate the ambiguity: $$a = \frac{1}{2}\left(\sqrt{r+2s} + \sqrt{r-2s}\right) \qquad\qquad b = \frac{1}{2}\left(\sqrt{r+2s} - \sqrt{r-2s}\right)$$

We can (and should) solve for $\theta$ and $\phi$. Start by observing ... \begin{align} p_x^2 + p_y^2 = a^2\cos^2\theta+b^2\sin^2\theta &\qquad q_x^2 + q_y^2 = a^2\sin^2\theta+b^2\cos^2\theta \\ p_x^2 + q_x^2 = a^2\cos^2\phi + b^2\sin^2\phi &\qquad p_y^2 + q_y^2 = a^2\sin^2\phi + b^2\cos^2\phi \end{align} so that \begin{align} \left(p_x^2+p_y^2\right)-\left(q_x^2+q_y^2\right) &= \left(a^2-b^2 \right)\left(\cos^2\theta-\sin^2\theta\right) = \sqrt{r^2 - 4 s^2}\;\cos 2\theta\\[6pt] \left(p_x^2+q_x^2\right)-\left(p_y^2+q_y^2\right) &= \left(a^2-b^2 \right)\left(\cos^2\phi-\sin^2\phi\right) = \sqrt{r^2-4s^2}\;\cos 2\phi \end{align} whence $$\cos 2\theta = \frac{\left(p_x^2+p_y^2\right)-\left(q_x^2+q_y^2\right)}{\sqrt{r^2-4s^2}} \qquad \cos 2\phi = \frac{\left(p_x^2+q_x^2\right)-\left(p_y^2+q_y^2\right)}{\sqrt{r^2-4s^2}}$$

(Parameter $\theta$ itself isn't important for your purposes, but it's worth noting how its expression in terms of $P$ and $Q$ matches that of $\phi$.)

• I added a link to an example image. Thanks for the Pappus link David. Jun 14, 2013 at 22:02
• Blue, thanks for answering. Although, referencing the image I added to the post, I realize I don't know what theta is in your explanation. Jun 14, 2013 at 22:06
• @Fiddler99: $\theta$ is from the common parametric form of the ellipse. It has a wonderful geometric meaning, but you don't have to "see" it in an image to use it.
– Blue
Jun 15, 2013 at 2:16

There's a linear-algebraic solution to this problem too. You can take $P$ and $Q$ as vectors, and then construct the matrix $$A=\begin{pmatrix} p_x & q_x \\ p_y & q_y \end{pmatrix},$$

Take the singular value decomposition of $A$, $U\Sigma V^T$, and you'll get the axes as the columns of $U\Sigma$.

The reason this works is that $A$ transforms $(1,0)$ to $P$, and $(0,1)$ to $Q$. The parallelogram is simply the box $\{(1,1),(-1,1),(-1,-1),(1,-1)\}$ transformed by $A$. The ellipse, conveniently enough, is the unit circle transformed by $A$.

When you take $A$ decomposed as the singular value decomposition, then $A$ is a rotation (or flip) $V^T$, followed by a scale $\Sigma$, followed by another rotation $U$.

$V^T$ does absolutely nothing to the unit circle, since the unit circle is invariant to rotation and reflection about the origin.

After that happens though, the scaling transform breaks the invariance. It scales the unit circle along the axes so that $(1,0)$ and $(0,1)$ are stretched/contracted, then rotates the resulting ellipse. But then you can just describe the axes of the ellipse by what happens to these unit vectors, that is, extract the columns of $U\Sigma$.