# Compute the major and minor axis of an ellipse after linearly transforming it.

I have a small conic problem over which I need some help.

Let $E$ be an axis-aligned ellipse and let $T$ be a linear transformation. (In my case $T$ is actually an affine transformation, but I don't think the translation component of $T$ is too much of a problem, so I went with a linear transformation instead.

I'm given the center $c$ of $E$ and its two radii, $r_x$ and $r_y$. I have to find the orientation, the center and the radii of the transformed ellipse, $T(E)$.

$T$ can be formed from any matrix, not only the usual rotate/translate/scale.

I though of using the principal axis theorem. Here is what I tried.

First I didn't bother with $c \ne (0,0)$ because I can always translate back and forth the center to the origin.

Let $Q$ be the matrix of the quadratic form of $E$. $$\begin{pmatrix}x&y\end{pmatrix} Q \begin{pmatrix}x\\y\end{pmatrix} = 1.$$ To match $\frac{x^2}{r_x^2} + \frac{y^2}{r_y^2} = 1$, I set it up as

$$Q = \begin{pmatrix}\frac{1}{r_x^2}&0\\0&\frac{1}{r_y^2}\end{pmatrix}$$

After transformation, $(x,y)$ are mapped to $T(x,y)$ so to evaluate $T(E)$, I have to transform back the points and evaluate for the original $E$. $$\begin{pmatrix}x&y\end{pmatrix} T^{-1,t}QT^{-1} \begin{pmatrix}x\\y\end{pmatrix} = 1.$$

I can then take the eigenvalues and the eigenvalues $\lambda_1,\lambda_2$ of $T^{-1,t}QT^{-1}$ and their associated (normalized) eigen vectors $e_1,e_2$. The eigenvectors are the principal axes of $T(E)$ and I selected the radii as such : \begin{equation*} r^{T(E)}_x = \frac{1}{\sqrt{\lambda_1}} \\ r^{T(E)}_x = \frac{1}{\sqrt{\lambda_2}} \\ \end{equation*}

The principal axes seems to be okay, but the radii seems completely off. Can you help me ? All my thanks !

• Aren't the eigenvalues $r_x^{-2}$ and $r_y^{-2}$? – Shuri2060 Jul 7 '17 at 17:43
• If that's true then $r_x = \sqrt{\lambda_1}^{-1}$ as I did... – Lærne Jul 7 '17 at 18:13
• Looks about right to me. Maybe it’s the actual calculations that are off. Please add a concrete example where your computed axis lengths are incorrect. – amd Jul 7 '17 at 20:44
• Got it. I'm using the math for some computer project, and apparently I received the matrix of $T$ transposed. But for the case I computed by hand, I used a symmetric $T$... which did not help me spot the issue ! – Lærne Jul 10 '17 at 10:48