I'd like to describe the ellipse centered at the origin with a fixed major axis length of $2a$ that passes through two points $(u_x, u_y)$ and $(v_x, v_y)$ (both within $a$ of the origin). In particular, I need to compute the angle of rotation $\phi$ of this ellipse, and the length $2b$ of its minor axis.

I tried the straightforward approach of just setting up a couple of equations to solve for the coordinates of the foci $(f_x, f_y)$ and $(-f_x, -f_y)$:

$\sqrt{(u_x - f_x)^2 + (u_y - f_y)^2} + \sqrt{(u_x + f_x)^2 + (u_y + f_y)^2} = 2a = \sqrt{(v_x - f_x)^2 + (v_y - f_y)^2} + \sqrt{(v_x + f_x)^2 + (v_y + f_y)^2}$

If I were able to use these equations to determine $(f_x, f_y)$ then presumably $\phi = \arctan(f_y / f_x)$ and $b = \sqrt{a^2 - f_x^2 - f_y^2}$...but solving those equations for $(f_x, f_y)$ is beyond my algebraic skills. (They also appear to flummox the SymPy solver.)

  • $\begingroup$ Interesting problem. From playing around with it a bit in GeoGebra, it looks like there are generally two such ellipses. $\endgroup$ – amd May 3 at 0:41
  • $\begingroup$ I doubt that there’s going to be any “nice” algebraic solution to this, and certainly not a nice general formula. Instead of trying to compute the foci, I would look at the family of conics parameterized by $\theta$ centered at the origin that pass through the two points and $a(\cos\theta,\sin\theta)$. The equations for these are easily constructed with a determinant. De la Hire’s construction of an ellipse seems promising, too: you can construct two inner circles and try to find the angle at which they coincide. $\endgroup$ – amd May 3 at 0:45

Let $y=mx$ be the equation of the major axis of the ellipse, and $b$ its semi-minor axis (which lies on line $y=-x/m$). Distances $u_a$ and $u_b$ from point $u$ to the lines of the axes are given by: $$ u_a^2={(u_y-mu_x)^2\over1+m^2},\quad u_b^2={(mu_y+u_x)^2\over1+m^2}, $$ and analogous expressions can be written for point $v$. If $u$, $v$ belong to the ellipse, then: $$ {u_b^2\over a^2}+{u_a^2\over b^2}=1 \quad\text{and}\quad {v_b^2\over a^2}+{v_a^2\over b^2}=1. $$ This is a system of equations for the unknowns $m$ and $b$: I solved it with Mathematica and, apart from the trivial solutions $(b=a,\ m=\pm i)$, it has two real solutions: $$ {1\over b^2}= \frac{ u_x^2+u_y^2+v_x^2+v_y^2 -a\left(2u_x^2v_x^2+2u_y^2v_y^2+2 u_x u_y v_x v_y+u_y^2 v_x^2+u_x^2 v_y^2\right) \pm 2 (u_xv_x+u_yv_y)\sqrt{\Delta}} {(u_y v_x-u_x v_y)^2} $$ $$ m= \frac{ -u_x u_y \left(a\left(v_x^2+v_y^2\right)-1\right) +v_x v_y\left(a\left(u_x^2+u_y^2\right)-1\right) \mp(u_y v_x-u_x v_y)\sqrt{\Delta}} {u_x^2 \left(1-a v_y^2\right)+v_x^2 \left(a u_y^2-1\right)}, $$ where: $\Delta={\left(1-a \left(u_x^2+u_y^2\right)\right) \left(1-a\left(v_x^2+v_y^2\right)\right)}$.

  • $\begingroup$ This is terrific! (SymPy appears to choke on these equations as well, which may be more an indication of my inexperience with computer algebra systems than a symptom of SymPy's shortcomings.) I wrote a very quick and dirty Python script to visualise the results: gist.github.com/7066d2de2afb0bf3c87812499ed4d540 $\endgroup$ – rvcx May 5 at 19:24

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.