9. Limits and continuity in two variables, and why paths matter

📖 Reading · 11 min
💡 Every code box below is live — edit it and hit Run.

§1.9's \varepsilon-\delta definition let x approach a from exactly two directions — the left and the right. A point (x,y) approaching (a,b) in the plane can come from infinitely many directions at once — straight lines at any angle, spirals, parabolic paths, anything. This lesson shows why that difference is not cosmetic: it makes proving a two-variable limit exists genuinely harder, and gives a function with no one-variable analogue — one that behaves perfectly well along every straight line through a point, yet still has no limit there at all.

The definition, generalized

\lim_{(x,y)\to(a,b)}f(x,y)=L

means: for every \varepsilon>0, there is a \delta>0 such that |f(x,y)-L|<\varepsilon whenever (x,y) is within distance \delta of (a,b) (using §9.0's distance formula) — regardless of the direction or path taken to get there. This is §1.9's definition verbatim, with "within \delta of a" replaced by "within \delta of (a,b)" using ordinary distance in the plane instead of distance on a line.

The consequence that matters in practice: if f(x,y) approaches different values along two different paths toward (a,b), the limit does not exist — because a single L would need to match every path simultaneously, and it can't match two different values at once.

A limit that fails along straight lines

f(x,y)=\frac{xy}{x^2+y^2}

Along the path y=0 (the x-axis): f(x,0)=\dfrac{0}{x^2}=0 for every x\ne0, so the limit along this path is 0.

Along the path y=x: f(x,x)=\dfrac{x^2}{2x^2}=\dfrac12 for every x\ne0 — the limit along this path is \dfrac12.

Two different paths, two different limiting values0\ne\dfrac12 — so \displaystyle\lim_{(x,y)\to(0,0)}f(x,y) does not exist, even though f looks perfectly smooth and well-defined at every point except the origin. Checking along the general line y=mx makes the whole picture visible at once: f(x,mx)=\dfrac{m}{m^2+1}, a value that genuinely depends on the slope m — the function approaches a different number depending on which direction you walk in.

A subtler trap: agreeing on every line still isn't enough

g(x,y)=\frac{x^2y}{x^4+y^2}

Along every straight line y=mx:

g(x,mx)=\frac{x^2(mx)}{x^4+m^2x^2}=\frac{mx^3}{x^2(x^2+m^2)}=\frac{mx}{x^2+m^2}\ \xrightarrow{x\to0}\ 0

for every slope m — every straight-line path gives the same limit, 0. It's tempting to conclude the limit is 0. But try the curved path y=x^2:

g(x,x^2)=\frac{x^2\cdot x^2}{x^4+x^4}=\frac{x^4}{2x^4}=\frac12

— a different value, \frac12\ne0, along this parabolic path.

\boxed{\lim_{(x,y)\to(0,0)}g(x,y)\text{ does not exist}}

This is the essential warning of the lesson: checking every straight line is never sufficient to prove a two-variable limit exists — there are always more paths (parabolas, cubics, spirals, anything) that straight-line checking can miss entirely. Path-checking is a powerful tool for disproving a limit (one disagreeing path is all it takes), but it can never prove one, no matter how many paths agree.

Proving a limit exists: the squeeze theorem, two variables up

Since path-checking can't prove existence, proving a two-variable limit exists usually needs a direct bound — §1.3's Squeeze Theorem, generalized. For h(x,y)=\dfrac{x^2y}{x^2+y^2}:

|h(x,y)|=\frac{x^2}{x^2+y^2}\cdot|y|\le1\cdot|y|=|y|

since \dfrac{x^2}{x^2+y^2}\le1 always (the numerator is part of the denominator's sum, §0.1-level algebra). As (x,y)\to(0,0), |y|\to0, so by the squeeze theorem h(x,y)\to0 — a genuine proof, valid along every possible path at once, because the bound |y| never depended on which direction (x,y) approached from.

Continuity

f is continuous at (a,b) if \displaystyle\lim_{(x,y)\to(a,b)}f(x,y)=f(a,b) — the identical definition from §1.7, now requiring the limit (which itself requires path-independence) to match the function's actual value there.

Doing it in Python

Confirming the path-dependent limit of f(x,y)=\dfrac{xy}{x^2+y^2} along several lines:

import sympy as sp

x, m = sp.symbols('x m')
y = m * x
f = (x * y) / (x**2 + y**2)

limit_along_line = sp.limit(f, x, 0)
print(f"limit along y=mx, as a function of slope m: {sp.simplify(limit_along_line)}")
for m_val in (0, 1, 2, -1):
    print(f"  m={m_val}: limit = {limit_along_line.subs(m, m_val)}")
print("\ndifferent slopes give different limits -- the limit does not exist")

The subtler trap: every straight line agrees, but a parabola disagrees:

import sympy as sp

x, y, m = sp.symbols('x y m')
g = (x**2 * y) / (x**4 + y**2)

line_limit = sp.limit(g.subs(y, m*x), x, 0)
print(f"along y=mx (any slope m): limit = {line_limit}")

parabola_limit = sp.limit(g.subs(y, x**2), x, 0)
print(f"along y=x^2:              limit = {parabola_limit}")
print("\nall lines agree at 0, but the parabola disagrees -- limit does not exist")

Confirming a genuine limit with the squeeze theorem, by bounding |h(x,y)|\le|y| numerically as (x,y)\to(0,0) along a spiraling path:

import math

def h(x, y):
    return x**2 * y / (x**2 + y**2)

print(f"{'r':>8} {'h(x,y)':>12} {'bound |y|':>12}")
for n in range(1, 6):
    r = 1 / 2**n
    x, y = r * math.cos(n), r * math.sin(n)   # a spiral, shrinking and rotating
    print(f"{r:>8.4f} {h(x,y):>12.6f} {abs(y):>12.6f}")
print("\nh(x,y) always stays within the shrinking bound |y| -- consistent with limit 0")

Worked example

Determine whether \displaystyle\lim_{(x,y)\to(0,0)}\dfrac{x^2-y^2}{x^2+y^2} exists.

Along y=0: \dfrac{x^2-0}{x^2+0}=\dfrac{x^2}{x^2}=1 for x\ne0 — limit along this path is 1.

Along x=0: \dfrac{0-y^2}{0+y^2}=\dfrac{-y^2}{y^2}=-1 for y\ne0 — limit along this path is -1.

1\ne-1

\boxed{\text{limit does not exist}}

Sanity check. This function is actually independent of distance from the origin along each ray — check y=mx: \dfrac{x^2-m^2x^2}{x^2+m^2x^2}=\dfrac{1-m^2}{1+m^2}, a value depending only on the slope m, never on x itself. Every ray through the origin gives a constant value all along that ray, and different rays give different constants (m=0 gives 1, as m\to\infty the value \to-1) — a strong visual confirmation that no single limiting value could possibly work for every direction simultaneously. ✓

Your turn

1. Determine whether \displaystyle\lim_{(x,y)\to(0,0)}\dfrac{x^3}{x^2+y^2} exists, using the squeeze theorem (bound |f(x,y)| by something that \to0, independent of direction).

2. Show that \displaystyle\lim_{(x,y)\to(0,0)}\dfrac{x^2-y^2}{x^2+y^2} also fails along the specific line y=x (a second confirmation beyond the worked example's x=0/y=0 pair).

3. True or false: if a two-variable limit agrees along every straight line through the point, the limit exists.

Solutions

1. |f(x,y)|=\dfrac{|x|^3}{x^2+y^2}=|x|\cdot\dfrac{x^2}{x^2+y^2}\le|x|\cdot1=|x|, using the same \dfrac{x^2}{x^2+y^2}\le1 bound as the concept section. As (x,y)\to(0,0), |x|\to0, so by the squeeze theorem, \boxed{\text{the limit is }0} — and this is a genuine proof, valid along every path, not just a check of a few.

2. Along y=x: \dfrac{x^2-x^2}{x^2+x^2}=\dfrac0{2x^2}=0 for x\ne0 — a third distinct value (0, different from both 1 and -1 found along the axes), reinforcing that this function takes a different constant value along every distinct direction through the origin, consistent with the \frac{1-m^2}{1+m^2} pattern from the worked example's sanity check (at m=1: \frac{1-1}{1+1}=0, matching exactly).

3. False. This is precisely the trap illustrated by g(x,y)=\dfrac{x^2y}{x^4+y^2} in the concept section: every straight line y=mx gave the same limit 0, and yet the true limit does not exist, because the curved path y=x^2 disagreed. Agreement along all lines is necessary but never sufficient for a two-variable limit to exist.

Check yourself in code

For f(x,y)=\dfrac{xy}{x^2+y^2}, compute the limit as x\to0 along the line y=mx, as a function of the slope m, and evaluate it at m=0 and m=1.

Print exactly this:

limit along y=m*x = m/(m**2 + 1)
at m=0: 0
at m=1: 1/2
import sympy as sp

x, m = sp.symbols('x m')
y = m * x
f = (x * y) / (x**2 + y**2)

limit_expr = sp.simplify(sp.limit(f, x, 0))
print("limit along y=m*x = ...")
print("at m=0: ...")
print("at m=1: ...")
import sympy as sp

x, m = sp.symbols('x m')
y = m * x
f = (x * y) / (x**2 + y**2)

limit_expr = sp.simplify(sp.limit(f, x, 0))
print(f"limit along y=m*x = {limit_expr}")
print(f"at m=0: {limit_expr.subs(m, 0)}")
print(f"at m=1: {limit_expr.subs(m, 1)}")

A two-variable limit must agree along every possible path of approach, not just the two directions a one-variable limit had to worry about — and because there are infinitely many paths, checking straight lines can disprove a limit (one disagreement is enough) but can never prove one, even when every line agrees, as \dfrac{x^2y}{x^4+y^2}'s parabolic counterexample shows. Proving existence instead needs a direct bound, the Squeeze Theorem from §1.3 generalized to two dimensions, using an inequality that holds regardless of direction.

Next: differentiating a function of several variables — starting by freezing all but one variable at a time, the most direct way to reuse every derivative rule already built in Module 2.