Proofs of Theorems
This appendix lesson proves a few theorems that the rest of the course uses constantly: the Squeeze Theorem, the limit , the Chain Rule (in the careful form that survives ) and a sketch of Clairaut's Theorem on mixed partial derivatives. Each proof is followed by a numerical or symbolic sanity check, because a check never replaces a proof but often catches a misread statement.
How to read a limit proof
Every proof below uses the precise definition from The Precise Definition of a Limit:
The pattern is always the same: someone hands you an , and you must produce a that works. The tools are the inequality rules and the triangle inequality from Numbers, Inequalities and Absolute Values.
Theorem 1: the Squeeze Theorem
Statement. If for all near , and as , then .
Proof. Let . Because , there is with whenever . Because , there is with whenever . The inequality holds for . Take . For all three facts hold, so
Theorem 2:
Statement. ( in radians).
Proof. Take and the unit circle with , , , and where the line meets the tangent line . Compare three areas:
(The sector area is where radians enter.) Divide by and take reciprocals, which flips the inequalities:
Both sides are even functions of , so the same holds for . As , , and the Squeeze Theorem gives the limit 1. ∎
This limit is exactly what makes ; see Derivatives of Trigonometric Functions.
import math
print(f"{'theta':>8} {'cos':>12} {'sin/theta':>12} squeezed?")
for theta in [0.5, 0.1, 0.01, -0.01, 0.001]:
ratio = math.sin(theta) / theta
print(f"{theta:8} {math.cos(theta):12.9f} {ratio:12.9f} {math.cos(theta) <= ratio <= 1}")
deg = math.radians(1)
print("in degrees, sin(x°)/x ->", round(math.sin(deg) / 1, 6), "= pi/180 =", round(math.pi / 180, 6)) theta cos sin/theta squeezed?
0.5 0.877582562 0.958851077 True
0.1 0.995004165 0.998334166 True
0.01 0.999950000 0.999983333 True
-0.01 0.999950000 0.999983333 True
0.001 0.999999500 0.999999833 True
in degrees, sin(x°)/x -> 0.017452 = pi/180 = 0.017453
The last line shows why calculus uses radians: in degrees the limit is , not 1.
Theorem 3: the Chain Rule
Statement. If is differentiable at and is differentiable at , then is differentiable at and .
The tempting proof and its gap. Write and . It is tempting to write , but can be 0 for nonzero (even for infinitely many near 0, as with ), and then is meaningless.
The careful proof. Define the error of the difference quotient of :
Since is differentiable at , as , so is continuous at 0. The definition was chosen so that
Now divide by :
As : ; because a differentiable is continuous; therefore . The limit of the right side is . ∎
import sympy as sp
x = sp.symbols('x')
g = x**3 + 2*x
f = lambda u: sp.exp(sp.sin(u))
F = f(g)
by_rule = sp.exp(sp.sin(g)) * sp.cos(g) * sp.diff(g, x) # f'(g(x)) * g'(x)
print("difference:", sp.simplify(sp.diff(F, x) - by_rule))
a, h = 0.7, 1e-6
Fn = sp.lambdify(x, F)
print("central difference:", round((Fn(a + h) - Fn(a - h)) / (2 * h), 6))
print("chain rule :", round(float(by_rule.subs(x, a)), 6))difference: 0
central difference: -1.592555
chain rule : -1.592555
The gentle introduction is The Chain Rule; the full lesson is The Chain Rule.
Theorem 4: Clairaut's Theorem (sketch)
Statement. If and are both continuous on a disc around , then .
Sketch. Look at the "mixed second difference"
Group it as with . The Mean Value Theorem gives a between and with . Apply the MVT again, now in , to : for some between and . Grouping the four terms the other way ( first) gives . So , and letting , both points tend to ; continuity finishes it. ∎
The continuity hypothesis is needed. The classic counterexample , , has but . You can see it numerically from the definitions, using and :
def f(x, y):
return 0.0 if x == y == 0 else x * y * (x*x - y*y) / (x*x + y*y)
def fx(x, y, h=1e-7):
return (f(x + h, y) - f(x - h, y)) / (2 * h)
def fy(x, y, h=1e-7):
return (f(x, y + h) - f(x, y - h)) / (2 * h)
k = 1e-3
print("f_xy(0,0) ≈ d/dy f_x =", round((fx(0, k) - fx(0, -k)) / (2 * k), 4))
print("f_yx(0,0) ≈ d/dx f_y =", round((fy(k, 0) - fy(-k, 0)) / (2 * k), 4))f_xy(0,0) ≈ d/dy f_x = -1.0
f_yx(0,0) ≈ d/dx f_y = 1.0
Mixed partials are covered in Partial Derivatives.
In software
Proofs explain why tools work. The careful chain-rule proof is exactly what automatic differentiation implements: local derivatives multiplied along a computation graph, with no division by . Clairaut's theorem is why a Hessian matrix is symmetric, so optimizers store only half of it. The limit appears in code as the sinc function, which libraries special-case at 0 to avoid .
Exercises
Exercise 1: Squeeze
Prove that .
Answer
The limit is 0, by squeezing between and .
Solution
Exercise 2: Use the sine limit
Find and .
Answer
and 0.
Solution
Exercise 3: A for the squeeze
For and , give a that guarantees , and test it in code on random .
Answer
works, since .
Solution
import numpy as np
eps = 1e-4
delta = eps ** 0.5
x = np.random.default_rng(3).uniform(-delta, delta, 100_000)
x = x[x != 0]
print(delta, bool(np.all(np.abs(x**2 * np.cos(1 / x)) < eps)))0.01 True
Exercise 4: Clairaut on a smooth function
Check with SymPy that for .
Answer
Both equal .
Solution
; differentiate in : . The other order gives the same, as Clairaut predicts for this smooth .
import sympy as sp
x, y = sp.symbols('x y')
f = x**3 * sp.exp(2*y) + sp.sin(x*y)
fxy, fyx = sp.diff(f, x, y), sp.diff(f, y, x)
print(fxy)
print(sp.simplify(fxy - fyx))6*x**2*exp(2*y) - x*y*sin(x*y) + cos(x*y)
0
Test yourself
In the proof that , which inequality is squeezed?
Why does the naive chain-rule proof fail?
- might be negative
- can be 0 for nonzero
- might not be continuous
- The product of limits does not exist
Which hypothesis does Clairaut's Theorem need?
- is a polynomial
- is bounded
- and are continuous near the point