---
title: L'Hôpital's rule
heading: When top and bottom both vanish, compare their rates
eyebrow: A5 · Lesson 33 · L'Hôpital's rule
xp: 40
---

::: hook
What does $\frac{1 - e^{-t/\tau}}{t}$ do as $t \to 0$? Both top and bottom go to zero, and no algebra trick from lesson 3 applies directly. But near zero, each is close to its tangent line, so their ratio is close to the ratio of their slopes. That's L'Hôpital's rule: for a 0/0 limit, differentiate the top and bottom separately and try again. It settles many limits that matter in circuits, like what an RC circuit's response looks like in its first instant.
:::

::: play
- The two curves are $f(x) = 1 - e^{-x}$ and $g(x) = x$, both zero at the origin.
- Move the point toward 0. The readouts show $f/g$ and the ratio of slopes $f'/g'$. What do both approach?
:::
:::

```sim plot
view: graph
x: x = -0.5..2
y: y = -0.6..2
slider: x0 = 0.01..2 step 0.01 = 1
plot: 1 - exp(-x) | label: f(x) = 1 − e⁻ˣ
plot: x | color: ch2 | label: g(x) = x
point: x0, 1 - exp(-x0)
point: x0, x0
readout: f/g = (1 - exp(-x0))/x0 | digits: 5
readout: f′/g′ = exp(-x0)/1 | digits: 5
```

::: predict
## What is $\displaystyle\lim_{x \to 0}\frac{e^{3x} - 1}{x}$?

- [ ] 0
- [ ] 1
- [x] 3
- [ ] $\infty$

::: reveal
3. It's 0/0, so differentiate top and bottom: $\frac{3e^{3x}}{1} \to 3$. Near zero, $e^{3x} - 1$ rises with slope 3 while $x$ rises with slope 1, so their ratio is 3.
:::
:::

::: nameit
## The rule

If $\lim f(x) = 0$ and $\lim g(x) = 0$ (or both $\to \pm\infty$), and $f'/g'$ has a limit, then

$$\lim\frac{f(x)}{g(x)} = \lim\frac{f'(x)}{g'(x)}$$

Differentiate the top and bottom **separately**. This isn't the quotient rule.

- Check the form first. If it isn't 0/0 or ∞/∞, the rule doesn't apply and gives wrong answers: $\lim_{x \to 0}\frac{x + 1}{x + 2} = \frac{1}{2}$, but the "rule" would say $\frac{1}{1} = 1$.
- If the new limit is still 0/0, apply the rule again.

## Other indeterminate forms

Convert them to 0/0 or ∞/∞ first:
- **0 · ∞:** write $fg$ as $\frac{f}{1/g}$. For example $\lim_{t \to \infty}t e^{-t} = \lim\frac{t}{e^t} = \lim\frac{1}{e^t} = 0$.
- **∞ − ∞:** combine into one fraction.
- **$1^\infty$, $0^0$, $\infty^0$:** take the log. For instance $\lim_{n \to \infty}(1 + \frac{x}{n})^n = e^x$, the compound-growth limit behind $e$.

## Why it works

Near the point $a$ where both vanish, $f(x) \approx f'(a)(x - a)$ and $g(x) \approx g'(a)(x - a)$ (lesson 21), so

$$\frac{f(x)}{g(x)} \approx \frac{f'(a)(x - a)}{g'(a)(x - a)} = \frac{f'(a)}{g'(a)}$$

The factor $(x - a)$ that made both vanish cancels.
:::

::: example
## Find $\displaystyle\lim_{x \to 0}\frac{1 - \cos x}{x^2}$.

::: solution
1. **First try.** Substituting gives 0/0, so differentiate the top and bottom:
   $$\frac{\sin x}{2x}$$
   still 0/0.
2. **Differentiate again.**
   $$\frac{\cos x}{2} \to \frac{1}{2}$$
3. **What it means.** For small $x$, $1 - \cos x \approx \frac{x^2}{2}$, or $\cos x \approx 1 - \frac{x^2}{2}$: the second-order small-angle approximation.

**Answer:** the limit is $\tfrac12$.
:::
:::

::: example
## What does an RC low-pass's step response look like at the very start? Find $\displaystyle\lim_{t \to 0^+}\frac{V(1 - e^{-t/\tau})}{t}$.

::: solution
1. **Check the form.** At $t = 0$ it's 0/0.
2. **Differentiate the top and bottom.**
   $$\frac{(V/\tau)e^{-t/\tau}}{1} \to \frac{V}{\tau}$$
3. **What it means.** At first the output rises in a straight line at $V/\tau$ volts per second, as if heading for $V$ in exactly one time constant. It's why the tangent at $t = 0$ crosses the final value at $t = \tau$.

**Answer:** the limit is $V/\tau$: the output starts as a straight ramp at $V/\tau$ volts per second.
:::
:::

::: example
## Find $\displaystyle\lim_{x \to 0^+} x\ln x$.

::: solution
1. **Rewrite as a quotient.** It's $0 \times (-\infty)$, so write it as
   $$\frac{\ln x}{1/x}$$
   which is $\frac{-\infty}{\infty}$.
2. **Apply L'Hôpital's rule.**
   $$\begin{aligned} \lim_{x \to 0^+}\frac{1/x}{-1/x^2} &= \lim_{x \to 0^+}(-x) \\ &= 0 \end{aligned}$$
3. **What it means.** The $x$ wins: it goes to zero faster than $\ln x$ goes to $-\infty$. The same fact says $x^x \to 1$ as $x \to 0^+$.

**Answer:** the limit is 0.
:::
:::

::: check
given: k = 2 | 3 | 5
answer: k

## Find $\displaystyle\lim_{x \to 0}\frac{e^{\given{k}x} - 1}{x}$.

::: right
Right. 0/0, and $\frac{\given{k}e^{\given{k}x}}{1} \to$ {k}.
:::

::: misses
- [1] Differentiate $e^{\given{k}x}$ with the chain rule: it gives $\given{k}e^{\given{k}x}$.
- [0] It's 0/0, not 0: compare the rates.
- [any] Not yet. Differentiate the top and the bottom separately.
:::
:::

::: check
given: k = 2 | 4 | 6
answer: k^2/2

## Find $\displaystyle\lim_{x \to 0}\frac{1 - \cos(\given{k}x)}{x^2}$.

::: right
Right. Twice: $\frac{\given{k}\sin \given{k}x}{2x}$, then $\frac{\given{k}^2\cos \given{k}x}{2} \to$ {answer}.
:::

::: misses
- [1/2] The chain rule brings out a {k} each time you differentiate.
- [k/2] Two rounds of L'Hôpital, so two factors of {k}.
- [any] Not yet. Apply the rule twice.
:::
:::

::: check
given: n = 2 | 3 | 4
answer: 0

## Find $\displaystyle\lim_{x \to \infty}\frac{x^{\given{n}}}{e^{x}}$.

::: right
Right. Applying the rule {n} times leaves a constant over $e^x$, which goes to 0.
:::

::: misses
- [1] Keep going: each round lowers the power by one while $e^x$ stays.
- [any] Not yet. ∞/∞: differentiate until the power is gone.
:::
:::

::: check
given: a = 2 | 3; b = 5 | 7
answer: a/b
tolerance: 0.5%

## Find $\displaystyle\lim_{x \to 0}\frac{\ln(1 + \given{a}x)}{\given{b}x}$.

::: right
Right. $\frac{a/(1 + ax)}{b} \to \frac{a}{b}$ = {answer}.
:::

::: misses
- [1/b] Differentiate $\ln(1 + ax)$ with the chain rule: $\frac{a}{1 + ax}$.
- [b/a] Top's derivative over bottom's.
- [any] Not yet. Differentiate top and bottom.
:::
:::

::: check
kind: choice

## Someone applies L'Hôpital's rule to $\displaystyle\lim_{x \to 1}\frac{x^2 + 1}{x + 1}$ and gets $\frac{2x}{1} \to 2$. What's wrong?

- [x] The limit isn't 0/0 or ∞/∞, so the rule doesn't apply; the answer is $\frac{2}{2} = 1$
- [ ] Nothing: the answer is 2
- [ ] They should have used the quotient rule
- [ ] The limit doesn't exist

::: right
Right. At $x = 1$ the fraction is just $2/2$. L'Hôpital only applies to indeterminate forms.
:::

::: misses
- [2] Substitute first: is it really 0/0?
- [any] Check the form before using the rule.
:::
:::

::: check
given: V = 5 | 12; tau = 2 | 10
answer: V/tau
tolerance: 0.5%

## Find $\displaystyle\lim_{t \to 0^+}\frac{\given{V}(1 - e^{-t/\given{tau}})}{t}$, the initial slope of a charging capacitor (V per ms, with $t$ and $\tau$ in ms).

::: right
Right. $\frac{(V/\tau)e^{-t/\tau}}{1} \to V/\tau$ = {answer}.
:::

::: misses
- [V] Divide by $\tau$: the chain rule on $e^{-t/\tau}$.
- [0] 0/0 is undetermined; compare the rates.
- [any] Not yet. L'Hôpital: differentiate top and bottom.
:::
:::

::: check
kind: parts
given: a = 2 | 3; b = 1 | 5

## Use L'Hôpital's rule.

::: part
answer: a/b
tolerance: 0.5%

### $\displaystyle\lim_{x \to 0}\frac{e^{\given{a}x} - 1}{\given{b}x}$

::: misses
- [b/a] Upside down.
- [any] Differentiate the top and bottom once.
:::
:::

::: part
answer: a^2/2
tolerance: 0.5%

### $\displaystyle\lim_{x \to 0}\frac{1 - \cos \given{a}x}{x^2}$

::: misses
- [a/2] Twice: the first derivative gives $\frac{a\sin ax}{2x}$, still $0/0$.
- [any] Apply the rule twice.
:::
:::

::: part
answer: -a^3/6
tolerance: 0.5%

### $\displaystyle\lim_{x \to 0}\frac{\sin \given{a}x - \given{a}x}{x^3}$

::: misses
- [a^3/6] Check the sign: $\sin u < u$ for small positive $u$.
- [any] It takes three applications.
:::
:::
:::

::: check
kind: derivation
vars: x = 0.01..1

## Find $\displaystyle\lim_{x \to 0}\frac{\sin x - x}{x^3}$ with L'Hôpital's rule.

::: step
answer: (cos(x) - 1)/(3*x^2)

### Apply the rule once: what is the new quotient?
:::

::: step
answer: -sin(x)/(6*x)

### It's still $0/0$. Apply it again.
:::

::: step
answer: -1/6

### What is the limit?
:::

::: right
Right. The limit is $-\tfrac16$, which is why $\sin x \approx x - x^3/6$.
:::
:::

::: explain
## Why does differentiating the top and bottom separately give the right limit for 0/0, even though that isn't how you differentiate a quotient?

::: model
We aren't differentiating the quotient; we're comparing how fast the top and bottom go to zero. Near the point where both vanish, each is approximately its slope times the distance from the point, $f \approx f'(a)(x - a)$ and $g \approx g'(a)(x - a)$. In the ratio, the shared factor $(x - a)$ cancels, leaving $f'(a)/g'(a)$. So the ratio of the functions approaches the ratio of their slopes.
:::
:::

::: practice

::: check
given: a = 2 | 3; b = 4 | 6
answer: a/b
tolerance: 0.5%

## Find $\displaystyle\lim_{x \to 0}\frac{\sin \given{a}x}{\sin \given{b}x}$.

::: misses
- [1] Differentiate each with its chain-rule factor.
- [any] $\frac{a\cos ax}{b\cos bx} \to a/b$.
:::
:::

::: check
given: c = 2..9 int
answer: 0

## Find $\displaystyle\lim_{x \to \infty}\frac{\ln x}{x^{1/\given{c}}}$.

::: misses
- [any] Logs grow slower than any positive power.
:::
:::

::: check
given: x = 1 | 2 | 0.5
answer: exp(x)
tolerance: 0.5%

## What does $\left(1 + \frac{\given{x}}{n}\right)^n$ approach as $n \to \infty$?

::: misses
- [1] It's a $1^\infty$ form, not 1.
- [any] Take the log: $n\ln(1 + x/n) \to x$.
:::
:::
:::
