[Math] transformation matrix of unit circle to ellipse

conic sectionslinear algebra

Given the quadratic form of an ellipse, $f(x,y) = ax^2 + bxy + cy^2 +dx + fy + g = 0$, with known coefficients. What is the relationship between $f(x,y)$ and a $2\times 3$ transformation matrix $T$ such that a point on the unit circle $(x_C,y_C)$ can be transformed to a point on the ellipse $(x_e,y_e)$ as

$$ \begin{bmatrix}
x_e \\
y_e \\
\end{bmatrix} = T\begin{bmatrix}
x_C \\
y_C \\
1\\
\end{bmatrix}$$

The 3rd column of $T$, $t_{13}$ and $t_{23}$, is the coordinate of the ellipse center $(x_0,y_0)$. The entry $t_{12}$ appears to always equal to zero.

If there is no rotation to the ellipse, then $t_{11} = $ length of semi-major axis and $t_{22}$ = length of semi-minor axis and $t_{21}=0$. No issues in this scenario.

My issue is when there is rotation to the ellipse. In this case, I am unable to see the direct relationship between $t_{11}, t_{2,1}$ and $t_{22}$. Is there a way to compute each of the entries of $T$ directly from $f(x,y)$?

Best Answer

Here's a way. Write $$ f(x, y) = \pmatrix{x & y & 1 } \pmatrix{a & b/2 & d/2 \\ b/2 & c & f/2 \\ d/2 & f/2 & g} \pmatrix{x\\y\\1}, $$ which I'll denote as $h^t M h$, where $M$ is the middle matrix, and $h$ is the vector $\pmatrix{x\\y\\1}$.

You'd like to find a matrix $T$ with the property that when $u^2 + v^2 = 1$, then $$ s = T\pmatrix{u\\v\\1} $$ has the property that $s^t M s = 0$. (I'm going to use a $3 \times 3$ matrix for $T$, but the last row will be $\pmatrix{0& 0&1}$, so you can chop it off to get your $T$ matrix, OK? )

Composing those two things, and letting w be the vector $\pmatrix{u\\v\\1}$ you want to have \begin{align} 0 &= s^t M s \\ 0 &= (Tw)^t M (Tw) \\ 0 &= w^t T^t M Tw \\ 0 &= w^(T^t M T)w \end{align} for all vectors $w$ with $u^2 + v^2 = 1$. So letting $K = T^t M T$, we want to have $$ \pmatrix{u & v & 1} K \pmatrix{u\\v\\1} = 0, $$ for all $u,v$ with $u^2 + v^2 = 1$. If we simply pick $K$ to be $\pmatrix{1&0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1}$, we get \begin{align} \pmatrix{u & v & 1} K\pmatrix{u\\v\\1} &= \pmatrix{u & v & 1} \pmatrix{1&0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1} \pmatrix{u\\v\\1}\\ &= u^2 + v^2 - 1 \\ &= 0. \end{align}

So now we know what we need: a matrix $T$ with the property that $T^t M T$ is the diagonal matrix with $1,1,-1$ on the diagonal.

To find this, we simply find the eigenvectors of $M$ and put them into the columns of $T$ and compute $T^t M T$; if the result has the $-1$ in the wrong spot, swap the vectors in $T$ to move that column to the last column. (BTW, you may also need to multiply each column by some constant to make the product have $1$s and $-1$ on the diagonal rahter than some other numbers).

Perhaps "find the eigenvectors of $M$" isn't something you know how to do -- you didn't really say how much math you knew -- but for this particular problem, it's not too tough. My best guess, off the top of my head, is that two of them look something like $$ \pmatrix {\cos \theta\\ \sin \theta \\ 0}, \pmatrix {-\sin \theta\\ \cos \theta \\ 0}, $$ where $\theta$ is the angle of rotation of your ellipse, and the third (with the negative eigenvalue) is the cross-product of these two. [I'm sure that guess is at least slightly wrong, but that's the gist.]