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.)
Best Answer
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)}$.