L'Hôpital's Rule

Published on 2026-11-04·v1.0

Learning Objectives

  • State L'Hôpital's Rule for 00\frac00 and ∞∞\frac{\infty}{\infty} with all of its hypotheses, including the one that is most often forgotten: the limit of the derivative quotient must exist.
  • Recognize limits where the rule does not apply, and limits where it applies but does not help.
  • Rewrite the forms 0⋅∞0 \cdot \infty, ∞−∞\infty - \infty, 1∞1^\infty, 000^0, and ∞0\infty^0 so that the rule becomes usable.
  • Prove that logarithms grow slower than any positive power, and powers slower than exponentials, and connect this to comparing algorithm running times.

Context & Motivation

The limit laws in limit-laws-and-indeterminate-forms say nothing when a quotient has the form 00\frac00 or ∞∞\frac{\infty}{\infty}. Factoring and rationalizing work for algebraic expressions, but they are hopeless for something like ex−1−xx2\frac{e^x - 1 - x}{x^2} as x→0x \to 0. L'Hôpital's Rule replaces the quotient of two functions by the quotient of their derivatives, which is often much simpler. The idea is that near the limit point a differentiable function behaves like its tangent line, so the ratio of the functions behaves like the ratio of the slopes.

The rule is also the standard tool for the dominance hierarchy in limits-at-infinity-and-asymptotic-growth, which is the calculus under big-o-and-asymptotic-complexity: it proves that nln⁡nn \ln n grows more slowly than n1.5n^{1.5} and that polynomials grow more slowly than exponentials. But the rule is a theorem with hypotheses, and treating it as a mechanical "differentiate top and bottom" habit is a reliable source of wrong answers. This lesson spends as much time on when it fails as on when it works.

Core Theory

The statement

L'Hôpital's Rule. Let ff and gg be differentiable on an open interval containing aa, except possibly at aa itself, with g′(x)≠0g'(x) \ne 0 for x≠ax \ne a in that interval. Suppose

  1. lim⁡x→af(x)=0\lim_{x \to a} f(x) = 0 and lim⁡x→ag(x)=0\lim_{x \to a} g(x) = 0, or both ∣f∣\lvert f\rvert and ∣g∣\lvert g\rvert tend to ∞\infty; and
  2. lim⁡x→af′(x)g′(x)\lim_{x \to a} \frac{f'(x)}{g'(x)} exists, as a finite number or as ±∞\pm\infty.

Then

lim⁡x→af(x)g(x)=lim⁡x→af′(x)g′(x).\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f'(x)}{g'(x)}.

The same statement holds for one-sided limits and for x→±∞x \to \pm\infty. The proof is a refinement of the Mean Value Theorem (the Cauchy form, which compares two functions at the same intermediate point). A quick plausibility check for 00\frac00: if f(a)=g(a)=0f(a) = g(a) = 0 and both are differentiable at aa with g′(a)≠0g'(a) \ne 0, then f(x)g(x)=f(x)−f(a)g(x)−g(a)\frac{f(x)}{g(x)} = \frac{f(x) - f(a)}{g(x) - g(a)}, and dividing top and bottom by x−ax - a gives f′(a)g′(a)\frac{f'(a)}{g'(a)} in the limit.

Notice the direction of the implication. If the derivative quotient has a limit, so does the original. The converse is false. Condition 1 says the rule is for indeterminate forms only. Condition 2 says that a derivative quotient that wanders tells you nothing.

Rewriting the other indeterminate forms

The rule needs a quotient. Other forms are converted first.

  • 0⋅∞0 \cdot \infty: write f⋅gf \cdot g as f1/g\frac{f}{1/g} or g1/f\frac{g}{1/f}, whichever has simpler derivatives.
  • ∞−∞\infty - \infty: combine into one fraction, or factor.
  • 1∞1^\infty, 000^0, ∞0\infty^0: for y=f(x)g(x)y = f(x)^{g(x)} with f>0f > 0, take logarithms: ln⁡y=g(x)ln⁡f(x)\ln y = g(x)\ln f(x) is a 0⋅∞0 \cdot \infty form. If ln⁡y→ℓ\ln y \to \ell, then y→eℓy \to e^\ell because the exponential is continuous. The positivity of ff is what makes the logarithm legal.

Worked Examples

Example 1: the rule at work

Evaluate lim⁡x→0ex−1−xx2\lim_{x \to 0} \frac{e^x - 1 - x}{x^2}. Both numerator and denominator tend to 00, so the form is 00\frac00. Differentiating gives ex−12x\frac{e^x - 1}{2x}, which is again 00\frac00. Differentiating once more gives ex2\frac{e^x}{2}, which tends to 12\frac12. The second application was legal only because the first result was still indeterminate. Stop the moment the form is no longer indeterminate: applying the rule to ex2\frac{e^x}{2} would be an error. A numerical check agrees: at x=0.1,0.01,0.001x = 0.1, 0.01, 0.001 the quotient is 0.517090.51709, 0.501670.50167, 0.500170.50017.

Example 2: three ways the rule fails

It does not apply: not an indeterminate form. Take lim⁡x→1x2+1x+1\lim_{x \to 1} \frac{x^2 + 1}{x + 1}. The numerator tends to 22 and the denominator to 22, so continuity gives the limit 11. Differentiating anyway gives 2x1→2\frac{2x}{1} \to 2, a wrong answer.

It does not apply: the derivative quotient has no limit. Take lim⁡x→∞x+sin⁡xx\lim_{x \to \infty} \frac{x + \sin x}{x}. The form is ∞∞\frac{\infty}{\infty} and the functions are differentiable, but the derivative quotient is 1+cos⁡x1\frac{1 + \cos x}{1}, which keeps oscillating between 00 and 22 and has no limit. Condition 2 fails, so the rule says nothing. The original limit exists anyway: x+sin⁡xx=1+sin⁡xx\frac{x + \sin x}{x} = 1 + \frac{\sin x}{x} and ∣sin⁡x∣x≤1x→0\frac{\lvert\sin x\rvert}{x} \le \frac1x \to 0 by the squeeze theorem, so the limit is 11. A second example of the same disease is lim⁡x→0x2sin⁡(1/x)sin⁡x\lim_{x \to 0} \frac{x^2 \sin(1/x)}{\sin x}. It is 00\frac00, but the derivative quotient 2xsin⁡(1/x)−cos⁡(1/x)cos⁡x\frac{2x\sin(1/x) - \cos(1/x)}{\cos x} oscillates near 00. Yet the original equals xsin⁡x⋅xsin⁡1x→1⋅0=0\frac{x}{\sin x} \cdot x\sin\frac1x \to 1 \cdot 0 = 0.

It applies but does not help. Take lim⁡x→∞xx2+1\lim_{x \to \infty} \frac{x}{\sqrt{x^2 + 1}}. It is ∞∞\frac{\infty}{\infty} and the hypotheses hold. The derivative quotient is 1x/x2+1=x2+1x\frac{1}{x/\sqrt{x^2 + 1}} = \frac{\sqrt{x^2 + 1}}{x}, the reciprocal of what we started with. Apply the rule again and you get the original expression back, forever. The right tool is algebra: divide top and bottom by xx, giving 11+1/x2→1\frac{1}{\sqrt{1 + 1/x^2}} \to 1. (For x>0x > 0, x2=x\sqrt{x^2} = x; for x→−∞x \to -\infty the same trick gives −1-1.)

Example 3: other indeterminate forms

0⋅∞0 \cdot \infty. lim⁡x→0+xln⁡x\lim_{x \to 0^+} x\ln x. Write it as ln⁡x1/x\frac{\ln x}{1/x}, a −∞∞\frac{-\infty}{\infty} form. The derivative quotient is 1/x−1/x2=−x→0\frac{1/x}{-1/x^2} = -x \to 0, so the limit is 00. The other rewrite, x1/ln⁡x\frac{x}{1/\ln x}, is legal but produces −xln⁡2x-x\ln^2 x, another 0⋅∞0 \cdot \infty form that is harder than the one you started with. Choose the rewrite whose derivative simplifies.

∞−∞\infty - \infty. lim⁡x→0(1sin⁡x−1x)=lim⁡x−sin⁡xxsin⁡x\lim_{x \to 0} \left(\frac{1}{\sin x} - \frac1x\right) = \lim \frac{x - \sin x}{x\sin x}, which is 00\frac00. One application gives 1−cos⁡xsin⁡x+xcos⁡x\frac{1 - \cos x}{\sin x + x\cos x}, still 00\frac00. A second gives sin⁡x2cos⁡x−xsin⁡x→02=0\frac{\sin x}{2\cos x - x\sin x} \to \frac02 = 0. The values at x=0.1,0.01x = 0.1, 0.01 are 0.0166860.016686 and 0.0016670.001667, consistent with a limit of 00.

000^0. lim⁡x→0+xx\lim_{x \to 0^+} x^x. For x>0x > 0, ln⁡(xx)=xln⁡x→0\ln(x^x) = x\ln x \to 0 by the first part, so xx→e0=1x^x \to e^0 = 1. The restriction to x→0+x \to 0^+ matters: xxx^x is not defined for negative xx in general, so there is no two-sided limit.

1∞1^\infty. lim⁡x→∞(1+1x)x\lim_{x \to \infty} \left(1 + \frac1x\right)^x has ln⁡y=xln⁡(1+1x)=ln⁡(1+1/x)1/x\ln y = x\ln\left(1 + \frac1x\right) = \frac{\ln(1 + 1/x)}{1/x}, a 00\frac00 form whose derivative quotient is 11+1/x→1\frac{1}{1 + 1/x} \to 1. So the limit is e1=ee^1 = e.

Example 4: comparing growth rates

For any p>0p > 0, lim⁡x→∞ln⁡xxp\lim_{x \to \infty} \frac{\ln x}{x^p} is ∞∞\frac{\infty}{\infty}, and the derivative quotient is 1/xp xp−1=1p xp→0\frac{1/x}{p\,x^{p-1}} = \frac{1}{p\,x^p} \to 0. So every positive power eventually beats the logarithm. Similarly lim⁡x→∞xnex\lim_{x \to \infty} \frac{x^n}{e^x} becomes n xn−1ex\frac{n\,x^{n-1}}{e^x}, then n(n−1)xn−2ex\frac{n(n-1)x^{n-2}}{e^x}, and after nn applications n!ex→0\frac{n!}{e^x} \to 0, for any positive integer nn. For a real exponent p>0p > 0 and x≥1x \ge 1, xp≤x⌈p⌉x^p \le x^{\lceil p\rceil}, so xpex≤x⌈p⌉ex→0\frac{x^p}{e^x} \le \frac{x^{\lceil p\rceil}}{e^x} \to 0. So exe^x eventually beats every power of xx.

Consequence for algorithms: nln⁡nn1.5=ln⁡nn→0\frac{n \ln n}{n^{1.5}} = \frac{\ln n}{\sqrt n} \to 0, so nln⁡nn \ln n grows more slowly than n1.5n^{1.5}. For this pair there is no crossover to hunt for: ln⁡xx\frac{\ln x}{\sqrt x} peaks at x=e2x = e^2 with value 2e≈0.736\frac2e \approx 0.736 and then falls, so nln⁡n<n1.5n \ln n < n^{1.5} for every n≥1n \ge 1. The convergence to 00 is slow, though:

text
n ln(n)/sqrt(n) 10 0.7281 100 0.4605 10^4 0.0921 10^6 0.0138 10^8 0.0018

The limit of a real variable xx gives the limit of the integer sequence nn by restricting. A far-off crossover does occur for other pairs, such as polynomial against exponential. n10n^{10} is larger than 2n2^n for every nn from 22 to 5858 (at n=58n = 58: 258≈2.88×10172^{58} \approx 2.88 \times 10^{17} against 5810≈4.31×101758^{10} \approx 4.31 \times 10^{17}), and 2n2^n takes over from n=59n = 59 (259≈5.76×10172^{59} \approx 5.76 \times 10^{17} against 5910≈5.11×101759^{10} \approx 5.11 \times 10^{17}). The limit says who wins eventually, not where the crossover is.

Common Misconceptions & Pitfalls

  • Differentiating the quotient instead of top and bottom. The rule uses f′g′\frac{f'}{g'}, not (fg)′\left(\frac fg\right)'.
  • Applying it when the form is not indeterminate. Example 2 gives 22 instead of 11. Substitute first.
  • "No limit for f′g′\frac{f'}{g'} means no limit for fg\frac fg." The oscillation examples refute this; the rule is silent, not negative.
  • Stopping too late or too early. Re-check the form after every application and simplify before differentiating again.
  • Using it on sequences directly. A sequence ana_n has no derivative. Extend to a function of a real variable xx, apply the rule, and conclude about the sequence from the function's limit.
  • Circular reasoning. Using the rule to prove lim⁡x→0sin⁡xx=1\lim_{x \to 0}\frac{\sin x}{x} = 1 assumes the derivative of sin⁡x\sin x, which in the usual development is proved from that very limit.
  • Reaching for it by reflex. When algebra works (dividing by the highest power, factoring) it is usually shorter and safer.

Summary

L'Hôpital's Rule says that if fg\frac{f}{g} is of the form 00\frac00 or ∞∞\frac{\infty}{\infty} near aa, the functions are differentiable with g′≠0g' \ne 0, and f′g′\frac{f'}{g'} has a limit (finite or infinite), then fg\frac fg has the same limit. The hypotheses are all load-bearing. A non-indeterminate form gives wrong answers, as in x2+1x+1\frac{x^2 + 1}{x + 1} at 11. A wandering derivative quotient makes the rule silent, as in x+sin⁡xx\frac{x + \sin x}{x}, whose limit is 11 by squeezing. And a limit like xx2+1\frac{x}{\sqrt{x^2 + 1}} cycles without progress and yields to algebra. Other indeterminate forms are rewritten as quotients, powers by taking logarithms of a positive base. Applied to growth rates, the rule shows that ln⁡x≪xp≪ex\ln x \ll x^p \ll e^x as x→∞x \to \infty, which is the calculus beneath comparing running times such as nln⁡nn\ln n against n1.5n^{1.5}. The limit says who wins in the end, not where a crossover falls, as n10n^{10} against 2n2^n shows. The next lesson, antiderivatives-and-initial-value-problems, runs differentiation in reverse.

Documentation Links