L'Hopital's Rule

When we're doing some of these calculations with continuous probabilities, we will need to take a limit as part of the calculation. Sometimes, these limits show up as one of a few indeterminate forms. Some examples are

  • $\frac{\infty}{\infty}$ or $\frac{0}{0}$
  • $0\cdot \infty$
  • $0^{0}$ or $\infty^{0}$ or $1^\infty$
These are forms in which the it is not clear how to apply the rules of arithmetic. For example, we're told that any number times 0 is always 0, yet any number times infinity is always infinity. How then do we make sense of $0\cdot \infty?$.

These forms don't actually make sense on their own, but can be evaluated as the result of a limit. In fact, what ends up being important is the speed at which these limits are approached. This idea can be quantified in what is known as L'Hopital's rule:

L'Hopital's rule: If $f$ and $g$ are differentiable functions and $\lim_{x\to a}f(x) = \lim_{x\to a}g(x) = 0$ or $\lim_{x\to a}f(x) = \lim_{x\to a}g(x) = \pm \infty$, then $$\lim_{x\to a}\frac{f(x)}{g(x)} = \lim_{x \to a }\frac{f'(x)}{g'(x)}.$$

Example: We needed to know $$\lim_{x\to \infty} x e^{-\lambda x}$$ in order to calculate the expected value of the exponential distribution. In order to apply L'Hopital's rule, we need to first write this as a ratio of two functions. We can use exponent rules to write $e^{-\lambda x}=\frac{1}{e^{-\lambda x}}$. Then since $\frac{d}{dx} x = 1$ and $\frac{d}{dx} e^{\lambda x} = \lambda e^{\lambda x}$ we have from L'Hopital's rule $$ \lim_{x\to\infty} x e^{-\lambda x} = \lim_{x\to \infty} \frac{x}{e^{\lambda x}} = \lim_{x\to \infty}\frac{1}{\lambda e ^{\lambda x}}=0$$ where this last term evaluates to 0 since $\lambda$ is a positive number. The idea here is that $e^{-\lambda x}$ converges to 0 as $x \to \infty$ faster than $x$ goes to infinity.

Example: Find $\displaystyle\lim_{x\to 2}\frac{x^2-4}{2x-4}.$

We'll notice that we don't need to use L'Hopital's rule here. The numerator of this limit is factorable as $x^2-4 = (x-2)(x+2).$ Therefore we could just write $$\lim_{x\to 2} \frac{x^2-4}{2x-4}= \lim_{x\to2}\frac{(x-2)(x+2)}{2(x-2)} = \lim_{x\to 2}\frac{x+2}{2} = 2$$ However, since this limit is an indeterminate form, we can use L'Hopital's rule. By taking the derivitave of the numerator and denominator separately, we have $$\lim_{x\to2} \frac{x^2-4}{2x-4} = \lim_{x\to 2}\frac{2x}{2} = \lim_{x\to 2}x = 2.$$

Example: Find $\displaystyle\lim_{x\to\infty} x^{1/x}$

This is in the indeterminate form $\infty^0$, which is not one of the forms that we can apply L'Hopital's rule to directly. So we need to convert this into a ratio of different functions. In order to get the $1/x$ out of the exponent, we will take a logarithm, and in order to make sure that we aren't changing the function at all, we will also take the exponential of the function. In other words, notice that $$ x^{1/x} = e^{\ln(x^{1/x})}.$$ Then we have $$\lim_{x\to\infty} x^{1/x}= \lim_{x\to\infty}e^{\ln(x^{1/x})}.$$ At first glance, this looks worse. However, we can use the fact that $e^{x}$ is a continuous function to bring the limit inside, and use our exponent rulest to simplify to $$\lim_{x\to \infty} x^{1/x} = e^{\lim_{x\to\infty}\frac{\ln(x)}{x}}.$$ Therefore we can solve the original problem if we solve $$L = \lim_{x\to\infty} \frac{\ln(x)}{x},$$ which is in the indeterminate form $\frac{\infty}{\infty}$. L'Hopital's rule can handle this. Applying L'Hopital's rule gives $$L = \lim_{x\to\infty} \frac{1/x}{1} = 0,$$ and therefore $$\lim_{x\to\infty} x^{1/x} = e^{L} = e^0 = 1.$$

Exercises:

  1. Find each of the following limits
    1. $$\lim_{x\to0}\frac{\sin(x)}{1-\cos(x)}$$
    2. $$\lim_{x\to 0}\frac{e^{x}-1}{x}$$
    3. $$\lim_{x\to \infty} x \ln\left(1+\frac{1}{x}\right)$$
    4. $$\lim_{x\to\infty} xe^{-x^2}$$
    5. $$\lim_{x\to0} \frac{e^x-1-x}{x^2}$$
    6. $$\lim_{x\to\infty} \left(1+\frac{1}{x}\right)^x$$