
11 Derivatives of Elementary Functions
The previous chapter gave us the rules for combining derivatives, and with the power rule they differentiate every rational function. What they cannot do is create a derivative from nothing: to differentiate \(e^x\), \(\ln x\) or \(\sin x\) we must go back to the definition once for each.
The computation is shorter than one might fear, because each of these functions satisfies an addition formula: \[ e^{x+h} = e^x e^h, \qquad \ln(x+h) = \ln x + \ln\!\left(1 + \tfrac hx\right), \qquad \sin(x+h) = \sin x\cos h + \cos x \sin h. \] In each case the behavior near \(x\) is expressed through the behavior near \(0\) (or \(1\), for the logarithm). So each derivative reduces to a single limit, and once that limit is in hand the derivative at every point follows. The work in this chapter is those limits.
Notation. From here on we write \(f'(x)\) for the derivative as a function of the point \(x\). The meaning is unchanged: \(f'(x)\) is the coefficient of \(h\) in \(f(x+h) = f(x) + f'(x)h + o(h)\).
11.1 The Exponential and the Logarithm
We use the standard properties of real powers established earlier: for \(a > 0\) the function \(x \mapsto a^x\) is continuous and strictly monotone, with \(a^{x+y} = a^xa^y\) and \((a^x)^y = a^{xy}\); the number \(e\) is \(\lim_{n\to\infty}(1 + \frac1n)^n\); and \(\ln\) is the inverse function of \(e^x\), continuous, with \(\ln e = 1\) and \(\ln(a^b) = b\ln a\).
The cleanest route starts with the logarithm, because the definition of \(e\) speaks directly about it.
Lemma 11.1 (The Basic Logarithm Limit) \[ \lim_{u \to 0}\frac{\ln(1+u)}{u} = 1. \]
The idea: \(\frac{\ln(1+u)}{u} = \ln\big((1+u)^{1/u}\big)\), so the limit is \(\ln\) of the limit of \((1+u)^{1/u}\), and that limit is \(e\) by definition, once we pass from sequences to a continuous variable.
Step 1: \((1+u)^{1/u} \to e\) as \(u \to 0\).
Let \(u \to 0^+\) and put \(n = \lfloor 1/u \rfloor\), so \(n \le 1/u < n+1\) and \(\frac{1}{n+1} < u \le \frac1n\). Since the base \(1+u\) exceeds \(1\), \[ \left(1 + \tfrac{1}{n+1}\right)^{n} < (1+u)^n \le (1+u)^{1/u} \le (1+u)^{n+1} \le \left(1 + \tfrac1n\right)^{n+1}. \] As \(u \to 0^+\) we have \(n \to \infty\), and both outer expressions tend to \(e\): the left one is \(\big(1+\frac{1}{n+1}\big)^{n+1}\big/\big(1 + \frac{1}{n+1}\big)\) and the right one is \(\big(1+\frac1n\big)^n\big(1 + \frac1n\big)\). By the squeeze theorem, \((1+u)^{1/u} \to e\).
Now let \(u = -v\) with \(v \to 0^+\), and put \(w = \frac{v}{1-v}\), so \(w \to 0^+\), \(1 - v = \frac{1}{1+w}\) and \(\frac1v = \frac1w + 1\). Then \[ (1+u)^{1/u} = (1-v)^{-1/v} = (1+w)^{1/v} = (1+w)^{1/w}\,(1+w) \to e \cdot 1 = e. \]
Step 2. Since \(\ln\) is continuous at \(e\), \[ \frac{\ln(1+u)}{u} = \ln\big((1+u)^{1/u}\big) \to \ln e = 1. \qquad \square \]
Theorem 11.1 (Derivative of the Logarithm) For \(x > 0\), \((\ln x)' = \dfrac{1}{x}\).
By the logarithm law, \(\ln(x+h) - \ln x = \ln\!\big(1 + \frac hx\big)\). With \(u = h/x\), which tends to \(0\) with \(h\), \[ \frac{\ln(x+h) - \ln x}{h} = \frac1x\cdot\frac{\ln(1+u)}{u} \to \frac1x\cdot 1, \] by Lemma 11.1. \(\square\)
As a check, \(\ln(10.1) - \ln(10) = 0.009950\ldots\), while the linear prediction is \(h/x = 0.1/10 = 0.01\). A change of \(1\%\) in the input is a change of about \(0.01\) in the logarithm.
Theorem 11.2 (Derivative of the Exponential) For every \(x \in \mathbb{R}\), \((e^x)' = e^x\).
The idea is to reduce to the point \(0\) with the addition formula, and evaluate the limit there by turning the exponential problem into a logarithm problem.
Since \(e^{x+h} - e^x = e^x(e^h - 1)\), it suffices to show \(\frac{e^h - 1}{h} \to 1\).
Put \(u = e^h - 1\). As \(h \to 0\) we have \(u \to 0\) by continuity of the exponential, and \(u \ne 0\) for \(h \ne 0\) since the exponential is injective. Also \(h = \ln(1+u)\). So \[ \frac{e^h - 1}{h} = \frac{u}{\ln(1+u)} \to 1 \] by Lemma 11.1. Therefore \((e^x)' = e^x\cdot 1\). \(\square\)
The exponential is its own derivative: the tangent at \((a, e^a)\) has slope \(e^a\), and \(e^{a+h} \approx e^a(1 + h)\). As a check, \(e^{0.1} = 1.10517\ldots\) and the prediction is \(1.1\); the error is \(0.005 \approx h^2/2\).
The figure shows what singles out \(e\). Every exponential \(a^x\) passes through \((0,1)\) and has a tangent there, with slope depending on \(a\). The base \(e\) is the one whose slope at \(0\) is exactly \(1\).
11.1.1 Uniqueness
The exponential has a second life as the solution of a differential equation, and the Mean Value Theorem pins it down.
Proposition 11.1 (The Equation \(f' = f\)) If \(f : \mathbb{R} \to \mathbb{R}\) is differentiable with \(f' = f\), then \(f(x) = f(0)\,e^x\) for all \(x\).
Let \(g(x) = f(x)\,e^{-x}\). By the product rule and the chain rule, \[ g'(x) = f'(x)e^{-x} - f(x)e^{-x} = 0. \] By Corollary 9.1 on the interval between \(0\) and \(x\), \(g(x) = g(0) = f(0)\), so \(f(x) = f(0)e^x\). \(\square\)
So a quantity whose rate of change is equal to itself is a multiple of \(e^x\). This is the reason the exponential models populations, radioactive decay and compound interest: in each, the rate of change is proportional to the current amount.
11.1.2 General Exponentials and Real Powers
Once \(e^x\) and \(\ln\) are differentiable, everything else is a composition. For \(a > 0\) write \(a^x = e^{x\ln a}\). By the chain rule, \[ (a^x)' = e^{x\ln a}\cdot \ln a = a^x\ln a. \] At \(x = 0\) the slope is \(\ln a\), as in the figure. As a check, for \(a = 2\) and \(h = 0.01\): \(\frac{2^{0.01} - 1}{0.01} \approx 0.6956\), against \(\ln 2 \approx 0.6931\).
For \(x > 0\) and any real number \(r\), write \(x^r = e^{r\ln x}\). Then \[ (x^r)' = e^{r\ln x}\cdot\frac rx = r\,x^{r-1}. \]
Theorem 11.3 (Power Rule for Real Exponents) For \(x > 0\) and every real \(r\), \((x^r)' = r\,x^{r-1}\).
This contains the cases we already had (\(r = n\), \(r = -1\), \(r = \tfrac12\) in \(\sqrt x\)) and extends them to every real exponent at once, including \(\pi\) and \(\sqrt2\). The reader should keep two formulas apart: \((x^r)' = rx^{r-1}\) has the variable in the base, and \((a^x)' = a^x\ln a\) has it in the exponent. The first is false for \(2^x\), where \(x\cdot 2^{x-1}\) is not even the right order of magnitude at \(x = 0\).
Example 1. What is the derivative of \(\varphi(x) = x^x\) for \(x > 0\)?
Neither formula applies, since the variable appears in both the base and the exponent. Rewrite \(\varphi(x) = e^{x\ln x}\). By the chain rule and the product rule, \[ \varphi'(x) = e^{x\ln x}\,(\ln x + 1) = x^x(\ln x + 1). \]
The same device handles \(\ln|x|\). For \(x < 0\), \(\ln|x| = \ln(-x)\) has derivative \(\frac{1}{-x}\cdot(-1) = \frac1x\) by the chain rule, so \((\ln|x|)' = \frac1x\) for all \(x \ne 0\).
11.2 The Trigonometric Functions
From the chapter on limits we have two facts about the behavior at \(0\) (Theorem 5.1 and Corollary 5.1): \[ \lim_{h\to0}\frac{\sin h}{h} = 1, \qquad \lim_{h\to0}\frac{\cos h - 1}{h} = 0. \] In the language of linear approximation they say \(\sin h = h + o(h)\) and \(\cos h = 1 + o(h)\): near \(0\) the sine is the identity and the cosine is the constant \(1\), to first order.
Theorem 11.4 (Derivatives of Sine and Cosine) \((\sin x)' = \cos x\) and \((\cos x)' = -\sin x\) for all \(x \in \mathbb{R}\).
By the addition formula and the two facts above, \[ \sin(x+h) = \sin x\cos h + \cos x\sin h = \sin x\,\big(1 + o(h)\big) + \cos x\,\big(h + o(h)\big) = \sin x + (\cos x)\,h + o(h), \] using Lemma 10.1 to absorb the constant multiples of \(o(h)\). The coefficient of \(h\) is \(\cos x\). For the cosine, \[ \cos(x+h) = \cos x\cos h - \sin x\sin h = \cos x\,\big(1 + o(h)\big) - \sin x\,\big(h + o(h)\big) = \cos x - (\sin x)\,h + o(h). \qquad \square \]
As a check, \(\sin(1.01) = 0.846832\ldots\), while \(\sin 1 + (\cos 1)(0.01) = 0.841471 + 0.005403 = 0.846874\). The error is about \(-4\times10^{-5} \approx -\sin(1)\,h^2/2\), a second-order quantity.
The other four functions are quotients. For the tangent, \[ (\tan x)' = \frac{\cos x\cdot\cos x - \sin x\cdot(-\sin x)}{\cos^2x} = \frac{1}{\cos^2 x} = \sec^2x, \] on the set where \(\cos x \ne 0\). The derivatives of \(\cot\), \(\sec\) and \(\csc\) are Problem 2.
11.3 Compositions
With these building blocks, the chain rule differentiates every composition. The procedure is to identify the outermost operation and work inward.
Example 2. \(h(x) = \sin(x^2)\). The outer function is \(\sin\) and the inner is \(x^2\), so \(h'(x) = \cos(x^2)\cdot 2x\).
Example 3. \(h(x) = e^{x/(x+1)}\) for \(x \ne -1\). The inner function \(g(x) = \frac{x}{x+1}\) has \(g'(x) = \frac{1}{(x+1)^2}\) by the quotient rule, so \[ h'(x) = e^{x/(x+1)}\cdot\frac{1}{(x+1)^2}. \] As a check at \(x = 0\): \(h'(0) = 1\), and \(\frac{h(0.01) - h(0)}{0.01} = \frac{e^{0.0099} - 1}{0.01} \approx 0.995\).
Example 4. \(h(x) = \sin\!\big(e^{x^2}\big)\) has three layers. Applying the chain rule twice, \[ h'(x) = \cos\!\big(e^{x^2}\big)\cdot e^{x^2}\cdot 2x. \]
11.4 Table of Derivatives
| Function | Derivative | Domain |
|---|---|---|
| \(c\) | \(0\) | \(\mathbb{R}\) |
| \(x^r\) | \(r\,x^{r-1}\) | \(x > 0\) |
| \(e^x\) | \(e^x\) | \(\mathbb{R}\) |
| \(a^x\) | \(a^x\ln a\) | \(\mathbb{R}\) |
| \(\ln\lvert x\rvert\) | \(1/x\) | \(x \ne 0\) |
| \(\log_a x\) | \(\dfrac{1}{x\ln a}\) | \(x > 0\) |
| \(\sin x\) | \(\cos x\) | \(\mathbb{R}\) |
| \(\cos x\) | \(-\sin x\) | \(\mathbb{R}\) |
| \(\tan x\) | \(\sec^2 x\) | \(\cos x\ne0\) |
| \(\cot x\) | \(-\csc^2 x\) | \(\sin x \ne 0\) |
| \(\sec x\) | \(\sec x\tan x\) | \(\cos x\ne0\) |
| \(\csc x\) | \(-\csc x\cot x\) | \(\sin x \ne 0\) |
The row for \(\log_a x\) comes from \(\log_a x = \frac{\ln x}{\ln a}\). Together with linearity, the product, quotient and chain rules, this table differentiates every function built from elementary ones. The calculation is mechanical, and you can practice it with our derivative calculator.
11.5 Where This Leads
What remains are functions defined as inverses: \(\arcsin\), \(\arccos\), \(\arctan\), and the logarithm seen from the other side. The next chapter shows that the differential of an inverse function is the inverse of the differential, which in one dimension is the reciprocal of the slope. The inverse trigonometric derivatives then follow from the table above in one line each.
- Every derivative in this chapter reduces to one limit at a single point, because of an addition formula: \(e^{x+h} = e^xe^h\), \(\ln(x+h) = \ln x + \ln(1+\frac hx)\), \(\sin(x+h) = \sin x\cos h + \cos x\sin h\).
- The logarithm comes first: \((1+u)^{1/u} \to e\) gives \(\frac{\ln(1+u)}{u} \to 1\), hence \((\ln x)' = \frac1x\). The exponential follows by the substitution \(u = e^h - 1\).
- \(e\) is the base for which the tangent to \(a^x\) at \(0\) has slope \(1\). A function with \(f' = f\) is a multiple of \(e^x\), by the Mean Value Theorem.
- Writing \(x^r = e^{r\ln x}\) proves the power rule for every real exponent, and handles variable exponents such as \(x^x\).
- Sine and cosine are differentiated from \(\sin h = h + o(h)\) and \(\cos h = 1 + o(h)\). The other trigonometric functions are quotients.
- Do not confuse \((x^r)' = rx^{r-1}\) (variable in the base) with \((a^x)' = a^x\ln a\) (variable in the exponent).
Differentiate, stating where the result is valid.
\(e^{-x^2}\)
\(\ln(1 + x^2)\)
\(x^2\sin x\)
\(\dfrac{\sin x}{1 + \cos x}\)
\(x^\pi + \pi^x\)
Derive the derivatives of \(\cot x\), \(\sec x\) and \(\csc x\) from the quotient rule.
Let \(\varphi(x) = x^x\) for \(x > 0\). Find where \(\varphi'(x) = 0\), and show that this point is the minimum of \(\varphi\) on \((0,\infty)\). (Use the sign of \(\varphi'\) and the Mean Value Theorem.)
The equation \(f' = f\).
Suppose \(f' = f\) on \(\mathbb{R}\) and \(f(0) = 0\). Show that \(f \equiv 0\).
Suppose \(f' = kf\) for a constant \(k\). Show that \(f(x) = f(0)e^{kx}\). (Consider \(f(x)e^{-kx}\).)
Show that \((\ln|f(x)|)' = \dfrac{f'(x)}{f(x)}\) wherever \(f\) is differentiable and nonzero. Use this to differentiate \(\ln|\cos x|\).
Addition formulas. Suppose \(E : \mathbb{R} \to \mathbb{R}\) satisfies \(E(x+y) = E(x)E(y)\) for all \(x, y\) and is differentiable at \(0\). Show that \(E\) is differentiable everywhere, with \(E'(x) = E'(0)\,E(x)\).
Use the tangent line (the linear approximation \(f(a+h) \approx f(a) + f'(a)h\)) to estimate \(e^{0.1}\), \(\ln(1.05)\) and \((1.02)^{10}\), and compute the errors with a calculator. Explain the size and sign of each error.
\(-2x\,e^{-x^2}\) for all \(x\).
\(\dfrac{2x}{1 + x^2}\) for all \(x\).
\(2x\sin x + x^2\cos x\) for all \(x\).
\(\dfrac{\cos x(1 + \cos x) + \sin x\cdot\sin x}{(1+\cos x)^2} = \dfrac{1 + \cos x}{(1+\cos x)^2} = \dfrac{1}{1 + \cos x}\), wherever \(\cos x \ne -1\).
\(\pi x^{\pi - 1} + \pi^x\ln\pi\) for \(x > 0\).
\((\cot x)' = \left(\dfrac{\cos x}{\sin x}\right)' = \dfrac{-\sin x\sin x - \cos x\cos x}{\sin^2 x} = -\csc^2 x\). \((\sec x)' = \left(\dfrac{1}{\cos x}\right)' = \dfrac{\sin x}{\cos^2x} = \sec x\tan x\). \((\csc x)' = \left(\dfrac{1}{\sin x}\right)' = \dfrac{-\cos x}{\sin^2 x} = -\csc x\cot x\).
\(\varphi'(x) = x^x(\ln x + 1)\), and \(x^x > 0\), so \(\varphi'(x) = 0\) exactly when \(\ln x = -1\), i.e. \(x = 1/e\). For \(x < 1/e\) we have \(\ln x + 1 < 0\) and \(\varphi' < 0\); for \(x > 1/e\), \(\varphi' > 0\). By Problem 4(d) of the chapter on the derivative, \(\varphi\) is strictly decreasing on \((0, 1/e]\) and strictly increasing on \([1/e, \infty)\). So \(x = 1/e\) is the minimum, with value \(e^{-1/e} \approx 0.692\).
This is Proposition 11.1 with \(f(0) = 0\).
Let \(g(x) = f(x)e^{-kx}\). Then \(g'(x) = f'(x)e^{-kx} - kf(x)e^{-kx} = (f'(x) - kf(x))e^{-kx} = 0\), so \(g\) is constant by Corollary 9.1, equal to \(g(0) = f(0)\). Hence \(f(x) = f(0)e^{kx}\).
If \(f(x) > 0\), then \((\ln f)' = \frac{f'}{f}\) by the chain rule. If \(f(x) < 0\), then \(\ln|f| = \ln(-f)\) and \((\ln(-f))' = \frac{-f'}{-f} = \frac{f'}{f}\). For \(f = \cos\): \((\ln|\cos x|)' = \dfrac{-\sin x}{\cos x} = -\tan x\) wherever \(\cos x \ne 0\).
Taking \(x = y = 0\) gives \(E(0) = E(0)^2\), so \(E(0) \in \{0, 1\}\). If \(E(0) = 0\), then \(E(x) = E(x)E(0) = 0\) for all \(x\), and the claim is trivial. If \(E(0) = 1\), then \[ \frac{E(x+h) - E(x)}{h} = E(x)\,\frac{E(h) - E(0)}{h} \to E(x)\,E'(0). \]
The derivative of \(e^x\) at \(0\) is \(1\), so \(e^{0.1} \approx 1 + 0.1 = 1.1\); the true value is \(1.10517\), and the error is \(0.0052 \approx h^2/2\) (the next term of the expansion). The derivative of \(\ln x\) at \(1\) is \(1\), so \(\ln(1.05) \approx 0.05\); the true value is \(0.04879\) and the error is \(-0.0012 \approx -h^2/2\). The derivative of \(x^{10}\) at \(1\) is \(10\), so \((1.02)^{10} \approx 1.2\); the true value is \(1.2190\) and the error is \(0.0190\), mostly from \(\binom{10}{2}h^2 = 45(0.0004) = 0.018\). The errors have the signs of the second derivative: \(e^x\) and \(x^{10}\) curve upward and the tangent line lies below them, while \(\ln x\) curves downward and the tangent line lies above it.