Given the parametric equation $$\big(\;a \cos(\alpha+\theta), \;\;b\sin(\beta+\theta)\;\big)$$ with parameter $\theta$, how can we determine the length of the semimajor and semiminor axes, as well as the angle of tilt of the ellipse?

By experimentation it can be shown that by varying $\alpha, \beta$, the resulting ellipses are tangential to the rectangle defined by $|x|=a, |y|=b$. enter image description here

See Desmos implementation here.


The parameterization $\mathbf r(t)=\left(w\cos(t+\alpha),h\sin(t+\beta)\right)$ has the interesting property that $\dot{\mathbf r}(t)=\mathbf r(t+\pi/2)$, which means that for any $t$, the points $\mathbf r(t)$ and $\mathbf r(t+\pi/2)$ are endpoints of conjugate diameters. (I’ve changed the parameter names to $w$ and $h$ in order to use $a$ and $b$ for the ellipse’s semiaxis lengths. I’m also assuming that $w,h\gt0$ since the solutions for negative values of these parameters can be obtained by reflection.) The area of the triangle formed by the halves of a pair of conjugate diameters is constant, which gives us the identity $$a b = \det\begin{bmatrix}w\cos(t+\alpha) & h\sin(t+\beta)&1 \\ -w\sin(t+\alpha) & h\cos(t+\beta) & 1 \\ 0&0&1\end{bmatrix} = w h \cos(\alpha-\beta).$$ The sides of the bounding rectangle are perpendicular tangents to the ellipse, so the corners of the rectangle lie on the ellipse’s orthoptic, which in turn means that $$a^2+b^2=w^2+h^2.$$ We want the nonnegative solutions to this system of equations with $a\ge b$. With a bit of help from a symbolic algebra program, the semiaxis lengths of the ellipse can be found to be $$\left(\frac12\left(w^2+h^2\pm\sqrt{w^4+h^4-2w^2h^2\cos(2(\alpha-\beta))}\right)\right)^{1/2},$$ or equivalently, $${\sqrt2 w h \cos(\alpha-\beta) \over \left(w^2+h^2\mp\sqrt{w^4+h^4-2w^2h^2\cos(2(\alpha-\beta))}\right)^{1/2}}.$$ The linear eccentricity, a.k.a. distance from center to focus, is then $$\left(w^4+h^4-2w^2h^2\cos(2(\alpha-\beta))\right)^{1/4}.$$

There’s a very simple geometric construction for finding the axes of an ellipse: draw a circle with the same center as the ellipse that intersects it at four points. The sides of the rectangle thus formed are parallel to the axes of the ellipse. Unfortunately, in this case this construction doesn’t really translate well into an analytical solution, but we can turn to the polar equation of an ellipse relative to its center: $$r = {b\over\sqrt{1-(e\cos\theta)^2}}$$ from which $$\cos^2\theta = {r^2-b^2\over r^2e^2}.$$ We have $e^2=1-b^2/a^2$ and using $\mathbf r(t)\cdot\mathbf r(t)$ with a convenient value of $t$ for $r^2$, we get (again with the help of a program because I’m lazy) $$\cos^2\theta = \frac12 + {w^2-h^2 \over \sqrt{w^4+h^4-2w^2h^2\cos(2(\alpha-\beta))}}.$$ I’m not sure that there’s any good way to choose the correct signs for $\cos\theta$ and ultimately for $\theta$ itself automatically, but it’s easy enough to generate potential solutions from this and choose the correct one either by comparing to the graph of the curve or by trying out a few values.

There are other options for finding the axes of the ellipse, but they’re not as computationally attractive. One option is to solve $\lVert\mathbf r(t)\rVert^2=\mathbf r(t)\cdot\mathbf r(t)=a^2$ or $\mathbf r(t)\cdot\mathbf r(t)=b^2$ for $t$ and substitute back into $\mathbf r$. These equations can be solved analytically, although the solutions appear to be rather unpleasant-looking. Or, one might exploit symmetry: the reflection of $\mathbf r(t)$ in the line with slope $\tan\theta$ is $$x = h \sin (2 \theta ) \sin (\beta +t)+w \cos (2 \theta ) \cos (\alpha +t) \\ y = w \sin (2 \theta ) \cos (\alpha +t)-h \cos (2 \theta ) \sin (\beta +t).$$ Choose a convenient value of $t$ such as $\pi/2-\alpha$ or $-\beta$ and find values of $\theta$ for which the reflected point also lies on the ellipse. A general solution using this method doesn’t look promising, it might be useful for specific instances.

Yet another possibility is to find the values of $t$ for which the conjugate diameters are perpendicular: $$w^2\cos(t+\alpha)\sin(t+\alpha)=h^2\cos(t+\beta)\sin(t+\beta).$$ This equation also arises when trying to find the extrema of $\lVert\mathbf r(t)\rVert^2$. Since you know the linear eccentricity, it might also be possible to work up some other equations using the reflective property of ellipses, but I don’t think that they’re going to be any more tractable than these.

  • $\begingroup$ Thanks. Nice solution. (+1) $\endgroup$ Jun 9 '19 at 13:34
  • $\begingroup$ Hi. I know a non-polar solution. may I tell you that? $\endgroup$
    – aminabzz
    Mar 7 '20 at 17:42
  • $\begingroup$ @aminabzz Post your own answer. $\endgroup$
    – amd
    Mar 8 '20 at 4:36
  • $\begingroup$ @amd please check it $\endgroup$
    – aminabzz
    Mar 8 '20 at 14:14

Let's use vectors. For an ellipse, we know that at the endpoints of the semi-major and semi-minor axes, the vector pointing from the origin to the point is perpedicular to the tangent vector at that point.

If $\vec{v}(\theta)=(x(\theta),y(\theta))$ is the equation of the ellipse, then $\vec{v}'(\theta)=(x'(\theta),y'(\theta))$ specifies the direction of the tangent vector. Given $\vec{v}(\theta)=(a \cos(\alpha + \theta),b \sin(\beta + \theta))$, we deduce that $\vec{v}(\theta)=(-a \sin(\alpha + \theta),b \cos(\beta + \theta))$. Using our conclusions from above, we find that we must have $$\vec{v} \cdot \vec{v}' = 0 \implies \frac{a^2}{b^2} = \frac{\sin(\alpha + \theta)\cos(\alpha + \theta)}{\sin(\beta + \theta)\cos(\beta + \theta)} = \frac{\sin(2(\alpha + \theta))}{\sin(2(\beta + \theta))}$$

Solve for the $\theta$ that makes this relation true to find the "tilt" angle (I assume you define it as the angle between the semi-major axis vector of the new ellipse and the $x$-axis).* You will get multiple solutions between $0$ and $2 \pi$ (call these $s_i$). The length of the semi-major axis (correspondingly semi-minor axis) is then the maximum (correspondingly minimum) of $f(s_i) = a^2 \cos^2(\alpha + \theta) + b^2 \sin^2(\beta + \theta)$.

$*$ I'm not aware of any algebraic way to solve this equation. I think it's pretty similar to solving an equation like $\sin x = x$.

  • $\begingroup$ Nice solution. Thanks (+1). $\endgroup$ Jun 9 '19 at 13:32

this solution isn't polar

we have $Ax^2+Bxy+Cy^2+Dx+Ey+F=0$ as our conic section equation which is rotated.

if $B^2-4AC<0$, then we have an ellipse (If $A=C$ and $B=0$, it is a circle).

if $B^2-4AC=0$, then we have a parabola.

if $B^2-4AC>0$, then we have a hyperbola (If $A+C=0$, then we have a rectangular hyperbola).

our goal is to find the canonical equation of the rotated ellipse

first, we should calculate the Eigenvalues of the following matrix:


for finding the Eigenvalues, we should rewrite the matrix as the following and then find its determinant; then find $\lambda$ (note that you'll find two lambdas) when $|\alpha_2|=0$ ($|\alpha_2|$ is the determinant of the matrix).


now, we should find the determinant of the following matrix:


now, find the canonical equation using the following formula:


if you don't know how to find those determinants, please tell me in the comments.


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.