Tutorials on Advanced Math and Computer Science Concepts

L'Hopital's Rule

Throughout our work with limits and derivatives, we encountered a number of hard to solve limits. For example, consider $lim_{x \to 0} \frac{sin(x)}{x}$. When determining the derivative of sin(x), we encountered this limit, and used a geometric proof to show that it should be equal to 1.

Limits like these are hard to solve, which is where L'Hopital's rule comes in handy. L'Hopital's rule gives us an easy way to solve limits that are in indeterminate forms. We will start by discussing what indeterminate form is, and show how we can use L'Hopital's rule.

Definition: A limit is in indeterminate form if, after substituting the limit value, you receive one of the following outcomes:

  1. $lim_{x \to a} \frac{f(x)}{g(x)} = \frac{0}{0}$
  2. $lim_{x \to a} \frac{f(x)}{g(x)} = \frac{\infty}{\infty}$
  3. $lim_{x \to a} \frac{f(x)}{g(x)} = \frac{-\infty}{-\infty}$

For example, with $lim_{x \to 0} \frac{sin(x)}{x}$, substituting x = 0 gives us $\frac{0}{0}$, which means that the limit is in indeterminate form. For these limits, we can apply L'Hopital's rule.

L'Hopital's Rule: Suppose that f(x) and g(x) are differentiable, and $g'(x) \ne 0$. If $lim_{x \to a} \frac{f(x)}{g(x)}$ is in indeterminate form, then $lim_{x \to a} \frac{f(x)}{g(x)} = lim_{x \to a} \frac{f'(x)}{g'(x)}$

Essentially, L'Hopital's rule tells us that if a limit is in indeterminate form, we should take the derivative of both functions until it is either solved, or no longer in indeterminate form.

Example: Determine $lim_{x \to 0} \frac{sin(x)}{x}$

You will see that this problem becomes quite easy with L'Hopital's rule. We can simply take the derivative of both functions to get: $lim_{x \to 0} \frac{sin(x)}{x} = lim_{x \to 0} \frac{cos(x)}{1} = 1$

This makes the limit significantly easier to solve, compared to the geometric proof shown earlier.

Example: Determine $lim_{x \to \infty} \frac{e^x}{x^2}$

We can see that this is in indeterminate form, since putting infinity in gives us: $lim_{x \to \infty} \frac{e^x}{x^2} = \frac{\infty}{\infty}$

You will see the first derivative didn't help us much, but we are still in indeterminate form, so we can take the derivative yet again to get:

$lim_{x \to \infty} \frac{e^x}{x^2}$
$= lim_{x \to \infty} \frac{e^x}{2x}$
$= lim_{x \to \infty} \frac{e^x}{2}$
$= \infty$

Therefore, the answer for this problem is infinity. As you can see, sometimes you may be required to take the derivative more than once to solve the problem. Remember that as long as the result is in indeterminate form, you can continue to apply L'Hoptial's rule.

The indeterminate forms we discussed at the beginning cover a few instances, but not all of them. There are a few additional indeterminate forms that are a little trickier to see.

Indeterminate products: If we have a limit in the form $lim_{x \to a} f(x)g(x)$, where subbing in a gives us $0 * \infty$ or $0 * -\infty$, then the limit is in indeterminate form. To solve the limit, we rewrite it into one of two forms:

  1. $f(x)g(x) = \frac{f(x)}{\frac{1}{g(x)}}$
  2. $f(x)g(x) = \frac{g(x)}{\frac{1}{f(x)}}$

From here, we can apply L'Hopital's rule to solve the limit.

Example: Evaluate the limit $lim_{x \to 0} xln(x)$

Trying to directly substitue 0 will give us indeterminate form: $lim_{x \to 0} xln(x) = 0 * - \infty$, therefore we can apply L'Hopital's rule for indeterminate products.

We can do this by rewritten the function as follows: $lim_{x \to 0} xln(x) = lim_{x \to 0} \frac{ln(x)}{\frac{1}{x}}$

Notice how in this form, if we apply the limit, we get $\frac{0}{0}$. Now, we can apply L'Hopital's rule.

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

The next indeterminate form has to do with differences of functions.

Indeterminate differences: If we have a limit in the form $lim_{x \to a} [f(x) - g(x)]$, where subbing in a gives us $\infty - infty$, then the limit is in indeterminate form. In this case, we should find a common denominator between f(x) and g(x) and apply L'Hopital's rule.

Example: Evaluate $lim_{x \to \frac{\pi}{2}} (sec(x)-tan(x)$

In this case, we can see that for x = $\frac{\pi}{2}$, we get the indeterminate form $\infty - \infty$. This being the case, we can find the common denominator, and apply L'Hopital's rule.

Recall that $tan(x) = \frac{sin(x)}{cos(x)}$ and $sec(x) = \frac{1}{cos(x)}$. This gives us:

$lim_{x \to \frac{\pi}{2}}(\frac{1}{cos(x)}-\frac{sin(x)}{cos(x)})$
$=lim_{x \to \frac{\pi}{2}}(\frac{1-sin(x)}{cos(x)})$

Now, we have a limit that results in $\frac{0}{0}$, so we can apply L'Hopital's rule.
$=lim_{x \to \frac{\pi}{2}}(\frac{-cos(x)}{sin(x)}) = 0$

The final set of indeterminate forms we will discuss are related to powers.

Indeterminate powers: If we have a function that is in the form $lim_{x \to a}[f(x)]^{g(x)}$, we will have an indeterminate form if the following situations occur when evaluating at a:

  1. $lim_{x \to a} [f(x)]^{g(x)} = 0^0$
  2. $lim_{x \to a} [f(x)]^{g(x)} = \infty^0$ or $-\infty^0$
  3. $lim_{x \to a} [f(x)]^{g(x)} = 1^\infty$ or $1^{-\infty}$

In all of these cases, we can take the natural logarithm of the function, to remove the power, and then try to apply L'Hopital's rule.

Example: $lim_{x \to 0} (1+sin(4x))^{cot(x)}$

In this case, putting in 0 will give us $0^0$ which is indeterminate form. To solve this, we need to take the logarithm of the function.

$y = (1+sin(4x))^{cot(x)}$
$\Longrightarrow ln(y) = ln((1+sin(4x))^{cot(x)}$
$\Longrightarrow ln(y) = cot(x) * ln(1+sin(4x))$

By using the fact that $cot(x) = \frac{1}{tan(x)}$, we get:

$lim_{x \to 0}cot(x) * ln(1+sin(4x))$
$\Longrightarrow lim_{x \to 0} \frac{ln(1+sin(4x))}{tan(x)}$

Now, we apply L'Hopital's rule:

$lim_{x \to 0}\frac{ln(1+sin(4x))}{tan(x)}$
$\Longrightarrow lim_{x \to 0} \frac{\frac{4cos(4x)}{1+sin(4x)}}{sec^2(x)} = 4$

We aren't quite done yet. Recall that we applied the logarithm to both sides of the equation, meaning we found the limit for ln(y), not y.

So, to find the value for y, we can use the fact that $y = e^{ln(y)}$. This simply means we take our results to the power of e, so the real answer is $e^4$