Ellipse From Two Points

I'm deriving the standard equation for an ellipse from two arbitrary points $$F_1$$ and $$F_2$$. An ellipse around these two focal points is a set of points $$P$$ for which the sum of the distances to $$F_1$$ and $$F_2$$ is a constant $$s$$, where $$s$$ may be any value greater $$\overline{F_1 F_2}$$. $$\overline{F_1 P} + \overline{F_2 P} = s$$ Let's sketch this out with a little SVG (luckily, SVG has an ellipse element).

We have our focal points $$F_1 = (-c, 0)$$ and $$F_2 = (c, 0)$$. The midpoint of $$\overline{F_1 F_2}$$ is the point of origin and center of the ellipse $$O = (0,0)$$. The points $$V_1 = (a, 0)$$ and $$V_2 = (0, b)$$ are the vertices of the ellipse. Parameter $$a$$ is the semi-major axis (maximal radius of the ellipse), $$b$$ the semi-minor axis (minimal radius of the ellipse), and $$c$$ the linear eccentricity (distance from the center to any of the two foci).

The sum of the distances from $$F_1$$ and $$F_2$$ to $$V_1$$ is $$2a$$, so in general $$s = 2a$$. $$\overline{F_1 V_1} + \overline{F_2 V_1} = (c + a) + (a - c) = 2a$$

The distance from any point $$P = (x,y)$$ of the ellipse to $$F_1$$ is $$\sqrt{(x+c)^2 + y^2}$$, accordingly to $$F_2$$ it is $$\sqrt{(x-c)^2 + y^2}$$.

In case you don't believe me, consider the points $$P$$, $$F_1$$ and $$Q = (-c, y)$$. If $$-c = x$$, then the distance obviously is $$\sqrt{(x+c)^2 + y^2} = y$$. Otherwise, those three points form a right triangle with the hypotenuse $$\overline{P F_1}$$. Line segment $$\overline{P Q}$$ is parallel to the x-axis and has length $$x + c$$. Line segment $$\overline{F_1 Q}$$ is parallel to the y-axis and has length $$y$$. The Pythagorean theorem says $$\overline{P F_1}^2 = (x + c)^2 + y^2$$.

Now we can express the definition of the ellipse with the following equation: $$\sqrt{(x-c)^2 + y^2} + \sqrt{(x+c)^2 + y^2} = 2a .$$

We use a bit of algebraic manipulation and the Pythagorean theorem to derive the standard ellipse equation... \begin{align*} \sqrt{(x-c)^2 + y^2} + \sqrt{(x+c)^2 + y^2} &= 2a \\ \sqrt{(x-c)^2 + y^2} &= 2a - \sqrt{(x+c)^2 + y^2}\\ \cancel{x^2} - 2cx + \cancel{c^2} + \cancel{y^2} &= 4a^2 - 4a \sqrt{(x+c)^2 + y^2} \\ &\hphantom{=} + \cancel{x^2} + 2cx + \cancel{c^2} + \cancel{y^2}\\ \cancel{-4} (cx + a^2) &= \cancel{-4}a \sqrt{(x+c)^2 + y^2}\\ c^2x^2 + 2 c x a^2 + a^4 &= a^2 (x^2 + 2cx + c^2 + y^2) \\ \frac{c^2 x^2}{a^2} + \cancel{2cx} + a^2 &= x^2 + \cancel{2xc} + c^2 + y^2 \\ \end{align*}

At this point we use the Pythagorean theorem to substitute $$c^2 = a^2 - b^2$$. \begin{align*} \frac{(a^2 - b^2) x^2}{a^2} + \cancel{a^2} &= x^2 + \cancel{a^2} - b^2 + y^2 \\ \cancel{a^2 x^2} - b^2 x^2 &= \cancel{a^2 x^2} - a^2 b^2 + a^2 y^2\\ -x^2 &= -a^2 + \frac{a^2 y^2}{b^2} \\ \frac{x^2}{a^2} &= 1 - \frac{y^2}{b^2} \end{align*}

$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$

If $$F_1 = F_2$$ (there is only one focal point) and thus $$a = b = r$$, we have the special case of a circle with radius $$r$$ around the center $$O$$. $$x^2 + y^2 = r^2$$