# Given the end points of the semi major axis, and 2 other points, is it possible to find the equation of an ellipse?

I've projected a point outwards onto a 2D plane, which forms an ellipse (or very close to one!). The 4 points I now have are the end points of the semi major axis, and two other points:

I know the equation of a general ellipse (tilted, and non-centred), but how can one find it from the given information above.

$$\dfrac {((x-h)\cos(A)+(y-k)\sin(A))^2}{(a^2)}+\dfrac{((x-h) \sin(A)-(y-k) \cos(A))^2}{(b^2)}=1$$

Let's say these 4 points are "approximate", is there a way to determine an approximate ellipse?

If you have the endpoints of one axis of the ellipse plus one other point, it is possible to uniquely identify the ellipse through those three points.

Suppose the two endpoints of one axis of the ellipse are $P_1 = (x_1,y_1)$ and $P_2 = (x_2,y_2),$ and let $P_3 = (x_3,y_3)$ be any other point on the ellipse.

The center of the ellipse, $C = (h,k),$ is the midpoint of the segment $P_1P_2,$ which is $$\left(\frac{x_1+x_2}{2}, \frac{y_1+y_2}{2}\right).$$ Therefore $h = \frac12(x_1+x_2)$ and $k = \frac12(y_1+y_2).$

The slope of the axis of the ellipse is the slope of the line through $P_1$ and $P_2,$ which is $\frac{y_2-y_1}{x_2-x_1}$ (rise divided by run). The angle $A$ that the axis of the ellipse makes with the $x$-axis is therefore $$A = \arctan\left(\frac{y_2-y_1}{x_2-x_1} \right).$$

The distance between $P_1$ and $P_2$ is the length of the axis of the ellipse, which is twice the semi-axis length $a.$ That is, $$a = \frac12 \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}.$$ Since you only really need $a^2$ to write your formula, however, a simpler calculation is $$a^2 = \frac14 \left((x_2-x_1)^2 + (y_2-y_1)^2\right).$$

So far we have four of the five constants that you need in order to write your formula for the ellipse. We just have to find the value of $b.$ One way to do this is to write the equation that $(x_3,y_3)$ must satisfy, $$\frac{((x_3-h)\sin(A)-(y_3-k)\cos(A))^2}{b^2} + \frac{((x_3-h)\cos(A)+(y_3-k)\sin(A))^2}{a^2} = 1,$$ and then rearrange the equation as follows: $$\frac{((x_3-h)\sin(A)-(y_3-k)\cos(A))^2}{b^2} = 1 - \frac{((x_3-h)\cos(A)+(y_3-k)\sin(A))^2}{a^2},$$ $$\frac{1}{b^2} = \frac{1 - \frac{1}{a^2}((x_3-h)\cos(A)+(y_3-k)\sin(A))^2} {((x_3-h)\sin(A)-(y_3-k)\cos(A))^2},$$ $$b^2 = \frac{((x_3-h)\sin(A)-(y_3-k)\cos(A))^2} {1 - \frac{1}{a^2}((x_3-h)\cos(A)+(y_3-k)\sin(A))^2}.$$ You can evaluate $b^2$ by plugging in the given values $x_3$ and $y_3$ and the already-calculated values $h,$ $k,$ $A,$ and $a.$ You could then assume $b$ is positive, that is, $b = \sqrt{b^2},$ but just having gotten a value of $b^2$ you have enough to write the equation of the ellipse.

With four points, you have the problem of which of the two "extra" points to use in order to determine your ellipse. Either choice will give the same values of $h,$ $k,$ $A,$ and $a,$ since those depend only on the two endpoints of the ellipse's axis. But if the positions of the other two points are not exactly on the same ellipse, you will get two different values of $b^2$ depending on which point you choose as the "third" point. One resolution to the problem might be to do the calculation of $b^2$ twice, once for each of the "extra" points, and somehow average the two values that you obtain.

• Thanks @David K! Your solution helped to generate an "approximate" ellipse! The last point about averaging the 2 semi-minor axis solutions is a decent idea. Once the averaged b is inserted, I get an ellipse which fits the data fairly well. May 13, 2017 at 14:26