Conic Sections
Slice a double cone with a flat plane and the edge of the cut is a circle, an ellipse, a parabola or a hyperbola. These four curves, the conic sections, are also the graphs of second-degree equations in and . This lesson gives each curve's standard equation, its key features (centre, foci, vertices, asymptotes) and where you meet them in orbits, satellite dishes, lenses and game code.
Four curves from one cone
| Plane cut | Curve | Standard equation (centre or vertex at origin) |
|---|---|---|
| perpendicular to the axis | circle | |
| tilted, cutting all the way round | ellipse | |
| parallel to the side of the cone | parabola | , or |
| steeper than the side, cutting both halves | hyperbola |
Every conic is the graph of an equation . Without the term (, no rotation) you can tell them apart from and : gives a circle, same sign gives an ellipse, one of them zero gives a parabola, opposite signs give a hyperbola.
The circle and the ellipse
A circle with centre and radius is the set of points at distance from the centre: . Moving the centre just replaces by and by , as in transformations.
An ellipse is the set of points whose distances to two fixed points, the foci, add up to a constant . In standard form with :
- is the semi-major axis (vertices at ), the semi-minor axis;
- the foci are at with ;
- the eccentricity measures how stretched it is (0 for a circle, near 1 for a long thin ellipse).
The "two pins and a string" definition is easy to test numerically:
import math
a, b = 5, 3
c = math.sqrt(a**2 - b**2) # foci at (±4, 0)
print("c =", c, " eccentricity =", c / a)
for t in [0, 0.7, 1.5, 2.5, 4.0]:
x, y = a * math.cos(t), b * math.sin(t) # a point on the ellipse
d1 = math.dist((x, y), (-c, 0))
d2 = math.dist((x, y), (c, 0))
print(f"point ({x:6.3f}, {y:6.3f}): d1 + d2 = {d1 + d2:.6f}")c = 4.0 eccentricity = 0.8
point ( 5.000, 0.000): d1 + d2 = 10.000000
point ( 3.824, 1.933): d1 + d2 = 10.000000
point ( 0.354, 2.992): d1 + d2 = 10.000000
point (-4.006, 1.795): d1 + d2 = 10.000000
point (-3.268, -2.270): d1 + d2 = 10.000000
The sum is always . Planets move on ellipses with the Sun at one focus (Kepler's first law); Earth's orbit has , very nearly a circle.
The parabola
A parabola is the set of points at equal distance from a fixed point (the focus) and a fixed line (the directrix). With the vertex at the origin, focus and directrix , the equation is .
Its reflective property is used everywhere: rays coming in parallel to the axis bounce off the parabola and all pass through the focus. That is why satellite dishes, solar cookers and car headlights are parabolic. In physics, anything thrown under constant gravity (without air resistance) follows a parabola, so projectile paths in games are parabolas too.
The hyperbola
A hyperbola is the set of points where the difference of the distances to two foci is a constant . In standard form :
- vertices at , foci at with (plus, not minus);
- two branches that approach the asymptotes ;
- eccentricity .
Old radio navigation (LORAN) used hyperbolas: the difference in arrival times of signals from two stations puts the receiver on a hyperbola with the stations as foci.
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0, 2 * np.pi, 300)
s = np.linspace(-1.6, 1.6, 200)
plt.figure(figsize=(6, 6))
plt.plot(2 * np.cos(t), 2 * np.sin(t), label="circle x² + y² = 4")
plt.plot(5 * np.cos(t), 3 * np.sin(t), label="ellipse x²/25 + y²/9 = 1")
xp = np.linspace(-4, 4, 200)
plt.plot(xp, xp**2 / 4, label="parabola x² = 4y")
for sign in (1, -1):
plt.plot(sign * 2 * np.cosh(s), 1.5 * np.sinh(s), "C3", label="hyperbola x²/4 − y²/2.25 = 1" if sign == 1 else None)
plt.plot(xp * 2, 0.75 * xp * 2, "C3:", lw=1)
plt.plot(xp * 2, -0.75 * xp * 2, "C3:", lw=1)
plt.xlim(-7, 7); plt.ylim(-6, 6); plt.gca().set_aspect("equal")
plt.legend(fontsize=8, loc="lower right")
print("drawn: circle, ellipse, parabola, hyperbola with asymptotes")drawn: circle, ellipse, parabola, hyperbola with asymptotes
In software
- Collision shapes. Circle tests (is the distance between centres less than the sum of the radii?) are the cheapest collision checks in games (Circles and Spheres). An ellipse test is a circle test after scaling by and by .
- Ballistics. An aiming system solves the parabola of a projectile for the launch angle that hits a target.
- Ray tracing. A ray hitting a sphere, cylinder or paraboloid leads to a quadratic equation, the same algebra as conics (Ray–Sphere).
For conics in calculus and in polar form, see Conic Sections and Conics in Polar Coordinates.
Exercises
Exercise 1: Identify
Name the conic: (a) , (b) , (c) , (d) .
Answer
(a) circle, (b) hyperbola, (c) parabola, (d) ellipse.
Solution
Exercise 2: Complete the square
Find the centre and radius of .
Answer
Centre , radius 5.
Solution
Exercise 3: Ellipse facts
For , find the foci and the eccentricity.
Answer
Foci , .
Solution
Exercise 4: Point in an ellipse
Write a function inside(x, y, a, b) that returns True when lies inside or on the ellipse . Test it on , and with , .
Answer
True, False, True.
Solution
def inside(x, y, a, b):
return (x / a)**2 + (y / b)**2 <= 1
print(inside(3, 2, 5, 3), inside(4, 2, 5, 3), inside(0, 3, 5, 3))True False True
Test yourself
For the ellipse , where are the foci?
What are the asymptotes of ?
- There are none
Why are satellite dishes parabolic?
- Parabolas are the cheapest shape to build
- Incoming rays parallel to the axis all reflect through the focus
- A parabola has two foci
- It makes the dish lighter