Limits and Continuity Fundamentals

Limits are the foundation on which derivatives and integrals are built. A limit
describes the value a function approaches as its input approaches a point — the
function need not be defined at that point. Continuity asks whether the
function actually attains that value, or whether something fails at the point.

Definition of a limit

Consider:

$f(x) = (x^2 - 1) / (x - 1)$

At x = 1 the expression is undefined (0/0). Evaluating near x = 1 — at
x = 0.99, 0.999, 1.001, 1.01 — the outputs approach 2. The limit is 2,
even though f(1) does not exist.

Three standard approaches to evaluating a limit:

  • Graphically — inspect whether both sides converge to the same value.
  • Numerically — tabulate f(x) for inputs approaching a and observe the trend.
  • Algebraically — simplify using limit laws.
1
2
3
4
5
6
7
import numpy as np

x_vals = np.array([0.9, 0.99, 0.999, 1.001, 1.01, 1.1])
f_vals = (x_vals**2 - 1) / (x_vals - 1)

for x, y in zip(x_vals, f_vals):
print(f"x={x:.3f}, f(x)={y:.6f}")

Formal definition

$\lim_{x \to a} f(x) = L$ means f(x) can be made arbitrarily close to L by
taking x sufficiently close to a, without requiring x = a.

The epsilon-delta formulation makes this precise — see the worked proof below.

One-sided limits

  • $\lim_{x \to a^-} f(x)$ — the left-hand limit, approaching a from below.
  • $\lim_{x \to a^+} f(x)$ — the right-hand limit, approaching a from above.

The two-sided limit exists if and only if both one-sided limits exist and are equal.

Limit laws

When the individual limits exist, they obey the following rules:

  • Sum: $\lim(f+g) = \lim f + \lim g$
  • Difference: $\lim(f-g) = \lim f - \lim g$
  • Product: $\lim(fg) = (\lim f)(\lim g)$
  • Quotient: $\lim(f/g) = (\lim f)/(\lim g)$ — provided the denominator limit is nonzero
  • Power: $\lim(f^n) = (\lim f)^n$
  • Composition: if f is continuous at L, then $\lim f(g(x)) = f(\lim g(x))$

Indeterminate forms

Indeterminate forms such as $0/0$ or $\infty/\infty$ have no immediately
obvious value. Standard resolution techniques:

  • Factor and cancel
  • Multiply by the conjugate
  • Apply trigonometric identities
  • Use series expansions

Factor and cancel:

$\lim_{x \to 1} (x^2 - 1)/(x - 1)$

Since $x^2 - 1 = (x - 1)(x + 1)$, for $x \ne 1$ the expression reduces to $x + 1$.

$\lim_{x \to 1} x + 1 = 2$

Continuity

A function f is continuous at x = a if and only if:

  1. f(a) is defined
  2. $\lim_{x \to a} f(x)$ exists
  3. $\lim_{x \to a} f(x) = f(a)$

If any condition fails, f is discontinuous at a. Discontinuities are classified as:

  1. Removable — the limit exists, but the function value is absent or incorrect
  2. Jump — left and right limits are finite but unequal
  3. Infinite — the function diverges near the point
  4. Oscillating — the function does not converge to any value (e.g. $\sin(1/x)$ near 0)

Removable discontinuity

$f(x) = (x^2 - 1)/(x - 1)$ reduces to $x + 1$ for $x \ne 1$, but f(1) is
undefined. There is a removable discontinuity (hole) at (1, 2).

1
2
3
4
5
6
7
8
9
10
11
12
13
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0.5, 1.5, 400)
f = (x**2 - 1) / (x - 1)

plt.plot(x, f, label="(x^2 - 1)/(x - 1)")
plt.scatter([1], [2], facecolors="none", edgecolors="red", s=80, label="hole at x=1")
plt.axvline(1, color="gray", linestyle="--", linewidth=1)
plt.ylim(0, 3)
plt.legend()
plt.title("Removable Discontinuity")
plt.show()

Jump discontinuity

$$
g(x)=\begin{cases}
-1, & x < 0 \\
1, & x \ge 0
\end{cases}
$$

The left-hand limit at 0 is -1 and the right-hand limit is 1. Since the
one-sided limits are unequal, the two-sided limit does not exist.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import numpy as np
import matplotlib.pyplot as plt

x_left = np.linspace(-2, -0.01, 200)
x_right = np.linspace(0.01, 2, 200)

plt.plot(x_left, -np.ones_like(x_left), label="x < 0")
plt.plot(x_right, np.ones_like(x_right), label="x >= 0")
plt.scatter([0], [1], color="red", s=40)
plt.scatter([0], [-1], facecolors="none", edgecolors="red", s=80)
plt.ylim(-2, 2)
plt.title("Jump Discontinuity at x=0")
plt.legend()
plt.show()

Vertical asymptotes

When f(x) diverges without bound near a point, we write:

$\lim_{x \to a} f(x) = \infty$

For $f(x) = 1/(x - 2)$, the function diverges to $\pm\infty$ near x = 2, with
the sign determined by the direction of approach.

1
2
3
4
5
6
7
8
9
10
11
12
13
import numpy as np
import matplotlib.pyplot as plt

x1 = np.linspace(0.5, 1.9, 200)
x2 = np.linspace(2.1, 3.5, 200)

plt.plot(x1, 1/(x1-2), label="x < 2")
plt.plot(x2, 1/(x2-2), label="x > 2")
plt.axvline(2, color="gray", linestyle="--")
plt.ylim(-10, 10)
plt.title("Vertical Asymptote at x=2")
plt.legend()
plt.show()

Squeeze theorem

If $h(x) \le f(x) \le k(x)$ near a, and $\lim_{x \to a} h(x) = \lim_{x \to a} k(x) = L$,
then $\lim_{x \to a} f(x) = L$.

A standard application is $\lim_{x \to 0} \sin(x)/x = 1$, established via the
bounds $\cos(x) \le \sin(x)/x \le 1$ for $x$ near 0. Both bounds converge to 1,
so $\sin(x)/x$ is squeezed to 1 as well.

1
2
3
4
5
6
7
8
9
10
11
12
13
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-1.5, 1.5, 400)
x = x[np.abs(x) > 1e-6]

plt.plot(x, np.sin(x)/x, label="sin(x)/x", color="steelblue")
plt.plot(x, np.cos(x), label="cos(x) — lower bound", color="tomato", linestyle="--")
plt.plot(x, np.ones_like(x), label="1 — upper bound", color="seagreen", linestyle="--")
plt.ylim(0.5, 1.1)
plt.title("Squeeze Theorem: cos(x) ≤ sin(x)/x ≤ 1")
plt.legend()
plt.show()

Intermediate Value Theorem

If f is continuous on $[a, b]$ and N lies strictly between f(a) and f(b), then
there exists $c \in (a, b)$ such that $f(c) = N$.

Continuous functions cannot skip over intermediate values. This is the
theoretical basis for bisection and related root-finding algorithms.

Common errors

  • Cancelling a factor without verifying it is nonzero at the limit point
  • Assuming $\lim_{x \to a} f(x) = f(a)$ without establishing continuity
  • Overlooking one-sided limits in piecewise-defined functions
  • Assuming a function must be defined at a point for the limit to exist there

Epsilon-delta proof

Claim: $\lim_{x \to 2} (3x - 1) = 5$

Definition: for every $\varepsilon > 0$, there must exist $\delta > 0$ such
that $0 < |x - 2| < \delta$ implies $|(3x - 1) - 5| < \varepsilon$.

Bound the expression:

$|(3x - 1) - 5| = |3x - 6| = 3|x - 2|$

Choice of $\delta$: the condition $3|x - 2| < \varepsilon$ is satisfied
when $|x - 2| < \varepsilon/3$.

Conclusion: set $\delta = \varepsilon/3$. Then:

$|(3x - 1) - 5| = 3|x - 2| < 3 \cdot \frac{\varepsilon}{3} = \varepsilon \qquad \square$

Worked examples

Example 1: $\lim_{x \to 3} (x^2 - 9)/(x - 3)$

Factor: $x^2 - 9 = (x - 3)(x + 3)$.
For $x \ne 3$, cancel the common factor: $\lim_{x \to 3} (x + 3) = 6$.

Example 2: $\lim_{x \to 0} (\sqrt{x + 4} - 2) / x$

Multiply numerator and denominator by $\sqrt{x + 4} + 2$:

$$
\frac{\sqrt{x + 4} - 2}{x} \cdot \frac{\sqrt{x + 4} + 2}{\sqrt{x + 4} + 2}
$$

The numerator simplifies to $(x + 4) - 4 = x$. Cancelling x:

$\lim_{x \to 0} \frac{1}{\sqrt{x + 4} + 2} = \frac{1}{4}$

Example 3: piecewise function

$$
f(x)=\begin{cases}
x^2, & x < 1 \\
2x + 1, & x \ge 1
\end{cases}
$$

Left-hand limit: $\lim_{x \to 1^-} x^2 = 1$

Right-hand limit: $\lim_{x \to 1^+} (2x + 1) = 3$

Since the one-sided limits are unequal, the two-sided limit at x = 1 does not exist.

Example 4: $\lim_{x \to 0} 1/x^2$

From both sides, $1/x^2$ diverges. The limit is $\infty$, and x = 0 is a
vertical asymptote.