Math Insight

L'Hospital's rule


L'Hospital's rule is the definitive way to simplify evaluation of limits. It does not directly evaluate limits, but only simplifies evaluation if used appropriately.

In effect, this rule is the ultimate version of ‘cancellation tricks’, applicable in situations where a more down-to-earth genuine algebraic cancellation may be hidden or invisible.

Suppose we want to evaluate $$\lim_{x\rightarrow a}{f(x)\over g(x)}$$ where the limit $a$ could also be $+\infty$ or $-\infty$ in addition to ‘ordinary’ numbers. Suppose that either $$\lim_{x\rightarrow a}f(x)=0 \hbox{ and } \lim_{x\rightarrow a} g(x)=0$$ or $$\lim_{x\rightarrow a}f(x)=\pm\infty \hbox{ and } \lim_{x\rightarrow a} g(x)=\pm\infty$$ (The $\pm$'s don't have to be the same sign). Then we cannot just ‘plug in’ to evaluate the limit, and these are traditionally called indeterminate forms. The unexpected trick that works often is that (amazingly) we are entitled to take the derivative of both numerator and denominator: $$\lim_{x\rightarrow a}{f(x)\over g(x)}= \lim_{x\rightarrow a}{f'(x)\over g'(x)}.$$ No, this is not the quotient rule. No, it is not so clear why this would help, either, but we'll see in examples.

Example 1

Find $\lim_{x\rightarrow 0}\,(\sin\,x)/x$.

Solution: both numerator and denominator have limit $0$, so we are entitled to apply L'Hospital's rule: $$\lim_{x\rightarrow 0}\,{\sin\,x\over x}= \lim_{x\rightarrow 0}\,{\cos\,x\over 1}.$$ In the new expression, neither numerator nor denominator is $0$ at $x=0$, and we can just plug in to see that the limit is $1$.

Example 2

Find $\lim_{x\rightarrow 0}\,x/(e^{2x}-1)$.

Solution: both numerator and denominator go to $0$, so we are entitled to use L'Hospital's rule: $$\lim_{x\rightarrow 0}\,{ x \over e^{2x }-1}= \lim_{x\rightarrow 0}\,{ 1 \over 2e^{2x }}$$ In the new expression, the numerator and denominator are both non-zero when $x=0$, so we just plug in $0$ to get $$\lim_{x\rightarrow 0}\,{ x \over e^{2x }-1}= \lim_{x\rightarrow 0}\,{ 1 \over 2e^{2x }}={1\over 2e^0}={1\over 2}$$

Example 3

Find $\lim_{x\rightarrow 0^+}\,x\,\ln x$.

Solution: The $0^+$ means that we approach $0$ from the positive side, since otherwise we won't have a real-valued logarithm. This problem illustrates the possibility as well as necessity of rearranging a limit to make it be a ratio of things, in order to legitimately apply L'Hospital's rule. Here, we rearrange to $$\lim_{x\rightarrow 0^+}\,x\,\ln x=\lim_{x\rightarrow 0}{\ln\,x\over 1/x}$$ In the new expressions the top goes to $-\infty$ and the bottom goes to $+\infty$ as $x$ goes to $0$ (from the right). Thus, we are entitled to apply L'Hospital's rule, obtaining $$\lim_{x\rightarrow 0^+}\,x\,\ln x=\lim_{x\rightarrow 0}{\ln\,x\over 1/x}=\lim_{x\rightarrow 0}{1/x\over -1/x^2}$$ Now it is very necessary to rearrange the expression inside the last limit: we have $$\lim_{x\rightarrow 0}{1/x\over -1/x^2}= \lim_{x\rightarrow 0}\,-x$$ The new expression is very easy to evaluate: the limit is $0$.

Example 4

It is often necessary to apply L'Hospital's rule repeatedly: Let's find $\lim_{x\rightarrow +\infty}x^2/e^x$.

Solution: both numerator and denominator go to $\infty$ as $x\rightarrow +\infty$, so we are entitled to apply L'Hospital's rule, to turn this into $$\lim_{x\rightarrow +\infty}{2x\over e^x}$$ But still both numerator and denominator go to $\infty$, so apply L'Hospital's rule again: the limit is $$\lim_{x\rightarrow +\infty}{2\over e^x}=0$$ since now the numerator is fixed while the denominator goes to $+\infty$.

Example 5

Now let's illustrate more ways that things can be rewritten as ratios, thereby possibly making L'Hospital's rule applicable. Let's evaluate $$\lim_{x \rightarrow 0}\,x^x.$$

Solution: It is less obvious now, but we can't just plug in $0$ for $x$: on one hand, we are taught to think that $x^0=1$, but also that $0^x=0$; but then surely $0^0$ can't be both at once. And this exponential expression is not a ratio.

The trick here is to take the logarithm: $$\ln\left(\lim_{x \rightarrow 0^+}\,x^x\right)=\lim_{x \rightarrow 0^+}\,\ln(x^x)$$ The reason that we are entitled to interchange the logarithm and the limit is that logarithm is a continuous function (on its domain). Now we use the fact that $\ln(a^b)=b\ln a$, so the log of the limit is $$\lim_{x \rightarrow 0^+}\,x\ln x$$ Aha! The question has been turned into one we already did! But ignoring that, and repeating ourselves, we'd first rewrite this as a ratio $$\lim_{x \rightarrow 0^+}\,x\ln x=\lim_{x \rightarrow 0^+}\,{\ln x\over 1/x}$$ and then apply L'Hospital's rule to obtain $$\lim_{x \rightarrow 0^+}\,{1/x\over -1/x^2}=\lim_{x \rightarrow 0^+}\,-x=0$$ But we have to remember that we've computed the log of the limit, not the limit. Therefore, the actual limit is $$\lim_{x \rightarrow 0^+}\,x^x=e^{\hbox{ log of the limit }}=e^0=1$$ This trick of taking a logarithm is important to remember.

Example 6

Here is another issue of rearranging to fit into accessible form: Find $$\lim_{x\rightarrow +\infty}\sqrt{x^2+x+1}-\sqrt{x^2+1}.$$

Solution: This is not a ratio, but certainly is ‘indeterminate’, since it is the difference of two expressions both of which go to $+\infty$. To make it into a ratio, we take out the largest reasonable power of $x$: \begin{align*} \lim_{x\rightarrow +\infty} \sqrt{x^2+x+1}-\sqrt{x^2+1}&= \lim_{x\rightarrow +\infty} x\cdot\left(\sqrt{1+{1\over x}+{1\over x^2}}- \sqrt{1+{1\over x^2}}\right) \\ &=\lim_{x\rightarrow +\infty} {\sqrt{1+{1\over x}+{1\over x^2}}- \sqrt{1+{1\over x^2}} \over 1/x} \end{align*} The last expression here fits the requirements of the L'Hospital rule, since both numerator and denominator go to $0$. Thus, by invoking L'Hospital's rule, it becomes $$=\lim_{x\rightarrow +\infty} \;{1\over 2}\; {{-{1\over x^2}-{2\over x^3} \over \sqrt{1+{1\over x}+{1\over x^2}}}- { {-2\over x^3} \over \sqrt{1+{1\over x^2}}} \over -1/x^2}.$$

This is a large but actually tractable expression: multiply top and bottom by $x^2$, so that it becomes $$=\lim_{x\rightarrow +\infty} {{1\over 2}+{1\over x} \over \sqrt{1+{1\over x}+{1\over x^2}}}+ { {-1\over x} \over \sqrt{1+{1\over x^2}} } .$$

At this point, we can replace every ${1\over x}$ by $0$, finding that the limit is equal to $${{1\over 2}+0 \over \sqrt{1+0+0}}+ { 0 \over \sqrt{1+0 }}={1\over 2}.$$

It is important to recognize that in additional to the actual application of L'Hospital's rule, it may be necessary to experiment a little to get things to settle out the way you want. Trial-and-error is not only ok, it is necessary.


  1. Find $\lim_{x\rightarrow 0}\,(\sin\,x)/x$
  2. Find $\lim_{x\rightarrow 0}\,(\sin\,5x)/x$
  3. Find $\lim_{x\rightarrow 0}\,(\sin\,(x^2))/x^2$
  4. Find $\lim_{x\rightarrow 0}\,x/(e^{2x}-1)$
  5. Find $\lim_{x\rightarrow 0}\,x\,\ln x$
  6. Find $$\lim_{x\rightarrow 0^+}\,(e^x-1)\ln x$$
  7. Find $$\lim_{x\rightarrow 1}\,{ \ln x \over x-1 }$$
  8. Find $$\lim_{x\rightarrow +\infty}\,{ \ln\,x \over x }$$
  9. Find $$\lim_{x\rightarrow +\infty}\,{ \ln x \over x^2 }$$
  10. Find $\lim_{x\rightarrow 0}\,(\sin x)^x$