Learning Objectives
By the end of this section, you will be able to:
- Recognise the seven indeterminate forms and explain why they defy direct substitution.
- State L'Hôpital's Rule and describe the hypotheses under which it is legal to apply.
- Interpret the rule geometrically — two curves kissing the axis with slopes whose ratio is the limit.
- Compute limits of the forms 0/0 and ∞/∞ using the rule, and convert 0 · ∞, ∞ − ∞, 0⁰, 1^∞, ∞⁰ into one of those two forms.
- Verify the rule numerically in Python and automate it with PyTorch's autograd.
The Problem: When Algebra Runs Out
"What is 0 divided by 0?" The honest answer is: it depends on how both parts got to zero.
Up to this point, computing a limit at a point has been a two-step choreography: plug in , and if the result is a finite number, that is the limit. The trouble is that a quotient like
hands back the moment you substitute. The numerator and denominator both vanish, and the ratio is whatever you want it to be — carries no information. Yet the limit clearly exists, because if you plot the curve near you see it settle comfortably at .
The question that launched L'Hôpital's Rule
Given two functions that both go to zero at the same point, which one gets there faster? The answer — their rates, i.e. their derivatives — turns out to be exactly the limit of the ratio.
In 1696, Guillaume de L'Hôpital published the first calculus textbook, and inside it was a rule (learned from his tutor, Johann Bernoulli) that lets us substitute the derivatives of the numerator and denominator when the originals both go to zero. The rule is astonishingly cheap to state, astonishingly powerful in practice, and leans on every piece of machinery we have built so far: limits, continuity, and the derivative's meaning as a local rate.
What Indeterminate Forms Actually Mean
Not every suspicious-looking expression is indeterminate. A limit that produces is simply . A limit that produces with the denominator approaching 0 from the positive side is . Indeterminate forms are the ones where different underlying rates produce different answers.
| Form | Example | Possible limits | Strategy |
|---|---|---|---|
| 0 / 0 | sin(x)/x as x → 0 | Any real number, ∞, or DNE | L'Hôpital directly |
| ∞ / ∞ | x / eˣ as x → ∞ | Any real number or ∞ | L'Hôpital directly |
| 0 · ∞ | x ln(x) as x → 0⁺ | Any real number or ∞ | Rewrite as 0/0 or ∞/∞ |
| ∞ − ∞ | csc(x) − 1/x as x → 0 | Any real number or ∞ | Combine into a single fraction |
| 0⁰ | xˣ as x → 0⁺ | Any value in [0, ∞] | Take ln; becomes 0 · ∞ |
| 1^∞ | (1 + 1/n)ⁿ as n → ∞ | Any value in [0, ∞] | Take ln; becomes ∞ · 0 |
| ∞⁰ | x^(1/x) as x → ∞ | Any value in [0, ∞] | Take ln; becomes 0 · ∞ |
Why seven, and why these?
Each indeterminate form is a place where two competing behaviours meet — one pushing toward 0, the other toward infinity — and the final answer depends on which wins and by how much. L'Hôpital's Rule quantifies the fight by comparing rates.
Intuition: Two Cars Racing to Zero
Think of and as positions of two cars on the number line. At time they both reach the finish line . The ratio is the distance ratio between the two cars just before they arrive.
Directly read positions at the finish line: both are 0, so the ratio is . No information — you cannot compare distances when both cars are exactly at the line.
Compare the cars' speeds as they cross the line. If is travelling at 3 m/s and at 5 m/s right at the instant of arrival, the ratio of remaining distances an instant earlier was . That is the limit.
This is exactly the content of the rule: the indeterminate ratio of positions is determined by the ratio of the rates at which they reach zero. The derivative literally means "how fast f is changing at c" — which for a function vanishing at c is the same as "how fast f is approaching zero at c".
Linear approximation in disguise
Near we have and . Dividing, the factors cancel and you are left with . L'Hôpital is just this cancellation made rigorous.
The Rule, Stated Precisely
L'Hôpital's Rule
Suppose and are differentiable on an open interval containing (except possibly at itself), that on that interval, and that either
or
Then, provided the right-hand limit exists (or is ),
The same conclusion holds at and for one-sided limits.
All three conditions must hold
- Indeterminate form: direct substitution must produce or .
- Differentiability near c: both and must have derivatives on a punctured neighbourhood of .
- near — you cannot divide by zero, even after differentiating.
- The new limit must exist (or be ). If it does not, the rule simply tells you nothing.
Why It Works — A Linear Approximation Proof
The clearest way to see the rule is to Taylor-expand. Because and are differentiable at with , for near :
where the remainders are — they vanish faster than the linear term. Dividing,
Because and as , the middle expression tends to . That is the rule. A more careful proof uses the Cauchy Mean Value Theorem — which is the main-course version of the idea we'll cover in a later chapter — but the linear-approximation picture is the honest intuition.
What if f'(c)/g'(c) is itself 0/0?
Apply the rule again! For , the first application yields — still 0/0. A second application gives . Each pass peels off another layer of vanishing behaviour.
Interactive: Compare f/g and f'/g'
Below you can step through six indeterminate-form limits side by side. The red plot is the naive ratio ; the green plot is the ratio of derivatives . Drag the zoom slider to shrink the window around the trouble point. Watch how the red curve has to crawl toward the answer while the green curve sits on it from the start.
Try this experimental loop:
- Start with sin(x)/x at x → 0. Zoom all the way in — the red curve wobbles numerically near 0, but the green cos(x)/1 is perfectly flat at 1.
- Switch to (1 − cos x)/x². Zoom in. The red crawl is slow because the numerator is quadratic; but is still 0/0, so the green curve itself is an indeterminate ratio until you apply the rule a second time (mentally) to land on 1/2.
- Jump to x/eˣ at x → ∞. Now you zoom on a very large window. The red ratio falls from 1/eˣ quickly; the green curve is already the derivative answer.
- Pick x · ln(x) at x → 0⁺. This is a 0·∞ form. The rewrite converts it to 0/0 and shows both ratios climbing to 0.
Worked Example: lim sin(3x)/sin(5x)
We will compute three ways: as a direct substitution (fails), via L'Hôpital, and via a small Taylor argument. Do each step on paper — it builds the reflex for recognising when the rule applies and when it does not.
📝 Step-by-step numerical walkthrough — try it yourself first
Step 1 — Attempt direct substitution. Plug in :
Useless. Both parts vanish at the same point. This flags the limit as a candidate for L'Hôpital.
Step 2 — Check hypotheses. Both and are differentiable everywhere, and is nonzero in a neighbourhood of 0 (it equals 5 there). The rule applies.
Step 3 — Differentiate top and bottom separately. Important: we do not use the quotient rule; L'Hôpital differentiates the numerator and denominator independently.
Step 4 — Evaluate the new ratio at x = 0.
Step 5 — Sanity-check numerically. At :
sin(0.5) = 0.4794255386
ratio = 0.2955202067 / 0.4794255386 = 0.6164048071 (≈ 0.6 ✓)
At the ratio is 0.6000016000; at it is 0.6000000160. Convergence is quadratic — exactly what Taylor predicts.
Step 6 — Cross-check with Taylor. Using :
The leading behaviour is exactly; the correction is quadratic in . This explains the empirical pattern: the error at is about .
The pattern works for every linear-in-argument pair
For with , the answer is always . Same for , , etc. Each L'Hôpital call strips one layer off the chain rule.
Handling ∞/∞ and Other Forms
∞ / ∞ directly: x / eˣ as x → ∞
Both and blow up, so direct evaluation gives . Differentiate:
One L'Hôpital call collapsed a hard question into an easy one. This also proves the classical fact that dominates every polynomial — apply the rule times to and you end up with .
0 · ∞: x ln(x) as x → 0⁺
A product of 0 and is ambiguous. Rewrite it as a quotient to force a 0/0 or ∞/∞ form, whichever is easier to differentiate:
Apply L'Hôpital:
Notice the freedom in the rewrite: we could also have used (a 0/0 form), but the resulting derivative is uglier. Part of the skill is choosing the rewrite that leads to the cleanest derivative.
1^∞ and ∞⁰: take the logarithm first
For powers whose base and exponent both misbehave, take to convert a product of a log and another ambiguous factor, then use the techniques above. The classical example is
Let so , an form. Rewrite:
The resulting limit is , so and . The same trick handles 0⁰, 1^∞, and ∞⁰ uniformly.
Python: Verifying L'Hôpital Numerically
The rule is a theorem, but a computer can illustrate it beautifully. Below we compute at shrinking values and watch it converge to the L'Hôpital answer . We then compute the answer directly by plugging into — zero shrinking required.
What to notice in the output
The naive ratio needs shrinking x by four orders of magnitude to nail the first eight digits of 0.6. The L'Hôpital call produces those digits from a single division. The error column also shows the quadratic convergence predicted by Taylor — a quiet confirmation that really is the limit.
PyTorch: Using Autograd as an L'Hôpital Engine
Hand-differentiating is easy. Hand-differentiating a 100-term loss function in a neural net is not. Autograd does it for us, which means we can build a fully automatic L'Hôpital evaluator: declare and , call .backward() twice, divide, done.
The deep connection to machine learning
Every training step of a neural network computes a ratio-like quantity — the gradient of loss with respect to weights — at a point where the network's output is near its target. That computation is, in effect, asking "how does the output respond to a tiny nudge?", and the answer comes from autograd the same way L'Hôpital reads . The rule that 17th-century mathematicians wrote for limits is the same rule that 21st-century optimisers use to train billion-parameter models.
Where L'Hôpital Unlocks Real Problems
Which grows faster: or ? L'Hôpital applied 100 times proves the exponential wins — the basis of every complexity argument in computer science.
and are L'Hôpital results. They underpin the pendulum equation, optics, and every small-perturbation expansion in physics.
The limit is the reason continuous compounding exists. Without L'Hôpital (or Taylor), the conversion from discrete to continuous interest is mysterious.
Ratios of log-likelihoods, Bayes factors, softmax temperatures — many statistical criteria reduce to ratios that are 0/0 or ∞/∞ at critical limits. L'Hôpital is the tool that makes them meaningful.
Common Pitfalls
Pitfall 1 — Applying the rule to non-indeterminate forms
by direct substitution. Blindly differentiating gives at — a wrong answer. Always verify the form is 0/0 or ∞/∞ before differentiating.
Pitfall 2 — Using the quotient rule
L'Hôpital replaces with — not with . Do not apply the quotient rule; it gives a different (usually much uglier) expression.
Pitfall 3 — Stopping too early when the form persists
After one application, the new ratio may still be indeterminate. Keep applying the rule (or switch to Taylor) until you land on a form that can be evaluated directly. Trying with only one pass produces — an answer, but still 0/0. A second pass gives the true answer 1/2.
Pitfall 4 — When the derivative limit does not exist
If fails to exist (for instance, oscillating like ), the rule is silent — it does not say the original limit fails. You may need a different technique (squeeze theorem, Taylor remainder bounds, etc.).
Pitfall 5 — Circular reasoning for sin(x)/x
Using L'Hôpital to "prove" is logically circular, because the derivative of is usually derived from that limit. This is a book-keeping issue, not a rule issue: once derivatives of trig are established by a geometric squeeze argument, L'Hôpital handles every other trig limit cleanly.
Summary
L'Hôpital's Rule is a bridge between two pillars of calculus: the limit and the derivative. When direct substitution produces an indeterminate form, the rule says: the answer is controlled by the rate at which numerator and denominator approach their limiting values. Formally,
whenever the hypotheses (indeterminate form, differentiability, , and existence of the right-hand limit) hold.
| Indeterminate form | Conversion | Then apply |
|---|---|---|
| 0 / 0 | — | L'Hôpital directly |
| ∞ / ∞ | — | L'Hôpital directly |
| 0 · ∞ | Rewrite as 0/(1/∞) or ∞/(1/0) | L'Hôpital on the quotient |
| ∞ − ∞ | Combine into one fraction via common denominator | L'Hôpital |
| 0⁰, 1^∞, ∞⁰ | Take ln; becomes 0 · ∞ | Convert and apply L'Hôpital |
Key Takeaways
- L'Hôpital is a statement about rates: the ratio of values at the trouble point equals the ratio of their derivatives there.
- The rule applies only to 0/0 and ∞/∞ forms directly; every other indeterminate form must be rewritten into one of these first.
- If the new ratio is still indeterminate, apply the rule again — or switch to a Taylor expansion for clarity.
- The proof is just a linear approximation: and , then cancel .
- In practice, PyTorch's autograd turns L'Hôpital into a two-line procedure — which is effectively what every deep-learning optimiser does, billions of times per second, at scale.
Coming Next: Chapter 3 turns the ε–δ language into a property of functions themselves: continuity. We will see why continuous functions are the sandbox on which every theorem about derivatives and integrals is built — and how the smallest break in a curve unravels entire theorems.