Differentiability and Continuity

Imagine driving fast along a road that suddenly bends — not in a curve, but in a sharp kink, like the letter V. To follow it you'd have to snap the steering wheel from one angle to another in literally zero time. No car can do that; the wheel would be wrenched out of your hands. Real roads, rollercoaster tracks, aeroplane flight paths and robot-arm trajectories are all engineered to be smooth: the direction of travel is allowed to change, but never to jump.

Differentiability is the mathematics of "no kinks". A function f is differentiable at a point when its derivative exists there — that is, when the difference-quotient limit

f'(a) = \lim_{h \to 0}\frac{f(a+h)-f(a)}{h}

settles on one finite value. Every word of that condition earns its keep. One value: the slope you measure approaching from the left (h \to 0^-) must agree with the slope from the right (h \to 0^+) — a kink is exactly a disagreement. Finite: a slope of "infinity" is not a number, so a vertical tangent doesn't count. Geometrically, differentiability means the curve has a single, well-defined tangent line at that point — a steering-wheel angle the car can actually hold.

Most functions you've differentiated so far — polynomials, \sin, \cos, e^x — are differentiable everywhere. But some points break the rule, and exam questions love them. This page is about knowing exactly where a derivative fails to exist, why, and how to engineer a function so that it doesn't.

Worked example 1: why |x| fails at 0

The absolute-value function f(x) = |x| is the V-shaped road. It is perfectly continuous — you can draw it without lifting your pen — so let's see precisely how the derivative dies at the corner. We compute the difference quotient at a = 0 from each side separately.

Step 1 — approach from the right. Take h > 0. Then |h| = h, so

\frac{f(0+h)-f(0)}{h} = \frac{|h| - 0}{h} = \frac{h}{h} = 1 \quad\Longrightarrow\quad \lim_{h \to 0^+}\frac{f(h)-f(0)}{h} = +1.

Step 2 — approach from the left. Take h < 0. Now |h| = -h (the absolute value flips the sign), so

\frac{f(0+h)-f(0)}{h} = \frac{-h}{h} = -1 \quad\Longrightarrow\quad \lim_{h \to 0^-}\frac{f(h)-f(0)}{h} = -1.

Step 3 — compare. The right-hand slope is +1; the left-hand slope is -1. A limit only exists when both sides agree, and +1 \neq -1, so

f'(0) \text{ does not exist.}

Notice what did not go wrong: f(0) = 0 is perfectly well defined, and the function is continuous there. The failure is purely about slope — the two halves of the V simply cannot agree on a tangent direction. Away from 0 there's no drama at all: f'(x) = 1 for x > 0 and f'(x) = -1 for x < 0.

The rogues' gallery: corner, cusp, vertical tangent

There are three classic ways a continuous curve can fail to have a derivative, and it pays to recognise each on sight. Step through the figure below and match each shape to its diagnosis:

And there is a fourth, cruder failure that doesn't even need a diagram: a jump. If the graph breaks — a jump discontinuity — then no tangent is possible at the break, for a reason the theorem in the next card makes precise.

The one theorem you must know

Differentiability and continuity are related, but not symmetrically. The relationship is a one-way street, and examiners test the direction of travel relentlessly.

Why is it true? The trick is to write the change in f as "slope times run" and let the run shrink:

f(a+h) - f(a) = \underbrace{\frac{f(a+h)-f(a)}{h}}_{\to\, f'(a)} \cdot \underbrace{h}_{\to\, 0} \;\longrightarrow\; f'(a) \cdot 0 = 0.

So f(a+h) \to f(a) as h \to 0 — which is exactly the definition of continuity at a. The argument only works because f'(a) is a finite number: finite slope times vanishing run is a vanishing rise. Intuitively, a curve with a genuine tangent line hugs that line near the point, and a line doesn't jump — so the curve can't either.

Worked example 2 — see both directions in action.

Forward direction: take f(x) = x^2 at a = 3. The difference quotient is \tfrac{(3+h)^2 - 9}{h} = \tfrac{6h + h^2}{h} = 6 + h \to 6, so f'(3) = 6 exists. The theorem then guarantees continuity at 3 — and indeed \lim_{x \to 3} x^2 = 9 = f(3). No separate check was needed: differentiability handed us continuity for free.

Converse fails: take f(x) = |x| at a = 0. Continuity holds (\lim_{x\to 0}|x| = 0 = f(0)), yet worked example 1 showed the derivative does not exist. Continuity was not enough. One counterexample is all it takes to kill a converse.

Contrapositive in action: take the step function f(x) = 0 for x < 0, f(x) = 1 for x \ge 0. From the left the difference quotient at 0 is \tfrac{0 - 1}{h} = -\tfrac{1}{h}, which blows up as h \to 0^-. The jump destroyed any hope of a derivative — exactly as the theorem predicts.

The single most common error on this topic is treating "continuous" and "differentiable" as interchangeable. They are not, and the traffic flows in one direction only:

Zoom in: the microscope test

Here is the most useful mental picture on the whole page. A differentiable curve is locally linear: zoom in far enough at any point and the curve becomes indistinguishable from its tangent line. That's really what "having a derivative" means — under a strong enough microscope, the function is a straight line with slope f'(a), plus an error too small to see.

A corner never passes the microscope test. The faint curve below is the smooth f(x) = x^2; the bold one is the corner g(x) = |x|. Slide the zoom window towards 0 and watch the parabola flatten into a perfect line — while the kink in |x| stays exactly as sharp at every magnification. The V shape is scale-invariant: |zx|/z = |x|, so zooming does nothing to it. No magnification will ever make the two arms agree on a slope.

This picture also explains why differentiability matters beyond exams: it is the licence to replace a curve by a line. Every linear approximation, every Newton–Raphson root hunt, every physics estimate of the form "for small h, f(a+h) \approx f(a) + f'(a)h" leans on the function being differentiable at the point in question. At a corner, that licence is revoked.

Worked example 3: engineering smoothness in a piecewise function

Now the constructive version of the problem — the one rollercoaster designers actually solve. Two pieces of track must join into a single differentiable curve. Find the constants a and b so that

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

is differentiable at the joint x = 1.

Step 1 — match the slopes. Left of the joint the slope is a (a straight line); right of it the slope is \tfrac{d}{dx}(x^2 + b) = 2x, which at x = 1 equals 2. Differentiability needs the one-sided slopes to agree:

a = 2.

Step 2 — match the values. Slope-matching alone is not enough — the two pieces must actually meet (differentiable \Rightarrow continuous, so continuity is non-negotiable). The left piece approaches a \cdot 1 = 2; the right piece starts at 1^2 + b = 1 + b. Setting them equal:

2 = 1 + b \quad\Longrightarrow\quad b = a - 1 = 1.

Step 3 — check. With a = 2, b = 1: both pieces pass through (1, 2) ✓, and both have slope 2 there ✓. The line y = 2x is in fact the tangent to y = x^2 + 1 at that point — the track glides from the straight into the curve with no jolt at all.

Two conditions, always. Match the values (continuity) and match the slopes (differentiability). Forgetting the first gives a track whose pieces are parallel but don't touch; forgetting the second welds them together at a kink. Try it yourself below: drag a and b until the two pieces fuse into one smooth curve. There is exactly one winning pair — and it is the one we just computed.

The three-question checklist

Faced with "is f differentiable at a?", run this triage in order — each question only makes sense if the previous one passed:

For most of the nineteenth century, mathematicians believed that a continuous function must be differentiable almost everywhere — surely a curve you can draw without lifting your pen can only have a scattering of corners? In 1872 Karl Weierstrass demolished that belief with a single formula:

W(x) = \sum_{n=0}^{\infty} a^n \cos(b^n \pi x), \qquad 0 < a < 1,\; ab > 1 + \tfrac{3\pi}{2}.

Each term adds wiggles that are smaller but proportionally steeper than the last, and the balance is rigged so the sum stays continuous while the slopes never settle. The result is continuous everywhere and differentiable nowhere — a curve that is all corner, at every point, at every magnification. Zoom in anywhere and it never straightens; it just reveals more wrinkles. The establishment was horrified: Charles Hermite wrote of turning away "in fear and horror from this lamentable plague of functions with no derivatives", and Henri Poincaré called such constructions "monsters".

The monsters won. Curves that are rough at every scale turned out to be everywhere: a coastline reveals new bays and headlands at every zoom level (which is why "how long is the coastline of Britain?" has no stable answer); a stock-price chart looks just as jagged over a decade as over an hour; the path of a pollen grain jittering in water — Brownian motion — is, with probability one, continuous everywhere and differentiable nowhere, a genuine Weierstrass monster served up by nature itself. The microscope test from earlier is exactly what these objects fail: they are the curves that never straighten.

Watch it explained

Sal Khan connects differentiability and continuity, and walks through the places a derivative fails to exist — a good second pass over everything on this page.