# Ellipses given focus and two points

I would like to find all ellipses which contain 2 given points and has one focus at origin (zero). All in 2D plane.

There are several possible approaches but I'm not sure which is the best - both looks quite difficult to solve algebraically.

1. using polar equation relative to focus with $(R_1,\phi_1),(R_2,\phi_2)$, being coordinates of points $$R_1 = \frac{a(1-e^2)}{1-ecos(\phi_1-\theta)}$$ $$R_2 = \frac{a(1-e^2)}{1-ecos(\phi_2-\theta)}$$ then for given $\theta$ solve for semimajor axis $a$ and eccentricity $e$
2. using deffinition of elipse as a set of points of the same distance from both foci. Given 2 points of cartesian coordinates $(x_1,y_1),(x_2,y_2)$ and one focus in origin $(0,0)$. For each given distance parameter $L$ solve for coordinates of second focus $(x_f,y_f)$, $$L = \sqrt{x_1^2 + y_2^2} + \sqrt{(x_1 - x_f)^2 + (y_1 - y_f)^2}$$ $$L = \sqrt{x_2^2 + y_2^2} + \sqrt{(x_2 - x_f)^2 + (y_2 - y_f)^2}$$
3. I can also first rotate the coordinate system (or my input points) by given angle (which is my arbitrary parameter) and then use some simplified equation of ellipse which has major axis parallel to x-axis which has just 2 degrees of freedom. But even after this rotation I don't see much simplification of algebraic solution.

Or is there any better way?

The resulting equations are quite difficult to solve. I wonder if there is some trick to simplify it and make it more elegant.

Also, because I would later to implement it into computational code where it would be computed manytimes per second, I would prefer solution inf form which is fast to evaluate numerically ( prefferably without goniometric or any transcedental functions )

Why I'm interested ? - I need it for some optimalization of orbital transfers for spaceship orbiting the Sun. I asked also in physics.stackexchange, and people recomand me that I should rather go to math section.

-
This is quite an interesting problem. Note that given points $P_1,P_2$, with a very few exceptions there are at least two non-trivially different ellipses that can be specified which satisfy every valid $L$ value. I'm still working out the details to provide an answer for you. – abiessu Oct 31 '13 at 20:25
Try plotting the problem in the complex plane. – ben May 6 '14 at 5:15
@prokop-hapala Did you solve your problem? I am having the exact same problem but the answer given below doesn't really help me! Can you explain how you find such an ellipse? – thalador Feb 18 at 17:02

If $a$ is the semi-major axis of one such ellipse, and $F$ its other focus, then $$|R_1|+|R_1-F|=2a=|R_2|+|R_2-F|.$$ Subtracting one from the other, $F$ must satisfy the following equation: $$|F-R_1|-|F-R_2|=|R_2|-|R_1|.$$ The set of all points $F$ that satisfy this equation is a hyperbola with focuses $R_1$ and $R_2$, and the semi-major axis $-\frac12\big||R_1|-|R_2|\big|$, and it is easy to find coordinates of points on the hyperbola using standard formulas (see the mathworld link, e.g.).

-
Very nice answer, short and effective! ;-) – Jean-Claude Arbaut May 6 '14 at 5:56