xaktly | Calculus | Limits

L'Hôpital's rule


A shortcut for finding some types of limits


L'Hôpital's rule (sometimes spelled L'Hôspital's with a silent "s") is pronounced "Lo-pee-tal's". L'Hopitals rule is very handy for finding stubborn limits, but only certain kinds of limits, and only if you are pretty good at finding derivatives of functions first.

Basically, the rule says that for certain types of limits called indeterminate forms (more on that below), the limit of a ratio of functions is equal to the limit of the ratio of their derivatives. Here it is:

L'Hôpital's rule

Let $f(x)$ and $g(x)$ be functions that are differentiable on an open interval that contains a. In special cases, such as when $f(a) = f(b) = 0,$ or when

$$\lim_{x\to a} \, f(x) = ±\infty \phantom{000} \color{#E90F89}{\text{&}} \phantom{000} \lim_{x\to a} \, g(x) = ± \infty$$

then

$$\lim_{x \to a} \, \frac{f(x)}{g(x)} \: = \: \lim_{x \to a} \frac{f'(x)}{g'(x)}$$

Of course, we have to assume that $g'(x) \ne 0.$ This rule means that the limit of a ratio (in certain cases) is the same as the limit of the ratio of the derivatives of the numerator and denominator.

Indeterminate forms


L'Hôpital's rule only works in special cases called indeterminate forms. Two such forms are ratios of functions for which direct substitution of the limiting value of $x$ yields:

$$\frac{±\infty}{±\infty} \phantom{000} \color{#E90F89}{\text{or}} \phantom{000} \frac{0}{0}$$

The rule is also valid for the following forms because they can usually be manipulated into one of the indeterminate forms above:

You'll find a couple of examples of those kinds of manipulations in the examples that follow.

$$\infty \cdot \infty \phantom{0000} \infty \cdot 0 \phantom{0000} 0^{\infty}$$

$$0^0 \phantom{0000} \infty^0$$

A proof of L'Hôpital's rule is included below, but for now it's best to learn to use it by working examples. L'Hôpital's is a terrific time-saver.


Example 1

$$\lim_{x\to 0} \, \frac{\sqrt{x}}{\text{sin}(x)}$$

 


If we simply try to substitute $x = 0$ into this function, we see that it has the indeterminate form $\frac{0}{0}$,

$$\lim_{x\to\ 0} \, \frac{\sqrt{x}}{\text{sin}(x)}$$

L'Hopital's rule says that this limit is identical to the limit of a new function consisting of the derivative of the numerator over the derivative of the denominator:

$$\lim_{x\to\ 0} \frac{\sqrt{x}}{\text{sin}(x)} = \lim_{x\to\ 0} \frac{\frac{1}{2}x^{-1/2}}{\text{cos}(x)}$$

Caution: one common mistake is to apply the quotient rule. We're not taking the derivative of a quotient here. We're finding the derivatives of the numerator and denominator separately – no quotient rule.

We can now do a little algebra and plug $x = 0$ in to find that this function "blows up." It tends toward infinity as $x$ approaches zero. The cosine term will oscillate between zero and one, but the square root term will be zero when $x = 0$.

$$= \lim_{x\to\ 0} \, \frac{1}{2 \sqrt{x} \,\text{cos}(x)} \rightarrow \infty$$

Example 2

$$\lim_{x\to 1} \, \frac{x^2 - 1}{ln(x)}$$

 


This is a   $\frac{0}{0}$   limit, too. If we substitute $x = 1$ directly into the function, we find that both the numerator and denominator are zero. Therefore, this is a fine candidate for L'Hôpital's rule.

$$\lim_{x\to 1} \, \frac{x^2 - 1}{ln(x)} \; \rightarrow \; \left( \frac{0}{0} \right)$$

Taking derivatives of the numerator and the denominator gives:

$$\lim_{x\to 1} \, \frac{x^2 - 1}{ln(x)} = \lim_{x\to 1} \frac{2x}{\frac{1}{x}}$$

Now we can rearrange (division by a fraction is the same as multiplication by the reciprocal) and substitute $x = 1$ to get:

$$\lim_{x\to 1} \, 2x^2 = 2$$

So this function has a limit of $2$ at $x = 1$.


Example 3 – repeated use of L'Hôpital's rule

$$\lim_{x\to \infty} \, \frac{2x^3 - 5x^2 + 1}{x^3 - 1}$$

 


This is an   $\frac{\infty}{\infty}$ limit:

$$\lim_{x\to\infty} \, \frac{2x^3 - 5x^2 + 1}{x^3 - 1} \; \rightarrow \; \left( \frac{\infty}{\infty} \right)$$

Application of L'Hôpital's rule yields another limit, which is still an   $\frac{\infty}{\infty}$   limit.

$$ \begin{align} \lim_{x\to\infty} &\, \frac{2x^3 - 5x^2 + 1}{x^3 - 1} \\[5pt] &= \lim_{x\to\infty} \, \frac{6x^2 - 10x}{3x^2} \end{align}$$

But that's OK, the rule still applies. We simply take derivatives of the numerator and denominator again.

Taking the derivative once again gives us an   $\frac{\infty}{\infty}$   limit:

$$\lim_{x\to\infty} \, \frac{6x^2 - 10x}{3x^2} = \lim_{x\to\infty} \, \frac{12x - 10}{6x}$$

But that's still OK; the rule still applies, so we'll take another round of derivatives to get:

$$\lim_{x\to\infty} \, \frac{12x - 10}{6x} = \lim_{x\to\infty} \, \frac{12}{6} = 2$$

Finally, we have an answer. As $x \rightarrow \infty$, the function approaches a fixed limit of 2.

Pro tip

As long as the previous application of L'Hôpital's rule yielded an indeterminate form, it's fine to repeat it as many times as necessary to reduce the limit to a form that can be evaluated.


Example 4

Find the limit of $f(x) = x·ln(x)$ as x approaches zero from the right.


Direct substitution of zero for x gives us one of the indeterminate forms, but one for which it is difficult to know how to apply L'Hôpital's rule.

$$\lim_{x\to 0^+} \, x\, ln(x) \; \rightarrow \; (0 \cdot -\infty)$$

However, we can use an algebraic trick, writing $x$ as $1/(1/x)$, or $1/(x^{-1})$, to give a form that then yields the indeterminate form $\frac{\infty}{\infty}$ after direct substitution.

Now we can take derivatives as usual, to get:

$$\lim_{x\to 0^+} \, \frac{\frac{1}{x}}{-x^{-2}} = \lim_{x\to 0^+} \, (-x) = 0$$


We need to take a minute to consider that this is a one-sided limit. It's actually a natural way to write a limit like this; recall that the domain of a function like this, containing a log function, is $x \ge 0$.


Example 5

$$\lim_{x\to 0} \, \left( \frac{1}{\text{sin}(x)} - \frac{1}{x} \right)$$

 


Direct substitution of 0 for $x$ gives the indeterminate form,

$$= \lim_{x\to 0} \, \left( \frac{1}{\text{sin}(x)} - \frac{1}{x} \right) \; \rightarrow \; (\infty - \infty)$$

which is difficult to work with. However, we can fins a common denominator for those two fractions in the parenthesis to get a $\frac{0}{0}$ limit:

$$\lim_{x\to 0} \, \left( \frac{x - \text{sin}(x)}{x \, \text{sin}(x)} \right) \; \rightarrow \; \left( \frac{0}{0} \right)$$

Application of L'Hôpital's rule gives us another indeterminate limit $\left(\frac{0}{0}\right)$:

$$ \begin{align} &= \lim_{x\to 0} \, \frac{x - \text{sin}(x)}{x \text{sin}(x)} \\[5pt] &= \lim_{x\to 0} \, \frac{1 - \text{cos}(x)}{x \text{cos}(x) + \text{sin}(x)} \end{align}$$

So we just apply the rule again to get a limit we can finally evaluate,

$$= \lim_{x\to 0} \, \frac{\text{sin}(x)}{-x \text{sin}(x) + 2 \text{cos}(x)} = 0$$

... so you may have to try a few things (some of which may fail – no big deal – and be persistent about applying L'Hôpital's rule to solve some of these limits.


Example 6

$$\lim_{x\to \infty} \, x^{1/x}$$

 


This limit has the indeterminate form,

$$\lim_{x\to\infty} \, x^{1/x} \; \rightarrow \; 0^{\infty}$$

which is an acceptable form for L'Hôpital's rule, but we'll need to rearrange it into one of the ratio forms to proceed. If we let

$$y = x^{\frac{1}{x}} \; \; \text{then} \; \; ln(y) = \frac{1}{x} ln(x)$$

Then we can take the limit of $\text{ln}(y)$ like this.

$$ \begin{align} \lim_{x\to \infty} \, ln(y) &= \lim_{x\to \infty} \, \frac{ln(x)}{x} \\[5pt] &= \lim_{x\to \infty} \, \frac{1/x}{1} = 0 \end{align}$$

Notice that the second term in that last equation series is an $\frac{\infty}{\infty}$ limit. Now we apply the inverse function, $e^y$, to our result to get the limit:

$$ \begin{align} \lim_{x\to \infty} \, y &= \lim_{x\to \infty} \, e^{ln(y)} \\[5pt] &= e^{\lim_{x\to \infty} \, ln(y)} \\[5pt] &= e^0 = 1 \end{align}$$

Proof of L'Hôpital's rule $\big( \frac{0}{0} \; \text{case}\big)$


Here is a proof of L'Hôpital's rule for the case where, as $x \rightarrow a$, $f(a) = g(a) = 0$, which is a $\frac{0}{0}$ case. We have to assume that $f'(x)$ and $g'(x)$ are continuous at $x = a$ and that $g'(a) ≠ 0$, as we stated in the theorem box above. We simply build up to a ratio of derivatives. In these two steps, first the terms $f(a)$ and $g(a)$, both of which are known to be zero, are subtracted from the numerator and denominator, respectively. Then, to build toward a derivative, the numerator and denominator are both divided by $x - a$.

$$\frac{f(x)}{g(x)} = \frac{f(x) - f(a)}{g(x) - g(a)} = \frac{\frac{f(x) - f(a)}{x-a}}{\frac{g(x) - g(a)}{x-a}},$$

where $f(a) = g(a) = 0.$ Now if we take the limit of each term of the ratio, and recall (from the properties of limits)

that the limit of a ratio is the ratio of the limits of the numerator and denominator, taken separately, we have the derivative $f'(x)$, evaluated at $a$ over the derivative $g'(x)$ evaluated at $a$.

$$\lim_{x\to a} \, \frac{f(x)}{g(x)} = \frac{\color{#E90F89}{\lim_{x\to a} \frac{f(x) - f(a)}{x-a}}}{\lim_{x\to a} \frac{g(x) - g(a)}{x-a}}$$

Now notice that the expression in magenta is the derivative of $f(x)$ evaluated at $x = a$, and likewise for the denominator, $g'(a)$, so we have

$$\frac{f'(a)}{g'(a)} = \lim_{x\to a} \frac{f'(x)}{g'(x)}$$

The general proof of L'Hôpital's rule (i.e. for all indeterminate forms) is a little more involved, and I'll save it for another time.


Practice problems


  1. $$\lim_{x\to 0} \frac{\text{sin}(x)}{x}$$

    Solution

    $$ \begin{align} \lim_{x\to 0} \frac{\text{sin}(x)}{x} \; &\longrightarrow \left( \frac{0}{0} \right) \\[5pt] \lim_{x\to 0} \frac{\text{cos}(x)}{1} &= \lim_{x\to 0} \, \text{cos}(x) \\[5pt] &= \text{cos}(0) = 1 \end{align}$$


  2. $$\lim_{x\to 0} \frac{\text{cos}(x) - 1}{x}$$

    Solution

    $$ \begin{align} \lim_{x\to 0} \frac{\text{sin}(x)}{x} \; &\longrightarrow \left( \frac{0}{0} \right) \\[5pt] \lim_{x\to 0} \frac{-\text{sin}(x)}{1} &= -\lim_{x\to 0} \, \text{sin}(x) \\[5pt] &= \text{sin}(0) = 0 \end{align}$$


  3. $$\lim_{x\to 0} \frac{x - \text{sin}(x)}{\text{tan}(x)}$$

    Solution

    $$ \begin{align} \lim_{x\to 0} \frac{x - \text{sin}(x)}{\text{tan}(x)} \; &\longrightarrow \left( \frac{0}{0} \right) \\[5pt] \lim_{x\to 0} \frac{1-\text{cos}(x)}{sec^2(x)} &= \lim_{x\to 0} \, \frac{1 - \text{cos}(x)}{\left( \frac{1}{\text{cos}(x)} \right)^2} \\[5pt] &= \frac{1 - 1}{1} = 0 \end{align}$$


  4. $$\lim_{x\to 0} \frac{ln[\text{cos}(x)]}{x}$$

    Solution

    We have to be careful with this function. Take a look at its graph:

    Notice that the limits at x = 0 are different from the left and the right. We can work it out using L'Hopital's rule:

    $$ \begin{align} \lim_{x\to 0} \frac{ln(\text{cos}(x))}{x} \; &\longrightarrow \left( \frac{0}{0} \right) \\[5pt] \lim_{x\to 0} \frac{\frac{1}{\text{cos}(x)}(-\text{sin}(x))}{1} &= \lim_{x\to 0} \, \frac{-\text{sin}(x)}{\text{cos}(x)} \\[5pt] &= \lim_{x\to 0} -\text{tan}(x) = 0 \end{align}$$

    But from the right, the limit would be infinite.


  5. $$\lim_{x\to\infty} \frac{e^x + 1}{x^2}$$

    Solution

    $$ \begin{align} \lim_{x\to\infty} \frac{e^x + 1}{x^2} \; &\longrightarrow \left( \frac{\infty}{\infty} \right) \\[5pt] \lim_{x\to \infty} \frac{e^x}{2x} &= \lim_{x\to\infty} \, \frac{e^x}{2} \\[5pt] &= \frac{1}{2}\lim_{x\to \infty} \, e^x \; \rightarrow \; = \infty \end{align}$$


  6. $$\lim_{x\to 0^-} x e^{\frac{1}{x}}$$

    Solution

    $$\lim_{x\to\ 0^-} \, x \, e^{\frac{1}{x}}$$

    We have to be careful with this function. Take a look at its graph:

    Notice that the limits at x = 0 are different from the left and the right. We can work it out using L'Hopital's rule. First manipulate it into a ∞/∞ limit like this:

    $$\lim_{x\to 0^-} \, \frac{e^{1/x}}{\frac{1}{x}}$$

    $$\lim_{x\to 0^-} \, \frac{e^{1/x}}{\frac{1}{x}} \; \longrightarrow \left( \frac{\infty}{\infty} \right)$$

    Now when x is positive, we have:

    $$ \require{cancel} \lim_{x\to 0^-} \frac{e^{1/x} \cancel{\left( \frac{-1}{x^2} \right)}}{\cancel{\frac{-1}{x^2}}} = \lim_{x\to 0^-} \, e^{1/x} = e^{\infty} \; \rightarrow \; \infty$$

    But when x < 0, that is, when we approach zero from the left, we have:

    $$\lim_{x\to 0} \frac{1}{e^{\frac{1}{x}}} = 0$$


  7. $$\lim_{x\to 0} \frac{1 - \text{cos}(x)}{x^2}$$

    Solution

    $$ \begin{align} \lim_{x\to 0} \, \frac{1 - \text{cos}(x)}{x^2} \; &\longrightarrow \left( \frac{0}{0} \right) \\[5pt] \lim_{x\to 0} \frac{\text{sin}(x)}{2x} &\longrightarrow \left( \frac{0}{0} \right) \\[5pt] \lim_{x\to 0} \frac{\text{cos}(x)}{2} &= \bf{\frac{1}{2}} \end{align}$$


  8. $$\lim_{x\to 0} \,x\,csc(x)$$

    Solution

    $$ \begin{align} \lim_{x\to 0} \, x \, csc(x) = \lim_{x\to 0} \, \frac{x}{\text{sin}(x)} \; &\longrightarrow \left( \frac{0}{0} \right) \\[5pt] \lim_{x\to 0} \, \frac{1}{\text{cos}(x)} &= 1 \end{align}$$

  1. $$\lim_{x\to 1} \frac{x^3 - x^2}{x^3 - 1}$$

    Solution

    $$ \begin{align} \lim_{x\to 1} \, \frac{x^3 - x^2}{x^3 - 1} \; &\longrightarrow \; \left( \frac{0}{0} \right) \\[5pt] &= \lim_{x\to 1} \, \frac{3x^2 - 2x}{3x^2} \\[5pt] &= \frac{3 - 2}{3} = \frac{1}{3} \end{align}$$


  2. $$\lim_{x\to 0} \frac{\text{tan}(x)}{\text{tan}(3x)}$$

    Solution

    $$ \begin{align} \lim_{x\to 0} \, \frac{\text{tan}(x)}{\text{tan}(3x)} \; &\longrightarrow \; \left( \frac{0}{0} \right) \\[5pt] &= \lim_{x\to 0} \, \frac{sec^2(x)}{3 sec^2(3x)} = \lim_{x\to 0} \, \frac{\frac{1}{\text{cos}^2(x)}}{\frac{3}{\text{cos}^2(3x)}} \\[5pt] &= \lim_{x\to 0} \, \frac{\text{cos}^2(3x)}{3 \text{cos}^2(x)} = \frac{\text{cos}^2(0)}{3 \text{cos}^2(0)} = \frac{1}{3} \end{align}$$


  3. $$\lim_{x\to\infty} x^3 e^{-x}$$

    Solution

    $$ \begin{align} \lim_{x\to\infty} \, x^3 e^{-x} &= \lim_{x\to\infty} \frac{x^3}{e^x} \; \longrightarrow \; \left( \frac{\infty}{\infty} \right) \\[5pt] &= \lim_{x\to\infty} \frac{3x^2}{e^x} = \lim_{x\to\infty} \frac{6x}{e^x} \\[5pt] &= \lim_{x\to\infty} \frac{6}{e^x} = 0 \end{align}$$


  4. $$\lim_{x\to 0} x^2 \, ln(x)$$

    Solution

    $$\lim_{x\to 0} \, x^2 \, ln(x)$$

    We can manipulate this limit into an $\frac{\infty}{\infty}$ limit like this:

    $$ \begin{align} \lim_{x\to 0} \, \frac{ln(x)}{\frac{1}{x^2}} \; &\longrightarrow \; \left( \frac{\infty}{\infty} \right) \\[5pt] &= \lim_{x\to 0} \frac{\frac{1}{x}}{\frac{-2}{x^3}} = \lim_{x\to 0} \frac{-x^3}{2x} \\[5pt] &= \lim_{x\to 0} \frac{-x^2}{2} = 0 \end{align}$$


  5. $$\lim_{x\to 0^+} x^{\text{sin}(x)}$$

    Solution

    $$\lim_{x\to 0^+} \, x^{\text{sin}(x)}$$

    This one is do-able, but we have to use some trickery. Instead, find the limit of:

    $$\lim_{x\to 0^+} \, ln\left( x^{\text{sin}(x)} \right) = \lim_{x\to 0^+} \, \text{sin}(x) ln(x)$$

    Using the properties of limits, we'll be able to take the result of this as an exponent of e to get the final answer. Now re-express as:

    $$ \begin{align} \lim_{x\to 0^+} \, \frac{ln(x)}{\frac{1}{\text{sin}(x)}} \; &\longrightarrow \; \left( \frac{\infty}{\infty} \right) \\[5pt] &= \lim_{x\to 0^+} \frac{\frac{1}{x}}{\frac{\text{cos}(x)}{\text{sin}^2(x)}} \\[5pt] &= \lim_{x\to 0^+} \frac{\text{sin}^2(x)}{x \text{cos}(x)} \; \longrightarrow \; \left( \frac{0}{0} \right) \\[5pt] &= \lim_{x\to 0^+} \frac{2 \text{sin}(x) \text{cos}(x)}{\text{cos}(x) - x \text{sin}(x)} = \frac{0}{1} = 0 \end{align}$$

    Now we actually found the log (ln) of the limit, so we have to undo that:

    $$\lim_{x\to 0^+} \, x^{\text{sin}(x)} = e^0 = 1$$


  6. $$\lim_{x\to\infty} \frac{\sqrt{1 + x^2}}{x}$$

    Solution

    This is a fascinating limit. A first look, particularly in the context of a L'Hopital's rule section, is that it's an ∞/∞ limit, so we can apply L'Hopital's rule like this:

    $$ \begin{align} \lim_{x\to\infty} \, \frac{\sqrt{1 + x^2}}{x} \; &\longrightarrow \; \left( \frac{\infty}{\infty} \right) \\[5pt] &= \lim_{x\to\infty} \frac{\frac{1}{\cancel{2}}(1 + x^2)^{-1/2}\cancel{2}x}{1} \\[5pt] &= \lim_{x\to\infty} \frac{x}{\sqrt{1 + x^2}} \end{align}$$

    Now this is just the reciprocal of our original limit, and a little thought will convince you that if we apply L'Hopital's rule again, we'll just get back to the original limit; it's a never-ending loop. So how to solve it? Using the properties of limits, try squaring the whole limit:

    $$\left( \lim_{x\to \infty} \frac{\sqrt{1 + x^2}}{x} \right)^2 = \lim_{x\to \infty} \frac{1 + x^2}{x^2} = 1.$$

    Now if we just take the square root of that result, the solution is 1.


  7. $$\lim_{x\to\infty} (e^{-x})^{1/x}$$

    Solution

    $$\lim_{x\to\infty} \, (e^{-x})^{\frac{1}{x}} = \lim_{x\to\infty} \left( \frac{1}{e^x} \right)^{\frac{1}{x}}$$

    This is a $0^0$ limit. We can solve it by taking the limit of the natural log of this function, remembering that we'll have to raise our result as a power of e to finish:

    $$ \begin{align} &\lim_{x\to\infty} \, ln\left[ (e^{-x})^{\frac{1}{x}} \right] \\[5pt] &= \lim_{x\to\infty} \, \frac{1}{x} \, ln(e^{-x}) = \lim_{x\to\infty}\, \frac{-x}{x} = -1 \end{align}$$

    Now raise that result as a power of e:

    $$e^{-1} = \frac{1}{e}$$


  8. $$\lim_{x\to\infty} \frac{e^x}{x}$$

    Solution

    $$ \begin{align} \lim_{x\to\infty} \, \frac{e^x}{x} \; &\longrightarrow \; \left( \frac{\infty}{\infty} \right) \\[5pt] &= \lim_{x\to\infty} \frac{e^x}{1} \; \longrightarrow \; \infty \end{align}$$

    This makes sense. The exponential function in the numerator grows faster than the polynomial function in the denominator.

Creative Commons License   optimized for firefox
xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012-2025, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.