9. Differentiating Exponentials and Logarithms#

Recall, from earlier in the course, that there is an irrational number \(e\approx 2.718\) which had some special properties. We investigate what happens when we differentiate \(y=e^x\).

9.1. Differentiating exponential functions#

Consider an exponential function \(y=a^x\). For convenience, let’s suppose \(a>1\), so that the function is increasing.

_images/y%3De%5Ex.png

Fig. 9.1 Graph of \(y=a^x\)#

We differentiate this function from first principles. To do this, we must analyse the behaviour of

\[ \frac{a^{x+h}-a^x}{h} \]

when \(h\) is a small number.

By standard index laws,

\[ \frac{a^{x+h}-a^x}{h} = \frac{a^xa^h-a^x}{h} = \frac{a^x(a^h-1)}{h} = a^x\left(\frac{a^h-1}{h}\right). \]

This means that

\[ \frac{d}{dx}\left(a^x\right) = \lim_{h\rightarrow 0}\frac{a^{x+h}-a^x}{h} = a^x\lim_{h\rightarrow 0}\left(\frac{a^h-1}{h}\right). \]

Now, \(\lim_{h\rightarrow 0}\frac{a^h-1}{h}\) is a constant — specifically, it is the slope of the tangent to \(y=a^x\) when \(x=0\). So we have shown that

(9.1)#\[\frac{d}{dx}\left(a^x\right) = Ca^x.\]

where \(C\) is a constant.

The constant \(C\) depends on the base number, \(a\), but nothing else. Moreover, we’ve shown that the derivative of an exponential function is always proportional to itself!

Definition 9.1

Euler’s number, denoted by \(e\), is defined to be the base for which the constant \(C\) of equation (9.1) is equal to \(1\).

Like \(\pi\), \(e\) is an irrational number, and there are many methods to calculate \(e\) to an arbitrary number of decimal places. To 50 decimal places,

\[ e = 2.71828182845904523536028747135266249775724709369995.... \]

The following result is immediate from the definition of \(e\).

Theorem 9.1 (Differentiation of \(e^x\))

The derivative of \(e^x\) is itself:

\[ \frac{d}{dx}\left(e^x\right) = e^x. \]

Remarks:

  1. It can be shown that \(e^x\) is the only function \(f(x)\) such that \(f(0)=1\) and \(f'(x) = f(x)\).

  2. If we forget about the problems that occur with infinite sums, we can also see the above result from differentiating the power series expansion of \(e^x\). \begin{align*} \frac{d}{dx}(e^x) &= \frac{d}{dx}\left(1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4!}+\ldots \right)\ &= 0+ 1 + \frac{2x}{1\times 2} + \frac{3x^2}{1\times 2\times 3} + \frac{4x^3}{1\times 2\times 3\times 4}+\dots\ &= 1+ x + \frac{x^2}{2!} + \frac{x^3}{3!}+\dots\ &= e^x. \end{align*}

Note

The above ‘proof’ relies on the theory of convergence. This is, in some way, a special case: for other similar expansions the above method does not work.

9.2. Examples#

Example 9.1

Let \(y = e^{7x}\). Find \(\frac{dy}{dx}\).

Solution.
We need the chain rule here. Let \(u = 7x\) so that \(y = e^u\). Then

\[\begin{align*} \frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx} &= e^u\times 7 = 7e^{7x}. \end{align*}\]

Example 9.2 (Exponential Decay)

In a radioactive decay, the rate of change of mass is directly proportional to the mass remaining.

Let \(y\) be the mass of the sample at time \(t\). Then we are told that \(\frac{dy}{dt}\) is directly proportional to \(y\) (written \(\frac{dy}{dt}\propto y\)), that is

(9.2)#\[\frac{dy}{dt} = -ky \eqno{(*)}\]

for some constant \(k\), where we have introduced the negative sign since the mass, \(y\), will be decreasing with time. An application of the chain rule shows that if \(y = e^{-kt}\) then

\[ \frac{dy}{dt} = -k e^{-kt} = -ky \]

and so \(y = e^{-kt}\) is a solution for the equation (9.2). But, in fact, we can do better. For any constant \(A\), if \(y = Ae^{-kt}\) then

\[ \frac{dy}{dt} = -k\cdot Ae^{-kt} = -ky. \]

So \(y = Ae^{-kt}\) is also a solution of (9.2) for any \(A \in \mathbb{R}\).

It can be shown that all solutions of (9.2) are of the form \(Ae^{-kt}\) for some constant \(A\in\mathbb{R}\); we call \(y=Ae^{-kt}\) the general solution of (9.2).

Equations such as (9.2) are called differential equations as they contain derivatives as well as the more ordinary terms. Many scientific theories involve differential equations like this.

_images/expdecay.png

Fig. 9.2 Exponential decay: \(y=5e^{-\frac{1}{2}t}\), for \(t\geq 0\).#

Example 9.3

Differentiate \(y = e^{x^2}\).

Solution.
We use the chain rule. Let \(u = x^2\) so that \(y = e^u\). Then

\[\begin{align*} \frac{dy}{dx} &= \frac{dy}{du}\cdot\frac{du}{dx}\\ &= e^u\times 2x\\ &= 2x e^{x^2}. \end{align*}\]

In general, if \(y = e^{f(x)}\) and we use the chain rule with \(u = f(x)\), we get \(\frac{dy}{du} = e^{u}\) and \(\frac {du}{dx} = f'(x)\). Thus \(\frac{dy}{dx} = f'(x) e^{u} = f'(x) e^{f(x)}\). Hence we have the following result.

Theorem 9.2

Let \(f(x)\) be a function and let \(y=e^{f(x)}\). Then

\[ \frac{dy}{dx} = f'(x) e^{f(x)}. \]

9.3. Differentiating \(y = \ln x\)#

We know from earlier in the module that \(e^x\) and \(\ln x\) are inverse functions, that is

\[ y = e^x \text{, so } \ln y = x. \]

Now let \(y = \ln x\). Then \(x = e^y\) and so \(\frac{dx}{dy} = e^y\). By the inverse function rule, we have

\[ \frac{dy}{dx} = \frac{~1~}{~\frac{dx}{dy}~} = \frac 1{e^y} = \frac 1x. \]

(Note that we have to express \(\frac{dy}{dx}\) in terms of \(x\) not in terms of \(y\).) Thus we have proved the following result.

Theorem 9.3 (Differentiation of \(\ln x\))

The derivative of the natural logarithm is given by

\[ \frac{d}{dx}\Big(\ln x\Big) = \frac{1}{x}, \hspace{2em} \text{ for all } x>0. \]

9.4. Examples#

Example 9.4

Differentiate \(y = \ln (x^2+1)\).

Solution.
We use the chain rule with \(u = x^2 +1\) so that \(y = \ln u\). Then

\[ \frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx} = \frac{1}u\cdot 2x = \frac{2x}{x^2+1}. \]

Example 9.5

Differentiate \(y = \ln(-x)\) for \(x < 0\).

Solution.
Note that as \(x < 0\), we have \(-x >0\) and so \(\ln(-x)\) exists. We use the chain rule with \(u = -x\) so that \(y = \ln u\). Then

\[ \frac{dy}{dx} = \frac 1u \times (-1)= \frac 1{-x}\times (-1) = \frac 1x. \]

Remark 9.1

The outcome of Example 9.5 may seem surprising — \(\ln(x)\) is not the only function with derivative \(\frac{1}{x}\)!

The key thing to remember here is whether \(x\) is positive or negative. If \(x\) is negative, then \(\ln(x)\) does make sense, but \(\ln(-x)\) does. So \(\frac{1}{x}\) is the derivative of \(\ln(x)\) when \(x>0\), and the derivative of \(\ln(-x)\) when \(x<0\).

More on this in Chapter 12 Integration.

Example 9.6

Differentiate \(y = \ln\big(f(x)\big)\).

Solution.
We use the chain rule with \(u = f(x)\) so that \(y = \ln u\). Then \(\frac{dy}{du} = \frac 1u\) and \(\frac{du}{dx} = f'(x)\). Thus

\[ \frac{dy}{dx} = \frac 1u\cdot f'(x) = \frac{f'(x)}{f(x)}. \]

So the derivative of \(\ln (f(x))\) is the derivative of the function \(f(x)\) divided by the original function \(f(x)\). We have proved the following theorem.

Theorem 9.4 (Differentiating \(\ln(f(x))\))

Let \(y = \ln (f(x))\). Then

\[ \frac{dy}{dx} = \frac{f'(x)}{f(x)}. \]

Example 9.7

Differentiate \(y = \ln \left(\frac{x(3x+1)^2}{(x^2+2)^3}\right)\).

Solution.
We can do two things here: either use the theorem above directly with \(f(x)=\frac{x(3x+1)^2}{(x^2+2)^3}\) or, the easier way, we first use the laws of logarithms to simplify the expression for \(y\).

\[\begin{align*} y &=\ln \left(\frac{x(3x+1)^2}{(x^2+2)^3}\right)\\ &=\ln (x(3x+1)^2) - \ln (x^2 +2)^3\\ &=\ln x+\ln((3x+1)^2) - 3\ln(x^2+2)\\ &=\ln x + 2\ln(3x+1) - 3\ln(x^2+2). \end{align*}\]

This is now much easier to differentiate, using Theorem 9.4 on each term we get

\[\begin{align*} \frac{dy}{dx} &= \frac 1x + 2\frac{3}{3x+1} - 3\frac{2x}{x^2+2}\\ &= \frac 1x + \frac 6{3x+1} - \frac{6x}{x^2+2}. \end{align*}\]