I have a rotated ellipse in parametric form:

$$\begin{pmatrix}y \\ z\end{pmatrix} = \begin{pmatrix}a\cos t + b\sin t \\ c\cos t + d\sin t\end{pmatrix} \tag{1} $$ or,

$$(y,z) = (a\cos t + b\sin t , c\cos t + d\sin t) \tag{2} $$

By using $$\cos^2 t + \sin^2 t = 1 $$

I can rewrite into:

$$ \frac{(d^2 + c^2)y^2 + (-2bd-2ac)yz + (a^2+b^2)z^2}{(ad-bc)^2} = 1 \tag{3} $$

I need to compare it with the standard form of a rotated ellipse (the input format in a program I am writing):

$$\left(\frac{\cos\theta(y-h) + \sin\theta (z-k)}{r_1}\right)^2 + \left(\frac{\sin\theta(y-h) - \cos\theta (z-k)}{r_2}\right)^2 = 1 \tag{4} $$

To solve for $r_1, r_2, \theta $ (namely the semi-major, minor axis and angle of rotation).

However I realized that this will involve 3 non-linear equations. Although it is solvable, I was wondering if there is a simpler way to find the values?

  • $\begingroup$ If $a d − b c = 0 $, due to proportionality it is a straight line, and if $ (a^2+c^2) =(b^2+d^2)$, are a pair of circles through origin. $\endgroup$ – Narasimham Mar 24 '15 at 14:25

Your ellipse is centered at the origin. Therefore let's look at the function $$R(t):=y^2(t)+z^2(t)=(a^2+c^2)\cos^2 t+(b^2+d^2)\sin^2 t +2(ab+cd)\cos t\sin t$$ that represents the squared distance of the moving point from the origin. It can be rewritten as $$R(t)={1\over2}\biggl(a^2+c^2+b^2+d^2 +\bigl((a^2+c^2)-(b^2+d^2)\bigr)\cos(2t)+2(ab+cd)\sin(2t)\biggr)\ .$$ We now have to compute the $t$-values for which $R(t)$ becomes maximal, resp. minimal. To this end we compute $$R'(t)=-\bigl((a^2+c^2)-(b^2+d^2)\bigr)\sin(2t)+2(ab+cd)\cos(2t)\ .$$ This vanishes when $$t={1\over2}\arctan{2(ab+cd)\over(a^2+c^2)-(b^2+d^2)}+{k\pi\over2}\qquad(0\leq k\leq3)\ .$$ Plugging in two successive of these four $t$-values into the given parametric representation of the ellipse gives you at once two points on the two main axes. From their coordinates the length of these axes and the angle of rotation can immediately be read off. (For "automatic purposes" some exception handling might be necessary.)

  • $\begingroup$ Thanks. Just a question, any reason why $R(t)$ is chosen to be $y^2(t)+z^2(t)$ (as opposed to $y^3(t)$ or something)? Also could the same reasoning work if the ellipse is not centered at the origin? $\endgroup$ – John Tan Mar 24 '15 at 14:06
  • $\begingroup$ This choice of $R(t)$ is geometrically natural under the circumstances. Maximizing, e.g., $y(t)$ gives you the points where the tangent is parallel to the $z$-axis, and not points on the main axes of the ellipse. When the ellipse is not centered at the origin you have to subtract off the center from the parametric representation before starting with the above calculations. $\endgroup$ – Christian Blatter Mar 24 '15 at 14:24
  • $\begingroup$ @Christian Blatter: Nice treatment for central conicoids. Three observations. Looking at associated matrix arrangement {{a,b},{c,d}} of (1*), $ a d - b c =0 $ determinant value is for a pair of straight lines ? Secondly, what imaginary numbers determinant produce the pair of circles through origin when $ a^2 + c^2 = b^2 + d^2 $? Thirdly, values of (a,b,c,d) can produce a hyperbolas also, right? ( relevant also for automatic generation of conics). $\endgroup$ – Narasimham Mar 24 '15 at 14:52
  • $\begingroup$ @Narasimhan: The given paramatrization can only produce ellipses (maybe degenerated to a segment or a point). Everything in sight here is considered real. $\endgroup$ – Christian Blatter Mar 24 '15 at 14:57

You can also find the eigenvalues of the matrix


in order to diagonalise it.

The eigenvalues are $\lambda=\frac{s^2\pm\sqrt{(s^2-2\det{})(s^2+2\det{})}}{2(\det{})^2}$, where $\det{} =ad-bc$ and $s^2=a^2+b^2+c^2+d^2$

giving your rotated ellipse the form $\lambda_1(y')^2+\lambda_2(z')^2=1$, which gives you the $r_1$ and $r_2$. The eigenvector matrix will give the $\theta$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.