# L’Hôpital’s Rule - what it is and why it works

Let’s suppose, for the moment, you’re interested in the function $f(x) = \frac{\pi\sin(x)}{x}$. It’s a perfectly respectable function, defined everywhere except for $x = 0$, where the bottom is 0. The top is also zero there (because $\sin(0) = 0$), so its value is, strictly speaking, *indeterminate* - $\frac{0}{0}$ could, in reality, be anything.

However, if you draw the graph of $y = \frac{\pi\sin(x)}{x}$, you’ll see that near $x=0$, the value gets closer and closer to $\pi$, and it’s the same on either side, so saying $\frac{\pi \sin(0)}{0} “=“ \pi$ seems legit. Unfortunately, we can’t write that, because of the whole dividing by 0 problem, but we can say that as $x \rightarrow 0$ (“$x$ approaches zero”), $\frac{\pi \sin(0)}{0} \rightarrow \pi$. Our answer gets as close to $\pi$ as we could possibly want.

One way to show this is to use something called L’Hôpital’s rule, which I’ve always liked because it has two apostrophes and a circumflex. I’ve recently come to appreciate it more, on the ground that L’Hôpital didn’t discover it, Bernoulli did - and L’Hôpital bought the rights.

Here’s what it says:

If $u(x_0) = 0$ and $v(x_0) = 0$ for some value of $x_0$, and if you can differentiate $u(x)$ and $v(x)$ at $x_0$, then the limit of $\frac{u(x)}{v(x)}$ as $x \rightarrow x_0$ is $\frac{u’(x_0)}{v’(x_0)}$.

I’m not going to go into many of the subtleties of that here, but focus on the main result: if you’ve got a function that gives an indeterminate fraction somewhere, you can find the value that makes sense by dividing the derivatives.

### Danger! Danger!

Under no circumstances should you confuse L’Hôpital’s rule with the quotient rule. Different things with different uses. Be careful.

### In this case…

So, in this case, we’ve got $u(x) = \pi \sin(x)$, which gives $u’(x) = \pi \cos(x)$. Meanwhile, $v(x) = x$, so $v(x) = 1$.

Divide them to get $\frac{u’(0)}{v’(0)} = \frac{\pi \times 1}{1} = \pi$, which is what we wanted. Hooray.

### But why?

The pirate proof is very simple, if you know your Taylor series. You know that $u(x_0 + \epsilon) \simeq u(x_0) + \epsilon u’(x_0) + …$, where $\epsilon$ is small and everything after that is *really* small - so small we can ignore it.

Similarly, $v(x_0 + \epsilon) \simeq v(x_0) + \epsilon v’(x_0) + …$, where again $\epsilon$ is small and everything else is too small to worry about.

So that means $f(x_0 + \epsilon) \simeq \frac{ u(x_0) + \epsilon u’(x_0)}{v(x_0) + \epsilon v’(x_0)}$. However, we also know that $u(x_0) = v(x_0) = 0$, because $f(x)$ is indeterminate. So, that’s all the same as $f(x_0 + \epsilon) = \frac{ \epsilon u’(x_0) + \epsilon^2(\text{stuff})}{ \epsilon v’(x_0) + \epsilon^2 (\text{stuff})}$.

We can divide the top and bottom by $\epsilon$ (which, remember, is small):

$f(x_0 + \epsilon) \simeq \frac{ u’(x_0) + \epsilon(\text{stuff})}{ v’(x_0) + \epsilon(\text{stuff})}$.

Lastly, we see what happens when we let $\epsilon$ approach zero: the “stuff” all becomes zero, so $f(x_0 + \epsilon) \rightarrow \frac{u’(x_0)}{v’(x_0)}$ as $\epsilon \rightarrow 0$ - or, better still:

$f(x) \rightarrow \frac{u’(x_0)}{v’(x_0)}$ as $x \rightarrow x_0$