L'Hôpital's Rule

A 0/0 limit settled by two derivatives.

Zero over zero decides nothing

Put x = 0 into sin x / x and both the top and the bottom are 0. The form 0/0 has no value: it says only that both parts are shrinking, not how their sizes compare as they shrink.

The values nearby do settle it. At x = 0.1, sin x / x = 0.998334, and at x = 0.01 it is 0.999983. The limit of sin x / x as x tends to 0 is 1, which the squeeze theorem proved.

Zoom in: two tangent lines

Take a fraction f(x) / g(x) where f(a) = 0 and g(a) = 0. Near x = a each function is close to its tangent line there. The tangent to f at a passes through (a, 0) with gradient f'(a), so near a, f(x) ≈ f'(a)(x − a). In the same way, g(x) ≈ g'(a)(x − a).

Divide one by the other. The factor (x − a) is on the top and on the bottom, and it cancels, because x is near a but never equal to it. What is left is f'(a)/g'(a), so the limit of f(x) / g(x) as x tends to a is f'(a)/g'(a), provided g'(a) is not 0.

That is L'Hôpital's rule: when a limit gives 0/0, differentiate the top and the bottom separately, and take the limit of the new fraction instead.

sin 2xxwindow ±0.5×2f/g = 1.682f′(0)/g′(0) = 2

near 0, sin 2x ≈ 2x and x ≈ x: the ratio is 1.682 in this window and is heading for f′(0)/g′(0) = 2

Zoom past ×50 and read the ratio of the two lines

The gold curve is sin 2x and the plain line is x, both passing through 0 at x = 0. In a window of ±0.5 the ratio at the edge is 1.682. Drag the zoom up: the curve straightens into its tangent, of gradient 2, and at ±0.02 the ratio is 1.999, closing in on f'(0)/g'(0) = 2/1 = 2.

sin x / x again

Both parts are 0 at x = 0, so the rule applies. The derivative of sin x is cos x and the derivative of x is 1, so sin x / x becomes cos x / 1. At x = 0 that is cos 0 / 1 = 1, the same limit the squeeze theorem gave.

(eˣ − 1) / x is 0/0 at x = 0 too. Differentiating gives eˣ / 1, and e⁰ = 1, so the limit is 1. At x = 0.001 the fraction is 1.0005.

A check by factoring

At x = 1, (x² − 1) / (x − 1) is (1 − 1) ÷ (1 − 1), which is 0/0. Differentiate the top and the bottom separately: 2x / 1, which is 2 at x = 1.

Factoring agrees. x² − 1 = (x − 1)(x + 1), so away from x = 1 the fraction is x + 1, which tends to 2. At x = 1.001 the fraction is 2.001.

In the same way, (x² − 9) / (x − 3) at x = 3 becomes 2x / 1, which is 6 there, and factoring gives x + 3, which is 6 at x = 3.

Check the form first

The rule applies only to 0/0, or to ∞/∞, where the top and the bottom both grow without bound. Before using it, substitute and look at the form. If the bottom is not 0, the substitution already gives the limit.

Take (x² + 1) / (x + 1) at x = 1. Substituting gives 2 ÷ 2 = 1, and that is the limit; at x = 1.001 the fraction is 1.0005. Differentiating the top and the bottom anyway would give 2x / 1, which is 2 at x = 1: a wrong answer, because the form was never 0/0.

For ∞/∞, take (3x + 1) / (x + 2) as x grows without bound. Both parts grow without bound, so the rule applies: the derivatives give 3 ÷ 1, so the limit is 3. At x = 1000 the fraction is 3001/1002 = 2.99501.

A second round

Sometimes the new fraction is still 0/0. Then apply the rule again. (1 − cos x) / x² is 0/0 at x = 0. Differentiating gives sin x / 2x, which is still 0/0 at x = 0. Differentiating again gives cos x / 2, which is 1/2 at x = 0. So the limit is 1/2.

Check: at x = 0.01, (1 − cos x) / x² = 0.499996.

The usual mistakes

Using the quotient rule. The rule differentiates the top and the bottom each on its own. The quotient rule gives the derivative of the whole fraction, which is a different quantity.

Stopping at the new fraction. cos x / 1 is not the answer; substitute x = 0 into it to get 1.

Reading 0/0 as 0, or as 1. Both parts are 0, so the form decides nothing until the derivatives are compared.

Using the rule when the form is not 0/0 or ∞/∞, as with (x² + 1) / (x + 1) at 1.

A charging capacitor

In the application below, the mean current into a capacitor over its first n seconds is a fraction that gives 0/0 at n = 0. The rule finds its limit once, and then twice for the rate at which it falls.

Worked example: A Timing Circuit's Capacitor Charging from Empty: the Mean Current over a First Instant Too Short to Time

Question A 2000-microfarad capacitor in a timing circuit is charged from a 9-volt battery through a 500-ohm resistor. It starts empty, and n seconds after the switch is closed the charge on it is Q = 0.018(1 − e−n) coulombs, so the mean current over those first n seconds is I = 0.018(1 − e−n)n amperes. That formula cannot be worked out at n = 0. (a) Find the limit of I as n tends to 0, in milliamperes, and check it against the current Ohm's law gives while the capacitor is still empty. (b) Find the limit, as n tends to 0, of 0.018 − In, in amperes per second, and use it to estimate the mean current over the first 0.1 seconds, in milliamperes.

  1. 1.Put n = 0 into I = 0.018(1 − e−n)n: the top is 0.018(1 − 1) = 0 and the bottom is 0. The formula gives 00, which decides nothing, so the limit has to be found another way.

    051015200123seconds since the switch closed, nmean current, mAno value from the formulan = 0: top 0.018(1 − 1) = 0bottom 0, so 0/0 decides nothing
    051015200123seconds since the switch closed, nmean current, mAno value from the formulan = 0: top 0.018(1 − 1) = 0bottom 0, so 0/0 decides nothing
    At n = 0 the formula for the mean current is 00: the curve has a gap exactly where the switch closes.
  2. 2.Both top and bottom tend to zero, so L'Hôpital's rule applies. Differentiate each separately: the top gives 0.018e−n and the bottom gives 1. So limn → 0 I = 0.018e01 = 0.018 A.

    051015200123seconds since the switch closed, nmean current, mAno value from the formulatop: 0.018e−nbottom: 1limit = 0.018e0/1 = 0.018 A
    051015200123seconds since the switch closed, nmean current, mAno value from the formulatop: 0.018e−nbottom: 1limit = 0.018e0/1 = 0.018 A
    Top and bottom both tend to zero, so differentiate each: 0.018e−n1, which tends to 0.018 A.
  3. 3.(a) The mean current closes in on 0.018 A, which is 18 mA. Check: while the capacitor is empty there is no voltage across it, so the whole 9 V lies across the resistor and Ohm's law gives 9500 = 0.018 A.

    051015200123seconds since the switch closed, nmean current, mA(0, 18)I closes in on 18 mAOhm: 9/500 = 0.018 A, the same
    051015200123seconds since the switch closed, nmean current, mA(0, 18)I closes in on 18 mAOhm: 9/500 = 0.018 A, the same
    (a) The mean current closes in on 18 mA, the 9500 A that Ohm's law gives while the capacitor is empty.
  4. 4.For (b), write the fraction over one line: 0.018 − In = 0.018n − 0.018(1 − e−n)n2 = 0.018(n − 1 + e−n)n2. At n = 0 the top is 0.018(0 − 1 + 1) = 0 and the bottom is 0. Differentiating both gives 0.018(1 − e−n)2n, which is still 00 at n = 0, so differentiate both again: 0.018e−n2, which tends to 0.0182 = 0.009.

    051015200123seconds since the switch closed, nmean current, mA(0, 18)(0.018 − I)/n = 0.018(n − 1 + e−n)/n2once: 0.018(1 − e−n)/(2n), still 0/0twice: 0.018e−n/2 gives 0.009
    051015200123seconds since the switch closed, nmean current, mA(0, 18)(0.018 − I)/n = 0.018(n − 1 + e−n)/n2once: 0.018(1 − e−n)/(2n), still 0/0twice: 0.018e−n/2 gives 0.009
    Over one line, 0.018 − In = 0.018(n − 1 + e−n)n2; one round of the rule leaves 00 again, and a second gives 0.018e−n2, which tends to 0.009.
  5. 5.(b) The limit is 0.009 amperes a second, or 9 mA a second, so over a short first interval of n seconds the mean current is about 18 − 9n mA. For the first 0.1 seconds that is 18 − 0.9 = 17.1 mA. Check: the formula itself gives 0.018(1 − e−0.1)0.1 = 0.18 × 0.09516 = 0.01713 A, which is 17.13 mA.

    051015200123seconds since the switch closed, nmean current, mA18 − 9n(0, 18)I is about 18 − 9n mA for small nn = 0.1: 18 − 0.9 = 17.1 mAthe formula gives 17.13 mA
    051015200123seconds since the switch closed, nmean current, mA18 − 9n(0, 18)I is about 18 − 9n mA for small nn = 0.1: 18 − 0.9 = 17.1 mAthe formula gives 17.13 mA
    (b) The curve leaves 18 mA along the line 18 − 9n, so the first 0.1 seconds average about 17.1 mA; the formula gives 17.13 mA.

Answer: (a) 18 mA, the same as the 9500 = 0.018 A Ohm's law gives for the empty capacitor; (b) the limit is 0.009 amperes a second, so the mean current over the first 0.1 seconds is about 18 − 0.9 = 17.1 mA (the formula gives 17.13 mA)

Common mistakes

  • Differentiating the whole fraction by the quotient rule. L'Hôpital's rule differentiates the top and the bottom each on its own; the quotient rule gives the derivative of I, a different quantity, and at n = 0 it is itself zero over zero.
  • Stopping after one round in (b). One differentiation leaves 0.018(1 − e−n)2n, which is still zero over zero at n = 0 and so has no value there yet; the rule is applied again until the bottom no longer tends to zero.

More using differentiation problems, worked step by step →

Practice L'Hôpital's Rule in the app