# ellipse equation from eigenvectors and eigenvalues

I have a eigenvectors d1,d2 and eigenvalues v1,v2. The eigenvectors are axes of an ellipse that surrounds data points, with center u,v, and radii size of the eigenvalues.

How can I find the ellipse parameters: a,b,c, such that

a(x-u)(x-u)+2b(x-u)(y-v)+c(y-v)(y-v)=1

.

Thank you. matlabit

-
It isn't clear what you are asking. Where did the eigenvalues and eigenvectors come from? – Daryl Mar 1 '13 at 23:59
I compute them around data points I have. The eigenvectors are axes of an ellipse around the data.But it shouldn't matter. I just need to express these values in terms of the ellipse equation. – matlabit Mar 2 '13 at 17:06

The eigenvectors $\vec{d}_1$ and $\vec{d}_2$ are surely orthogonal (if not, something has gone wrong). We can scale them to have unit length, so let's assume that this has been done. I will further simplify matters (for the time being) by assuming that $(u,v)$ is at the origin, because this amounts to a translation that we can do in the end. After all the shape and orientation of the ellipse only depends on $\vec{d}_i,$ $v_i$, $i=1,2.$
Let us first do this in the coordinate system where the axes are aligned to point in the direction of the eigenvectors. The usual equation works (as we normalized the eigenvectors), so the point $P$ with $\vec{OP}=x'\vec{d}_1+y'\vec{d}_2$ is on the ellipse, if and only if $$\frac{x'^2}{v_1^2}+\frac{y'^2}{v_2^2}=1.$$ What we need to is to write $x'$ and $y'$ using the usual coordinates $x$ and $y$. Again we take advantage of the fact that the eigenvectors are orthogonal and normalized to unit length. We can write the vector $\vec{OP}$ in two ways, so they must be equal: $$x\vec{i}+y\vec{j}=\vec{OP}=x'\vec{d}_1+y'\vec{d}_2. \tag{1}$$ We want to solve $x'$ from this equation. Let's take the dot product of both sides with $\vec{d}_1$. We get $$x(\vec{i}\cdot\vec{d}_1)+y(\vec{j}\cdot\vec{d}_1)=x'(\vec{d}_1\cdot\vec{d}_1)+y'(\vec{d}_2\cdot\vec{d}_1).$$ [If you are used to different notation for the dot product, say so, and I try to accomodate, I am gambling on typical high school/freshman linear algebra notation here.] Here on the right hand side the dot products are $1$ and $0$ respectively, so we get $$x'=x(\vec{i}\cdot\vec{d}_1)+y(\vec{j}\cdot\vec{d}_1).$$ Similarly by taking the dot product of both sides of equation $(1)$ with $\vec{d}_2$ we get $$y'=x(\vec{i}\cdot\vec{d}_2)+y(\vec{j}\cdot\vec{d}_2).$$ Let us abbreviate $a_{11}=\vec{i}\cdot\vec{d}_1$, $a_{12}=\vec{i}\cdot\vec{d}_2$, $a_{21}=\vec{j}\cdot\vec{d}_1$, $a_{22}=\vec{j}\cdot\vec{d}_2$. Plugging all this in gives us the equation of the ellipse as $$\frac{(a_{11}x+a_{21}y)^2}{v_1^2}+\frac{(a_{12}x+a_{22}y)^2}{v_2^2}=1.$$ You get your final answer by expanding this out, clearing the denominators, and replacing $x$ (resp. $y$) with $x-u$ (resp. $y-v$) throughout.
Expanding this gives $$\left(\frac{a_{11}^2}{v_1^2}+\frac{a_{12}^2}{v_2^2}\right)x^2+2\left(\frac{a_{11}a_{21}}{v_1^2}+\frac{a_{12}a_{22}}{v_2^2}\right)xy+\left(\frac{a_{21}^2}{v_1^2}+\frac{a_{22}^2}{v_2^2}\right)y^2=1.$$ as the equation of the ellipse.