[Math] Finding the angle of rotation of an ellipse from its general equation and the other way around

conic sections

The general equation for an ellipse is $Ax^2+Bxy+Cy^2+D=0$. How do I find the angle of rotation, the dimensions, and the coordinates of the center of the ellipse from the general equation and vice versa? Please avoid using matrices or parametric equations. I'd like all-in-one equations for each parameter.

Best Answer

The general equation of an ellipse is: $$Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0$$ if: $$4AC - B^2 > 0$$ The trick is to eliminate B so that the xy term vanishes.
If $B<>0$ then the ellipse is rotated and the angle of rotation is obtained from: $$tan(2 \theta) = \frac {B}{A-C}$$ $0 < \theta < \frac {\pi}{4}$

$$\cos {\theta} = \sqrt{\frac{1 + \cos{2 \theta}}{2}}$$ $$\sin{\theta} = \sqrt{\frac{1 - cos{2 \theta}}{2}}$$ Determine the new equation of the ellipse by calculating the following coefficients:
$A' = A \cos^2{\theta} + B \cos{\theta} \sin{\theta} + C \sin^2{\theta}$
$B' = 0$
$C' = A \sin^2{\theta} - B \cos{\theta} \sin{\theta} + C \cos^2{\theta}$
$D' = D \cos{\theta} + E \sin{\theta}$
$E' = -D \sin{\theta} + E \cos{\theta}$
$F' = F$

The resulting equation: $A'x'^2 + C'y'^2 + D'x' + E'y' + F' = 0$
After writing this equation in the form: $$ \frac{(x'-x'_0)^2}{a^2} + \frac{(y'-y'_0)^2}{b^2} = 1$$

We get: $$x'_0 = \frac{-D'}{2A'}$$ $$y'_0 = \frac{-E'}{2C'}$$

$$a^2 = \frac{-4F'A'C'+C'D'^2+A'E'^2}{4A'^2C'}$$ $$b^2 = \frac{-4F'A'C'+C'D'^2+A'E'^2}{4A'C'^2}$$

The coordinates of the centerpoint are found by rotating back about angle $\theta$

$x_0 = x'_0 \cos{\theta} - y'_0 \sin{\theta}$
$y_0 = x'_0 \sin{\theta} + y'_0 \cos{\theta}$

Cheers!