# L'hopital's rule

L'Hopital's rule is a theorem that can be used to evaluate difficult limits. It involves taking the derivatives of these limits, which can simplify the evaluation of the limit.

The theorem states that if f and g are differentiable and g'(x) ≠ 0 on an open interval containing a (except possibly at a) and one of the following holds:

Then:

given that the limit on the right side exists or is . For case 1, the limit is called an intermediate form of type 0/0. Similarly, in case 2, is called an indeterminate of the form ∞/∞.

Although L'Hopital's rule can sometimes be used with indeterminate limits of other forms, it is most typically useful for limits of the forms mentioned: 0/0 or ∞/∞. Both these types of indeterminate limit represent a "fight" between the numerator and denominator in which the "winner" is unclear without further calculation. "Winning," as it is used here and throughout the rest of the article, refers to which part of the function is dominant, i.e., which one is reaching its limit faster.

For limits of the form 0/0, if the numerator wins, then the limit will be 0. If instead the denominator wins, the limit will be . In the case of a tie, the limit will be a finite number.

The reverse logic also applies for limits of the form ∞/∞. Namely, for limits of type ∞/∞, if the numerator wins, the limit will be ∞. If the denominator wins, the limit will be 0. If there is a tie, then the limit will be a finite number as in the 0/0 case.

Example 1:

As x approaches ∞, both x and lnx approach infinity, so this is an indeterminate limit of type ∞/∞. If we apply L'Hopital's rule we get:

which tends to infinity, so the limit is .

Example 2:

If we plug in x = -4, we get 0/0, so when we apply L'Hopital's rule we get:

Note: Instead of using L'Hopital's rule, we could have multiplied both top and bottom by , which is the conjugate of the numerator. After doing so, we would obtain:

whose limit at -4 can be evaluated by plugging in x = -4. In general, we should try to look for an easier way to evaluate a limit such as using conjugates before resorting to L'Hopital's rule.

### How to handle 0∙∞

Whenever and , is called an indeterminate form of type 0∙∞. The limit could be 0 or ∞ if f or g wins respectively, or could be a finite number in the case of a tie. We can turn the indeterminate form 0∙∞ into either the form 0/0 or ∞/∞ by rewriting fg as

respectively so that we can use L'Hopital's rule. We choose between 0/0 and ∞/∞ based on which is easier to compute.

Example 3:

When we plug in for x for x we get and , so this is an indeterminate product of the form 0∙∞. We rewrite

as

which is of the form 0/0. By L'Hopital's rule:

= | |||

= | |||

= |

Note: We could have rewritten

as

which is of the form ∞/∞, but solving this with L'Hopital's rule would be more complicated.

Alternatively, we could have noted that and rewritten

Since ,

Now, applying L'Hopital's rule yields:

= | |||

= | |||

= |

which is what we got before.

### Applying L'Hopital's rule multiple times

Sometimes, applying L'Hopital's rule to indeterminate limits of the form 0/0 or ∞/∞ results in another 0/0 or ∞/∞ limit, and we have to use L'Hopital's rule a couple of times to determine the limit.

Example 4:

But this is still a limit of the form ∞/∞, and we would have to apply L'Hopital's rule 1000 times to be able to evaluate the limit. After each application of L'Hopital's rule, the resulting limit will still be ∞/∞ until the denominator is a constant. In the end we would get:

Note: If n is a positive integer, the symbol n!, called "n factorial," is defined to be:

where 0! is defined to be 1.

Even though 1000! is unimaginably large, e^{x} grows to infinity so the limit is still +∞.

### How to handle 1^{∞}, 0^{0}, ∞^{0}

Whenever and , the limit is called an indeterminate form of type 1^{∞}.

Replace f(x) and g(x) with 0 or infinity for the remaining two cases.

1^{∞} case: If f wins, or approaches its limit faster, the result is 1. If g wins, the result is ∞. If there is a tie, the result is a finite number.

0^{0} case: If f wins, the result is 0. If g wins, the result is 1. If there is a tie, the result is a finite number.

∞^{0} case: If f wins, the result is ∞. If g wins, the result is 1. If there is a tie, the result is a finite number.

For these indeterminate forms that involve exponents such as 1^{∞}, 0^{0}, ∞^{0}, we need to use the natural log function to turn the limit into the form 0^{0} or ∞^{∞} so that we can use L'Hopital's rule (see the trick in Implicit Differentiation for an example of how we use the ln function).

Example 5:

As x grows large, the limit is of the form ∞^{0}, so for now, we call the limit and take the ln of both sides to get:

Since ln is a continuous function, we can exchange the order of ln and lim symbols to get:

Since is just the reciprocal of the first example, , so L = 1.

Example 6:

and so this limit is of type 1^{∞} and we need to take the ln of this limit:

= | |||

= | |||

= |

Since , we can drop the term:

Now, this is in the form 0/0, so we apply L'Hopital's rule:

= | |||

= | |||

= |

Since this is the ln of the original limit, the original limit must be e^{0} = 1.

### How to handle ∞-∞

When working with limits of the form , we can use the exponential function to turn the limit into the form . In a way, this is the reverse technique of using the ln function to evaluate indeterminate forms of type 1^{∞}, ∞^{0}, and 0^{0}. If f and g are fractions, we can simply combine them into a single quotient using the least common denominator.

Example 7:

Both tan(x) and sec(x) approach infinity in this limit so we can use L'Hopital's rule. But first, since and we can rewrite the above as:

= | |||

= |

This is now of the form 0/0 so we can use L'Hopital's rule:

Example 8:

Both and approach infinity, so we can call the limit L for now and take the exponential of both sides. Since the exponential is a continuous function like ln, we can exchange the order of the exponential and limit operations:

Evaluating further gives us:

= | |||

= |

We could use L'Hopital's rule at this point since both and x approach +∞ so the limit is of type ∞/∞, but the math would be messy.

Instead we can rewrite x as:

and make the substitution y = so that:

and the limiit becomes:

This is the same limit we evaluated in Example 4, so

We are not quite done because this is the exponential of the original limit, or:

so we take the ln of both sides to conclude that:

### When not to use L'Hopital's rule

L'Hopital's rule can give you the wrong answer if applied incorrectly.

Example 9:

This limit can be evaluated simply by plugging in x = 0 to get:

However, if we indiscriminately apply L'Hopital's rule without plugging in the value x = 0, we would get:

which is wrong!

Remember, L'Hopital's rule only applies if the original limit is of type 0/0 or ∞/∞. Since the original limit was 2, L'Hopital's rule does not apply. This is why we should always plug the value that x is approaching into the limit to make sure that there is not an easier way to evaluate the limit before using L'Hopital's rule.

Also, L'Hopital's rule does not always work because in some cases, repeatedly applying L'Hopital's rule will still result in indeterminate forms regardless of how many times the rule is applied.

Example 10:

Both and approach , so we can apply L'Hopital's rule:

= | |||

= | |||

= |

However, this is still ∞/∞ so we apply L'Hopital's rule again:

= | |||

= | |||

= |

However, this brings us back to where we started, so we need to use another method to evaluate the limit. Notice that since x + 1 is always positive and x approaches +∞. Also, completing the square tells us that . Therefore,

= | |||

= | |||

= | |||

= | |||

= | |||

= |

We may have expected this because as x approaches ∞, , which can be approximated as . This equals , so we can guess that the limit should be .

### Why L'Hopital's rule works

Recall the statement of L'Hopital's rule:

If f and g are differentiable and g'(x) ≠ 0 on an open interval containing a (except possibly at a) and one of the following holds:

Then:

given that the limit on the right side exists or is .

To see why for the 0/0 case, recall the definition of a derivative at the point x = a:

If we assume that f' and g' are continuous at a, then their limits near x = a equal their values at x = a:

Therefore:

Dividing these two equations and remembering that from the properties of limits:

,

we get:

= | |||

= | |||

= |

Notice that we can cancel out the x - a terms on the right-most side to get:

= | |||

= |

Since we assumed that is type 0/0, we can also say that

f(a) = 0

g(a) = 0

If we plug this into the formula for we get:

= | |||

= | |||

= |

which is L'Hopital's rule.

We can convert the case when is of type ∞/∞ into a type 0/0 case by rewriting as :

Since and , we know that and , so is now a type 0/0 case for which we have just proven L'Hopital's rule works. Therefore we can apply L'Hopital's rule to to get:

= | |||

= |

Using the chain rule,

and

Plugging these into the previous formula:

= | |||

= |

We can simplify the right-hand side to get:

Now we plug this back into the previous equation to get:

Remembering our original rewrite that , we know that:

= | |||

= |

Notice that we can cancel out a term from the left and right side of the above equation to get:

Now, if we multiply both sides by , we get L'Hopital's rule for the ∞/∞ case:

= | |||

= |