Mathematics/Lessons/Differentiation/Differentiation from First Principles
Pure · Differentiation · Year 1

Differentiation from First Principles

The gradient of a curve at a point is the limit of a chord's gradient as the two points merge. That limit — the derivative — is where all of calculus begins.

10 min read 3 worked examples

The gradient of a curve at a point

For a straight line, "gradient" is a single number — rise over run, the same everywhere. A curve is different: its steepness changes from point to point. So what could the gradient at a single point even mean? The answer is the key idea of all calculus: the gradient of a curve at a point is the gradient of the tangent to the curve there — the straight line that just grazes the curve at that point.

The problem is that a tangent touches at only one point, and you need two points to compute a gradient. Differentiation from first principles solves this with a clever limiting trick: start with a chord joining two nearby points, then slide the second point closer and closer to the first, watching what the chord's gradient approaches.

A curve with a fixed point P at x and a nearby point Q at x plus h. The chord from P to Q is drawn, alongside the tangent at P. A right-angle construction shows the horizontal run h and the vertical rise f(x+h) minus f(x), with a curved arrow showing Q sliding back along the curve toward P as the chord approaches the tangent.
The chord from P(x, f(x)) to Q(x+h, f(x+h)) has gradient [f(x+h) − f(x)] / h — simply the rise over the run h.
Why the derivative is a limit

Take a point $P(x, f(x))$ and a second point $Q$ a small horizontal distance $h$ away, at $(x+h,\ f(x+h))$. The chord $PQ$ has gradient $\dfrac{f(x+h) - f(x)}{h}$ — an ordinary rise-over-run. As $h$ shrinks toward $0$, $Q$ slides into $P$ and the chord rotates until it is the tangent. The tangent's gradient is therefore the limit of the chord's gradient as $h\to 0$. That limit is the derivative.

The definition

Writing $f'(x)$ (read "f-dash of x") for the derivative, the definition is

$f'(x) = \lim_{h\to 0}\dfrac{f(x+h) - f(x)}{h}.$

The notation $\lim_{h\to 0}$ means "the value this expression approaches as $h$ gets arbitrarily close to $0$". You can't just set $h=0$ — that gives $\tfrac{0}{0}$, which is meaningless. The whole technique is to simplify first so the troublesome $h$ in the denominator cancels, and only then let $h\to 0$.

Strategy — the four-step recipe

Every first-principles derivation follows the same four moves: (1) write out $f(x+h)$; (2) form $f(x+h) - f(x)$ and simplify the numerator; (3) divide every term by $h$, cancelling the denominator; (4) let $h\to 0$ and read off what survives. If step 3 leaves an $h$ still stuck in a denominator, you haven't simplified enough in step 2.

Worked example 1

Differentiate x² from first principles
Use the limit definition to show that if $f(x) = x^2$, then $f'(x) = 2x$.
MethodApply the four-step recipe
1
Write $f(x+h) = (x+h)^2 = x^2 + 2xh + h^2$.
Expand the bracket.
2
Form the numerator: $f(x+h) - f(x) = (x^2 + 2xh + h^2) - x^2 = 2xh + h^2$.
The $x^2$ terms cancel.
3
Divide by $h$: $\dfrac{2xh + h^2}{h} = 2x + h$.
Every term has an $h$ to cancel.
4
Let $h\to 0$: $f'(x) = \lim_{h\to 0}(2x + h) = 2x$.
The $h$ term vanishes.
▪ shown
Examiner's eye

The magic is in step 3: because every term of the numerator contained an $h$, dividing by $h$ removed it from the denominator entirely, leaving $2x + h$ — an expression you can safely evaluate at $h=0$. Notice we never divided by zero; we cancelled the $h$ while it was still non-zero, then took the limit.

Worked example 2

Differentiate x³ from first principles
Show from first principles that the derivative of $f(x) = x^3$ is $f'(x) = 3x^2$.
MethodSame recipe, with a cubic expansion
1
$f(x+h) = (x+h)^3 = x^3 + 3x^2h + 3xh^2 + h^3$.
Expand $(x+h)^3$.
2
Numerator: $f(x+h) - f(x) = 3x^2h + 3xh^2 + h^3$.
The $x^3$ terms cancel.
3
Divide by $h$: $\dfrac{3x^2h + 3xh^2 + h^3}{h} = 3x^2 + 3xh + h^2$.
Cancel one $h$ from each term.
4
Let $h\to 0$: the $3xh$ and $h^2$ terms vanish, leaving $f'(x) = 3x^2$.
Only the $h$-free term survives.
▪ shown
The key insight — spotting the pattern

Look at the two results together: $x^2 \to 2x$ and $x^3 \to 3x^2$. In each case the power dropped by one and the old power appeared as a multiplier out front. That's not a coincidence — it's the general power rule $\dfrac{d}{dx}(x^n) = nx^{n-1}$, and first principles is why it holds. Once you've seen it proved twice, you can use the shortcut with confidence in the next lesson.

Worked example 3

A gradient at a specific point
Given $f(x) = x^2 - 4x$, find $f'(x)$ from first principles, and hence the gradient of the curve at the point where $x = 3$.
MethodDerive, then evaluate
1
$f(x+h) = (x+h)^2 - 4(x+h) = x^2 + 2xh + h^2 - 4x - 4h$.
Expand both parts.
2
Numerator: $f(x+h) - f(x) = 2xh + h^2 - 4h$.
$x^2 - 4x$ cancels.
3
Divide by $h$: $\dfrac{2xh + h^2 - 4h}{h} = 2x + h - 4$.
Cancel the $h$.
4
Let $h\to 0$: $f'(x) = 2x - 4$.
Drop the $h$ term.
5
At $x=3$: $f'(3) = 2(3) - 4 = 2$. The gradient there is $2$.
Substitute the point.
▪ solved
Look deeper — the derivative is a function

Notice $f'(x) = 2x - 4$ is itself a formula, not a single number: feed in any $x$ and it returns the gradient there. That's why $f'$ is called the gradient function or derived function. To get the gradient at a particular point, you evaluate this function at that point — as we did with $f'(3) = 2$. One derivation, then a gradient anywhere on the curve.

Common mistake

You cannot reach the answer by setting $h=0$ at the start — $\dfrac{f(x+h)-f(x)}{h}$ becomes $\tfrac00$, which is undefined. The $h$ must be cancelled from the denominator first (step 3), and only then may you let $h\to 0$. Also, expand $(x+h)^2$ and $(x+h)^3$ in full — writing $(x+h)^2 = x^2 + h^2$ (forgetting the $2xh$) collapses the whole derivation.

Check yourself

Use first principles to show that if $f(x) = 3x^2 + 2$, then $f'(x) = 6x$. Hence find the gradient of the curve at $x = -1$.
(Hint: expand $3(x+h)^2 + 2$, subtract $f(x)$, divide by $h$, then let $h\to 0$.)

Method
1
$f(x+h) = 3(x+h)^2 + 2 = 3x^2 + 6xh + 3h^2 + 2$.
Expand and distribute the 3.
2
Numerator: $f(x+h) - f(x) = 6xh + 3h^2$.
$3x^2 + 2$ cancels.
3
Divide by $h$: $6x + 3h$.
Cancel the $h$.
4
Let $h\to 0$: $f'(x) = 6x$. At $x=-1$: $f'(-1) = 6(-1) = -6$.
Evaluate at the point.
▪ solved

The constant $+2$ vanished the moment we formed the numerator — constants have zero gradient, which is why the derivative of any constant is $0$. The gradient at $x=-1$ is $-6$ (a steep, downward slope).