Chapter 3 · Applications of Derivatives

3.7 L'Hospital's Rule

Indeterminate forms $\tfrac00$ and $\tfrac\infty\infty$ — replace the quotient of functions by the quotient of their derivatives.

Applying L'Hôpital's Rule

For $\displaystyle\lim_{x\to a}\frac{f(x)}{g(x)}$, if $f\to L_1$ and $g\to L_2\neq0$ the limit is simply $\dfrac{L_1}{L_2}$. But if both $f\to0$ and $g\to0$ we have the indeterminate form $\tfrac00$: we cannot tell what happens without more analysis. We met this before — $\displaystyle\lim_{x\to2}\frac{x^2-4}{x-2}=\lim_{x\to2}(x+2)=4$ by factoring, and $\displaystyle\lim_{x\to0}\frac{\sin x}{x}=1$ by a geometric argument. L'Hôpital's rule handles such limits systematically. The notation $\tfrac00$ does not mean dividing zero by zero; it names a quotient of two limits that are each zero.

📐 Theorem 3.10 — L'Hôpital's Rule ($\tfrac00$ case)
Suppose $f$ and $g$ are differentiable over an open interval containing $a$, except possibly at $a$, with $g^\prime(x)\neq0$ on that interval for $x\neq a$. If $\displaystyle\lim_{x\to a}f(x)=0$ and $\displaystyle\lim_{x\to a}g(x)=0$, then $$\lim_{x\to a}\frac{f(x)}{g(x)}=\lim_{x\to a}\frac{f^\prime(x)}{g^\prime(x)},$$ assuming the limit on the right exists or is $\infty$ or $-\infty$. This also holds for one-sided limits and for $a=\pm\infty$.
⚠️ Not the quotient rule
Differentiate the numerator and the denominator separately. You are not differentiating the fraction $\dfrac fg$.
Interactive 1 — Why L'Hôpital Works

Near $a$ both $f$ and $g$ are almost straight lines through zero, with slopes $f^\prime(a)$ and $g^\prime(a)$. Their ratio is therefore close to the ratio of slopes. The table closes in on $a$ and shows both ratios settling on the same number.

numerator $f$ (red) and denominator $g$ (blue)
$f/g$ (black) and $f'/g'$ (green, dashed)
$x$—
$f(x)/g(x)$—
$f'(x)/g'(x)$—
limit—
✏️ Example 1 — Applying L'Hôpital's rule ($\tfrac00$ case)
Evaluate each limit.
  • a $\displaystyle\lim_{x\to0}\frac{1-\cos x}{x}$
  • b $\displaystyle\lim_{x\to1}\frac{\sin(\pi x)}{\ln x}$
  • c $\displaystyle\lim_{x\to\infty}\frac{e^{1/x}-1}{1/x}$
  • d $\displaystyle\lim_{x\to0}\frac{\sin x-x}{x^2}$
(a) Both $1-\cos x\to0$ and $x\to0$. $$\lim_{x\to0}\frac{1-\cos x}{x}=\lim_{x\to0}\frac{\sin x}{1}=0.$$
(b) Both $\sin(\pi x)\to0$ and $\ln x\to0$. $$\lim_{x\to1}\frac{\sin(\pi x)}{\ln x}=\lim_{x\to1}\frac{\pi\cos(\pi x)}{1/x}=\lim_{x\to1}\pi x\cos(\pi x)=\pi(1)(-1)=-\pi.$$
(c) Both $e^{1/x}-1\to0$ and $\tfrac1x\to0$. $$\lim_{x\to\infty}\frac{e^{1/x}\left(-\tfrac{1}{x^2}\right)}{-\tfrac{1}{x^2}}=\lim_{x\to\infty}e^{1/x}=e^0=1.$$
(d) Both parts $\to0$. $\displaystyle\lim_{x\to0}\frac{\sin x-x}{x^2}=\lim_{x\to0}\frac{\cos x-1}{2x}$, again $\tfrac00$, so apply the rule a second time: $\displaystyle\lim_{x\to0}\frac{-\sin x}{2}=0$.
✏️ Example 2 — Using L'Hôpital's rule
Evaluate $\displaystyle\lim_{x\to0}\frac{x}{\tan x}$.
Step 1 Both $x\to0$ and $\tan x\to0$: the form is $\tfrac00$.
Step 2 $$\lim_{x\to0}\frac{x}{\tan x}=\lim_{x\to0}\frac{1}{\sec^2x}=\lim_{x\to0}\cos^2x=1.$$

L'Hôpital's rule also handles quotients where $f\to\pm\infty$ and $g\to\pm\infty$: the indeterminate form $\tfrac{\infty}{\infty}$.

📐 L'Hôpital's Rule ($\tfrac\infty\infty$ case)
Suppose $f$ and $g$ are differentiable over an open interval containing $a$, except possibly at $a$, with $g^\prime(x)\neq0$ on that interval for $x\neq a$, and $\displaystyle\lim_{x\to a}f(x)=\pm\infty$ and $\displaystyle\lim_{x\to a}g(x)=\pm\infty$. Then $\displaystyle\lim_{x\to a}\frac{f(x)}{g(x)}=\lim_{x\to a}\frac{f^\prime(x)}{g^\prime(x)}$, assuming the limit on the right exists or is $\pm\infty$. It also holds for one-sided limits and $a=\pm\infty$.
✏️ Example 3 — Applying L'Hôpital's rule ($\tfrac\infty\infty$ case)
Evaluate each limit.
  • a $\displaystyle\lim_{x\to\infty}\frac{3x+5}{2x+1}$
  • b $\displaystyle\lim_{x\to0^+}\frac{\ln x}{\cot x}$
(a) Both $\to\infty$: $\displaystyle\lim_{x\to\infty}\frac{3x+5}{2x+1}=\lim_{x\to\infty}\frac32=\frac32$. (Dividing by $x$, as in Section 1.4, gives the same answer.)
(b) $\ln x\to-\infty$ and $\cot x\to\infty$: $$\lim_{x\to0^+}\frac{\ln x}{\cot x}=\lim_{x\to0^+}\frac{1/x}{-\csc^2x}=\lim_{x\to0^+}\frac{1}{-x\csc^2x}.$$ This is still unclear ($0\cdot\infty$ in the denominator), so rewrite with $\csc x=\tfrac1{\sin x}$: $\displaystyle\lim_{x\to0^+}\frac{\sin^2x}{-x}$, a $\tfrac00$ form. Apply the rule again: $\displaystyle\lim_{x\to0^+}\frac{2\sin x\cos x}{-1}=0$.
✏️ Example 4 — When L'Hôpital's rule does not apply
Consider $\displaystyle\lim_{x\to1}\frac{x^2+5}{3x+4}$. Show that it cannot be evaluated by L'Hôpital's rule.
Step 1 $x^2+5\to6$ and $3x+4\to7$ — neither $\tfrac00$ nor $\tfrac\infty\infty$, so the rule does not apply.
Step 2 Applying it anyway would give $\displaystyle\lim_{x\to1}\frac{2x}{3}=\frac23$ — wrong.
Step 3 The correct value, by direct substitution, is $\dfrac67$. Always check the form first.

Exercises

I
Evaluate the limit. (Where $k$, $n$ appear, take $k>0$ and $n$ a positive integer; the mini-lab uses $k=3$, $n=5$, $a=2$.)
  • 1 $\displaystyle\lim_{x\to\infty}\frac{e^x}{x}$
  • 2 $\displaystyle\lim_{x\to1}\frac{x-1}{\sin x}$
  • 3 $\displaystyle\lim_{x\to\infty}\frac{e^x}{x^k}$
  • 4 $\displaystyle\lim_{x\to0}\frac{(1+x)^n-1}{x}$
  • 5 $\displaystyle\lim_{x\to\infty}\frac{\ln x}{x^k}$
  • 6 $\displaystyle\lim_{x\to0}\frac{(1+x)^n-1-nx}{x^2}$
  • 7 $\displaystyle\lim_{x\to a}\frac{x-a}{x^2-a^2}$, $a\neq0$
  • 8 $\displaystyle\lim_{x\to0}\frac{\sin x-\tan x}{x^3}$
  • 9 $\displaystyle\lim_{x\to a}\frac{x-a}{x^3-a^3}$, $a\neq0$
  • 10 $\displaystyle\lim_{x\to0}\frac{\sqrt{1+x}-\sqrt{1-x}}{x}$
  • 11 $\displaystyle\lim_{x\to a}\frac{x-a}{x^n-a^n}$, $a\neq0$
  • 12 $\displaystyle\lim_{x\to0}\frac{e^x-x-1}{x^2}$
Watch the ratios settle
numerator $f$ (red) and denominator $g$ (blue)
$f/g$ (black) and $f'/g'$ (green, dashed)
$x$—
$f(x)/g(x)$—
$f'(x)/g'(x)$—
limit—
1 $\tfrac\infty\infty$: $\displaystyle\lim\frac{e^x}{1}=\infty$.
2 Not indeterminate: $x-1\to0$ but $\sin x\to\sin1\neq0$. Direct substitution gives $\dfrac{0}{\sin1}=0$. (L'Hôpital would wrongly give $\tfrac{1}{\cos1}$.)
3 $\tfrac\infty\infty$. Apply the rule $\lceil k\rceil$ times; the denominator eventually becomes a constant or a power tending to $0$, while the numerator stays $e^x$: the limit is $\infty$. Exponentials beat every power.
4 $\tfrac00$: $\displaystyle\lim_{x\to0}\frac{n(1+x)^{n-1}}{1}=n$.
5 $\tfrac\infty\infty$: $\displaystyle\lim\frac{1/x}{kx^{k-1}}=\lim\frac{1}{kx^k}=0$. Every positive power beats the logarithm.
6 $\tfrac00$: $\dfrac{n(1+x)^{n-1}-n}{2x}$ is again $\tfrac00$, so once more: $\dfrac{n(n-1)(1+x)^{n-2}}{2}\to\dfrac{n(n-1)}{2}$.
7 $\tfrac00$: $\displaystyle\lim_{x\to a}\frac{1}{2x}=\frac{1}{2a}$.
8 $\tfrac00$: $\dfrac{\cos x-\sec^2x}{3x^2}$ is $\tfrac00$; again $\dfrac{-\sin x-2\sec^2x\tan x}{6x}$ is $\tfrac00$; once more $\dfrac{-\cos x-2\sec^4x-4\sec^2x\tan^2x}{6}\to\dfrac{-1-2}{6}=-\dfrac12$.
9 $\tfrac00$: $\displaystyle\lim_{x\to a}\frac{1}{3x^2}=\frac{1}{3a^2}$.
10 $\tfrac00$: $\displaystyle\lim_{x\to0}\left(\frac{1}{2\sqrt{1+x}}+\frac{1}{2\sqrt{1-x}}\right)=\frac12+\frac12=1$.
11 $\tfrac00$: $\displaystyle\lim_{x\to a}\frac{1}{nx^{n-1}}=\frac{1}{na^{n-1}}$.
12 $\tfrac00$: $\dfrac{e^x-1}{2x}$ is $\tfrac00$; again $\dfrac{e^x}{2}\to\dfrac12$.
II
Determine whether you can apply L'Hôpital's rule directly. Explain why or why not. Then indicate if there is some way you can alter the limit so you can apply it.
  • 1 $\displaystyle\lim_{x\to0^+}\frac{\tan x}{\sqrt x}$
  • 2 $\displaystyle\lim_{x\to1}\frac{x-1}{\ln x}$
  • 3 $\displaystyle\lim_{x\to0^+}x^2\ln x$
  • 4 $\displaystyle\lim_{x\to0}(x+1)^{1/x}$
  • 5 $\displaystyle\lim_{x\to\infty}x^{1/x}$
  • 6 $\displaystyle\lim_{x\to1}\frac{\sqrt x-\sqrt[3]x}{x-1}$
  • 7 $\displaystyle\lim_{x\to0^+}x^{2/x}$
  • 8 $\displaystyle\lim_{x\to0^+}x^{2x}$
  • 9 $\displaystyle\lim_{x\to0}\frac{x^2}{1/x}$
  • 10 $\displaystyle\lim_{x\to\infty}\frac{e^x}{x}$
  • 11 $\displaystyle\lim_{x\to0}\frac{\sin x-x}{x^2}$
1 Yes, $\tfrac00$: $\displaystyle\lim\frac{\sec^2x}{1/(2\sqrt x)}=\lim2\sqrt x\sec^2x=0$.
2 Yes, $\tfrac00$: $\displaystyle\lim_{x\to1}\frac{1}{1/x}=1$.
3 No — the form is $0\cdot(-\infty)$, not a quotient. Rewrite as $\dfrac{\ln x}{x^{-2}}$ ($\tfrac{-\infty}{\infty}$): $\displaystyle\lim\frac{1/x}{-2x^{-3}}=\lim\left(-\frac{x^2}{2}\right)=0$.
4 No — the form is $1^\infty$. Take logarithms: $\ln y=\dfrac{\ln(x+1)}{x}$, a $\tfrac00$ form, with limit $\displaystyle\lim\frac{1}{x+1}=1$. So the limit is $e^1=e$.
5 No — the form is $\infty^0$. $\ln y=\dfrac{\ln x}{x}\to0$ (by the rule), so the limit is $e^0=1$.
6 Yes, $\tfrac00$: $\displaystyle\lim_{x\to1}\left(\frac{1}{2\sqrt x}-\frac{1}{3x^{2/3}}\right)=\frac12-\frac13=\frac16$.
7 No, and nothing is needed: as $x\to0^+$ the form is $0^{\infty}$, which is not indeterminate. $\ln y=\dfrac{2\ln x}{x}\to-\infty$, so the limit is $0$.
8 No — the form is $0^0$. $\ln y=2x\ln x=\dfrac{2\ln x}{1/x}$ ($\tfrac\infty\infty$) $\to\displaystyle\lim\frac{2/x}{-1/x^2}=\lim(-2x)=0$, so the limit is $e^0=1$.
9 No — the form is $\tfrac{0}{\infty}$, not indeterminate. Simplify: $\dfrac{x^2}{1/x}=x^3\to0$.
10 Yes, $\tfrac\infty\infty$: $\displaystyle\lim e^x=\infty$.
11 Yes, $\tfrac00$ — this is Example 1(d); the limit is $0$ after two applications.
III
Each limit is of the form $\tfrac00$ or $\tfrac\infty\infty$. Evaluate it, applying L'Hôpital's rule as many times as needed — check the form again before every application.
  • 1 $\displaystyle\lim_{x\to0}\frac{e^{2x}-1}{x}$
  • 2 $\displaystyle\lim_{x\to0}\frac{1-\cos3x}{x^2}$
  • 3 $\displaystyle\lim_{x\to\infty}\frac{x^2}{e^{3x}}$
  • 4 $\displaystyle\lim_{x\to\infty}\frac{(\ln x)^2}{x}$
  • 5 $\displaystyle\lim_{x\to0}\frac{x-\sin x}{x^3}$
Watch the ratios settle
numerator $f$ (red) and denominator $g$ (blue)
$f/g$ (black) and $f'/g'$ (green, dashed)
$x$—
$f(x)/g(x)$—
$f'(x)/g'(x)$—
limit—
1 $\tfrac00$: $\displaystyle\lim_{x\to0}\frac{2e^{2x}}{1}=2$.
2 $\tfrac00$: $\dfrac{3\sin3x}{2x}$ is still $\tfrac00$; again $\dfrac{9\cos3x}{2}\to\dfrac92$.
3 $\tfrac\infty\infty$: $\dfrac{2x}{3e^{3x}}$ is still $\tfrac\infty\infty$; again $\dfrac{2}{9e^{3x}}\to0$. The limit is $0$.
4 $\tfrac\infty\infty$: $\dfrac{2\ln x\cdot\frac1x}{1}=\dfrac{2\ln x}{x}$, still $\tfrac\infty\infty$; again $\dfrac{2/x}{1}\to0$. The limit is $0$.
5 $\tfrac00$ three times: $\dfrac{1-\cos x}{3x^2}\to\dfrac{\sin x}{6x}\to\dfrac{\cos x}{6}\to\dfrac16$.
IV
Identify the indeterminate form ($0\cdot\infty$, $\infty-\infty$, $1^\infty$, $0^0$ or $\infty^0$), rewrite it as a quotient, and evaluate.
  • 1 $\displaystyle\lim_{x\to\infty}x\sin\frac1x$
  • 2 $\displaystyle\lim_{x\to0^+}\sin x\,\ln x$
  • 3 $\displaystyle\lim_{x\to0^+}\left(\frac1x-\frac1{\sin x}\right)$
  • 4 $\displaystyle\lim_{x\to1^+}\left(\frac{1}{\ln x}-\frac{1}{x-1}\right)$
  • 5 $\displaystyle\lim_{x\to\infty}\left(1+\frac3x\right)^{x}$
  • 6 $\displaystyle\lim_{x\to0^+}x^{\sin x}$
  • 7 $\displaystyle\lim_{x\to\infty}(1+x)^{1/\ln x}$
1 $\infty\cdot0$. Write $\dfrac{\sin(1/x)}{1/x}$ ($\tfrac00$): $\displaystyle\lim\frac{\cos(1/x)\cdot(-1/x^2)}{-1/x^2}=\lim\cos\frac1x=1$.
2 $0\cdot(-\infty)$. Write $\dfrac{\ln x}{\csc x}$ ($\tfrac{-\infty}{\infty}$): $\displaystyle\lim\frac{1/x}{-\csc x\cot x}=\lim\left(-\frac{\sin x}{x}\cdot\tan x\right)=-1\cdot0=0$.
3 $\infty-\infty$. Combine: $\dfrac{\sin x-x}{x\sin x}$ ($\tfrac00$) $\to\dfrac{\cos x-1}{\sin x+x\cos x}$ ($\tfrac00$) $\to\dfrac{-\sin x}{2\cos x-x\sin x}\to\dfrac02=0$.
4 $\infty-\infty$. Combine: $\dfrac{x-1-\ln x}{(x-1)\ln x}$ ($\tfrac00$) $\to\dfrac{1-\frac1x}{\ln x+\frac{x-1}{x}}=\dfrac{x-1}{x\ln x+x-1}$ ($\tfrac00$) $\to\dfrac{1}{\ln x+1+1}\to\dfrac12$.
5 $1^\infty$. $\ln y=x\ln\!\left(1+\tfrac3x\right)=\dfrac{\ln(1+3/x)}{1/x}$ ($\tfrac00$) $\to\displaystyle\lim\frac{\frac{-3/x^2}{1+3/x}}{-1/x^2}=\lim\frac{3}{1+3/x}=3$. So the limit is $e^3\approx20.09$.
6 $0^0$. $\ln y=\sin x\ln x\to0$ (Part 2), so the limit is $e^0=1$.
7 $\infty^0$. $\ln y=\dfrac{\ln(1+x)}{\ln x}$ ($\tfrac\infty\infty$) $\to\displaystyle\lim\frac{1/(1+x)}{1/x}=\lim\frac{x}{1+x}=1$. So the limit is $e^1=e$.
V
When the rule fails, and who grows fastest.
  • 1 Show that $\displaystyle\lim_{x\to\infty}\frac{x+\sin x}{x}$ exists, even though L'Hôpital's rule gives a limit that does not exist. Why is there no contradiction?
  • 2 Try L'Hôpital's rule on $\displaystyle\lim_{x\to\infty}\frac{\sqrt{x^2+1}}{x}$. What happens? Evaluate the limit another way.
  • 3 Use L'Hôpital's rule to order these functions by growth rate as $x\to\infty$ (slowest first): $e^x$, $x^{10}$, $(\ln x)^3$, $x^x$, $\sqrt x$. Show the three comparisons $\displaystyle\lim\frac{(\ln x)^3}{\sqrt x}$, $\displaystyle\lim\frac{x^{10}}{e^x}$ and $\displaystyle\lim\frac{e^x}{x^x}$.
1 Directly, $\dfrac{x+\sin x}{x}=1+\dfrac{\sin x}{x}\to1+0=1$, since $\left|\dfrac{\sin x}{x}\right|\le\dfrac1x$. The rule would give $\displaystyle\lim\frac{1+\cos x}{1}$, which oscillates between $0$ and $2$ and does not exist. No contradiction: L'Hôpital's rule says if $\lim\frac{f^\prime}{g^\prime}$ exists then $\lim\frac fg$ equals it. When $\lim\frac{f^\prime}{g^\prime}$ fails to exist, the rule simply tells us nothing.
2 $\tfrac\infty\infty$ gives $\dfrac{x/\sqrt{x^2+1}}{1}=\dfrac{x}{\sqrt{x^2+1}}$ — the reciprocal of the original. Applying the rule again returns $\dfrac{\sqrt{x^2+1}}{x}$: the rule goes round in circles. Instead divide by $x=\sqrt{x^2}$ (for $x>0$): $\sqrt{1+\dfrac1{x^2}}\to1$.
3 (i) $\dfrac{(\ln x)^3}{\sqrt x}$: each application turns $(\ln x)^k$ into $k(\ln x)^{k-1}\cdot\frac1x$ and $x^{1/2}$ into $\tfrac12x^{-1/2}$, giving $\dfrac{2k(\ln x)^{k-1}}{\sqrt x}$; after three rounds $\dfrac{48}{\sqrt x}\to0$. (ii) $\dfrac{x^{10}}{e^x}$: ten applications give $\dfrac{10!}{e^x}\to0$. (iii) $\dfrac{e^x}{x^x}=\left(\dfrac ex\right)^x\to0$ since $\dfrac ex<\dfrac12$ once $x>2e$. Also $\dfrac{\sqrt x}{x^{10}}=x^{-19/2}\to0$. Order: $(\ln x)^3\ll\sqrt x\ll x^{10}\ll e^x\ll x^x$.
🔬 Research–Teaching NexusResearch-oriented · optional, about 30 minutes

Research question. Which grows fastest: $\ln x$, $x^n$, $e^x$ or $x^x$, and why does this matter for computers?

Why it matters. Computer scientists compare algorithm running times such as $n\ln n$, $n^2$ and $2^n$; the ordering of growth rates decides which programs are practical.

What to do.

  1. In a spreadsheet, compute $\ln x$, $x^3$, $e^x$ and $x^x$ for $x=1, 5, 10, 20, 50$.
  2. Find the value of $x$ after which $e^x$ stays larger than $x^3$.
  3. Use L'Hospital's Rule to show $\lim_{x\to\infty}\frac{\ln x}{x^3}=0$ and $\lim_{x\to\infty}\frac{x^3}{e^x}=0$.
  4. Explain why $\frac{e^x}{x^x}\to0$ by writing $x^x=e^{x\ln x}$.

Tools: Spreadsheet, calculator

Hand in: A half-page note: your table, the crossover point, and the growth order with a short justification.

Going further. Anywhere: time a simple sorting program on lists of increasing size and compare with these curves.

Instructor note: Students should notice $x^3$ beats $e^x$ between $x\approx1.86$ and $x\approx4.54$; after that $e^x$ wins forever, so small tables can mislead.

🧪 Self-check quiz

0/5 correct

Q1. L'Hôpital's rule may be applied to $\dfrac{f}{g}$ when the limit has the form:

Q2. $\displaystyle\lim_{x\to0}\frac{1-\cos x}{x}=$

Q3. $\displaystyle\lim_{x\to1}\frac{x^2+5}{3x+4}=$

Q4. $\displaystyle\lim_{x\to0}\frac{e^x-x-1}{x^2}=$

Q5. To handle $\displaystyle\lim_{x\to0^+}x^{2x}$ ($0^0$), first: