
13 L’Hôpital’s Rule
Limits such as \[ \lim_{x \to 0}\frac{e^x - 1 - x}{x^2} \] come up whenever we ask how good a linear approximation is: the numerator is the error of the approximation \(e^x \approx 1 + x\) and the denominator is the scale we measure it against. Substitution gives \(\frac00\), and the algebraic techniques of the limits chapters (factoring, rationalizing) have nothing to grab. This chapter shows that the derivative does.
13.1 The Easy Case, and Where It Stops
Suppose \(f(a) = g(a) = 0\) and both functions are differentiable at \(a\). Near \(a\) each is approximately linear, so we expect the ratio of the two to be approximately the ratio of the slopes.
Proposition 13.1 (Ratio of Linear Approximations) Let \(f, g\) be differentiable at \(a\) with \(f(a) = g(a) = 0\) and \(g'(a) \ne 0\). Then \[ \lim_{x \to a}\frac{f(x)}{g(x)} = \frac{f'(a)}{g'(a)}. \]
Write \(f(a+h) = f'(a)h + r_f(h)\) and \(g(a+h) = g'(a)h + r_g(h)\) with \(r_f, r_g = o(h)\). For \(h \ne 0\) small, \(g(a+h) \ne 0\) (its quotient by \(h\) tends to \(g'(a) \ne 0\)), and \[ \frac{f(a+h)}{g(a+h)} = \frac{f'(a) + r_f(h)/h}{g'(a) + r_g(h)/h} \longrightarrow \frac{f'(a)}{g'(a)}. \qquad \square \]
No new theorem is needed here. The interesting case is when this runs out, which is when \(g'(a) = 0\) as well. For \[ \lim_{x\to0}\frac{1 - \cos x}{x^2} \] both functions vanish to first order, \(1 - \cos x = o(x)\) and \(x^2 = o(x)\), so the linear approximations are both \(0\) and say nothing about the ratio. The ratio is decided by the next order.
The heuristic that handles this: the value \(f(x)\) is the total change of \(f\) between \(a\) and \(x\), and by the Mean Value Theorem that change is governed by the values of \(f'\) at points between \(a\) and \(x\). The same holds for \(g\). So if \(f'\) and \(g'\) are comparable near \(a\), then \(f\) and \(g\) should be. In other words, we may replace the problem \(f/g\) by the problem \(f'/g'\), which is one derivative simpler, and repeat if necessary. For \(1 - \cos x\) and \(x^2\) the derivatives are \(\sin x\) and \(2x\), and the ratio \(\frac{\sin x}{2x} \to \frac12\).
The geometric picture is to plot the curve \(t \mapsto \big(g(t), f(t)\big)\). When \(f(a) = g(a) = 0\) the curve passes through the origin at \(t = a\), and the ratio \(f(x)/g(x)\) is the slope of the line from the origin to the point of the curve at \(t = x\). The ratio \(f'(t)/g'(t)\) is the slope of the tangent to the curve. The claim is that the chord slopes are controlled by the tangent slopes.
The chord from the origin and the tangent at some intermediate point are parallel. This is the Mean Value Theorem for the curve, and it is the next result.
13.2 Cauchy’s Mean Value Theorem
Theorem 13.1 (Cauchy’s Mean Value Theorem) Let \(f, g\) be continuous on \([x, y]\) and differentiable on \((x, y)\), with \(g' \ne 0\) on \((x,y)\). Then \(g(x) \ne g(y)\), and there is a \(c \in (x, y)\) with \[ \frac{f(y) - f(x)}{g(y) - g(x)} = \frac{f'(c)}{g'(c)}. \]
For \(g(t) = t\) this is the Mean Value Theorem.
If \(g(x) = g(y)\), Rolle’s theorem (Theorem 9.2) gives a point where \(g' = 0\), contrary to hypothesis. So \(g(y) - g(x) \ne 0\). Define \[ \varphi(t) = \big(f(y) - f(x)\big)\,g(t) - \big(g(y) - g(x)\big)\,f(t). \] Then \(\varphi(x) = f(y)g(x) - g(y)f(x) = \varphi(y)\), so Theorem 9.2 gives \(c \in (x,y)\) with \(\varphi'(c) = 0\), that is, \[ \big(f(y) - f(x)\big)\,g'(c) = \big(g(y) - g(x)\big)\,f'(c). \] Divide by \(g'(c)\,\big(g(y) - g(x)\big)\). \(\square\)
13.3 L’Hôpital’s Rule
The theorem below is stated for one-sided limits, which covers limits at a finite point from either side and limits at \(\pm\infty\). The point \(a\) may be \(-\infty\).
Theorem 13.2 (L’Hôpital’s Rule) Let \(-\infty \le a < b \le \infty\) and let \(f, g\) be differentiable on \((a, b)\) with \(g' \ne 0\) there. Suppose that as \(x \to a^+\), either
- \(f(x) \to 0\) and \(g(x) \to 0\), or
- \(|g(x)| \to \infty\).
If \(\displaystyle\lim_{x\to a^+}\frac{f'(x)}{g'(x)} = L\), where \(L\) is a real number or \(\pm\infty\), then \[ \lim_{x \to a^+}\frac{f(x)}{g(x)} = L. \] The same statement holds for \(x \to b^-\). A two-sided limit at an interior point (or a limit as \(x \to \pm\infty\)) is covered by applying the statement on each side.
Two remarks before the proof. In case (2) nothing is assumed about \(f\): only the denominator needs to blow up. And the conclusion goes in one direction. If \(f'/g'\) has a limit, then so does \(f/g\), with the same value; if \(f'/g'\) has no limit, the theorem says nothing (see Section 13.5).
Since \(g' \ne 0\), Theorem 13.1 shows that \(g\) is injective on \((a,b)\), and since \(g\) is continuous it is strictly monotone. We prove the case where \(L\) is a real number. Fix \(\varepsilon > 0\) and choose \(p \in (a, b)\) such that \(\big|\frac{f'(c)}{g'(c)} - L\big| < \varepsilon\) for all \(c \in (a, p)\). By Theorem 13.1, for all \(a < x < y < p\), \[ \left|\frac{f(y) - f(x)}{g(y) - g(x)} - L\right| < \varepsilon. \tag{$*$} \]
Case 1: \(f, g \to 0\). Fix \(y \in (a, p)\). Since \(g\) is strictly monotone with limit \(0\) at \(a\), we have \(g(y) \ne 0\). Let \(x \to a^+\) in \((*)\): the quotient tends to \(\frac{f(y)}{g(y)}\), so \[ \left|\frac{f(y)}{g(y)} - L\right| \le \varepsilon \qquad\text{for every } y \in (a, p). \] Since \(\varepsilon\) was arbitrary, \(\frac{f}{g} \to L\).
Case 2: \(|g| \to \infty\). Fix \(y \in (a,p)\). For \(x \in (a, y)\) with \(g(x) \ne 0\) (true for \(x\) near \(a\)), write \[ \frac{f(x)}{g(x)} = \underbrace{\frac{f(x) - f(y)}{g(x) - g(y)}}_{Q}\cdot\underbrace{\frac{g(x) - g(y)}{g(x)}}_{r} + \frac{f(y)}{g(x)}. \] Then \(\frac{f(x)}{g(x)} - L = (Q - L)\,r + L\,(r - 1) + \frac{f(y)}{g(x)}\). As \(x \to a^+\): \(|Q - L| < \varepsilon\) by \((*)\); \(r = 1 - \frac{g(y)}{g(x)} \to 1\), so \(r - 1 \to 0\); and \(\frac{f(y)}{g(x)} \to 0\) because \(f(y)\) is a fixed number and \(|g(x)| \to \infty\). Hence \[ \limsup_{x \to a^+}\left|\frac{f(x)}{g(x)} - L\right| \le \varepsilon, \] and again \(\varepsilon\) was arbitrary.
The case \(L = \pm\infty\) is the same argument with “\(> M\)” in place of “within \(\varepsilon\)” (Problem 3). The statement for \(x \to b^-\) follows by applying the above to \(f(-x)\) and \(g(-x)\). \(\square\)
13.3.1 Using the Rule
Example 1. \(\displaystyle\lim_{x\to0}\frac{1 - \cos x}{x^2}\). Both functions tend to \(0\), and \(g'(x) = 2x \ne 0\) for \(x \ne 0\). The ratio of derivatives is \(\frac{\sin x}{2x} \to \frac12\), by \(\frac{\sin x}{x} \to 1\). So the limit is \(\frac12\). As a check, at \(x = 0.1\) the quotient is \(\frac{1 - 0.995004}{0.01} = 0.4996\).
Example 2. \(\displaystyle\lim_{x\to0}\frac{e^x - 1 - x}{x^2}\), the limit from the start of the chapter. The ratio of derivatives is \(\frac{e^x - 1}{2x}\), which is again of the form \(\frac00\). Applying the theorem to this ratio, we get \(\frac{e^x}{2} \to \frac12\). Since the second ratio has a limit, so does the first, and so does the original. So the limit is \(\frac12\), and the error of the linear approximation \(e^x \approx 1 + x\) is about \(\frac{x^2}{2}\). As a check, at \(x = 0.1\): \(e^{0.1} - 1.1 = 0.005171\), and divided by \(0.01\) this is \(0.5171\).
Example 3. \(\displaystyle\lim_{x\to0}\frac{\tan x - x}{x^3}\). The ratio of derivatives is \(\frac{\sec^2 x - 1}{3x^2} = \frac{\tan^2x}{3x^2} = \frac13\left(\frac{\tan x}{x}\right)^2 \to \frac13\), since \(\frac{\tan x}{x} = \frac{\sin x}{x}\cdot\frac{1}{\cos x} \to 1\). As a check, at \(x = 0.1\): \(\tan(0.1) - 0.1 = 0.000334672\), and divided by \(0.001\) this is \(0.3347\).
Example 4. \(\displaystyle\lim_{x\to\infty}\frac{\ln x}{x^a}\) for \(a > 0\). The denominator tends to \(\infty\), which is case 2 of Theorem 13.2, and \(g'(x) = ax^{a-1} \ne 0\). The ratio of derivatives is \(\frac{1/x}{ax^{a-1}} = \frac{1}{a\,x^a} \to 0\). So the limit is \(0\).
Notice that in each example the rule is used to reduce the problem, and what remains is a limit we already know. It is the repeated reduction that makes the rule useful, as in Example 2, but each application must be checked: before differentiating again we confirm that the new ratio is still of one of the two forms.
13.4 Other Indeterminate Forms
The forms \(0\cdot\infty\), \(\infty - \infty\), \(0^0\), \(1^\infty\) and \(\infty^0\) are reduced to a quotient by algebra.
Products. If \(f \to 0\) and \(|g| \to \infty\), write \(fg = \dfrac{f}{1/g}\), which is \(\frac00\); or \(\dfrac{g}{1/f}\), which is \(\frac\infty\infty\).
Example 5. \(\displaystyle\lim_{x \to 0^+} x\ln x\). Write \(x\ln x = \dfrac{\ln x}{1/x}\), with \(|1/x| \to \infty\) (case 2). The ratio of derivatives is \(\dfrac{1/x}{-1/x^2} = -x \to 0\). So \(x\ln x \to 0\): the factor \(x\) beats the logarithm.
Differences. The form \(\infty - \infty\) becomes a quotient after putting terms over a common denominator.
Example 6. \(\displaystyle\lim_{x\to0}\left(\frac1x - \frac{1}{\sin x}\right) = \lim_{x\to0}\frac{\sin x - x}{x\sin x}\). The derivatives give \(\dfrac{\cos x - 1}{\sin x + x\cos x}\), again \(\frac00\), and differentiating once more gives \(\dfrac{-\sin x}{2\cos x - x\sin x} \to 0\). So the limit is \(0\). As a check, at \(x = 0.1\) the expression is \(10 - 10.0167 = -0.0167\), which is small and shrinks with \(x\).
Powers. For \(\lim f^g\) with \(f > 0\), take the logarithm: \(\ln(f^g) = g\ln f\), which is a product. If \(g\ln f \to \ell\) then, since \(\exp\) is continuous, \(f^g \to e^\ell\).
Example 7. \(\displaystyle\lim_{x\to0^+}x^x\) (form \(0^0\)). We have \(\ln(x^x) = x\ln x \to 0\) by Example 5, so \(x^x \to e^0 = 1\).
Example 8. \(\displaystyle\lim_{x\to0}(1 + 2x)^{1/x}\) (form \(1^\infty\)). Here \(\ln\big((1+2x)^{1/x}\big) = \dfrac{\ln(1+2x)}{x}\), which is \(\frac00\) with ratio of derivatives \(\dfrac{2/(1+2x)}{1} \to 2\). So the limit is \(e^2\). As a check, \((1.002)^{1000} = 7.374\), while \(e^2 = 7.389\).
A caution on circularity: the derivative of \(\ln\) was computed from \(\lim\frac{\ln(1+u)}{u} = 1\), so we cannot use L’Hôpital’s rule to prove that limit, or to prove \((1+\frac1n)^n \to e\). The same applies to \(\frac{\sin x}{x}\), which is what gives \((\sin x)' = \cos x\). The rule is for new limits, not for the ones the derivatives were built on.
13.5 What Goes Wrong
The converse is false. If \(f'/g'\) has no limit, \(f/g\) may still have one. Take \(f(x) = x + \sin x\) and \(g(x) = x\) as \(x \to \infty\). Then \(\frac{f}{g} = 1 + \frac{\sin x}{x} \to 1\), but \(\frac{f'}{g'} = 1 + \cos x\) oscillates between \(0\) and \(2\). A second example: \(f(x) = x^2\sin(1/x)\) and \(g(x) = \sin x\) at \(0\) has \(\frac fg = x\cdot\frac{x}{\sin x}\cdot\sin\frac1x \to 0\), while \(\frac{f'}{g'} = \frac{2x\sin(1/x) - \cos(1/x)}{\cos x}\) oscillates. When the derivative ratio fails to converge, the rule is silent, and some other method is needed.
The form must be right. Hypothesis 1 or 2 is not decoration. For \(\frac{x+1}{x+2}\) at \(0\), the ratio of derivatives is \(1\), but the limit is \(\frac12\), because the numerator does not tend to \(0\).
Differentiate numerator and denominator separately. The rule uses \(\frac{f'}{g'}\), not \(\left(\frac fg\right)'\). The quotient rule is for a different problem.
The condition \(g' \ne 0\). It is what makes \(\frac{f'}{g'}\) meaningful and \(g\) injective, as Theorem 13.1 shows. Where \(g'\) vanishes infinitely often near \(a\) (as for \(x^2\sin(1/x)\) near \(0\)), the rule may not apply even though a limit exists.
13.6 The Hierarchy of Growth Rates
In the chapter on asymptotics (Section 6.3) we stated that logarithms grow more slowly than powers, which grow more slowly than the exponential. We now prove this.
Theorem 13.3 (Standard Growth Rates) As \(x \to \infty\):
- For every \(a > 0\), \(\;\dfrac{\ln x}{x^a} \to 0\).
- For every real \(r\), \(\;\dfrac{x^r}{e^x} \to 0\).
is Example 4.
First let \(r = n\) be a nonnegative integer; we show \(x^n/e^x \to 0\) by induction on \(n\). For \(n = 0\) this is \(e^{-x} \to 0\). Suppose it holds for \(n\). Both \(x^{n+1}\) and \(e^x\) tend to \(\infty\), so by case 2 of Theorem 13.2 it suffices that \[ \frac{(n+1)\,x^n}{e^x} \to 0, \] which is the induction hypothesis. For a real \(r\), choose an integer \(n \ge \max(r, 0)\). For \(x \ge 1\), \(0 < x^r \le x^n\), so \(0 < \frac{x^r}{e^x} \le \frac{x^n}{e^x} \to 0\). \(\square\)
The inequality chain is \[ \ln x \;\ll\; x^a \;\ll\; x^b \;\ll\; e^x \qquad (0 < a < b), \] where \(f \ll g\) means \(f/g \to 0\). Each step is a one-line substitution. For \(x^a \ll x^b\), the ratio is \(x^{a-b} \to 0\). A constant in the exponent changes nothing: \(\frac{x^{100}}{e^{0.01x}}\) with \(u = 0.01x\) is \(100^{100}\cdot\frac{u^{100}}{e^u} \to 0\) (Problem 4). Iterated logarithms follow the same way: \(\frac{\ln\ln x}{\ln x} = \frac{\ln u}{u}\) with \(u = \ln x\), which tends to \(0\) by part 1 with \(a = 1\).
13.7 Where This Leads
L’Hôpital’s rule is a tool for one question: what does a ratio of two vanishing quantities tend to? The tool has two limits. First, it works only when a limit exists, and it says nothing otherwise. Second, each application only moves the problem one derivative down, and a function like \(\frac{e^x - 1 - x - x^2/2}{x^3}\) takes three of them. A more systematic way to compare \(f\) with polynomials near a point is the Taylor polynomial, which packages all these applications into one expansion. The next chapter returns to derivatives of a function itself, in the context of finding its largest and smallest values.
- If \(f(a) = g(a) = 0\) and \(g'(a) \ne 0\), linear approximation gives \(\lim\frac fg = \frac{f'(a)}{g'(a)}\). L’Hôpital’s rule handles what remains, when the linear terms vanish.
- The idea is that \(f\) and \(g\) are the accumulated changes of \(f'\) and \(g'\), so comparable derivatives give comparable functions. Cauchy’s Mean Value Theorem makes this precise: some tangent slope equals the chord slope.
- Cases: \(\frac00\) or \(|g|\to\infty\). For \(\frac\infty\infty\) nothing is needed about \(f\).
- The rule is one-directional. If \(\frac{f'}{g'}\) has no limit, it says nothing about \(\frac fg\).
- Other forms reduce to a quotient: products by inverting a factor, differences by a common denominator, powers by taking logarithms.
- Do not use the rule to prove limits that the derivatives were built on, such as \(\frac{\sin x}{x} \to 1\).
- \(\ln x \ll x^a \ll e^x\) for every \(a > 0\), proved by L’Hôpital and an induction.
Evaluate the following limits.
\(\displaystyle\lim_{x\to0}\frac{x - \sin x}{x^3}\)
\(\displaystyle\lim_{x\to0}\frac{e^x - 1 - x - \frac{x^2}{2}}{x^3}\)
\(\displaystyle\lim_{x\to\infty}x^{1/x}\)
\(\displaystyle\lim_{x\to0^+}(\sin x)^x\)
\(\displaystyle\lim_{x\to1}\left(\frac{1}{\ln x} - \frac{1}{x-1}\right)\)
Hypotheses.
Show that \(\displaystyle\lim_{x\to\infty}\frac{x + \sin x}{x} = 1\), but that \(\frac{f'}{g'}\) has no limit.
Explain what is wrong with applying the rule to \(\displaystyle\lim_{x\to0}\frac{x+1}{x+2}\).
Let \(f(x) = x^2\sin(1/x)\) and \(g(x) = \sin x\). Show that \(\frac fg \to 0\) as \(x \to 0\) while \(\frac{f'}{g'}\) has no limit.
Infinite limits.
Prove case 1 of Theorem 13.2 when \(L = +\infty\): if \(f, g \to 0\) and \(\frac{f'}{g'} \to +\infty\) as \(x \to a^+\), then \(\frac fg \to +\infty\).
Use (a) to find \(\displaystyle\lim_{x\to0^+}\frac{e^x - 1}{x^2}\).
Growth rates.
Show that \(\dfrac{\ln\ln x}{\ln x} \to 0\) as \(x \to \infty\).
Show that \(\dfrac{x^{100}}{e^{0.01x}} \to 0\).
Show by induction on \(k\) that \(\dfrac{(\ln x)^k}{x} \to 0\) for every integer \(k \ge 0\).
Cauchy’s Mean Value Theorem.
For \(f(x) = x^2\) and \(g(x) = x^3\) on \([0,1]\), find the point \(c\) guaranteed by Theorem 13.1.
Show that Theorem 13.1 with \(g(t) = t\) is the Mean Value Theorem.
The ratio of derivatives is \(\dfrac{1 - \cos x}{3x^2} \to \dfrac13\cdot\dfrac12 = \dfrac16\) by Example 1.
The ratio of derivatives is \(\dfrac{e^x - 1 - x}{3x^2} \to \dfrac13\cdot\dfrac12 = \dfrac16\) by Example 2. (Each of the two intermediate limits exists, so the rule applies twice.)
Let \(y = x^{1/x}\), so \(\ln y = \dfrac{\ln x}{x} \to 0\) by Theorem 13.3. Hence \(y \to e^0 = 1\).
Let \(y = (\sin x)^x\), so \(\ln y = \dfrac{\ln\sin x}{1/x}\), with \(|1/x| \to \infty\). The ratio of derivatives is \(\dfrac{\cos x/\sin x}{-1/x^2} = -\,x\cos x\cdot\dfrac{x}{\sin x} \to -0\cdot 1\cdot 1 = 0\). So \(\ln y \to 0\) and \(y \to 1\).
Combine: \(\dfrac{1}{\ln x} - \dfrac{1}{x-1} = \dfrac{x - 1 - \ln x}{(x-1)\ln x}\), which is \(\frac00\) at \(x = 1\). The derivatives give \(\dfrac{1 - 1/x}{\ln x + (x-1)/x}\), again \(\frac00\). Differentiating once more, \(\dfrac{1/x^2}{1/x + 1/x^2} \to \dfrac{1}{1 + 1} = \dfrac12\). So the limit is \(\dfrac12\).
\(\dfrac{x + \sin x}{x} = 1 + \dfrac{\sin x}{x}\), and \(\left|\dfrac{\sin x}{x}\right| \le \dfrac1x \to 0\), so the limit is \(1\). The ratio of derivatives is \(1 + \cos x\), which is \(2\) at \(x = 2n\pi\) and \(0\) at \(x = (2n+1)\pi\), so it has no limit.
The numerator tends to \(1\) and the denominator to \(2\), so this is not an indeterminate form, and neither hypothesis holds. The limit is \(\frac12\) by direct substitution, while \(\frac{f'}{g'} = 1\).
\(\dfrac{x^2\sin(1/x)}{\sin x} = x\cdot\dfrac{x}{\sin x}\cdot\sin\dfrac1x\), and \(\left|x\cdot\dfrac{x}{\sin x}\cdot\sin\dfrac1x\right| \le |x|\cdot\dfrac{x}{\sin x} \to 0\). For the derivatives, \(\dfrac{f'}{g'} = \dfrac{2x\sin(1/x) - \cos(1/x)}{\cos x}\). At \(x_n = \frac{1}{2n\pi}\) this is \(\dfrac{-1}{\cos x_n} \to -1\), and at \(x_n' = \frac{1}{(2n+1)\pi}\) it is \(\dfrac{1}{\cos x'_n} \to 1\). So there is no limit.
Let \(M > 0\) and choose \(p\) with \(\frac{f'}{g'} > M\) on \((a,p)\). For \(a < x < y < p\), Theorem 13.1 gives \(\frac{f(y) - f(x)}{g(y) - g(x)} > M\). Let \(x \to a^+\): since \(f(x), g(x) \to 0\), we get \(\frac{f(y)}{g(y)} \ge M\) for every \(y \in (a,p)\). As \(M\) was arbitrary, \(\frac fg \to +\infty\).
With \(f = e^x - 1\) and \(g = x^2\) (both \(\to 0\), and \(g' = 2x \ne 0\) for \(x > 0\)), the ratio of derivatives is \(\dfrac{e^x}{2x} \to +\infty\) as \(x \to 0^+\). So the limit is \(+\infty\). As a check, at \(x = 0.01\) the quotient is \(100.5\).
With \(u = \ln x \to \infty\), the quotient is \(\dfrac{\ln u}{u} \to 0\) by Theorem 13.3 with \(a = 1\).
With \(u = 0.01x\), we have \(x^{100} = 100^{100}u^{100}\), so the quotient is \(100^{100}\,\dfrac{u^{100}}{e^u} \to 0\) by Theorem 13.3.
For \(k = 0\), \(\frac1x \to 0\). If it holds for \(k\), then for \(k+1\) the denominator tends to \(\infty\) and the ratio of derivatives is \(\dfrac{(k+1)(\ln x)^k/x}{1} \to 0\) by the induction hypothesis, so \(\dfrac{(\ln x)^{k+1}}{x} \to 0\).
\(\dfrac{f(1) - f(0)}{g(1) - g(0)} = 1\), and \(\dfrac{f'(c)}{g'(c)} = \dfrac{2c}{3c^2} = \dfrac{2}{3c}\). Setting \(\frac{2}{3c} = 1\) gives \(c = \frac23 \in (0,1)\).
With \(g(t) = t\) we have \(g' = 1 \ne 0\) and \(g(y) - g(x) = y - x\), so the conclusion reads \(\frac{f(y) - f(x)}{y - x} = f'(c)\).