TExcelTAD
Home › Calculus in Depth › Conic Sections

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 PP) Standard equation Key numbers
Parabola distance to focus FF = distance to directrix line x2=4pyx^2 = 4py (focus (0,p)(0, p), directrix y=−py = -p) pp = focal distance
Ellipse PF1+PF2=2aPF_1 + PF_2 = 2a (constant) x2a2+y2b2=1\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1, a≥b>0a \ge b > 0 foci (±c,0)(\pm c, 0), c2=a2−b2c^2 = a^2 - b^2
Hyperbola ∣PF1−PF2∣=2a\lvert PF_1 - PF_2 \rvert = 2a x2a2−y2b2=1\frac{x^2}{a^2} - \frac{y^2}{b^2} = 1 foci (±c,0)(\pm c, 0), c2=a2+b2c^2 = a^2 + b^2, asymptotes y=±baxy = \pm\frac{b}{a}x

Swapping xx and yy turns each into its vertical version (y2=4pxy^2 = 4px opens right, y2a2−x2b2=1\frac{y^2}{a^2} - \frac{x^2}{b^2} = 1 opens up and down).

Deriving the equations

Parabola. With F=(0,p)F = (0, p) and directrix y=−py = -p, the condition PFPF = distance to the line reads

x2+(y−p)2=∣y+p∣x2+y2−2py+p2=y2+2py+p2x2=4py\begin{aligned} \sqrt{x^2 + (y - p)^2} &= \lvert y + p \rvert \\ x^2 + y^2 - 2py + p^2 &= y^2 + 2py + p^2 \\ x^2 &= 4py \end{aligned}

Squaring is reversible here because both sides are non-negative.

Ellipse. With F1=(−c,0)F_1 = (-c, 0), F2=(c,0)F_2 = (c, 0) and PF1+PF2=2aPF_1 + PF_2 = 2a (a>ca > c):

(x+c)2+y2=2a−(x−c)2+y2square, cancel:a(x−c)2+y2=a2−cxsquare again:(a2−c2)x2+a2y2=a2(a2−c2)put b2=a2−c2:x2a2+y2b2=1\begin{aligned} && \sqrt{(x + c)^2 + y^2} &= 2a - \sqrt{(x - c)^2 + y^2} \\ &\text{square, cancel:} & a\sqrt{(x - c)^2 + y^2} &= a^2 - cx \\ &\text{square again:} & (a^2 - c^2)x^2 + a^2y^2 &= a^2(a^2 - c^2) \\ &\text{put } b^2 = a^2 - c^2{:} & \frac{x^2}{a^2} + \frac{y^2}{b^2} &= 1 \end{aligned}

The hyperbola goes the same way with 2a2a replaced by ±2a\pm 2a, and since now c>ac > a the constant c2−a2c^2 - a^2 is positive, which is why it is called b2b^2 with a plus sign: c2=a2+b2c^2 = a^2 + b^2.

Note: The eccentricity e=c/ae = c/a measures how stretched a conic is: e=0e = 0 is a circle, 0<e<10 < e < 1 an ellipse, e>1e > 1 a hyperbola, and a parabola has e=1e = 1. The next lesson, Conic Sections in Polar Coordinates, makes ee the single parameter that unifies all three.

python · try it yourself
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 2a=102a = 10 and for the hyperbola 2a=62a = 6, exactly as the definitions require.

The reflection property of the parabola

Claim. A ray travelling parallel to the axis of x2=4pyx^2 = 4py reflects off the parabola straight through the focus.

Proof. At P=(x0,y0)P = (x_0, y_0) with x0≠0x_0 \ne 0 the slope is y′=x0/(2p)y' = x_0/(2p), so the tangent line meets the yy-axis at T=(0,−y0)T = (0, -y_0) (substitute x=0x = 0 in y−y0=x02p(x−x0)y - y_0 = \frac{x_0}{2p}(x - x_0) and use x02=4py0x_0^2 = 4py_0). Then

FT=p+y0,FP=x02+(y0−p)2=4py0+y02−2py0+p2=y0+pFT = p + y_0, \qquad FP = \sqrt{x_0^2 + (y_0 - p)^2} = \sqrt{4py_0 + y_0^2 - 2py_0 + p^2} = y_0 + p

so triangle FPTFPT is isosceles and the angles at TT and PP are equal. The vertical incoming ray makes the same angle with the tangent as TFTF does (corresponding angles, since TFTF is vertical), so the angle of incidence equals the angle of reflection exactly when the reflected ray is PFPF. ∎

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 xx by x−hx - h and yy by y−ky - k moves a conic's centre (or vertex) to (h,k)(h, k). Expanding gives a general second-degree equation

Ax2+Cy2+Dx+Ey+F=0(no xy term)Ax^2 + Cy^2 + Dx + Ey + F = 0 \qquad (\text{no } xy \text{ term})

To read it, complete the square in xx and yy. Without an xyxy term the type follows from the signs of AA and CC: same sign → ellipse (or a point / nothing), opposite signs → hyperbola (or a pair of lines), one of them zero → parabola. With an xyxy term BxyBxy, the discriminant B2−4ACB^2 - 4AC decides: negative ellipse, zero parabola, positive hyperbola.

python · try it yourself
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 4x2+9y2−16x+54y+61=04x^2 + 9y^2 - 16x + 54y + 61 = 0 is 4(x−2)2+9(y+3)2=364(x - 2)^2 + 9(y + 3)^2 = 36, i.e. (x−2)29+(y+3)24=1\frac{(x - 2)^2}{9} + \frac{(y + 3)^2}{4} = 1: an ellipse centred at (2,−3)(2, -3) with a=3a = 3, b=2b = 2, c=5c = \sqrt{5}. SymPy prints products as 4*(x - 2)**2.

In software

  • Projectile arcs in games are parabolas: without drag, a thrown object's path y=y0+xtan⁡θ−gx22v2cos⁡2θy = y_0 + x\tan\theta - \frac{gx^2}{2v^2\cos^2\theta} 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 (x−h)2a2+(y−k)2b2≤1\frac{(x - h)^2}{a^2} + \frac{(y - k)^2}{b^2} \le 1, 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 (acos⁡t,bsin⁡t)(a\cos t, b\sin t); 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 y2=−12xy^2 = -12x.

Answer

Focus (−3,0)(-3, 0), directrix x=3x = 3.

Solution
y2=4px with 4p=−12, so p=−3: the parabola opens to the leftfocus (p,0)=(−3,0),directrix x=−p=3\begin{aligned} &y^2 = 4px \text{ with } 4p = -12, \text{ so } p = -3\text{: the parabola opens to the left} \\ &\text{focus } (p, 0) = (-3, 0), \qquad \text{directrix } x = -p = 3 \end{aligned}

Exercise 2: Build an ellipse

Write the equation of the ellipse with foci (0,±4)(0, \pm 4) and vertices (0,±5)(0, \pm 5), and give its eccentricity.

Answer

x29+y225=1\frac{x^2}{9} + \frac{y^2}{25} = 1, e=0.8e = 0.8.

Solution
vertical major axis: a=5, c=4, b2=a2−c2=9x2b2+y2a2=1  →  x29+y225=1,e=c/a=4/5\begin{aligned} &\text{vertical major axis: } a = 5,\ c = 4,\ b^2 = a^2 - c^2 = 9 \\ &\frac{x^2}{b^2} + \frac{y^2}{a^2} = 1 \;\to\; \frac{x^2}{9} + \frac{y^2}{25} = 1, \qquad e = c/a = 4/5 \end{aligned}

Exercise 3: Identify a shifted conic

Identify 9x2−4y2−36x−8y−4=09x^2 - 4y^2 - 36x - 8y - 4 = 0: type, centre, aa, bb and asymptotes.

Answer

Hyperbola (x−2)24−(y+1)29=1\frac{(x - 2)^2}{4} - \frac{(y + 1)^2}{9} = 1, centre (2,−1)(2, -1), a=2a = 2, b=3b = 3, asymptotes y+1=±32(x−2)y + 1 = \pm\frac{3}{2}(x - 2).

Solution
9(x2−4x+4)−4(y2+2y+1)=4+36−4=369(x−2)2−4(y+1)2=36  →  (x−2)24−(y+1)29=1\begin{aligned} 9(x^2 - 4x + 4) - 4(y^2 + 2y + 1) &= 4 + 36 - 4 = 36 \\ 9(x - 2)^2 - 4(y + 1)^2 &= 36 \;\to\; \frac{(x - 2)^2}{4} - \frac{(y + 1)^2}{9} = 1 \end{aligned}
python · try it yourself
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 x2=8yx^2 = 8y (focus (0,2)(0, 2)), take P=(4,2)P = (4, 2). Reflect the downward direction (0,−1)(0, -1) about the tangent at PP in code and check that the reflected ray passes through the focus.

Answer

The reflected direction is (−1,0)(-1, 0), which from P=(4,2)P = (4, 2) points straight at the focus (0,2)(0, 2).

Solution

Slope at PP: y′=x/4=1y' = x/4 = 1, so the unit tangent is (1,1)/2(1, 1)/\sqrt{2} and a normal is n=(1,−1)/2n = (1, -1)/\sqrt{2}. Reflect with r=d−2(d⋅n)nr = d - 2(d \cdot n)n.

python · try it yourself
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 x225+y29=1\frac{x^2}{25} + \frac{y^2}{9} = 1, where are the foci?

  1. (±3,0)(\pm 3, 0)
  2. (±5,0)(\pm 5, 0)
  3. (±4,0)(\pm 4, 0)
  4. (0,±4)(0, \pm 4)

Which relation holds for a hyperbola x2a2−y2b2=1\frac{x^2}{a^2} - \frac{y^2}{b^2} = 1?

  1. c2=a2−b2c^2 = a^2 - b^2
  2. c2=a2+b2c^2 = a^2 + b^2
  3. c=a+bc = a + b
  4. c=abc = ab

The equation x2+4xy+y2=1x^2 + 4xy + y^2 = 1 has B2−4AC=12B^2 - 4AC = 12. What is it?

  1. Hyperbola
  2. Ellipse
  3. Parabola
  4. Circle