Instant PDF download, name-and-email checkout. Complete bundle: every Economics, Statistics and Mathematics book
Mathematics guide, Unit 2, step 11 of 33Previous stepNext step

Step 11: The Derivative from First Principles

SyllabusAP 2.1–2.4 · 9709 P1 1.7 · IB SL 5.1, HL 5.12
In 30 seconds
  • The gradient of a chord is an average rate of change. Slide one end towards the other and the chord gradients settle on the gradient of the tangent: the instantaneous rate of change.
  • That limit is the derivative: \( f'(a) = \displaystyle\lim_{h \to 0} \frac{f(a+h)-f(a)}{h} \). It is written \( f'(x) \), \( \dfrac{dy}{dx} \) or \( \dfrac{d}{dx}(\ldots) \).
  • A function is differentiable at \( a \) only if the chord gradients from both sides agree on one finite number. Differentiable implies continuous, but a corner, a cusp or a vertical tangent can be continuous and still not differentiable.
  • Exam point: from a table you cannot take a limit, so estimate \( f'(a) \) with the chord that straddles \( a \), and always give the units (units of \( y \) per unit of \( x \)).
Video lesson coming soonA short animated lesson for this step will appear here.

From chords to tangents

A straight line has one gradient everywhere. A curve does not: \( y = x^2 + 2x \) is gentle near \( x = -1 \) and steep by \( x = 3 \). So what can “the gradient at a point” mean? This step answers that question, and the answer is the single most important idea in calculus.

Start with something you can already measure. A chord joins two points on a curve, and its gradient is rise over run. If the two points are at \( x = a \) and \( x = b \), the chord gradient is

\[ \frac{f(b)-f(a)}{b-a}, \]

which is the average rate of change of \( f \) over the interval from \( a \) to \( b \). A car that travels 150 km in 2 hours has an average speed of 75 km per hour, even if it sat at traffic lights for part of the time.

Now take the curve \( y = x^2 + 2x \) and the point \( P(1, 3) \). Put the second point at \( x = 1 + h \), a little to the right. The chord gradient is

\[ \frac{\big[(1+h)^2 + 2(1+h)\big]-3}{h} = 4 + h. \]

(Expand the top to get \( 4h + h^2 \), then cancel the \( h \), which is allowed because \( h \neq 0 \).)

With \( h = 2, 1, 0.5, 0.1, 0.01 \) the chord gradients are \( 6, 5, 4.5, 4.1, 4.01 \). They close in on 4, and the chords themselves swing round towards one line through \( P \): the tangent, \( y = 4x-1 \). The gradient of the curve at \( P \) is 4. You never put \( h = 0 \), which would give the meaningless \( \tfrac{0}{0} \); you ask what the chord gradients approach.

Chords of y = x² + 2x from P(1, 3)
y = x² + 2xchord, h = 2: gradient 6chord, h = 1: gradient 5chord, h = 0.5: gradient 4.5tangent y = 4x − 1: gradient 4
−11234812160xyP(1, 3)h = 2h = 1
Figure 1. Each chord joins P(1, 3) to the point where x = 1 + h. Its gradient is 4 + h. As h shrinks the chords swing round towards the tangent, whose gradient is 4.

Repeat this at a general point \( a \) and you have the definition.

Key termDerivative at a point: \( f'(a) = \displaystyle\lim_{h \to 0} \frac{f(a+h)-f(a)}{h} \), provided this limit exists and is a finite number. The fraction is the gradient of a chord (the difference quotient); the limit is the gradient of the tangent, the instantaneous rate of change of \( f \) at \( a \).

There is a second, equivalent form, which AP Calculus uses often. Call the moving point \( x \) instead of \( a + h \):

\[ f'(a) = \lim_{x \to a} \frac{f(x)-f(a)}{x-a}. \]

Both say the same thing: chord gradient, then limit.

Notation, and reading a limit as a derivative

Write \( y = f(x) \). Three notations are in everyday use, and you need all of them.

NotationRead asBest used for
\( f'(x) \), \( f'(3) \)“f dash of x”the derivative as a function, or its value at a point
\( \dfrac{dy}{dx} \)“dee y by dee x”naming both variables, for example \( \dfrac{dP}{dt} \) for price over time
\( \dfrac{d}{dx}(x^2 + 2x) \)“the derivative of”an instruction: differentiate this with respect to \( x \)

Leibniz’s \( \dfrac{dy}{dx} \) grows out of the chord gradient \( \dfrac{\Delta y}{\Delta x} \): as the change \( \Delta x \) shrinks to nothing, the \( \Delta \)s become \( d \)s. Treat it as one symbol, not a fraction, for now. Because the derivative has a value at every \( x \), it is itself a function, called the derivative function or gradient function.

A favourite AP multiple-choice question runs the definition backwards. You are shown a limit and asked for its value. Spot the pattern “\( f(a+h)-f(a) \) over \( h \)” and the limit is just \( f'(a) \).

Worked example

Evaluate \( \displaystyle\lim_{h \to 0} \frac{(4+h)^2 + 2(4+h)-24}{h} \) by recognising it as a derivative.

Step 1Match it to \( \dfrac{f(a+h)-f(a)}{h} \). With \( f(x) = x^2 + 2x \) and \( a = 4 \), \( f(4) = 16 + 8 = 24 \). It fits exactly.
Step 2So the limit is \( f'(4) \), the gradient of \( y = x^2 + 2x \) at \( x = 4 \).
Step 3Evaluate it: the numerator is \( 16 + 8h + h^2 + 8 + 2h-24 = 10h + h^2 \), so the quotient is \( 10 + h \to 10 \).

The value of the limit is 10: the gradient of \( y = x^2 + 2x \) at the point \( (4, 24) \).

Differentiation from first principles

Using the definition directly to find \( f'(x) \) is called differentiating from first principles. The method never changes:

StepWhat you do
1Write the difference quotient \( \dfrac{f(x+h)-f(x)}{h} \).
2Expand, combine fractions or use a conjugate until every term on top has a factor of \( h \).
3Cancel the \( h \), which is allowed because \( h \neq 0 \).
4Only now let \( h \to 0 \).
Worked example

Find \( f'(x) \) from first principles when \( f(x) = 3x^2-x \).

Step 1\( f(x+h) = 3(x+h)^2-(x+h) = 3x^2 + 6xh + 3h^2-x-h \).
Step 2Subtract \( f(x) = 3x^2-x \): \( f(x+h)-f(x) = 6xh + 3h^2-h \). Every term contains \( h \).
Step 3\( f'(x) = \displaystyle\lim_{h \to 0} \frac{6xh + 3h^2-h}{h} = \lim_{h \to 0} (6x + 3h-1) \).
Step 4Let \( h \to 0 \): \( f'(x) = 6x-1 \).

So the gradient at \( x = 2 \) is 11, and the gradient is zero at \( x = \tfrac{1}{6} \), the bottom of this parabola.

When \( f \) is a fraction, combine the two fractions in the numerator over a common denominator before you do anything else.

Worked example

Differentiate \( f(x) = \dfrac{2}{x} \) from first principles, for \( x \neq 0 \).

Step 1Numerator: \( \dfrac{2}{x+h}-\dfrac{2}{x} = \dfrac{2x-2(x+h)}{x(x+h)} = \dfrac{-2h}{x(x+h)} \).
Step 2Divide by \( h \): \( \dfrac{f(x+h)-f(x)}{h} = \dfrac{-2}{x(x+h)} \).
Step 3Let \( h \to 0 \): \( f'(x) = -\dfrac{2}{x^2} \).

The derivative is negative for every \( x \neq 0 \), which fits the graph of \( y = \tfrac{2}{x} \): both branches fall from left to right. For a square root, such as \( \sqrt{x} \), multiply top and bottom by the conjugate \( \sqrt{x+h} + \sqrt{x} \) instead; Q4 below uses this.

Common mistakePutting \( h = 0 \) too early, or dropping the limit sign halfway through. \( \dfrac{(x+h)^2-x^2}{h} \) at \( h = 0 \) is \( \tfrac{0}{0} \), which tells you nothing. Cancel the \( h \) first, and keep writing “\( \lim_{h \to 0} \)” on every line until the line where you actually let \( h \to 0 \). Examiners award the method marks for exactly this layout.

An economics example: marginal cost. A firm’s total cost of producing \( Q \) units is \( TC = 200 + 6Q + 0.2Q^2 \) dollars. The cost of raising output from \( Q \) to \( Q + h \) is \( TC(Q+h)-TC(Q) = 6h + 0.4Qh + 0.2h^2 \). Divide by \( h \) and let \( h \to 0 \): the rate at which cost rises is \( 6 + 0.4Q \) dollars per unit. This is marginal cost, \( MC = \dfrac{d(TC)}{dQ} \). At \( Q = 20 \) it is $14 per unit, so the 21st unit costs roughly $14 to make. Notice that the fixed cost of $200 cancelled out completely. That is good economics as well as good algebra: a cost you pay whatever you produce cannot change the cost of one more unit.

Exam tipKnow where first principles is tested. AP Calculus (topics 2.1 to 2.4) expects you to use and recognise the limit definition. IB AA puts formal first-principles derivations in the HL content (5.12); SL needs only the idea of the derivative as a limit. Cambridge 9709 Paper 1 asks you to understand the gradient as the limit of a sequence of chord gradients, typically by working out chord gradients for shrinking intervals, as in Figure 1.

Differentiability and continuity

A derivative exists only if the chord gradients settle on the same finite number whether \( h \) shrinks through positive values or through negative ones. Smooth curves pass this test easily. Three kinds of point fail it, even though the curve is unbroken:

TypeExample at \( x = 0 \)What the chord gradients do
Corner\( |x| \)\( \dfrac{|h|}{h} \) is \( +1 \) from the right and \( -1 \) from the left: two different limits
Cusp\( x^{2/3} \)\( h^{-1/3} \) heads to \( +\infty \) from the right and \( -\infty \) from the left
Vertical tangent\( x^{1/3} \)\( h^{-2/3} \to +\infty \) from both sides: the tangent is the line \( x = 0 \), whose gradient is undefined

Figure 2 shows a corner in a less obvious place. For \( y = |x^2-4| \), the part of the parabola below the axis is reflected upwards. Just left of \( x = 2 \) the curve is \( 4-x^2 \), with gradient \( -2x \to -4 \); just right of it the curve is \( x^2-4 \), with gradient \( 2x \to 4 \). The two sides disagree, so there is no derivative at \( x = 2 \).

y = |x² − 4|: continuous everywhere, with two corners
y = |x² − 4|right-hand gradient at x = 2 is +4left-hand gradient at x = 2 is −4
−3−2−112324680xy(2, 0)(−2, 0)
Figure 2. The graph has no gap at x = ±2, so the function is continuous there. But the gradient jumps from −4 to +4 as you pass x = 2, so no single tangent exists and the function is not differentiable at x = 2 (or, by symmetry, at x = −2).
Key termDifferentiability implies continuity: if \( f \) is differentiable at \( a \), then \( f \) is continuous at \( a \). The converse is false: \( |x| \) is continuous at 0 but not differentiable there.

The reason takes one line. For \( h \neq 0 \), \( f(a+h)-f(a) = h \times \dfrac{f(a+h)-f(a)}{h} \). As \( h \to 0 \) this tends to \( 0 \times f'(a) = 0 \), so \( f(a+h) \to f(a) \), which is exactly continuity. Turn it round and you get a useful test: if a function has a jump, a hole or an asymptote at \( a \), it cannot be differentiable there (continuity was covered in Step 10).

Worked example

\( f(x) = x^2 + 1 \) for \( x \le 2 \) and \( f(x) = ax + b \) for \( x > 2 \). Find \( a \) and \( b \) so that \( f \) is differentiable at \( x = 2 \).

Step 1Differentiable needs continuous first, so the pieces must meet at \( x = 2 \): \( 2^2 + 1 = 2a + b \), that is \( 2a + b = 5 \).
Step 2The gradients from the two sides must agree. On the left, \( \dfrac{d}{dx}(x^2 + 1) = 2x \) (from first principles, as for \( x^2 \)), which is 4 at \( x = 2 \). On the right the gradient is \( a \). So \( a = 4 \).
Step 3Then \( b = 5-2a = -3 \).

The line \( y = 4x-3 \) is the tangent to \( y = x^2 + 1 \) at \( (2, 5) \), so the join is perfectly smooth. Matching only the values (Step 1) would give a continuous function with a corner.

Estimating derivatives from tables and graphs

Real data rarely come with a formula. When all you have is a table, you cannot let \( h \to 0 \); the best you can do is the gradient of a short chord. The most accurate simple choice is the symmetric (or central) chord, which uses one data point on each side of \( a \):

\[ f'(a) \approx \frac{f(a+h)-f(a-h)}{2h}. \]

AP questions say “use the data in the table to estimate” and accept any chord that straddles the point, but the answer must come with units and, often, a sentence of interpretation.

Worked example

A firm records its total cost \( TC \) (in dollars) at five output levels \( Q \).

\( Q \)1020304050
\( TC \) ($)4005206708601100

Estimate the marginal cost at \( Q = 30 \), and interpret your answer.

Step 1Use the points either side of \( Q = 30 \): \( MC(30) \approx \dfrac{TC(40)-TC(20)}{40-20} = \dfrac{860-520}{20} = 17 \).
Step 2Units: dollars divided by units of output, so dollars per unit.
Step 3Compare the one-sided chords: \( \dfrac{860-670}{10} = 19 \) and \( \dfrac{670-520}{10} = 15 \). Cost is rising more and more steeply, so one overestimates and the other underestimates; the symmetric chord is their average.

At an output of 30 units, total cost is rising at about $17 per additional unit of output.

Total cost data with the symmetric chord at Q = 30 $
recorded total costsymmetric chord from Q = 20 to Q = 40: gradient 17parallel line through (30, 670): estimated tangent
1020304050200400600800100012000output, Qtotal cost ($)(10, 400)(20, 520)(30, 670)(40, 860)(50, 1100)
Figure 3. Only five data points are known, so the derivative at Q = 30 is estimated by the chord that straddles it (solid). A line through (30, 670) with the same gradient (dashed) is the estimated tangent. The gradient, (860 − 520) ÷ 20 = 17, estimates marginal cost at $17 per unit.

A graph lets you go further and sketch the whole derivative function. Read off the gradient of \( y = f(x) \) at many points and plot those gradients as a new curve. Where \( f \) is increasing, \( f’ \) is above the axis. Where \( f \) is decreasing, \( f’ \) is below it. Where \( f \) has a horizontal tangent, such as the top of a hill, \( f’ \) crosses zero. And where \( f \) has a corner, \( f’ \) jumps: for \( |x^2-4| \) in Figure 2, \( f’ \) jumps from \( -4 \) to \( +4 \) at \( x = 2 \).

Common mistakeReading \( f(a) \) when the question asks for \( f'(a) \). On a graph of \( f \), the derivative at a point is the steepness there, not the height. A curve can be high up and flat (\( f’ = 0 \)) or below the axis and climbing steeply (\( f’ \) large and positive).

Practise: 6 questions

Try each one on paper first, then check the worked answer.

EasyQ1. For \( y = x^2 \), find the gradient of the chord from \( x = 3 \) to \( x = 3.1 \). What does this suggest about the gradient of the curve at \( x = 3 \)? Show worked answer
The points are \( (3, 9) \) and \( (3.1, 9.61) \).
Chord gradient: \( \dfrac{9.61-9}{0.1} = \dfrac{0.61}{0.1} = 6.1 \).
In general the chord from \( 3 \) to \( 3 + h \) has gradient \( \dfrac{(3+h)^2-9}{h} = 6 + h \), which tends to 6.
So the gradient of the curve at \( x = 3 \) is 6.
EasyQ2. Find the average rate of change of \( f(x) = x^3 \) over the interval \( 1 \le x \le 3 \). Show worked answer
Average rate of change \( = \dfrac{f(3)-f(1)}{3-1} \).
\( = \dfrac{27-1}{2} = 13 \).
This is the gradient of the chord joining \( (1, 1) \) to \( (3, 27) \).
MediumQ3. Differentiate \( f(x) = x^2-5x + 2 \) from first principles. Show worked answer
\( f(x+h) = x^2 + 2xh + h^2-5x-5h + 2 \).
\( f(x+h)-f(x) = 2xh + h^2-5h \).
\( f'(x) = \displaystyle\lim_{h \to 0} \frac{2xh + h^2-5h}{h} = \lim_{h \to 0} (2x + h-5) \).
So \( f'(x) = 2x-5 \).
MediumQ4. Differentiate \( f(x) = \sqrt{x + 3} \) from first principles, for \( x > -3 \). Show worked answer
Difference quotient: \( \dfrac{\sqrt{x + h + 3}-\sqrt{x + 3}}{h} \).
Multiply top and bottom by the conjugate \( \sqrt{x + h + 3} + \sqrt{x + 3} \).
Top becomes \( (x + h + 3)-(x + 3) = h \), so the quotient is \( \dfrac{1}{\sqrt{x + h + 3} + \sqrt{x + 3}} \).
Let \( h \to 0 \): \( f'(x) = \dfrac{1}{2\sqrt{x + 3}} \).
MediumQ5. The volume of water \( V \) litres in a tank is recorded every 5 minutes: at \( t = 0, 5, 10, 15, 20 \) the readings are \( V = 120, 150, 172, 186, 194 \). Estimate \( V'(10) \), with units, and say what it means. Show worked answer
Use the symmetric chord from \( t = 5 \) to \( t = 15 \).
\( V'(10) \approx \dfrac{186-150}{15-5} = \dfrac{36}{10} = 3.6 \).
Units: litres per minute.
At \( t = 10 \) minutes, the volume of water is increasing at about 3.6 litres per minute.
ExamQ6. The function \( f \) is defined by \( f(x) = kx^2 \) for \( x \le 1 \) and \( f(x) = 3x + m \) for \( x > 1 \), where \( k \) and \( m \) are constants. (a) Given that \( f \) is continuous at \( x = 1 \), write an equation relating \( k \) and \( m \). [1] (b) Given also that \( f \) is differentiable at \( x = 1 \), find \( k \) and \( m \). [3] (c) Using your answers, find the value of \( \displaystyle\lim_{h \to 0} \frac{f(1+h)-f(1)}{h} \). [1] (d) Explain why a function that is differentiable at \( x = 1 \) must be continuous there. [2] Show worked answer
(a) Values must agree at \( x = 1 \): \( k = 3 + m \). [B1]
(b) Gradient from the left: \( \dfrac{d}{dx}(kx^2) = 2kx \), which is \( 2k \) at \( x = 1 \). Gradient from the right: 3. [M1]
So \( 2k = 3 \), giving \( k = \tfrac{3}{2} \). [A1]
Then \( m = k-3 = -\tfrac{3}{2} \). [A1]
(c) The limit is \( f'(1) = 3 \). [B1]
(d) \( f(1+h)-f(1) = h \times \dfrac{f(1+h)-f(1)}{h} \). [M1]
As \( h \to 0 \) this tends to \( 0 \times f'(1) = 0 \), so \( f(1+h) \to f(1) \), which is the definition of continuity at \( x = 1 \). [A1]
Total: 7 marks.

Check yourself

1. What is the value of \( \displaystyle\lim_{h \to 0} \frac{(2+h)^3-8}{h} \)?

This is \( f'(2) \) for \( f(x) = x^3 \). The numerator is \( 12h + 6h^2 + h^3 \), so the quotient is \( 12 + 6h + h^2 \to 12 \).

2. Which function is continuous at \( x = 0 \) but not differentiable there?

\( |x| \) has a corner at 0: chord gradients are \( +1 \) from the right and \( -1 \) from the left. \( x^2 \) is differentiable at 0, and \( \tfrac{1}{x} \) is not even defined there.

3. If \( f \) is differentiable at \( x = a \), which statement must be true?

Differentiability implies continuity. Nothing forces the value or the sign of the gradient.

Your score: 0 out of 3

The short version

  • A chord gradient \( \dfrac{f(b)-f(a)}{b-a} \) is an average rate of change; its limit as the chord shrinks is the instantaneous rate of change, the gradient of the tangent.
  • \( f'(a) = \displaystyle\lim_{h \to 0} \frac{f(a+h)-f(a)}{h} = \lim_{x \to a} \frac{f(x)-f(a)}{x-a} \). Notation: \( f'(x) \), \( \dfrac{dy}{dx} \), \( \dfrac{d}{dx} \).
  • First principles: simplify the difference quotient until the \( h \) cancels, then let \( h \to 0 \). Keep the limit sign on every line.
  • Differentiable implies continuous, not the other way round. Corners, cusps and vertical tangents are continuous but not differentiable.
  • From a table, estimate \( f'(a) \) with the chord that straddles \( a \), and give units of \( y \) per unit of \( x \).
  • The full chapter in Mathematics Made Simple has many more worked examples and a full set of practice questions with a complete answer key.
Want more questions like these, with worked answers?
The practice book has hundreds more, graded from easy to exam level.
Next: step 12 of 33Power, Product and Quotient Rules