TExcelTAD
Home › Calculus in Depth › Limits and Continuity

Limits and Continuity

In one variable, xx can approach aa only from the left or the right. In the plane, (x,y)(x, y) can approach (a,b)(a, b) along infinitely many paths, straight or curved, and a limit exists only if every one of them leads to the same value. This lesson gives the ε\varepsilon-δ\delta definition, the path test for proving that a limit does not exist, the squeeze and polar tricks for proving that one does, and the meaning of continuity.

It builds on the one-variable precise definition of a limit; the survey version of limits is in Limits.

The definition

Let ff be defined on a set DD that contains points arbitrarily close to (a,b)(a, b). We write

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

if for every ε>0\varepsilon > 0 there is a δ>0\delta > 0 such that

(x,y)∈Dand0<(x−a)2+(y−b)2<δ⟹∣f(x,y)−L∣<ε(x, y) \in D \quad \text{and} \quad 0 < \sqrt{(x - a)^2 + (y - b)^2} < \delta \quad \Longrightarrow \quad \lvert f(x, y) - L \rvert < \varepsilon

The only change from one variable is that the distance ∣x−a∣\lvert x - a \rvert becomes the Euclidean distance in the plane. "Close to (a,b)(a, b)" now means "inside a small disk around (a,b)(a, b)", and the disk contains points from every direction.

The usual limit laws (sum, product, quotient with non-zero denominator limit, composition with a continuous function) carry over with the same proofs, and so do lim⁡x=a\lim x = a and lim⁡y=b\lim y = b. Together they give limits of polynomials and rational functions by plugging in, wherever the denominator is not zero.

Proving that a limit does not exist: two paths

If f(x,y)→L1f(x, y) \to L_1 along one path to (a,b)(a, b) and f(x,y)→L2f(x, y) \to L_2 along another, with L1≠L2L_1 \ne L_2, then the limit does not exist. (If it existed and equalled LL, every path would give LL.)

Example 1. f(x,y)=(x2−y2)/(x2+y2)f(x, y) = (x^2 - y^2)/(x^2 + y^2) at (0,0)(0, 0). On the xx-axis (y=0y = 0) f=1f = 1; on the yy-axis f=−1f = -1. No limit.

Example 2. f(x,y)=2xy/(x2+y2)f(x, y) = 2xy/(x^2 + y^2). Along every axis f=0f = 0, but along y=mxy = mx

f(x,mx)=2mx2(1+m2)x2=2m1+m2f(x, mx) = \frac{2mx^2}{(1 + m^2)x^2} = \frac{2m}{1 + m^2}

which depends on mm (m=1m = 1 gives 1, m=0m = 0 gives 0). No limit.

Example 3: lines are not enough. f(x,y)=x2y/(x4+y2)f(x, y) = x^2y/(x^4 + y^2). Along y=mxy = mx, f=mx3/(x4+m2x2)=mx/(x2+m2)→0f = mx^3/(x^4 + m^2x^2) = mx/(x^2 + m^2) \to 0 for every mm (and f=0f = 0 on the yy-axis). Yet along the parabola y=x2y = x^2,

f(x,x2)=x4x4+x4=12f(x, x^2) = \frac{x^4}{x^4 + x^4} = \frac{1}{2}

so the limit does not exist. Agreement along all straight lines proves nothing.

python · try it yourself
import numpy as np

f = lambda x, y: x**2 * y / (x**4 + y**2)
t = np.array([1e-1, 1e-2, 1e-3, 1e-4])

print("t        along y=x     along y=3x    along y=x^2")
for s in t:
    print(f"{s:.0e}   {f(s, s):11.6f}  {f(s, 3*s):11.6f}  {f(s, s**2):11.6f}")
t        along y=x     along y=3x    along y=x^2
1e-01      0.099010     0.033296     0.500000
1e-02      0.009999     0.003333     0.500000
1e-03      0.001000     0.000333     0.500000
1e-04      0.000100     0.000033     0.500000

Numerically this is the trap: if you sample only along lines, ff looks like it tends to 0.

Proving that a limit exists: squeeze and polar coordinates

Paths can only disprove. To prove a limit, bound ∣f(x,y)−L∣\lvert f(x, y) - L \rvert by something that depends only on the distance r=x2+y2r = \sqrt{x^2 + y^2} and goes to 0.

Example 4. f(x,y)=3x2y/(x2+y2)f(x, y) = 3x^2y/(x^2 + y^2) at (0,0)(0, 0). Since x2≤x2+y2x^2 \le x^2 + y^2,

∣f(x,y)−0∣=3∣y∣⋅x2x2+y2≤3∣y∣≤3x2+y2\lvert f(x, y) - 0 \rvert = 3\lvert y \rvert \cdot \frac{x^2}{x^2 + y^2} \le 3\lvert y \rvert \le 3\sqrt{x^2 + y^2}

Given ε\varepsilon, choose δ=ε/3\delta = \varepsilon/3: if 0<r<δ0 < r < \delta then ∣f∣≤3r<ε\lvert f \rvert \le 3r < \varepsilon. So the limit is 0. This is a complete ε\varepsilon-δ\delta proof.

Polar trick. Put x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\theta. If ∣f−L∣≤g(r)\lvert f - L \rvert \le g(r) with g(r)→0g(r) \to 0 and the bound does not depend on θ\theta, the limit is LL. For Example 4, f=3rcos⁡2θsin⁡θf = 3r\cos^2\theta \sin\theta, so ∣f∣≤3r\lvert f \rvert \le 3r. For Example 2, f=2cos⁡θsin⁡θ=sin⁡2θf = 2\cos\theta \sin\theta = \sin 2\theta: no rr is left over, and the value depends on the direction θ\theta, confirming that there is no limit.

Note: The polar test needs a bound uniform in θ\theta. In Example 3 polar form gives f=rcos⁡2θsin⁡θ/(r2cos⁡4θ+sin⁡2θ)f = r\cos^2\theta \sin\theta/(r^2\cos^4\theta + \sin^2\theta): for each fixed θ\theta this goes to 0, but near θ=0\theta = 0 the denominator can be tiny, and no single g(r)g(r) bounds it. That is exactly the parabola path.

python · try it yourself
import sympy as sp

x, y, r, th = sp.symbols("x y r theta", real=True)
f = 3 * x**2 * y / (x**2 + y**2)
polar = sp.simplify(f.subs({x: r * sp.cos(th), y: r * sp.sin(th)}))
print("polar form:", polar)
print("limit r->0:", sp.limit(polar, r, 0))

g = 2 * x * y / (x**2 + y**2)
print("2xy/(x^2+y^2) in polar:", sp.simplify(g.subs({x: r * sp.cos(th), y: r * sp.sin(th)})))
polar form: 3*r*sin(theta)*cos(theta)**2
limit r->0: 0
2xy/(x^2+y^2) in polar: sin(2*theta)

Continuity

ff is continuous at (a,b)(a, b) if lim⁡f(x,y)\lim f(x, y) as (x,y)→(a,b)(x, y) \to (a, b) equals f(a,b)f(a, b) (so in particular f(a,b)f(a, b) is defined and the limit exists). ff is continuous on DD if it is continuous at every point of DD.

Polynomials are continuous on R2\mathbb{R}^2; rational functions are continuous wherever the denominator is non-zero; and a composition h(g(x,y))h(g(x, y)) is continuous where gg is continuous and hh is continuous at g(x,y)g(x, y). So exysin⁡(x+y2)e^{xy}\sin(x + y^2) and ln⁡(1+x2+y2)\ln(1 + x^2 + y^2) are continuous everywhere, and arctan⁡(y/x)\arctan(y/x) is continuous off the line x=0x = 0.

A removable discontinuity can be repaired: define F(x,y)=3x2y/(x2+y2)F(x, y) = 3x^2y/(x^2 + y^2) for (x,y)≠(0,0)(x, y) \ne (0, 0) and F(0,0)=0F(0, 0) = 0; by Example 4 FF is continuous on R2\mathbb{R}^2. No value at (0,0)(0, 0) can repair Example 2.

Everything extends to three or more variables: replace the disk by a ball, (x−a)2+(y−b)2+(z−c)2<δ\sqrt{(x - a)^2 + (y - b)^2 + (z - c)^2} < \delta.

In software

  • Numerical code near singular points. Expressions like xy/(x2+y2)xy/(x^2 + y^2) appear in normalised vectors, angles, and polar conversions. Even when a limit exists, evaluating at exactly (0,0)(0, 0) gives 0/0=NaN0/0 = \text{NaN} in floating point, so libraries special-case it (atan2(0, 0) returns 0 by convention, and np.linalg.norm guarded normalisation adds a small ε\varepsilon to the denominator).
  • Direction-dependent limits are a real bug source. A function like (x2−y2)/(x2+y2)(x^2 - y^2)/(x^2 + y^2) jumps between −1-1 and 1 near the origin depending on the approach direction, so a shader or physics routine that uses it will flicker for tiny inputs. Recognising "no limit" tells you the special case cannot be fixed by picking a value.
  • Testing by sampling has blind spots. The parabola example shows why random or grid-line probing can miss behaviour; property-based tests that try curved paths, or symbolic checks, catch more.

Exercises

Exercise 1: Two paths

Show that lim⁡(x+y)2/(x2+y2)\lim (x + y)^2/(x^2 + y^2) as (x,y)→(0,0)(x, y) \to (0, 0) does not exist.

Answer

Along y=0y = 0 the value is 1; along y=xy = x it is 2. Different, so no limit.

Solution
y=0:x2/x2=1y=x:(2x)2/(2x2)=4x2/2x2=2\begin{aligned} y = 0\text{:} &\quad x^2 / x^2 = 1 \\ y = x\text{:} &\quad (2x)^2 / (2x^2) = 4x^2 / 2x^2 = 2 \end{aligned}

Exercise 2: Squeeze

Prove that lim⁡xy2/(x2+y2)\lim xy^2/(x^2 + y^2) as (x,y)→(0,0)(x, y) \to (0, 0) equals 0, and give a δ\delta that works for ε\varepsilon.

Answer

∣f∣≤∣x∣≤r\lvert f \rvert \le \lvert x \rvert \le r, so δ=ε\delta = \varepsilon works.

Solution
y2≤x2+y2⟹∣xy2/(x2+y2)∣≤∣x∣≤x2+y2=r0<r<δ=ε⟹∣f(x,y)−0∣<ε\begin{aligned} y^2 \le x^2 + y^2 &\quad \Longrightarrow \quad \lvert xy^2/(x^2 + y^2) \rvert \le \lvert x \rvert \le \sqrt{x^2 + y^2} = r \\ 0 < r < \delta = \varepsilon &\quad \Longrightarrow \quad \lvert f(x, y) - 0 \rvert < \varepsilon \end{aligned}

Exercise 3: A curved path

For f(x,y)=xy2/(x2+y4)f(x, y) = xy^2 / (x^2 + y^4), compute the limit along every line y=mxy = mx and along x=y2x = y^2. What do you conclude?

Answer

0 along every line (and the yy-axis), but 1/21/2 along x=y2x = y^2, so the limit does not exist.

Solution
y=mx:m2x3/(x2+m4x4)=m2x/(1+m4x2)→0x=0:0x=y2:y4/(y4+y4)=1/2\begin{aligned} y = mx\text{:} &\quad m^2x^3 / (x^2 + m^4x^4) = m^2x / (1 + m^4x^2) \to 0 \\ x = 0\text{:} &\quad 0 \\ x = y^2\text{:} &\quad y^4 / (y^4 + y^4) = 1/2 \end{aligned}

Exercise 4: Where is it continuous?

Where is g(x,y)=ln⁡(x−y)/(1−x2−y2)g(x, y) = \ln(x - y) / (1 - x^2 - y^2) continuous?

Answer

On the set of points with y<xy < x that are not on the unit circle x2+y2=1x^2 + y^2 = 1.

Solution

ln⁡(x−y)\ln(x - y) is continuous where x−y>0x - y > 0. The quotient is continuous where its denominator is non-zero, i.e. off the unit circle. Both conditions together give the answer.

Exercise 5: Check numerically (code)

Evaluate f(x,y)=sin⁡(x2+y2)/(x2+y2)f(x, y) = \sin(x^2 + y^2)/(x^2 + y^2) at the points (t,0)(t, 0), (t,t)(t, t) and (t,−2t)(t, -2t) for t=0.1,0.01,0.001t = 0.1, 0.01, 0.001, and use the polar substitution to explain the result.

Answer

All values approach 1. In polar form f=sin⁡(r2)/r2f = \sin(r^2)/r^2, which depends only on rr and tends to 1, so the limit is 1.

Solution
python · try it yourself
import math
f = lambda x, y: math.sin(x*x + y*y) / (x*x + y*y)
for t in [0.1, 0.01, 0.001]:
    print(t, [round(f(*p), 8) for p in [(t, 0), (t, t), (t, -2*t)]])
0.1 [0.99998333, 0.99993333, 0.99958339]
0.01 [1.0, 0.99999999, 0.99999996]
0.001 [1.0, 1.0, 1.0]

Since sin⁡u/u→1\sin u / u \to 1 as u→0u \to 0 and u=r2→0u = r^2 \to 0, the limit is 1 from every direction at once.

Test yourself

A function tends to 0 along every straight line through the origin. What can you conclude?

  1. The limit at the origin is 0
  2. The limit does not exist
  3. Nothing yet: a curved path might give another value
  4. The function is continuous at the origin

In polar coordinates f(rcos⁡θ,rsin⁡θ)=cos⁡2θf(r\cos\theta, r\sin\theta) = \cos 2\theta near the origin. What is lim⁡f\lim f as (x,y)→(0,0)(x, y) \to (0, 0)?

  1. 1
  2. 0
  3. It does not exist
  4. −1-1

Which bound proves lim⁡3x2y/(x2+y2)=0\lim 3x^2y/(x^2 + y^2) = 0?

  1. ∣f∣≤3x2+y2\lvert f \rvert \le 3\sqrt{x^2 + y^2}
  2. ∣f∣≤3\lvert f \rvert \le 3
  3. ∣f∣≥3∣y∣\lvert f \rvert \ge 3\lvert y \rvert
  4. ∣f∣≤x2+y2+1\lvert f \rvert \le x^2 + y^2 + 1