L'Hôpital's rule
In computing limits, we met limits of the form $\dfrac{0}{0}$. We solved them with algebra: factoring, conjugates, or combining fractions. But algebra does not always work. For example, no algebra trick simplifies
$\displaystyle\lim_{x\to 1}\dfrac{\ln x}{x-1}$.
L'Hôpital's rule uses derivatives to find limits like this one. (The name is French. It is pronounced "low-pee-TAHL.")
Indeterminate forms
If both the numerator and the denominator approach $0$, the limit has the indeterminate form $\dfrac{0}{0}$. "Indeterminate" means that the form alone does not tell us the answer. For example, all of these have the form $\dfrac{0}{0}$ at $x=0$:
$\dfrac{2x}{x}\to 2$, $\dfrac{x^2}{x}\to 0$, $\dfrac{x}{x^3}\to\infty$.
The same is true when both approach $\infty$ (or $-\infty$). That is the indeterminate form $\dfrac{\infty}{\infty}$.
The rule
L'Hôpital's Rule: Suppose $f$ and $g$ are differentiable near $a$, and $g'(x)\ne 0$ near $a$ (except possibly at $a$). If $\dfrac{f(x)}{g(x)}$ has the form $\dfrac{0}{0}$ or $\dfrac{\infty}{\infty}$ as $x\to a$, then
$\displaystyle\lim_{x\to a}\dfrac{f(x)}{g(x)}=\lim_{x\to a}\dfrac{f'(x)}{g'(x)}$,
if the limit on the right exists (or is $\infty$ or $-\infty$).
The rule also works for one-sided limits and for $x\to\infty$ or $x\to-\infty$.
Two warnings:
- Differentiate the numerator and the denominator separately. This is not the quotient rule.
- Check the form first. The rule works only for $\dfrac{0}{0}$ and $\dfrac{\infty}{\infty}$.
Optional Why the rule works (a simple case)
Suppose $f(a)=g(a)=0$, and $f'$ and $g'$ are continuous with $g'(a)\ne 0$. Since $f(a)$ and $g(a)$ are $0$, we can subtract them:
$\begin{align*}&\dfrac{f(x)}{g(x)}\\&=\dfrac{f(x)-f(a)}{g(x)-g(a)}\end{align*}$
Now divide the numerator and the denominator by $x-a$:
$\begin{align*}&=\dfrac{\dfrac{f(x)-f(a)}{x-a}}{\dfrac{g(x)-g(a)}{x-a}}\end{align*}$
As $x\to a$, the top approaches $f'(a)$, and the bottom approaches $g'(a)$. So the limit is $\dfrac{f'(a)}{g'(a)}$.
Near $a$, both graphs look like their tangent lines. So their quotient is close to the quotient of the slopes.
The form $\dfrac{0}{0}$
Example 1: Find
$\displaystyle\lim_{x\to 1}\dfrac{\ln x}{x-1}$.
Solution:
At $x=1$: $\ln 1=0$ and $1-1=0$. So the form is $\dfrac{0}{0}$.
Use L'Hôpital's rule. The derivative of $\ln x$ is $\dfrac{1}{x}$, and the derivative of $x-1$ is $1$:
$\begin{align*}&\lim_{x\to 1}\dfrac{\ln x}{x-1}\\&=\lim_{x\to 1}\dfrac{1/x}{1}\\&=1\end{align*}$
Example 2: Find
$\displaystyle\lim_{x\to 0}\dfrac{1-\cos x}{x^2}$.
Solution:
At $x=0$, the form is $\dfrac{0}{0}$. Use the rule:
$\displaystyle\lim_{x\to 0}\dfrac{1-\cos x}{x^2}=\lim_{x\to 0}\dfrac{\sin x}{2x}$
This is still $\dfrac{0}{0}$. So use the rule again:
$\displaystyle\lim_{x\to 0}\dfrac{\sin x}{2x}=\lim_{x\to 0}\dfrac{\cos x}{2}=\dfrac{1}{2}$
You may use the rule as many times as you need, as long as the form is still indeterminate each time.
A note about $\dfrac{\sin x}{x}$: L'Hôpital's rule gives $\displaystyle\lim_{x\to 0}\dfrac{\sin x}{x}=\lim_{x\to 0}\dfrac{\cos x}{1}=1$. This is a good check. But it is not a proof, because we used this same limit to find the derivative of $\sin x$. The real proof is in the Squeeze Theorem.
The form $\dfrac{\infty}{\infty}$
L'Hôpital's rule can compare how fast two functions grow.
Example 3: Find
$\displaystyle\lim_{x\to\infty}\dfrac{e^x}{x^2}$.
Solution:
Both $e^x$ and $x^2$ approach $\infty$. Use the rule twice:
$\begin{align*}&\lim_{x\to\infty}\dfrac{e^x}{x^2}\\&=\lim_{x\to\infty}\dfrac{e^x}{2x}\\&=\lim_{x\to\infty}\dfrac{e^x}{2}\\&=\infty\end{align*}$
So $e^x$ grows much faster than $x^2$. The same steps show that $e^x$ grows faster than any power of $x$.
Example 4: Find
$\displaystyle\lim_{x\to\infty}\dfrac{\ln x}{\sqrt{x}}$.
Solution:
Both approach $\infty$. The derivative of $\sqrt{x}$ is $\dfrac{1}{2\sqrt{x}}$:
$\begin{align*}&\lim_{x\to\infty}\dfrac{\ln x}{\sqrt{x}}\\&=\lim_{x\to\infty}\dfrac{1/x}{1/(2\sqrt{x})}\\&=\lim_{x\to\infty}\dfrac{2\sqrt{x}}{x}\\&=\lim_{x\to\infty}\dfrac{2}{\sqrt{x}}\\&=0\end{align*}$
So $\ln x$ grows more slowly than $\sqrt{x}$. In fact, $\ln x$ grows more slowly than any positive power of $x$.
Other indeterminate forms
Some limits are indeterminate in other ways. Rewrite them as $\dfrac{0}{0}$ or $\dfrac{\infty}{\infty}$ first.
Products: $0\cdot\infty$
If one factor approaches $0$ and the other approaches $\infty$, write the product as a quotient. Divide by the reciprocal of one factor.
Example 5: Find
$\displaystyle\lim_{x\to 0^+}x\ln x$.
Solution:
As $x\to 0^+$, $x\to 0$ and $\ln x\to-\infty$. Write $x$ as $\dfrac{1}{1/x}$:
$x\ln x=\dfrac{\ln x}{1/x}$
Now the form is $\dfrac{-\infty}{\infty}$. The derivative of $\dfrac{1}{x}$ is $-\dfrac{1}{x^2}$:
$\begin{align*}&\lim_{x\to 0^+}\dfrac{\ln x}{1/x}\\&=\lim_{x\to 0^+}\dfrac{1/x}{-1/x^2}\\&=\lim_{x\to 0^+}(-x)\\&=0\end{align*}$
Differences: $\infty-\infty$
If both terms approach $\infty$, combine them into one fraction. For example, as $x\to 0^+$, both terms below approach $\infty$:
$\dfrac{1}{x}-\dfrac{1}{\sin x}=\dfrac{\sin x-x}{x\sin x}$
The right side has the form $\dfrac{0}{0}$, so L'Hôpital's rule can be used.
Powers: $1^\infty$, $0^0$, and $\infty^0$
For a limit of $y=f(x)^{g(x)}$, take the natural logarithm first:
$\ln y=g(x)\ln f(x)$
Find the limit $L$ of $\ln y$. Then the limit of $y$ is $e^L$.
Example 6: Find
$\displaystyle\lim_{x\to 0^+}x^x$.
Solution:
This has the form $0^0$. Let $y=x^x$. Then
$\ln y=x\ln x$.
By Example 5, $x\ln x\to 0$. So $\ln y\to 0$, and
$\displaystyle\lim_{x\to 0^+}x^x=e^0=1$.
Example 7: Find
$\displaystyle\lim_{x\to\infty}\left(1+\dfrac{1}{x}\right)^x$.
Solution:
This has the form $1^\infty$. Let
$y=\left(1+\dfrac{1}{x}\right)^x$.
Then
$\ln y=x\ln\left(1+\dfrac{1}{x}\right)=\dfrac{\ln(1+1/x)}{1/x}$.
This has the form $\dfrac{0}{0}$. Use L'Hôpital's rule. The numerator needs the chain rule:
$\begin{align*}&\lim_{x\to\infty}\ln y\\&=\lim_{x\to\infty}\dfrac{\dfrac{1}{1+1/x}\cdot\left(-\dfrac{1}{x^2}\right)}{-\dfrac{1}{x^2}}\end{align*}$
The factors ${-\dfrac{1}{x^2}}$ cancel:
$\begin{align*}&=\lim_{x\to\infty}\dfrac{1}{1+1/x}\end{align*}$
As $x\to\infty$, $\dfrac{1}{x}\to 0$:
$\begin{align*}&\lim_{x\to\infty}\ln y=\dfrac{1}{1+0}=1\end{align*}$
Since $\ln y\to 1$, $y$ approaches $e^1$:
$\displaystyle\lim_{x\to\infty}\left(1+\dfrac{1}{x}\right)^x=e^1=e$.
This limit appears in compound interest. It is another way to define the number $e$ (see derivatives of exponential and logarithmic functions).
Check the form first
Example 8: What is wrong with this work?
$\displaystyle\lim_{x\to 0}\dfrac{x+1}{x+2}=\lim_{x\to 0}\dfrac{1}{1}=1$
Solution:
The form is not indeterminate. At $x=0$, the quotient is $\dfrac{1}{2}$. So direct substitution gives the correct answer:
$\displaystyle\lim_{x\to 0}\dfrac{x+1}{x+2}=\dfrac{1}{2}$
L'Hôpital's rule does not apply here, and using it gave a wrong answer.
Summary
| Form | What to do |
|---|---|
| $\dfrac{0}{0}$ or $\dfrac{\infty}{\infty}$ | Use L'Hôpital's rule. |
| $0\cdot\infty$ | Rewrite the product as a quotient. |
| $\infty-\infty$ | Combine into one fraction. |
| $1^\infty$, $0^0$, $\infty^0$ | Take $\ln$, find the limit of $\ln y$, then use $e$. |
- Always check that the form is indeterminate before you use the rule.
- Differentiate the numerator and the denominator separately.
- You may use the rule more than once.