# How to draw an ellipse if a center and 3 arbitrary points on it are given?

How to draw an ellipse if a center and 3 arbitrary points on it are given?

-
@RahulNarain: Updated. – kiss my armpit Mar 23 '13 at 22:05

If a center point $C$ is chosen for the ellipse, one can draw two intersecting ellipses with center at $C$ which intersect at four points. So if $A,B$ happen to be two of those four points, the ellipse will not be unique. So I think you might need more assumptions, maybe that the ellipse is to have its major axis parallel to the $x$ axis.

Just saw the update: The above example shows you need at least 5 points given on the ellipse to determine it.

ADDED: Consider the following two ellipses, both centered at $(0,0)$. $$E_1:\ x^2+2y^2=3,\\ E_2:\ 2x^2+y^2=3.$$ The four points $$(1,1),\ (1,-1),\ (-1,1),\ (-1,-1)$$ each lie on both ellipses $E_1$ and $E_2$. So in general given only four points and the center, the ellipse is not determined.

-
5 points? Ellipse with fixed center has exactly three degrees of freedom, so three constraints must be exactly as much as needed. – Juris Mar 23 '13 at 22:40
@Juris : See the example I inserted after "ADDED" in above answer. – coffeemath Mar 23 '13 at 23:26

You must find three unknowns - two half axes describing the ellipse and an angle to describe it's orientation.

You must choose some equation that describes ellipse and write the equations for each of the points. Find the parameters of ellipse from them.

For example, with parametric equations you have two equations at each point: $$x_i=x_c+a\cos t_i \cos \varphi - b \sin t_i \sin \varphi$$ $$y_i=y_c+a\cos t_i \sin \varphi - b \sin t_i \cos \varphi$$

where $x_i$ and $y_i$ are the coordinates of $i$-th point, $x_c$ and $y_c$ are the centers coordinates, $t_i$ is parameters $t$ value at the $i$-th point and $a$, $b$ and $\varphi$ are the unknown values describing the ellipse and it's orientation. If you write these equations, you will have six equations and six unknown values (three $t_i$'s and the wanted values). Solvable, but not trivial. I'm showing you the approach not the solution. I'll leave it up to you to choose more appropriate ellipse equations to start with :)

-

The general centered 2D ellipse equation is

$$\begin{pmatrix} x\\y\\1 \end{pmatrix}^\top \begin{vmatrix} C_{11} & C_{12} & 0 \\ C_{12} & C_{22} & 0 \\ 0 & 0 & -1 \end{vmatrix} \begin{pmatrix} x\\y\\1 \end{pmatrix} = 0 \\ C_{11} x^2 + C_{22} y^2 + 2 C_{12} x y - 1 = 0$$

Using the three points you can find the three coefficients $C_{11}$, $C_{22}$ and $C_{12}$. First form a 3×3 system using the above equation for the three points $(x_1,y_1)$, $(x_2,y_2)$ and $(x_3,y_3)$.

$$\begin{vmatrix} x_1^2 & y_1^2 & 2 x_1 y_1 \\x_2^2 & y_2^2 & 2 x_2 y_2 \\ x_3^2 & y_3^2 & 2 x_3 y_3 \end{vmatrix} \begin{pmatrix} C_{11} \\ C_{22} \\ C_{12} \end{pmatrix} = \begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix}$$

The above system is easily solved by inverting the 3×3 matrix.

Once the coefficients are known you can find the angle of incline of the ellipse by $$\theta = \frac{1}{2} \arctan \left( \frac{2 C_{12}}{C_{22}-C_{11}} \right)$$

Note the angle is measured clockwise from horizontal

Getting the semi-major and semi-minor axes $a$ and $b$ is a little more involved.

• Find $\eta = C_{11} + C_{22}$
• Find $\zeta = \frac{C_{22}-C_{11}}{\cos(2 \theta)}$
• Semi major axis $a= \sqrt{ \frac{2}{\eta - \zeta} }$
• Semi minor axis $b= \sqrt{ \frac{2}{\eta + \zeta} }$

The equation of the ellipse is now

$$\left( \frac{(b^2-a^2) \cos^2 \theta}{a^2 b^2} + \frac{1}{b^2} \right) x^2 + \left( \frac{(a^2-b^2)\cos^2\theta}{a^2 b^2} + \frac{1}{a^2} \right) y^2 + \frac{2 (a^2 - b^2)\sin\theta\cos\theta}{a^2 b^2} x y - 1 = 0$$

## Example

Consider the points $(\sqrt{3}+1,-1)$, $(1,\sqrt{3}-1)$ and $(-1,\frac{5 \sqrt{3}}{13} + \frac{7}{13})$

Find the coefficients $$\begin{pmatrix} C_{11} \\ C_{22} \\ C_{12} \end{pmatrix} = \begin{pmatrix} \frac{5-2\sqrt{3}}{9} \\ \frac{2 \sqrt{3}+5}{9} \\ \frac{2}{9} \end{pmatrix}$$

Find the angle $$\theta = \frac{1}{2} \arctan \left( \frac{1}{\sqrt{3}} \right) = \frac{\pi}{12}$$

Find the axes:

• $\eta = \frac{10}{9}$
• $\zeta = \frac{8}{9}$
• $a^2 = \frac{2}{\frac{2}{9}}= 9$
• $b^2 = \frac{2}{2} = 1$

Find the ellipse equation

$$\left( \frac{5}{9} - \frac{2 \sqrt{3}}{9} \right) x^2 + \left( \frac{2 \sqrt{3}}{9} + \frac{5}{9} \right) + \frac{4}{9} x y - 1 =0$$

Confirm results with GeoGebra:

-
Note to self. Do not use mirror points because a solution won't be found. Also sometimes the result is a hyperbola and not an ellipse. – ja72 Nov 9 '15 at 0:01

For the ellipse is defined in a unique way, it takes one beyond the three-point line $ax + by + c = 0$ with the eccentricity $e$ the ellipse (see the definition of elipse in see wikipedia for more).

-

Actually I was suggesting my above answer to the people at geogabra and they told me about this nice parametric equation that only needs the center point and any 2 points on the ellipse, where A is the center: f(t)=A+(B-A)*sin(t)+(C-A)*cos(t)

-

I think I found an answer, you don't need to know the center but you have to know which 3 points on the diagram you know, I called it the

, once you find 2 additional points using the formulas you find the conic through 5 points as here Conic through 5 points...

I posted it on my blog here: Elliptical Pizza on Ben Paul Thurston Blog

-