I have found the following ellipse representation $(x,y)=(x_0\cos(\theta+d/2),y_0\cos(\theta-d/2))$, $\theta \in [0,2\pi]$. This is a contour of bivariate normal distribution with uneven variances and correlation $\rho=\cos(d)$. I know that this is a rotated ellipse with centre $(0,0)$. How to find the lengths of major and minor axes and the angle between x-axis and major axis?
[Math] Finding standard ellipse characteristics from specific ellipse parametrisation
conic sectionsgeometryplane-curves
Related Solutions
For example, let's take the 3-dimensional vectors $$ V_1 = \pmatrix{1\cr 2\cr 1\cr},\ V_2 = \pmatrix{3\cr -3\cr 2\cr} $$ With these as columns we form the matrix $$A = \pmatrix{1 & 3\cr 2 & -3\cr 1 & 2\cr}$$ Now $$ A A^T = \pmatrix{1 & 3\cr 2 & -3\cr 1 & 2\cr} \pmatrix{1 & 2 & 1\cr 3 & -3 & 2\cr} = \pmatrix{10 & -7 & 9\cr -7 & 13 & 0\cr 9 & 0 & 13\cr}$$ which has eigenvalues $23, 13, 0$ corresponding to normalized eigenvectors $$ W_1 = \frac{1}{\sqrt{230}} \pmatrix{10\cr -7 \cr 9\cr},\ W_2 = \frac{1}{\sqrt{130}} \pmatrix{0 \cr 9\cr 7\cr},\ W_3 = \frac{1}{\sqrt{299}} \pmatrix{13\cr 7\cr -9\cr} $$ Note that these are orthogonal since $A A^T$ is symmetric. The major and minor axes have lengths $\sqrt{23}$ and $\sqrt{13}$ (the singular values, which are the square roots of the nonzero eigenvalues of $A A^T$) and directions $W_1$ and $W_2$ respectively.
If you are looking for the length of the minor and major axis you can calculate $ r_{min} $ and $ r_{max} $ (see formulae below).
If you are trying to determine the bounding box, you can calculate the left-most, right-most, top-most and bottom-most points.
As far as the angle of rotation is concerned, I use the algorithm and formulae below.
Properties of an ellipse from equation for conic sections in general quadratic form
Given the equation for conic sections in general quadratic form: $ a x^2 + b x y + c y^2 + d x + e y + f = 0 $.
The equation represents an ellipse if $ b^2 - 4 a c < 0 $ , or similarly, $ 4 a c - b^2 > 0 $
The coefficient normalizing factor is given by:
$ q = 64 {{f (4 a c - b^2) - a e^2 + b d e - c d^2} \over {(4ac - b^2)^2}} $
The distance between center and focal point (either of the two) is given by:
$ s = {1 \over 4} \sqrt { |q| \sqrt { b^2 + (a - c)^2 }} $
The semi-major axis length is given by:
$ r_\max = {1 \over 8} \sqrt { 2 |q| {\sqrt{b^2 + (a - c)^2} - 2 q (a + c) }} $
The semi-minor axis length is given by:
$ r_\min = \sqrt {{r_\max}^2 - s^2} $
The center of the ellipse is given by:
$ x_\Delta = { b e - 2 c d \over 4 a c - b^2} $
$ y_\Delta = { b d - 2 a e \over 4 a c - b^2} $
The top-most point on the ellipse is given by:
$ y_T = y_\Delta + {\sqrt {(2 b d - 4 a e)^2 + 4(4 a c - b^2)(d^2 - 4 a f)} \over {2(4 a c - b^2)}} $
$ x_T = {{-b y_T - d} \over {2 a}} $
The bottom-most point on the ellipse is given by:
$ y_B = y_\Delta - {\sqrt {(2 b d - 4 a e)^2 + 4(4 a c - b^2)(d^2 - 4 a f)} \over {2(4 a c - b^2)}} $
$ x_B = {{-b y_B - d} \over {2 a}} $
The left-most point on the ellipse is given by:
$ x_L = x_\Delta - {\sqrt {(2 b e - 4 c d)^2 + 4(4 a c - b^2)(e^2 - 4 c f)} \over {2(4 a c - b^2)}} $
$ y_L = {{-b x_L - e} \over {2 c}} $
The right-most point on the ellipse is given by:
$ x_R = x_\Delta + {\sqrt {(2 b e - 4 c d)^2 + 4(4 a c - b^2)(e^2 - 4 c f)} \over {2(4 a c - b^2)}} $
$ y_R = {{-b x_R - e} \over {2 c}} $
The angle between x-axis and major axis is given by:
if $ (q a - q c = 0) $ and $ (q b = 0) $ then $ \theta = 0 $
if $ (q a - q c = 0) $ and $ (q b > 0) $ then $ \theta = {1 \over 4} \pi $
if $ (q a - q c = 0) $ and $ (q b < 0) $ then $ \theta = {3 \over 4} \pi $
if $ (q a - q c > 0) $ and $ (q b >= 0) $ then $ \theta = {1 \over 2} {atan ({b \over {a - c}})} $
if $ (q a - q c > 0) $ and $ (q b < 0) $ then $ \theta = {1 \over 2} {atan ({b \over {a - c}})} + {\pi} $
if $ (q a - q c < 0) $ then $ \theta = {1 \over 2} {atan ({b \over {a - c}})} + {1 \over 2}{\pi} $
Best Answer
This formula rescales a standard ellipse $(\cos(\theta + d/2), \cos(\theta - d/2))$ (inscribed within the unit square) by the diagonal matrix $(x_0, y_0)$. By symmetry, the values $\theta = 0$ and $\theta = \pi/2$ correspond to vertices of this standard ellipse, allowing us to find their coordinates (and thus the lengths of the semi-axes), whence we easily deduce its equation is $x^2 + y^2 - 2 \rho x y = 1 - \rho^2$. Applying the diagonal matrix gives the conventional implicit form
$$\left(\frac{x}{x_0}\right)^2 + \left(\frac{y}{y_0}\right)^2 - 2 \rho \frac{x}{x_0} \frac{y}{y_0} = 1 - \rho^2 \text{.}$$
From here you can look up anything you want.