23.6 Derivatives of Exponential and Logarithmic Functions

IB Math AA SL and HL: that e^x is its own derivative, and how to differentiate e^f(x); that the derivative of ln x is 1/x, and how to differentiate… Worked examples and solutions.

SL 5.6

In this section you will learn
  • that \(\mathrm{e}^x\) is its own derivative, and how to differentiate \(\mathrm{e}^{f(x)}\)
  • that the derivative of \(\ln x\) is \(\dfrac{1}{x}\), and how to differentiate \(\ln f(x)\)
  • how to use the laws of logarithms to make differentiation easier

The natural exponential function

The number \(\mathrm{e} \approx 2.718\) is special: the gradient of \(y = \mathrm{e}^x\) at any point is equal to the \(y\)-value at that point (Figure 1).

Figure 1: The tangent to \(y = \mathrm{e}^x\) at \((0,\,1)\) has gradient \(1\); at \((1,\,\mathrm{e})\) it has gradient \(\mathrm{e}\).

From the definition of the derivative,

\[ \frac{\mathrm{e}^{x + h} - \mathrm{e}^x}{h} = \frac{\mathrm{e}^x\left(\mathrm{e}^h - 1\right)}{h} = \mathrm{e}^x \cdot \frac{\mathrm{e}^h - 1}{h} . \]

The number \(\mathrm{e}\) is exactly the base for which \(\displaystyle\lim_{h \to 0}\frac{\mathrm{e}^h - 1}{h} = 1\) (the gradient of \(y = \mathrm{e}^x\) at \(x = 0\) is \(1\)). So the derivative is \(\mathrm{e}^x \times 1 = \mathrm{e}^x\).

Derivatives of \(\mathrm{e}^x\) and \(\mathrm{e}^{f(x)}\) Partly in the formula booklet

\[ f(x) = \mathrm{e}^x \;\Rightarrow\; f'(x) = \mathrm{e}^x \]

In the booklet

More generally, for any function \(f(x)\),

\[ \frac{\mathrm{d}}{\mathrm{d}x}\left(\mathrm{e}^{f(x)}\right) = f'(x)\,\mathrm{e}^{f(x)} . \]

This second result comes from the chain rule. For example, \(\dfrac{\mathrm{d}}{\mathrm{d}x}\left(\mathrm{e}^{kx}\right) = k\mathrm{e}^{kx}\).

  • \(\mathrm{e}\): Euler’s number, \(\mathrm{e} \approx 2.718\)
  • \(f(x)\): any function of \(x\) (the power)
  • \(k\): a constant

Example 1 Differentiate with respect to \(x\):

(a) \(y = \mathrm{e}^{5 - 2x}\)

(b) \(y = \mathrm{e}^{\sin x}\)

(c) \(y = x^2\mathrm{e}^{-3x}\)

(d) \(y = \dfrac{\mathrm{e}^{2x}}{x + 1}\)

(a) \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = -2\mathrm{e}^{5 - 2x}\).

(b) \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = \cos x\;\mathrm{e}^{\sin x}\).

(c) Product rule: \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2x\mathrm{e}^{-3x} + x^2\left(-3\mathrm{e}^{-3x}\right) = x\mathrm{e}^{-3x}(2 - 3x)\).

(d) Quotient rule:

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{(x + 1) \cdot 2\mathrm{e}^{2x} - \mathrm{e}^{2x} \cdot 1}{(x + 1)^2} = \frac{\mathrm{e}^{2x}(2x + 1)}{(x + 1)^2} . \]

Since \(\mathrm{e}^{f(x)} > 0\) for all \(x\), a factor like \(\mathrm{e}^{-3x}\) is never zero. This is useful when you solve \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 0\).

The natural logarithm

Let \(y = \ln x\), \(x > 0\). By definition, \(\mathrm{e}^y = x\). Differentiate both sides with respect to \(x\) (the left side needs the chain rule, because \(y\) is a function of \(x\)):

\[ \mathrm{e}^y\,\frac{\mathrm{d}y}{\mathrm{d}x} = 1 \qquad\Rightarrow\qquad \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{1}{\mathrm{e}^y} = \frac{1}{x} . \]

Derivatives of \(\ln x\) and \(\ln f(x)\) Partly in the formula booklet

\[ f(x) = \ln x \;\Rightarrow\; f'(x) = \frac{1}{x}, \quad x > 0 \]

In the booklet

More generally, by the chain rule,

\[ \frac{\mathrm{d}}{\mathrm{d}x}\big(\ln f(x)\big) = \frac{f'(x)}{f(x)}, \quad f(x) > 0 . \]

“The derivative of the inside, over the inside.”

  • \(\ln\): the natural logarithm (base \(\mathrm{e}\))
  • \(f(x)\): a function of \(x\) with \(f(x) > 0\) (the inside)

Example 2 Differentiate with respect to \(x\):

(a) \(y = \ln(5x - 2)\), \(\;x > \dfrac{2}{5}\)

(b) \(y = \ln(x^2 + \sin x)\), \(\;x > 0\)

(c) \(y = (\ln x)^4\), \(\;x > 0\)

(a) \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{5}{5x - 2}\).

(b) \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{2x + \cos x}{x^2 + \sin x}\).

(c) This is a power of \(\ln x\), not a log of a power. Chain rule: \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = 4(\ln x)^3 \times \dfrac{1}{x} = \dfrac{4(\ln x)^3}{x}\).

When the expression inside \(\ln\) is a product, a quotient or a power, use the laws of logarithms first. This turns one hard derivative into several easy ones.

Example 3 Differentiate \(y = \ln\left(\dfrac{(2x + 1)^3}{\sqrt{x - 2}}\right)\), \(\;x > 2\), with respect to \(x\).

Use the laws of logarithms:

\[ y = \ln(2x + 1)^3 - \ln(x - 2)^{\frac{1}{2}} = 3\ln(2x + 1) - \frac{1}{2}\ln(x - 2) . \]

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = 3 \times \frac{2}{2x + 1} - \frac{1}{2} \times \frac{1}{x - 2} = \frac{6}{2x + 1} - \frac{1}{2(x - 2)} . \]

As one fraction: \(\;\dfrac{12(x - 2) - (2x + 1)}{2(2x + 1)(x - 2)} = \dfrac{10x - 25}{2(2x + 1)(x - 2)} = \dfrac{5(2x - 5)}{2(2x + 1)(x - 2)}\).

Menu → Calculus → Numerical Derivative at a Point, variable \(x\), value \(3\), 1st derivative, and the function \(\ln\left(\dfrac{(2x + 1)^3}{\sqrt{x - 2}}\right)\) gives \(0.357143\). The exact answer from the example at \(x = 3\) is \(\dfrac{5 \times 1}{2 \times 7 \times 1} = \dfrac{5}{14} = 0.357142\ldots\) ✓.

HL students: continue with 23.7 Derivatives of aˣ and logₐ x.

Common errors

✗ Wrong ✓ Right Why
\(\dfrac{\mathrm{d}}{\mathrm{d}x}\left(\mathrm{e}^{x^2}\right) = x^2\mathrm{e}^{x^2 - 1}\) \(2x\,\mathrm{e}^{x^2}\) \(\mathrm{e}^x\) is not a power of \(x\); the power rule does not apply.
\(\dfrac{\mathrm{d}}{\mathrm{d}x}\ln(5x - 2) = \dfrac{1}{5x - 2}\) \(\dfrac{5}{5x - 2}\) Multiply by the derivative of the inside.
\(\dfrac{\mathrm{d}}{\mathrm{d}x}\ln(7x) = \dfrac{7}{x}\) \(\dfrac{7}{7x} = \dfrac{1}{x}\) Or: \(\ln 7x = \ln 7 + \ln x\).
\((\ln x)^4 = 4\ln x\) Only \(\ln x^4 = 4\ln x\) The power law works for the inside of the log only.
\(\dfrac{\mathrm{d}}{\mathrm{d}x}\left(\dfrac{1}{x}\right) = \ln x\) \(-\dfrac{1}{x^2}\) It is the other way round: \(\dfrac{\mathrm{d}}{\mathrm{d}x}(\ln x) = \dfrac{1}{x}\).

Exercises

1 Differentiate \(y = 4\mathrm{e}^{3x} - \mathrm{e}^{-x}\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 12\mathrm{e}^{3x} + \mathrm{e}^{-x}\).

2 Differentiate \(y = x\mathrm{e}^{2x}\), and find the value of \(x\) where \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 0\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \mathrm{e}^{2x} + 2x\mathrm{e}^{2x} = \mathrm{e}^{2x}(1 + 2x)\).

\(\mathrm{e}^{2x} > 0\), so \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 0\) only when \(1 + 2x = 0\), i.e. \(x = -\dfrac{1}{2}\).

3 Differentiate

(a) \(y = \ln(7x)\)

(b) \(y = \ln(x^2 + 4)\).

(a) \(\dfrac{7}{7x} = \dfrac{1}{x}\). \(\qquad\) (b) \(\dfrac{2x}{x^2 + 4}\).

4 Show that \(\dfrac{\mathrm{d}}{\mathrm{d}x}\ln(\cos x) = -\tan x\), for \(0 < x < \dfrac{\pi}{2}\).

\(\dfrac{\mathrm{d}}{\mathrm{d}x}\ln(\cos x) = \dfrac{-\sin x}{\cos x} = -\tan x\).

5 Let \(f(x) = \ln\sqrt{\dfrac{1 + x}{1 - x}}\), \(\;-1 < x < 1\). Show that \(f'(x) = \dfrac{1}{1 - x^2}\).

Laws of logarithms first: \(\;f(x) = \dfrac{1}{2}\ln(1 + x) - \dfrac{1}{2}\ln(1 - x)\).

\[ f'(x) = \frac{1}{2}\left(\frac{1}{1 + x} + \frac{1}{1 - x}\right) = \frac{1}{2} \times \frac{(1 - x) + (1 + x)}{(1 + x)(1 - x)} = \frac{1}{1 - x^2} . \]