Chapter 10L'Hôpital's rule

So far, the past two lessons have been pretty theory heavy; limits being used to formally define the derivative, then epsilons and deltas being used to rigorously define limits themselves. So, in this lesson, let's finish off our dive into limits with a trick for actually computing limits.

For example, let's say for some reason you were studying the function:

f(x)=sin(πx)x21f(x) = \frac{\sin (\pi x)}{x^{2}-1}

Maybe this models some kind of damped oscillation. When you plot a bunch of points to graph it, it looks continuous, but there's a problematic value, x=1x=1.

When you plug x=1x=1 into the numerator sin(πx)\sin(\pi x) becomes 00, and similarly the denominator x21x^{2}-1 also becomes 00, so the function is actually not defined at that input, and the graph should really have a hole there. This also happens at 1-1, but let's just focus our attention on a single one of these holes for now. Imagine zooming in on the point x=1x=1.

The graph of this function certainly does seem to approach some distinct value at that point, wouldn't you say? So you might ask, how do you figure out what output this approaches as xx approaches 11, since you can't just plug in 11?

Well, one way to approximate it would be to plug in a number thats just very very close to 11, like 1.000011.00001. Doing that, you'd find that this should be a number around 1.57-1.57. Translating this to the limit notation looks like this:

Plug a number really close to 11 in for xx or zoom in on the graph of this function and we can see this limit is approximately equal to 1.57-1.57.

But is there a way to know precisely what it is? Some systematic process to take an expression like this one, which looks like 00 divided by 00 at some input, and ask what its limit is as xx approaches that input? After limits so helpfully let us write the definition for a derivative, derivatives can come back to return the favor and help us evaluate limits. Let me show you what I mean.

Plot numerator and denominator

Let's graph the numerator, sin(πx)\sin(\pi x), and the denominator, x21x^2-1, of our original function and focus on what's happening at x=1x=1.

The point here is that sin(πx)\sin(\pi x) and x21x^2-1 are both 00 at that point, so they cross the xx-axis. In the same spirit as plugging in a specific value near 11, like 1.000011.00001, let's zoom in on that point and consider what happens a tiny nudge dxdx away.

The value of sin(πx)\sin(\pi x) is bumped down by some d(sin(πx))d(\sin(\pi x)) and the value of x21x^2-1 is bumped up by some d(x21)d(x^2-1).

Take a moment to think about how the fraction d(sin(πx))/d(x21)d(\sin (\pi x)) / d\left(x^{2}-1\right) reframes the initial problem which had previously looked like 00 divided by 00. Why might this lead us towards an exact answer rather than just an approximation?

Your answer:
Our answer:

First, this fraction is the same as evaluating the original function at f(1+dx)f(1 + dx).

And second, by looking at the ratio of these two tangent lines, whose approximations of the numerator and denominator get better and better as dxdx approaches 00, we are able to reason about the exact value this limit approaches.

Since both of these changes are proportional to the small nudge dxdx, we can go ahead and apply our knowledge of derivatives. Using the chain rule, we know that the change to the function d(sin(πx))d(\sin(\pi x)) should be around cos(πx)πdx\cos(\pi x) \cdot \pi \cdot dx. Similarly, using the power rule, we know that the change to the function x21x^2-1 should be around 2xdx2 x \cdot dx.

Since we are interested in the fraction of these two functions at the point at x=1x = 1 we can substitute x=1x=1 into both of these expressions and evaluate the fraction.

What this means is that for values of xx which are some tiny value dxdx away from 11, the ratio sin(πx)/(x21)\sin(\pi x)/(x^2-1) is approximately (πdx)/(2dx)(-\pi \cdot dx) / (2 \cdot dx). The dxdx's cancel, so that value is π/2-\pi/2. Importantly, these approximations get more and more accurate for smaller and smaller choices of dxdx, this ratio π/2-\pi/2 actually tells us the precise limiting value as xx approaches 11.

Remember, what that means is that the limiting height on our original graph is evidently exactly π/2-\pi/2.


What happened there is a little subtle, so let me show it again, but this time a little more generally. Instead of these two specific functions, which both equal 00 at x=1x=1, think of any two functions f(x)f(x) and g(x)g(x), which are both 00 at some common value x=ax = a.

The only constraint is that these have to be functions where you're able to take a derivative of them at x=ax = a, meaning they each basically look like a line when you zoom in close enough to that value.

Even though you can't compute ff divided by gg at this trouble point, since both equal zero, you can ask about this ratio for values of xx really really close to aa, the limit as xx approach aa. And it's helpful to think of those nearby inputs as a tiny nudge dxdx away from aa.

The value of ff at that nudged point is approximately its derivative, df/dxdf/dx evaluated at aa, times dxdx. Likewise, the the value of gg at that nudged point is approximately the derivative of gg, evaluated at aa, times dxdx.

So near this trouble point, the ratio between the outputs of ff and gg is actually about the same as the derivative of ff at aa, times dxdx, divided by the derivative of gg at aa, times dxdx. These dxdx's cancel, so the ratio of ff and gg near aa is about the same as the ratio between their derivatives.

Because both approximations get more accurate for smaller nudges, this ratio of derivatives gives the precise value for the limit.

This is a really handy trick for computing a lot of limits. If you come across an expression that seems to equal 0/00/0 when you plug in some input, just try taking the derivative of the top and bottom expressions, and plugging in that trouble input.

This clever trick is called "L'Hôpital's rule". Interestingly, it was actually discovered by Johann Bernoulli, but L'Hopital was this wealthy dude who essentially paid Bernoulli for the rights to some of his mathematical discoveries. Academia was weird back then, but in a very literal way, it pays to understand these tiny nudges.

Now, you might remember that the definition of a derivative for any given function comes down to computing the limit of a fraction that looks like 0/00/0, so you might think L'Hopital's rule gives a handy way to discover new derivative formulas. But that would be cheating, since presumably you don't yet know what the derivative on the numerator here is.

When it comes to discovering derivative formulas, something we've been doing a fair amount this series, there is no systematic plug-and-chug method. But that's a good thing. When creativity is needed to solve problems like these, it's a good sign you're doing something real; something that might give you a powerful tool to solve future problems.

In the next lesson, I'll talk about what an integral is, as well as the fundamental theorem of calculus, which is another example of where limits are used to help give a clear meaning to a fairly delicate idea that flirts with infinity.


What is the limit as xx approaches 00 of the function f(x)=sin(x)xf(x) = \frac{\sin(x)}{x}?

What is the limit of the function f(x)=x31x1\displaystyle f(x) = \frac{x^3 - 1}{x-1} as xx approaches 11?

Notice a mistake? Submit a correction on GitHub
Table of Contents


Special thanks to those below for supporting the original video behind this post, and to current patrons for funding ongoing projects. If you find these lessons valuable, consider joining.

Ali YahyaMeshal AlshammariCrypticSwarmKaustuv DeBiswasKathryn SchmiedickeNathan PellegrinKaran BhargavaJustin HelpsAnkit AgarwalYu JunDave NicponskiDamion KistlerJuan BenetOthman AlikhaMarkus PerssonDan BuchoffDerek DaiJoseph John CoxLuc RitchieMustafa MahdiDaan SmedingaJonathan EppeleAlbert Villeneuve NguyenNils SchneiderMathew BramsonJerry LingMark GoveaVecht世珉 匡Rish KundaliaAchille BrightonRipta PasayFelipe DSoufiane KHIATdim85ChrisChris WillisDonald PriceJim LauridsonJim MussaredGabriel CunhaPedro F PardoLoro LukicDavid WyrickRahul SureshLee BurnetteJohn C. VeseyPatrik AgnéAlvin KhaledScienceVRMichael RabadiAlexander JudaMads ElvheimJoseph CutlerCurtis MitchellAndy PetschOtavio GoodViesulas SliupasBrendan ShahAndrew McnabMatt ParlmerDan DavisonJose Oscar Mur-MirandaAidan BonehamHenry ReichSean BibbyPaul ConstantineJustin ClarkMohannad ElhamodBen GrangerJeffrey Herman