Conic Sections
The conic sections are the curves you get by slicing a double cone with a plane: the circle, the ellipse, the parabola and the hyperbola. Each one is also the graph of an equation of degree two in and . They describe planetary orbits, thrown balls, satellite dishes and collision shapes in games.
Four curves from one cone
| Plane cuts the cone… | Curve |
|---|---|
| straight across, perpendicular to the axis | circle |
| at a tilt, through one half only | ellipse |
| parallel to a side of the cone | parabola |
| steeply, through both halves | hyperbola (two branches) |
Every conic is a solution set of a second-degree equation
and, when , its type can be read from and : same sign gives an ellipse (a circle if ), one of them zero gives a parabola, opposite signs give a hyperbola.
Standard forms
Centred at the origin (or with the vertex at the origin for a parabola):
| Conic | Equation | Key facts |
|---|---|---|
| Circle | radius | |
| Ellipse | () | semi-axes and , foci at with |
| Parabola | , or | focus , directrix |
| Hyperbola | foci at with , asymptotes |
To move the centre to , replace by and by , exactly as in Graph Transformations.
Completing the square turns a general equation into standard form:
Focus and eccentricity
Each conic has a geometric definition through its foci:
- Ellipse: the sum of the distances to the two foci is constant (). Tie a loop of string around two pins and trace with a pencil.
- Hyperbola: the difference of the distances to the two foci is constant ().
- Parabola: the distance to the focus equals the distance to the directrix line.
The eccentricity measures how stretched a conic is: for ellipses and hyperbolas.
| Curve | |
|---|---|
| 0 | circle |
| ellipse | |
| 1 | parabola |
| hyperbola |
import math
a, b = 5.0, 3.0
c = math.sqrt(a**2 - b**2)
print(f"ellipse a = {a}, b = {b}: c = {c}, e = {c / a}")
for t in [0.0, 0.7, 1.9, 3.0, 4.4]:
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}")ellipse a = 5.0, b = 3.0: c = 4.0, e = 0.8
point ( 5.000, 0.000): d1 + d2 = 10.000000
point ( 3.824, 1.933): d1 + d2 = 10.000000
point (-1.616, 2.839): d1 + d2 = 10.000000
point (-4.950, 0.423): d1 + d2 = 10.000000
point (-1.537, -2.855): d1 + d2 = 10.000000
The points were generated with the parametric form , the easiest way to draw an ellipse in code. Every one of them has the same distance sum .
Drawing all four
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0, 2 * np.pi, 400)
s = np.linspace(-1.5, 1.5, 200)
plt.figure(figsize=(6, 4))
plt.plot(2 * np.cos(t), 2 * np.sin(t), label="circle x² + y² = 4")
plt.plot(4 * np.cos(t), 2 * np.sin(t), label="ellipse x²/16 + y²/4 = 1")
xp = np.linspace(-4, 4, 200)
plt.plot(xp, xp**2 / 4 - 3, label="parabola y = x²/4 − 3")
plt.plot(np.cosh(s), np.sinh(s) * 2, "C3", label="hyperbola x² − y²/4 = 1")
plt.plot(-np.cosh(s), np.sinh(s) * 2, "C3")
plt.gca().set_aspect("equal"); plt.xlim(-5, 5); plt.ylim(-4, 4)
plt.grid(alpha=0.3); plt.legend(fontsize=7, loc="lower right")
plt.title("The four conic sections")
x, y = np.cosh(1.2), 2 * np.sinh(1.2)
print("hyperbola point check:", round(x**2 - y**2 / 4, 10))hyperbola point check: 1.0
The hyperbola is drawn with , using the identity from Hyperbolic Functions.
In software
- Orbits: planets, moons and satellites move on ellipses with the central body at one focus (Kepler's first law). Earth's orbit has , nearly a circle; a comet on an escape path follows a parabola or a hyperbola. Orbit simulators and space games use these formulas directly.
- Projectiles: without air resistance, a thrown object follows a parabola, .
- Collision tests: a point is inside an axis-aligned ellipse with centre when . That is one line of code, much cheaper than a polygon test, and is used for elliptical hitboxes and selection areas (Circles and Spheres).
- Optics and antennas: a parabolic mirror sends every ray arriving parallel to its axis to the focus, which is why satellite dishes and car headlights are parabolic. An ellipse reflects rays from one focus to the other.
- GPS-style positioning: a fixed difference in arrival time of a signal at two receivers places the source on a hyperbola.
def in_ellipse(px, py, h, k, a, b):
return (px - h)**2 / a**2 + (py - k)**2 / b**2 <= 1
hitbox = dict(h=10, k=5, a=4, b=2) # a wide, flat enemy
for p in [(10, 5), (13.5, 5), (13, 6.5), (10, 7.5)]:
print(p, "hit" if in_ellipse(*p, **hitbox) else "miss")(10, 5) hit
(13.5, 5) hit
(13, 6.5) miss
(10, 7.5) miss
For : , just outside.
Exercises
Exercise 1: Identify the conic
Name each curve: (a) , (b) , (c) , (d) .
Answer
(a) ellipse, (b) hyperbola, (c) circle, (d) parabola.
Solution
- (a) Both squared terms positive with different coefficients: ellipse, .
- (b) Opposite signs: a hyperbola opening up and down.
- (c) Equal coefficients: completing the square gives , a circle with centre and radius 5.
- (d) Only is squared: a parabola.
Exercise 2: Foci of an ellipse
Find the foci and the eccentricity of .
Answer
Foci , .
Solution
Exercise 3: Complete the square
Put into standard form and give the centre and radius.
Answer
: centre , radius 4.
Solution
import sympy as sp
x, y = sp.symbols('x y')
lhs = x**2 + y**2 + 4*x - 6*y - 3
print(sp.expand((x + 2)**2 + (y - 3)**2 - 16 - lhs))0
Exercise 4: Parabola focus
A satellite dish has the cross-section (in cm). How far above the vertex should the receiver sit?
Answer
30 cm, at the focus .
Solution
Compare with : , so . The focus is at .
Exercise 5: Ellipse–point test with a rotated ellipse
An ellipse centred at the origin with semi-axes , is rotated 30° counterclockwise. Is the point inside? (Rotate the point by −30° first, then use the axis-aligned test.)
Answer
Yes; after rotating, the point is and the test value is about 0.7739, which is .
Solution
Rotating the point by −30° puts it in the ellipse's own coordinate frame:
import math
px, py = 2, 1.5
t = math.radians(-30)
u = px * math.cos(t) - py * math.sin(t)
v = px * math.sin(t) + py * math.cos(t)
value = u**2 / 3**2 + v**2 / 1**2
print(round(u, 4), round(v, 4), round(value, 4), value <= 1)2.4821 0.299 0.7739 True
Test yourself
Which conic has eccentricity exactly 1?
- Circle
- Ellipse
- Parabola
- Hyperbola
For the ellipse with , where are the foci?
In which shape do planets orbit the Sun, according to Kepler's first law?
- A circle with the Sun at the centre
- An ellipse with the Sun at one focus
- A parabola
- An ellipse with the Sun at the centre