A Discontinuous Derivative

f(x)=x2sin⁡(1/x)f(x) = x^2\sin(1/x) (f(0)=0f(0) = 0) is differentiable everywhere with f′(0)=0f'(0) = 0, yet the derivative f′(x)=2xsin⁡(1/x)−cos⁡(1/x)f'(x) = 2x\sin(1/x) - \cos(1/x) oscillates and is discontinuous at 00. Differentiable does not imply continuously differentiable — though derivatives still keep the intermediate value property (Darboux).

f′(0)=lim⁡h→0hsin⁡(1/h)=0f'(0) = \lim_{h \to 0} h\sin(1/h) = 0
f′(x)=2xsin⁡(1/x)−cos⁡(1/x)(x≠0),f′ ⁣(12πn)=−1f'(x) = 2x\sin(1/x) - \cos(1/x) \quad (x \neq 0), \qquad f'\!\left(\tfrac{1}{2\pi n}\right) = -1

Examples & Exercises

For f(x)=x2sin⁡(1/x)f(x) = x^2\sin(1/x) (x≠0x \ne 0), f(0)=0f(0) = 0, prove completely by the squeeze theorem that f′(0)=0f'(0) = 0.

f(h)−f(0)h=hsin⁡1h,∣hsin⁡1h∣≤∣h∣→0\frac{f(h) - f(0)}{h} = h\sin\frac{1}{h}, \qquad \left|h\sin\frac{1}{h}\right| \le |h| \to 0
r=0.1r = 0.1, h=0.01h = 0.01: the difference quotient ≈−0.0051\approx -0.0051 is near 0, and the left panel shows the secant slope collapsing onto the horizontal (dashed) tangent.
Show proof
  1. By the definition of the derivative, f′(0)=lim⁡h→0f(h)−f(0)hf'(0) = \lim_{h \to 0} \frac{f(h) - f(0)}{h} (h≠0h \ne 0). Since f(0)=0f(0) = 0 and f(h)=h2sin⁡(1/h)f(h) = h^2\sin(1/h) for h≠0h \ne 0, the difference quotient simplifies to h2sin⁡(1/h)−0h=hsin⁡(1/h)\frac{h^2\sin(1/h) - 0}{h} = h\sin(1/h).
  2. Since ∣sin⁡(1/h)∣≤1|\sin(1/h)| \le 1, we have ∣hsin⁡(1/h)∣≤∣h∣|h\sin(1/h)| \le |h|. As ∣h∣→0|h| \to 0 (h→0h \to 0), the squeeze theorem gives hsin⁡(1/h)→0h\sin(1/h) \to 0 — the limit of the difference quotient exists and f′(0)=0f'(0) = 0. The oscillating factor sin⁡(1/h)\sin(1/h) is completely damped by the factor hh.
  3. In the scene, shrinking hh down to 0.00010.0001 shows the difference quotient converging to 0 numerically (alongside the bound ∣hsin⁡(1/h)∣≤∣h∣|h\sin(1/h)| \le |h|).

Prove completely, via the product and chain rules, that f′(x)=2xsin⁡(1/x)−cos⁡(1/x)f'(x) = 2x\sin(1/x) - \cos(1/x) for x≠0x \ne 0.

f′(x)=ddx[x2sin⁡1x]=2xsin⁡1x−cos⁡1x(x≠0)f'(x) = \frac{d}{dx}\left[x^2\sin\frac{1}{x}\right] = 2x\sin\frac{1}{x} - \cos\frac{1}{x} \qquad (x \ne 0)
r=0.1r = 0.1: the right panel plots exactly this formula — the 2xsin⁡(1/x)2x\sin(1/x) term decays to 0 while the −cos⁡(1/x)-\cos(1/x) term keeps oscillating with amplitude 1.
Show proof
  1. Fix x≠0x \ne 0. Since f(x)=x2⋅sin⁡(1/x)f(x) = x^2 \cdot \sin(1/x) is a product of differentiable functions, apply the product rule: f′(x)=2x⋅sin⁡(1/x)+x2⋅ddxsin⁡(1/x)f'(x) = 2x \cdot \sin(1/x) + x^2 \cdot \frac{d}{dx}\sin(1/x).
  2. By the chain rule, ddxsin⁡(1/x)=cos⁡(1/x)⋅ddx(1/x)=cos⁡(1/x)⋅(−1/x2)\frac{d}{dx}\sin(1/x) = \cos(1/x) \cdot \frac{d}{dx}(1/x) = \cos(1/x) \cdot (-1/x^2) (since 1/x1/x is differentiable at x≠0x \ne 0). Substituting, f′(x)=2xsin⁡(1/x)+x2⋅cos⁡(1/x)⋅(−1/x2)=2xsin⁡(1/x)−cos⁡(1/x)f'(x) = 2x\sin(1/x) + x^2 \cdot \cos(1/x) \cdot (-1/x^2) = 2x\sin(1/x) - \cos(1/x) — proved.
  3. Numerical check: f′(0.5)=2(0.5)sin⁡2−cos⁡2≈1.3254f'(0.5) = 2(0.5)\sin 2 - \cos 2 \approx 1.3254, matching the model. This formula is not defined at x=0x = 0 — f′(0)f'(0) must be computed separately as the limit of the difference quotient, as in problem 1.

Prove completely, using the sequence xn=1/(2πn)x_n = 1/(2\pi n), that f′f' is discontinuous at x=0x = 0.

xn=12πn→0,f′(xn)=2xnsin⁡(2πn)−cos⁡(2πn)=−1≠0=f′(0)x_n = \frac{1}{2\pi n} \to 0, \qquad f'(x_n) = 2x_n\sin(2\pi n) - \cos(2\pi n) = -1 \ne 0 = f'(0)
r=0.01r = 0.01, h=0.001h = 0.001: zooming closer to 0, the right panel never stops oscillating, and the highlighted points xn=1/(2πn)x_n = 1/(2\pi n) keep landing on the dashed line y=−1y = -1.
Show proof
  1. Set xn=1/(2πn)x_n = 1/(2\pi n); then xn≠0x_n \ne 0 and xn→0x_n \to 0. Plugging into problem 2's formula, f′(xn)=2xnsin⁡(1/xn)−cos⁡(1/xn)=2xnsin⁡(2πn)−cos⁡(2πn)f'(x_n) = 2x_n\sin(1/x_n) - \cos(1/x_n) = 2x_n\sin(2\pi n) - \cos(2\pi n). Since sin⁡(2πn)=0\sin(2\pi n) = 0 and cos⁡(2πn)=1\cos(2\pi n) = 1, we get f′(xn)=0−1=−1f'(x_n) = 0 - 1 = -1 — constant for every nn.
  2. Hence f′(xn)→−1f'(x_n) \to -1, but f′(0)=0f'(0) = 0 by problem 1, so f′(xn)↛f′(0)f'(x_n) \not\to f'(0) even though xn→0x_n \to 0. By the sequential criterion, f′f' is not continuous at 00 — lim⁡x→0f′(x)\lim_{x \to 0} f'(x) does not even exist (the never-ending oscillation in the right panel).
  3. Remark: a discontinuous derivative still has the intermediate value property — by Darboux's theorem, f′f' satisfies the IVP on intervals. Differentiability is strictly weaker than continuity of the derivative.

9. Differentiation