Differentiating From First Principles

Expand, divide by h, then let h vanish.

The difference quotient

Every derivation from first principles starts in the same place. Take a point x on the curve y = f(x) and a second point a step h further along, at x + h. The rise between them is f(x + h) − f(x), and the run is h.

Dividing the rise by the run gives the gradient of the chord: (f(x + h) − f(x)) / h. This is called the difference quotient. The derivative is its limit as h tends to 0: f'(x) = lim (f(x + h) − f(x)) / h as h → 0.

The method has four moves, always in this order: write the rise out in full, simplify it, divide by h, and only then let h tend to 0.

xyh = 1.5rise 5.25(1, 1)(2.5, 6.25)

On y = x², the step from x = 1 to x = 2.5 has run h = 1.5. The rise is f(2.5) − f(1) = 6.25 − 1 = 5.25, so the difference quotient is 5.25 ÷ 1.5 = 3.5, the gradient of the chord.

Write the difference out in full

For f(x) = x², the rise is (x + h)² − x². Expand the bracket: (x + h)² = x² + 2xh + h², and the x² cancels with the − x², leaving 2xh + h².

Every term that is left has a factor h. A chord has h not equal to 0, so dividing by h is allowed: (2xh + h²) / h = 2x + h. Check it on the chord above: with x = 1 and h = 1.5, 2x + h = 2 + 1.5 = 3.5, the gradient found from the two points.

Only now let h vanish

The chord gradient is now 2x + h, with no h in a denominator. As h tends to 0 it tends to 2x, so f'(x) = 2x. At x = 1 the chord gradients 3.5, 3 and 2.5, for h = 1.5, 1 and 0.5, close in on 2.

The order matters. Putting h = 0 into ((x + h)² − x²) / h at the start gives (x² − x²) / 0 = 0/0, which is not a number. Dividing first removes the h that makes the denominator 0, and after that, putting h = 0 into 2x + h is safe.

Chords of y = x² from x = 1 with h = 1.5, 1 and 0.5, each fainter than the last. Their gradients are 2x + h = 3.5, 3 and 2.5, and they close on the tangent at (1, 1), whose gradient is 2.

A cube

For f(x) = x³, the rise is (x + h)³ − x³. Expand: (x + h)³ = x³ + 3x²h + 3xh² + h³, so the rise is 3x²h + 3xh² + h³ once the x³ cancels.

Divide by h: 3x² + 3xh + h². Every term after the first still carries an h, so as h tends to 0 they tend to 0, and f'(x) = 3x².

Check it at x = 2, where 3x² = 12. With h = 0.1 the quotient is (2.1³ − 8) / 0.1 = (9.261 − 8) / 0.1 = 12.61, which is 12 + 3 × 2 × 0.1 + 0.1² = 12 + 0.6 + 0.01. The table shows both sides closing in on 12.

2 to 2 + h2 − h to 20.112.6111.410.0112.060111.94010.00112.00600111.994001

Chord gradients of y = x³ for chords of width h with one end at x = 2. Each row is one width h; the first column has the chord to the right of 2 and the second the chord to the left. They close in on 12 from above and from below, as 3x² + 3xh + h² says they must.

A line, and a curve lifted by 1

For f(x) = 3x, the rise is 3(x + h) − 3x = 3h, and 3h / h = 3. No h is left, so there is nothing to wait for: the derivative is 3 at every x. It is not 0, because 3x climbs 3 for every 1 across.

For f(x) = x² + 1, the rise is (x + h)² + 1 − (x² + 1). The two 1s cancel, leaving (x + h)² − x² = 2xh + h², exactly as for x². So the derivative is 2x again: the + 1 lifts the curve and does not change its gradient anywhere.

A reciprocal

For f(x) = 1/x, the rise is 1/(x + h) − 1/x. Put it over the common denominator x(x + h): (x − (x + h)) / (x(x + h)) = −h / (x(x + h)).

Divide by h: −1 / (x(x + h)). As h tends to 0, x + h tends to x, so f'(x) = −1/x². The minus sign says the curve falls everywhere, for x positive or negative.

Check it at x = 2, where −1/x² = −0.25. With h = 0.1 the quotient is (1/2.1 − 1/2) ÷ 0.1 = −0.238095; with h = 0.01 it is −0.248756; with h = 0.001 it is −0.249875.

xy(2, 0.5)

The curve y = 1/x and its tangent at (2, 0.5), the line y = −0.25x + 1. Its gradient is −1/x² at x = 2, which is −0.25.

A square root

For f(x) = √x, the quotient is (√(x + h) − √x) / h, and no expansion clears the h. Multiply the numerator and the denominator by √(x + h) + √x. The numerator becomes a difference of two squares: (√(x + h) − √x)(√(x + h) + √x) = (x + h) − x = h.

So the quotient is h / (h(√(x + h) + √x)) = 1 / (√(x + h) + √x), and as h tends to 0 this tends to 1 / (2√x). At x = 4 that is 1/4 = 0.25. With h = 0.1 the quotient is 0.248457, with h = 0.01 it is 0.249844, and with h = 0.001 it is 0.249984.

The usual mistakes

Putting h = 0 before dividing by h. That gives 0/0, which decides nothing; the h in the denominator must be divided out first.

Expanding (x + h)² as x² + h². The middle term 2xh is lost, and it is the term the derivative comes from.

Writing f(x) + h for f(x + h). For x² that gives a rise of (x² + h) − x² = h and a quotient of 1, which is wrong: f(x + h) means x + h put in place of x.

Multiplying by the power without lowering it. For x² the surviving term is 2xh, one power of x down, so the answer is 2x and not 2x².

Leaving h in the answer. 2x + h is the gradient of a chord; the derivative is its limit, 2x.

A reservoir

In the application below, the depth of a reservoir in a dry spell is 120 − 0.5x² centimeters on day x. The rise over a step h is worked out in full, divided by h, and only then is h let tend to 0, giving the rate the depth falls. On day 6 the rain starts, and the quotients from the two sides of day 6 tend to two different numbers.

Worked example: A Reservoir Through a Dry Spell and Then Rain: a Derivative from First Principles, and a Day That Has None

Question A reservoir is measured every day. For the first 6 days its depth is D = 120 − 0.5x2 centimeters, where x is the number of days since the measurements began. Rain then sets in, and from day 6 onwards the depth is D = 102 + 5(x − 6) centimeters. (a) Differentiate the dry-spell depth from first principles and give the rate on day 4. (b) Show that the depth has no derivative on day 6.

  1. 1.Let f(x) = 120 − 0.5x2 be the depth during the dry spell. Then f(x + h) − f(x) = −0.5[(x + h)2 − x2] = −xh − 0.5h2.

    90100110120130140024681012days, xdepth, cm(4, 112)f(x) = 120 − 0.5x2on the dry days
    90100110120130140024681012days, xdepth, cm(4, 112)f(x) = 120 − 0.5x2on the dry days
    For the first six days the depth is f(x) = 120 − 0.5x2, and the dot is day 4.
  2. 2.Divide by the step: f(x + h) − f(x)h = −x − 0.5h.

    90100110120130140024681012days, xdepth, cm(4, 112)hquotient at x = 40.1−4.050.01−4.0050.001−4.0005f(x + h) − f(x) = −xh − 0.5h2divide by h: −x − 0.5h
    90100110120130140024681012days, xdepth, cm(4, 112)hquotient at x = 40.1−4.050.01−4.0050.001−4.0005f(x + h) − f(x) = −xh − 0.5h2divide by h: −x − 0.5h
    The difference over a step h is −xh − 0.5h2, so the quotient is −x − 0.5h.
  3. 3.Let h tend to zero: f'(x) = −x. At x = 4 the quotient is −4.05 for h = 0.1, −4.005 for h = 0.01 and −4.0005 for h = 0.001, closing in on −4.

    90100110120130140024681012days, xdepth, cm(4, 112)hquotient at x = 40.1−4.050.01−4.0050.001−4.0005as h tends to 0, the quotient tends to −x
    90100110120130140024681012days, xdepth, cm(4, 112)hquotient at x = 40.1−4.050.01−4.0050.001−4.0005as h tends to 0, the quotient tends to −x
    The table shows the quotient at x = 4 closing in on −4 as the step shrinks: f'(x) = −x.
  4. 4.(a) On day 4 the depth is falling at 4 centimeters a day, so dDdx = −4 there.

    90100110120130140024681012days, xdepth, cm(4, 112)day 4: the depth falls 4 cm a day
    90100110120130140024681012days, xdepth, cm(4, 112)day 4: the depth falls 4 cm a day
    (a) On day 4 the tangent falls 4 cm for each day: dDdx = −4.
  5. 5.On day 6 the dry-spell piece gives a left-hand quotient tending to f'(6) = −6, while the rain line D = 102 + 5(x − 6) is straight and gives a right-hand quotient of exactly 5.

    90100110120130140024681012days, xdepth, cm−6 cm a day5 cm a day(6, 102)from the left the quotient tends to −6from the right it is exactly 5
    90100110120130140024681012days, xdepth, cm−6 cm a day5 cm a day(6, 102)from the left the quotient tends to −6from the right it is exactly 5
    At the corner the dry-spell piece arrives with gradient −6 and the rain line leaves with gradient 5.
  6. 6.(b) The two one-sided rates, −6 and 5 centimeters a day, are different, so there is no derivative on day 6: the graph has a corner. The depth itself is unbroken, because both pieces give 102 centimeters there.

    90100110120130140024681012days, xdepth, cm−6 cm a day5 cm a day(6, 102)the two rates differ: no derivativethe depth is 102 cm from both sides
    90100110120130140024681012days, xdepth, cm−6 cm a day5 cm a day(6, 102)the two rates differ: no derivativethe depth is 102 cm from both sides
    (b) The one-sided rates differ, so there is no derivative on day 6. The depth itself is unbroken at 102 cm.

Answer: (a) f'(x) = −x, so the depth is falling at −4 centimeters a day on day 4; (b) the one-sided rates are −6 and 5 centimeters a day, so there is no derivative on day 6

Common mistakes

  • Putting h = 0 into the difference quotient before it is simplified. That gives 00, which is no number at all; the h in the denominator must be canceled first.
  • Saying the depth jumps on day 6 because the derivative fails there. A corner and a jump are different: the depth is 102 centimeters from both sides, so it is unbroken, and only its rate disagrees.

More rules of differentiation problems, worked step by step →

Practice Differentiating From First Principles in the app