24.5 Derivatives of Exponential and Logarithmic Functions

SL 5.6 AHL 5.15

In this section you will learn
  • that \(\mathrm{e}^x\) is its own derivative, and how to differentiate \(\mathrm{e}^{f(x)}\)
  • the derivative of \(a^x\) for any base \(a > 0\) (HL)
  • that the derivative of \(\ln x\) is \(\dfrac{1}{x}\), and how to differentiate \(\ln f(x)\)
  • the derivative of \(\log_a x\) (HL)
  • 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\).

Exponential functions with any base

AHL 5.15

For \(a > 0\), we can write \(a\) as a power of \(\mathrm{e}\): \(\;a = \mathrm{e}^{\ln a}\). So

\[ a^x = \left(\mathrm{e}^{\ln a}\right)^x = \mathrm{e}^{(\ln a)x} . \]

Now \(\ln a\) is just a constant, so by the chain rule

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

Derivatives of \(a^x\) and \(a^{f(x)}\) (\(a > 0\)) Partly in the HL formula booklet

\[ f(x) = a^x \;\Rightarrow\; f'(x) = a^x(\ln a) \]

In the HL booklet

More generally, by the chain rule,

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

  • \(a\): the base, a positive constant
  • \(f(x)\): a function of \(x\) (the power)
  • \(\ln a\): the natural logarithm of \(a\)

Example 2 Find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) when

(a) \(y = 2^{x^2}\)

(b) \(y = 7^{1 - 4x}\).

(a) \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2x \cdot 2^{x^2}\ln 2\).

(b) \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = -4 \cdot 7^{1 - 4x}\ln 7\).

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)

For a logarithm with another base, change the base first: \(\log_a x = \dfrac{\ln x}{\ln a}\) (see 1.4). Since \(\dfrac{1}{\ln a}\) is a constant:

Derivative of \(\log_a x\) AHL 5.15 In the HL formula booklet

\[ f(x) = \log_a x \;\Rightarrow\; f'(x) = \frac{1}{x\ln a} \]

  • \(a\): the base of the logarithm (\(a > 0\), \(a \neq 1\))
  • \(x\): a positive number (\(x > 0\))

Example 3 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\)

(d) AHL \(y = \log_2(x^2 + 1)\)

(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}\).

(d) \(y = \dfrac{\ln(x^2 + 1)}{\ln 2}\), so \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{1}{\ln 2} \times \dfrac{2x}{x^2 + 1} = \dfrac{2x}{(x^2 + 1)\ln 2}\).

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 4 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\) ✓.

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}\left(3^x\right) = x \cdot 3^{x - 1}\) \(3^x\ln 3\) The variable is in the exponent.
\(\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 = \mathrm{e}^{x^2 - 1}\).

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

3 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}\).

4 Find the gradient of the curve \(y = \mathrm{e}^{2x} - 4x\) at the point where \(x = \ln 3\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2\mathrm{e}^{2x} - 4\). At \(x = \ln 3\): \(\;\mathrm{e}^{2\ln 3} = \mathrm{e}^{\ln 9} = 9\), so the gradient is \(18 - 4 = 14\).

5 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}\).

6 Differentiate \(y = x^2\ln x\), \(\;x > 0\).

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

7 Differentiate \(y = \dfrac{\ln x}{x}\), \(\;x > 0\).

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{x \cdot \frac{1}{x} - \ln x \cdot 1}{x^2} = \frac{1 - \ln x}{x^2} . \]

8 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\).

9 AHL Differentiate \(y = 3^x + \log_3 x\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 3^x\ln 3 + \dfrac{1}{x\ln 3}\).

10 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} . \]