Let's say I have a set of points, and I want to check if this set defines circle or ellipse or parabola or hyperbola. Is there a way I can to it?

I've found that it takes three points to define a circle. If I have the fourth point, then I can check if the point is on the circle. Specifically, if I have points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$, then I can use these formulas in my computer code:

$$\begin{align} k&:=\frac{(x_1-x_2)(x_2^2-x_3^2+y_2^2-y_3^2)-(x_2-x_3)(x_1^2-x_2^2+y_1^2-y_2^2)}{2\left(\;(y_2-y_3)(x_1-x_2)-(y_1-y_2)(x_2-x_3)\;\right)} \\[4pt] h&:=\frac{(y_1-y_2)(y_1+y_2-2k)}{2(x_1-x_2)}+\frac12(x_1+x_2) \\[4pt] r&:=\sqrt{(x_3-h)^2+(y_3-k)^2} \end{align}$$

Then, to determine where the fourth point, $(x,y)$, lies relative to the circle, I can compute $$v :=(x-h)^2+(y-k)^2-r^2$$ so that $$\begin{align} v&=\phantom{-}0 \implies \text{lies on the circle} \\ v&=\phantom{-}1 \implies \text{lies outside the circle} \\ v&=-1 \implies \text{lies inside the circle} \end{align}$$

Is there a way to do something like this for ellipse or parabola or hyperbola? Any help would be appreciated.

  • $\begingroup$ Welcome to MSE. Please use MathJax to format your question. $\endgroup$ – user507623 Mar 1 '18 at 13:00
  • $\begingroup$ The expressions for k, h, etc. appear to be statements of a programming language. On this site people seem to prefer mathematical notation where possible, so instead of x1*x1 you might write $x_1^2.$ This also will make your formulas fit the page better. $\endgroup$ – David K Mar 1 '18 at 14:52
  • $\begingroup$ I've transcribed your equations into proper mathematical markup. Please double-check the formulas. I've also edited your description a little for clarity; I hope the changes are acceptable. $\endgroup$ – Blue Mar 1 '18 at 15:52

Assuming your set of points to be in the form of an equation,

The general equation of a conic section is a second-degree equation in two independent variables (say x,y) which can be written as

$$ \mathrm{ax^2 + 2hxy + by^2 + 2gx + 2fy + c =0} $$

There are several ways of classifying conic sections using the above general equation with the help of the discriminant $\Delta$ of this equation:

$$ \Delta = \mathrm{abc + 2fgh -af^2 -bg^2 -ch^2 }$$

If $\Delta$ not equal to 0,

  • If $\mathrm{h=0}$ and $\mathrm{a = b}$ the equation represents a circle.
  • If $\mathrm{h^2-ab = 0}$, the equation represents a parabola.
  • If $\mathrm{h^2-ab < 0}$, the equation represents an ellipse.
  • If $\mathrm{h^2-ab > 0}$,it represents a hyperbola and a rectangular hyperbola if a+b=0 also

If $\Delta = 0$ and $\mathrm{b^2-ab>=0}$ , the equation represents a pair of lines.


A general equation for a conic section can be written as $$ Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0. \tag1 $$

Now suppose you have the coordinates of five points. That is, you have five sets of known values of $x$ and $y$ that satisfy Equation $(1).$

If you take one of those pairs of coordinates and substitute those values of $x$ and $y$ into Equation $(1),$ you get a linear equation with six unknowns $A, B, C, D, E,$ and $F.$ (The values of $x^2,$ $xy,$ and so forth are the known linear coefficients of this new equation.)

Do this again four more times, once for each of the other pairs of known coordinates of points.

You now have five linear equations in six unknowns. If no three of the five given points are collinear, the solution set of the system of equations is a line in the six-dimensional space of the unknowns. In other words, if you take any solution in which $A, B, C, D, E,$ and $F$ are not all zero, you can produce any other solution just by multiplying all of the quantities $A, B, C, D, E,$ and $F$ by the same factor.

This solution set uniquely determines the conic section; that is, any solution in which $A, B, C, D, E,$ and $F$ are not all zero is the equation of a conic section, and every other solution (except $A=B=C=D=E=F=0$) is also an equation of the same conic section.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.