# Parametric form of an ellipse given by $ax^2 + by^2 + cxy = d$

If $c = 0$, the parametric form is obviously $x = \sqrt{\frac{d}{a}} \cos(t), y = \sqrt{\frac{d}{b}} \sin(t)$.

When $c \neq 0$ the sine and cosine should be phase shifted from each other. How do I find the angular shift and from there how do I adjust the factors multiplying the sine and cosine?

-
Principal axis theorem gives you an answer in the sense that there is a worked out example there. Hopefully somebody has the time to give you a bit more theory. I gotta go :-( –  Jyrki Lahtonen Oct 5 '11 at 14:03
Formulae 16-23 here are useful. –  Ｊ. Ｍ. Oct 5 '11 at 16:05

You would complete squares: $\left(a x + \frac{1}{2} c y\right)^2 + \left(a b - \frac{c^2}{4} \right) y^2 = a d$.

From there: $a x + \frac{c}{2} y = \sqrt{a d} \sin(t)$ and $\sqrt{a b - \frac{c^2}{4}} y = \sqrt{a d} \cos(t)$, assuming $c^2 < 4 a b$, and $a d > 0$.

Solving for $x$ and $y$ and denoting $\mathcal{D} = 4 a b - c^2$ $$x(t) = \sqrt{\frac{d}{a}} \left( \sin(t) - \frac{c}{\sqrt{\mathcal{D}} } \cos(t) \right) \qquad y(t) = \frac{2 \sqrt{a d}}{\sqrt{\mathcal{D}}} \cos(t)$$

-
I like that. +2 if I could. Much appreciated. –  jnm2 Oct 5 '11 at 15:33
+1 You didn't use the principal axes, but found a parametrization anyway :-) –  Jyrki Lahtonen Oct 5 '11 at 15:48
In the Olden Days (when I was in school) there was a college course called "Analytic Geometry". It would include such things as finding the rotation to eliminate the $xy$ term in a plane conic section. –  GEdgar Oct 5 '11 at 18:55

If the parametric ellipse coordinates are $\left(x(t),y(t)\right) = (X \cos\varphi \cos(t)-Y \sin\varphi \sin(t), Y \cos\varphi \sin(t)+X \sin\varphi \cos(t))$

Then the parameters $X,Y,\varphi$ are $$X =\pm \sqrt{\frac{2 d}{a+b+\sqrt{(a-b)^2+c^2}}}$$

$$Y =\pm \sqrt{\frac{2 d}{a+b-\sqrt{(a-b)^2+c^2}}}$$

$$\varphi = \frac{1}{2}\tan^{-1}\left(\frac{c}{a-b}\right)$$

Example:

$10 x^2+20 y^2-18 x y = 100$

The coefficients are ($a=10$, $b=20$, $c=-18$, $d=100$)

The parametric coefficients are $(-1.008311 \cos(t)+3.973667 \sin(t), 1.713639 \cos(t)+2.338119 \sin(t))$

-

(This is supposed to be a comment on ja72's answer, but it got too long.)

$$\tan\,2\varphi = \frac{c}{a-b}$$

I consider it a bit wasteful of effort to evaluate an arctangent and the subsequently pass it as the argument of a trigonometric unction much later; to avoid this, we can use the double angle formula for the tangent and the "Citardauq" formula in tandem to yield the relation

$$\tan\,\varphi=\frac{c}{a-b+(\mathrm{sign}\,c)\sqrt{c^2+(a-b)^2}}$$

Denoting this expression as $t$, we can then substitute this into the rotation matrix

$$\frac1{\sqrt{1+t^2}}\begin{pmatrix}1&-t\\t&1\end{pmatrix}$$

ja72's answer already gave the formulae for the axes; remember that $(p\sin\,u,q\cos\,u)$ and $(p\cos\,u,q\sin\,u)$ are the same ellipse traversed differently, so you can subsequently rotate whichever of the two expressions you pick with the rotation matrix I gave earlier.

-