Limits & Continuity
Calculus & Optimization
Chapter 2 · Limits & Continuity
Chapter 1's numerical experiment shrank h toward zero and watched the approximation "converge toward" the true derivative — without ever setting h exactly to zero. That word, converge, has a precise name: a limit. This chapter formalizes it, practically rather than with full epsilon-delta rigor, per Chapter 1's own honest scope note.
What a Limit Actually Captures
lim(x→a) f(x) = L means: as x gets arbitrarily close to a — without necessarily ever reaching it — f(x) gets arbitrarily close to L. The limit describes what a function approaches, which is a genuinely different question from what the function's value is at that exact point — sometimes those two things differ entirely.
Why This Matters for Derivatives Specifically
The derivative is defined as a limit: f'(x) = lim(h→0) (f(x+h)−f(x))/h. Plugging in h=0 directly gives 0/0 — genuinely undefined, a real division by zero. The limit is precisely the tool that lets Chapter 1's whole numerical experiment make sense: reasoning about what the expression approaches as h shrinks toward zero, without ever actually dividing by zero.
A Worked Example: A Limit That Exists Where the Function Doesn't
Consider f(x) = (x²−4)/(x−2). Substituting x=2 directly gives 0/0 — undefined, a genuine division-by-zero error.
(x²−4)/(x−2) = (x−2)(x+2)/(x−2) = x+2, valid everywhere x≠2. Approaching from below: x=1.9→3.9, x=1.99→3.99, x=1.999→3.999. Approaching from above: x=2.001→4.001, x=2.01→4.01, x=2.1→4.1. Both directions converge on 4 — confirming lim(x→2) f(x) = 4, even though f(2) itself is a genuine ZeroDivisionError, confirmed directly.
Continuity: When the Limit and the Function Actually Agree
f is continuous at a when three things all hold: f(a) is defined, lim(x→a) f(x) exists, and the two are equal.
f(x)=(x²−4)/(x−2) is discontinuous at x=2 — the limit exists (4, verified above), but f(2) itself is undefined, so the first requirement of continuity fails outright. The simplified function g(x)=x+2 is continuous everywhere, including at x=2 where it equals 4 — the two functions agree everywhere except at the single point the original one has a hole.
A Real Case: Continuous, But Not Differentiable
Continuity is necessary for differentiability, but not sufficient — a function can be perfectly continuous and still have no well-defined derivative at a point. f(x) = |x| at x=0 is the classic case.
x=0 from both sides: f(-0.01)=0.01, f(-0.001)=0.001, f(0.001)=0.001, f(0.01)=0.01 — the limit is 0, matching f(0)=0 exactly. |x| is genuinely continuous at 0.
(f(0+h)−f(0))/h, approached from the right (h=0.1, 0.01, 0.001, 0.0001): consistently 1.0. Approached from the left (h=−0.1, −0.01, −0.001, −0.0001): consistently −1.0. The two one-sided limits genuinely disagree — no single limit exists, so |x| has no derivative at x=0, despite being perfectly continuous there. A sharp corner, not a smooth curve, at that exact point.
Real Relevance
Chapter 6's gradient descent assumes it can always ask "which direction does this function decrease in?" — a question that only has a clean answer where the function is differentiable. Functions with sharp corners (like ReLU, an extremely common neural-network activation function, which is literally max(0,x) — a close cousin of |x|) genuinely have points where the derivative doesn't exist in the classical sense, a real practical wrinkle real ML libraries handle by defining a sensible value at that single point rather than pretending the problem doesn't exist.
Limits in Code
Hands-On Exercises
Find lim(x→3) (x²−9)/(x−3) algebraically (factor first), then verify your answer numerically by evaluating the function at x=2.99, x=2.999, x=3.001, and x=3.01.
Using this chapter's own three-part definition of continuity, explain specifically which part fails for f(x)=(x²−9)/(x−3) at x=3, given your answer to Exercise 1.
Using this chapter's own left/right difference-quotient method for |x|, compute the one-sided difference quotients for f(x) = -|x| at x=0 (approaching from the right with h=0.01, and from the left with h=-0.01). Do they agree? What does this tell you about whether -|x| is differentiable at x=0?
Chapter 2 Quick Reference
- Limit: what a function approaches as its input approaches a point — not necessarily what the function equals there
- The derivative is defined as a limit specifically to avoid ever dividing by zero directly
- An indeterminate
0/0form can often be resolved by algebraic simplification first — verified on(x²−4)/(x−2) → 4atx=2 - Continuity:
f(a)defined, the limit exists, and they're equal — all three, together - Continuity is necessary but not sufficient for differentiability — verified directly:
|x|is continuous but not differentiable atx=0(left/right difference quotients disagree,-1vs.1) - Next chapter: Derivatives — definition and rules