Single-variable Calculus: Derivatives & the Chain Rule · 10 min

The derivative as a function

f'(a) is a number at one point. Let a slide, and the numbers join into a new function f'(x). The derivative is not a thing you compute once. It is a function in its own right.

0 / 0

One slope at a point, then another, then another

Last lesson you found the slope of f(x)=x2f(x) = x^2 at x=1x = 1. It was 22. You found f(2)=4f'(2) = 4. You guessed f(3)=6f'(3) = 6.

There is a pattern, and naming it is the whole move of this lesson. Every xx has its own slope. The map from xx to the slope of ff at xx is itself a function. Call it ff'.

f(x)  =  the slope of f at the point x.f'(x) \;=\; \text{the slope of } f \text{ at the point } x.

For f(x)=x2f(x) = x^2, the slope-function is f(x)=2xf'(x) = 2x. Plug in 11, you get 22. Plug in 33, you get 66. Plug in 7-7, you get 14-14. One formula now handles every point on the curve.

This sounds like bookkeeping. It is the entire reason calculus works.

Sweep and watch it draw itself

Drag the sun-yellow handle along the x-axis. The red curve is f(x)f(x). The coral line is the tangent at the swept point. The teal curve is f(x)f'(x). It paints itself in wherever you sweep.

-2-112-2-11234
x 1.00
f(x) 1.00
f'(x) 2.00

drag the sun handle along the x-axis. red = f. coral = tangent line at x. teal = f′(x), drawn in wherever you have swept.

Try x2x^2 first. Sweep all the way across. The teal trace is a straight line through the origin with slope 22. That straight line is the function f(x)=2xf'(x) = 2x. You drew it by sampling slopes.

Now hit sin x. Sweep again. The teal trace climbs from 1-1, peaks at 11, dips back through zero. You are drawing cosx\cos x, one slope at a time. Sine differentiates to cosine, full stop, no algebra required to see it.

Read the slope of sine

With f(x)=sinxf(x) = \sin x, the teal trace tells you the slope at every xx.

What is f(π/2)f'(\pi/2) — the slope of sine at the top of its first bump?

The same object, four ways of writing it

Mathematicians who agree on the math sometimes disagree on the symbols. Four notations all mean the same function:

f(x),y,dydx,ddx[f(x)].f'(x), \qquad y', \qquad \frac{dy}{dx}, \qquad \frac{d}{dx}\bigl[f(x)\bigr].

Lagrange notation (ff', prime) reads cleanly when the argument is implicit: f prime of x. Leibniz notation (dy/dxdy/dx) reads as a ratio for a deep reason we will earn in the chain rule. The d/dxd/dx form is Leibniz used as a verb — take the derivative with respect to x.

You will meet all four. They are aliases, not rivals.

Where it breaks: the corner of |x|

Differentiable functions are smooth. But “smooth” has a precise meaning, and not every function has it everywhere.

Pick |x| on the widget. Sweep across. To the left of zero, the slope is 1-1. To the right of zero, the slope is +1+1. At zero, the teal trace breaks. The readout says undefined.

The function x|x| is perfectly continuous at 00 — you can draw it without lifting the pen. But it has no slope there. The secant from the left says 1-1, the secant from the right says +1+1, and there is no number both agree on. So f(0)f'(0) does not exist.

Now try x3\sqrt[3]{x}. Same story, different failure: at x=0x = 0 the tangent is vertical. The slope is “infinite,” which is another way of saying no number works. The teal trace shoots up to a spike at zero.

Continuous does not mean differentiable

The trap to dispel:

If a function is continuous, it must have a derivative.

It does not. x|x| at 00 is continuous and has no derivative. x3\sqrt[3]{x} at 00 is continuous and has no derivative. The standard theorem runs one way only:

differentiable at a    continuous at a.\text{differentiable at } a \;\Longrightarrow\; \text{continuous at } a.

The converse is false. Continuity is the floor; differentiability is a strictly stronger condition that says the graph has a well-defined tangent line at that point. A corner or a vertical tangent fails the test, even though the graph never breaks.

This matters for neural networks. ReLU, the most-used activation in deep learning, has exactly this kind of corner at 00. Backprop has to make a choice there — and it does, by convention. Hold that thought; you will need it in module 12.

Which one breaks at zero?

Four functions, all continuous at x=0x = 0. Select every one that is NOT differentiable at 00.

From one slope to many, from many to all

Calculus was invented when Newton and Leibniz both stopped asking “what is the slope of this curve at this one point?” and started asking “what is the slope-function of this whole curve?”. Once you have ff' as a function, you can ask new questions: where is the slope zero (peaks and valleys), where is the slope steepest (a maximum rate of change), what is the slope of the slope (acceleration).

You are one lesson from a single line that hands you ff' for any polynomial without doing a limit ever again. Then a second line for sines and cosines. Then a third for the exponential. By the end of the module, you compute derivatives the way you compute sums.

Lesson complete

Nice tinkering.