Conic Sections
Parabolas, ellipses and hyperbolas are the curves you get by slicing a double cone with a plane. This lesson defines each one by distances to foci and directrices, derives the standard equations from those definitions, proves the reflection property of the parabola with calculus, and shows how to recognise a shifted conic from its equation.
For a first, gentler pass see Conic Sections in the survey course.
Geometric definitions
| Conic | Definition (set of points ) | Standard equation | Key numbers |
|---|---|---|---|
| Parabola | distance to focus = distance to directrix line | (focus , directrix ) | = focal distance |
| Ellipse | (constant) | , | foci , |
| Hyperbola | foci , , asymptotes |
Swapping and turns each into its vertical version ( opens right, opens up and down).
Deriving the equations
Parabola. With and directrix , the condition = distance to the line reads
Squaring is reversible here because both sides are non-negative.
Ellipse. With , and ():
The hyperbola goes the same way with replaced by , and since now the constant is positive, which is why it is called with a plus sign: .
Note: The eccentricity measures how stretched a conic is: is a circle, an ellipse, a hyperbola, and a parabola has . The next lesson, Conic Sections in Polar Coordinates, makes the single parameter that unifies all three.
import sympy as sp
x, y, c, a = sp.symbols("x y c a", positive=True)
d1 = sp.sqrt((x + c)**2 + y**2)
d2 = sp.sqrt((x - c)**2 + y**2)
# check the derived ellipse on a concrete case: a = 5, c = 3, so b = 4
pt_x = sp.Rational(5, 1) * sp.cos(sp.pi / 7) # a point on x²/25 + y²/16 = 1
pt_y = 4 * sp.sin(sp.pi / 7)
total = (d1 + d2).subs({x: pt_x, y: pt_y, c: 3})
print("PF1 + PF2 =", sp.nsimplify(sp.simplify(total)))
# hyperbola x²/9 − y²/16 = 1 has c = 5; check |PF1 − PF2| at a point on it
hx, hy = 3 * sp.cosh(1), 4 * sp.sinh(1)
diff = (d1 - d2).subs({x: hx, y: hy, c: 5})
print("|PF1 − PF2| =", sp.N(sp.Abs(diff), 12))PF1 + PF2 = 10
|PF1 − PF2| = 6.00000000000
For the ellipse and for the hyperbola , exactly as the definitions require.
The reflection property of the parabola
Claim. A ray travelling parallel to the axis of reflects off the parabola straight through the focus.
Proof. At with the slope is , so the tangent line meets the -axis at (substitute in and use ). Then
so triangle is isosceles and the angles at and are equal. The vertical incoming ray makes the same angle with the tangent as does (corresponding angles, since is vertical), so the angle of incidence equals the angle of reflection exactly when the reflected ray is . ∎
The ellipse has the analogous property (a ray from one focus reflects through the other) and the hyperbola reflects rays aimed at one focus toward the other. Satellite dishes, car headlights and whispering galleries use these facts.
Shifted conics and the general equation
Replacing by and by moves a conic's centre (or vertex) to . Expanding gives a general second-degree equation
To read it, complete the square in and . Without an term the type follows from the signs of and : same sign → ellipse (or a point / nothing), opposite signs → hyperbola (or a pair of lines), one of them zero → parabola. With an term , the discriminant decides: negative ellipse, zero parabola, positive hyperbola.
import sympy as sp
x, y = sp.symbols("x y")
expr = 4*x**2 + 9*y**2 - 16*x + 54*y + 61
# complete the square: 4(x² − 4x + 4) + 9(y² + 6y + 9) = −61 + 16 + 81
print("x-part:", sp.factor(4*x**2 - 16*x + 16), " y-part:", sp.factor(9*y**2 + 54*y + 81))
print("constant moved over:", -(61 - 16 - 81))
print("check:", sp.expand(4*(x - 2)**2 + 9*(y + 3)**2 - 36) == expr)
def classify(A, B, C):
d = B**2 - 4*A*C
return "ellipse" if d < 0 else ("parabola" if d == 0 else "hyperbola")
for coeffs in [(4, 0, 9), (1, 4, 1), (1, 2, 1), (3, 1, -2)]:
print(coeffs, classify(*coeffs))x-part: 4*(x - 2)**2 y-part: 9*(y + 3)**2
constant moved over: 36
check: True
(4, 0, 9) ellipse
(1, 4, 1) hyperbola
(1, 2, 1) parabola
(3, 1, -2) hyperbola
So is , i.e. : an ellipse centred at with , , . SymPy prints products as 4*(x - 2)**2.
In software
- Projectile arcs in games are parabolas: without drag, a thrown object's path is a parabola, and the focus/vertex form is handy for aiming (see Game Physics).
- Ellipse hit tests: a point is inside an axis-aligned ellipse iff , which is cheaper than any polygon test and is how UI toolkits test clicks on round buttons.
- Rendering: ellipses are drawn by stepping a parametric form ; signed-distance shaders approximate the ellipse SDF because the exact one needs a quartic.
- Positioning: hyperbolas are the curves of constant time difference between two receivers, the basis of TDOA localisation (old LORAN navigation, some indoor tracking systems).
Exercises
Exercise 1: Focus and directrix
Find the focus and directrix of .
Answer
Focus , directrix .
Solution
Exercise 2: Build an ellipse
Write the equation of the ellipse with foci and vertices , and give its eccentricity.
Answer
, .
Solution
Exercise 3: Identify a shifted conic
Identify : type, centre, , and asymptotes.
Answer
Hyperbola , centre , , , asymptotes .
Solution
import sympy as sp
x, y = sp.symbols("x y")
lhs = 9*(x - 2)**2 - 4*(y + 1)**2 - 36
print(sp.expand(lhs))9*x**2 - 36*x - 4*y**2 - 8*y - 4
Exercise 4: Reflection numerically
For the parabola (focus ), take . Reflect the downward direction about the tangent at in code and check that the reflected ray passes through the focus.
Answer
The reflected direction is , which from points straight at the focus .
Solution
Slope at : , so the unit tangent is and a normal is . Reflect with .
import numpy as np
P = np.array([4.0, 2.0]); F = np.array([0.0, 2.0])
d = np.array([0.0, -1.0])
n = np.array([1.0, -1.0]) / np.sqrt(2)
r = d - 2 * np.dot(d, n) * n
to_focus = (F - P) / np.linalg.norm(F - P)
print("reflected:", [round(float(v), 6) + 0.0 for v in r])
print("towards focus:", [round(float(v), 6) for v in to_focus])reflected: [-1.0, 0.0]
towards focus: [-1.0, 0.0]
Test yourself
For the ellipse , where are the foci?
Which relation holds for a hyperbola ?
The equation has . What is it?
- Hyperbola
- Ellipse
- Parabola
- Circle