 ### Review of the laws of logs and exponential functions

In this section, we'll learn how to find the derivatives of exponential and logarithmic functions. To begin that, we'll take a closer look at a general exponential function, armed with our new view of mathematics that includes limits. ... but first, let's brush up on the laws of exponents:

### Laws of Exponents

 Operation Explanation Example Product am·an = am+n 22 · 23 = (2·2)(2·2·2) = 25 Quotient  Power (am)n = am·n (22)3 = (2·2)(2·2)(2·2) = 26 Inverse  Zero power a0 = 1 Why? We need aman = am·n when m = 0. In order for this law to be satisfied when m = 0, we have an = am+n = a0+n = a0an, so a0 must be 1.

### A fresh look at   f(x) = ax

Let's consider the function f(x) = ax in a little more detail. We know it's defined for x ∈ {Z} (x is an element of the set of integers). That is, we know that 22 = 4, 23 = 8, and so on.

We also know that the function is defined for x ∈ {Q}, the rational numbers, because we know that

$$a^{\frac{p}{q}} = \sqrt[q]{a^p} \, ,$$

which is exactly defined. But what about something like

$$a^{\sqrt{3}} = ?$$

How do we calculate the value of a number raised to an irrational power? To wrap our heads around this dilemma, let's replace   a   with a number:

$$2^{\sqrt{3}} = ?$$

Then let's approximate the root of three using rational numbers, one on the low side and another on the high side:

$$1.7 \; \lt \: \sqrt{3} \: \lt \: 1.8$$

Note that 1.7 and 1.8 are rational numbers. For example, 1.7 is 17/10. If √3 can be sandwiched between two rational numbers, then

$$2^{1.7} \; \lt \: 2^{\sqrt{3}} \: \lt \: 2^{1.8}$$

The value of 2√3 must lie between 21.7 and 21.8 somewhere. Now the trick is that we can do arbitrarily better than that. We can improve our rational-number estimates of 2√3, getting arbitrarily close to it.

There are two consequences to all of this. First, any graph of such an exponential function really has to be considered to be "full of holes", as depicted in the graph below. There are an infinity of holes between each pair of irrational exponents. Second, it means that the value of an exponential function is really a limit at those points:

$$a^x = \lim_{r\to x} \, a^r$$

Notice that this is the very definition of the continuity of a function, and exponential functions are continuous.

### The derivative of   f(x) = ax

What to do when the base isn't e

Now to find the derivative of the general exponential function f(x) = ax. We begin with the difference quotient, as usual. In the third step, we apply the product property of exponents.

Next we factor out the common ax and realize that it plays no factor in evaluating the limit (doesn't contain h), so it can be moved to the front.

We see then that the derivative of an exponential function is just the function itself times some value, the value of the limit:

$$\lim_{h\to 0} \frac{(a^h - 1)}{h}$$

which we assume to take on some constant value. That idea is worth repeating because it's quite an important one:

\begin{align} \frac{df}{dx} &= \lim_{h\to 0} \frac{f(x + h) - f(x)}{h} \\ \\ &= \lim_{h\to 0} \frac{a^{x + h} - a^x}{h} \\ \\ &= \lim_{h\to 0} \frac{a^x a^h - a^x}{h} \\ \\ &= \lim_{h\to 0} \frac{a^x (a^h - 1)}{h} \\ \\ &= a^x \, \lim_{h\to 0} \frac{a^h - 1}{h} \end{align}

#### Derivative of an exponential function

The derivative of an exponential function is directly proportional to the function itself: Now let's think a little harder about that limit. In the upper table below, I've calculated some of its values with different bases (0.5, 1, 2, 3) and with decreasing h (i.e. as h→0). In each case the limit converges to some number (bottom row), but there's an interesting possibility ...

If we choose   a  to lie somewhere between 2 and 3, it should be possible (and it is) to get the limit to converge to one. In that case, the derivative of the exponential function would just be the exponential function itself. The lower table ( ↑ ) shows that the number 2.7182818 ..., which turns out to the the irrational number e, the base of all continuously-growing exponential functions. Use of e for a in our limit expression gives a limit of one. That leads to the very important result:

The natural exponential function is its own derivative:

$$\frac{d}{dx} e^x = e^x$$

#### Derivative of f(x) = ex

The natural exponential function, f(x) = ex is the only function that is its own derivative. That means that the value, f(x), of the exponential function ex is equal to the slope of the function at every point in its domain: ### A general derivative of ax

Now we just need an expression for the derivative of f(x) = ax, where a ≠ e (a can be any positive base). We begin by noting that any exponential function ax can be rewritten as   ax = (eln(a))x = e(ln a)x. Now ln(a) is a constant, so it's just a matter of applying the chain rule to take the derivative, like this:

$$\frac{d}{dx} e^{(ln(a))x} = ln(a) \cdot e^{x ln(a)}$$

Remember that e(ln a) = a, then we can use that to find the derivative rule for a general exponential function:

$$\frac{d}{dx} a^x = ln(a) \cdot a^x$$

#### Derivative of f(x) = ax

The derivative of an exponential function with a base other than e is Notice that this equation works if the base is e, too, because ln(e) = 1.

### Example 1

Find the derivative of   $f(x) = 4x^2 \, e^x$

Solution: This is a product-rule problem that contains an exponential part; the function is a product of the quadratic function 4x2 (which is not an exponential function!) and the exponential function ex.

The derivative is which simplifies a bit to

$$= 4x \, e^x (x + 2)$$

### Example 2

Find the derivative of   $f(x) = 4^2x$

Solution: This is a composite function, an exponential function f(a) = 4a where a = 2x. The derivative is The derivative of 2x is 2, so the derivative of the function is:

$$= 2 \cdot ln(4) 4^{2x}$$

You'll need to memorize these two exponential derivatives, but a big part of finding derivatives of these functions is applying the other rules of differentiation.

Here is a graph of f(x) (black) and its derivative (purple) Notice that the derivative is just the original function scaled by a constant.

### Example 3

Find the derivative of the function   $3^{x^2}$

Solution: Taking the derivative of the inner function gives

$$= 2x \, ln(3) \, 3^{x^2}$$

### Practice problems

Find the derivatives of these functions, each containing an exponential function.

 1 $f(x) = e^{3x}$ Solution $$f'(x) = e^{3x} \cdot 3 = 3 e^{3x}$$ 2 $f(x) = e^{3x^2}$ Solution $$f'(x) = e^{3x^2} \cdot 6x = 6x \cdot e^{3x^2}$$ 3 $f(x) = 2x \cdot e^{x - 1}$ Solution \begin{align} f'(x) &= 2 e^{x - 1} + 2x [e^{x - 1}(1)] \\ \\ &= 2e^{x - 1} (1 + x) \end{align} 4 $f(x) = 2x^3 \cdot e^{-x^2}$ Solution \begin{align} f'(x) &= 6x^2 e^{-x^3} + 2x^3 e^{-x^3}(-3x^2) \\ &= 6x^2 e^{-x^3} - 6x^5 e^{-x^3} \\ &= 6x^2 e^{-x^3} (1 - x^3) \end{align} 5 $f(x) = -3^{2x}$ Solution $$f'(x) = -2 \cdot e^{2x} \cdot ln(3)$$

 6 $f(x) = 4x^2 \cdot 5^{x - 4}$ Solution \begin{align} f'(x) &= 8x 5^{x - 4} + 4x^2 5^{x - 4} ln(5) (1) \\ &= 8x 5^{x - 4} + 4x^3 ln(5) 5^{x - 4} \\ &= 4x \cdot 5^{x - 4} [2 + x^2 \cdot ln(5)] \end{align} 7 $f(x) = 3^{x^2 + 2x + 1}$ Solution \begin{align} f'(x) &= 3^{x^2 + 2x + 1} \cdot ln(3) \cdot (2x + 2) \\ &= 2 ln(3)(x + 1)\cdot 3^{x^2 + 2x + 1} \end{align} 8 $f(x) = 9 x^3 \cdot 3e^x$ Solution \begin{align} f'(x) &= 27 x^2 3^{e^x} + 9x^3 3^{e^x} ln(3) e^x \\ &= (9x^2 3^{e^x}) (3 + x ln(3) e^x) \end{align} 9 $f(x) = -x^{-2} e^{2x^2}$ Solution \begin{align} f'(x) &= 2 x^{-3} e^{2x^2} - x^{-2} e^{2x^2} 4x\\ \\ &= 2x^{-3} e^{2x^2} - 4x^{-1} \cdot e^{2x^2} \\ \\ &= 2 e^{2x^2} (x^{-3} - 2x^{-1}) \\ \\ &= 2 e^{2x^2} \left( \frac{1}{x^3} - \frac{2}{x}\right) \end{align} 10 $f(x) = \frac{-2^{x^2 - 2}}{x}$ Solution \begin{align} f'(x) &= \frac{x (-2^{x^2 - 2} ln(2) \cdot 2x) + 2^{x^2 - 2} (1)}{x^2} \\ \\ &= \frac{2^{x^2 - 2}[-2x^2 \cdot ln(2) + 1]}{x^2} \end{align}

### The derivative of f(x) = ln(x)

Once we know the derivative of ex, the derivative of its inverse function, f(x) = ln(x) is pretty straightforward. We start with the function:

$$y = ln(x)$$

First use exponentiation with the base   e   to get rid of the log, a common manipulation with log equations,

$e^y = x$         (*)

Now take the derivative of each side, remembering to use the chain rule on ey, because y is a function of x.

$$\frac{d}{dx} e^y = \frac{d}{dx} x$$

and

$$e^y \frac{dy}{dx} = 1$$

Then the trick is to realize that in the second step, labeled (*), we set ey = x. That allows us to solve for the derivative of y in terms of x. That means

$$x \frac{dy}{dx} = 1$$

So our derivative is

$$\frac{d}{dx} ln(x) = \frac{1}{x}$$

#### Derivative of f(x) = ln(x)

The derivative of the natural exponential function f(x) = ln(x) is ### The derivative of a general log function f(x) = loga(x)

What to do when the log base isn't e

All that's left for us to do in this section is to generalize the derivative of ln(x) so that we have a method of differentiating any log function (with any base). To do this, we simply recall that to change the base of a base   b   logarithm to the base   e,   we use the change-of-base formula:

$$log_b(x) = \frac{ln(x)}{ln(b)}$$

From there, if we recognize that 1/ln(b) is just a constant, we can use the previous result to get

$$\frac{d}{dx} log_b (x) = \frac{1}{x ln(b)}$$

And that's our result for the derivative of a log function of any base.

#### Derivative of f(x) = loga(x)

The derivative of a general (any base) logarithmic function is ### Practice problems

Find the derivatives of these functions containing logs.

 1 $f(x) = ln(x)$ Solution $$f'(x) = 1/x$$ 2 $f(x) = x\cdot log(x)$ Solution \begin{align} f'(x) &= log(x) + x\left(\frac{1}{x}\right) \\ \\ &= log(x) + 1 \end{align} 3 $f(x) = [ln(x)]^3$ Solution $f'(x) =$ $$3[ln(x)]^2 \cdot \left( \frac{1}{x}\right)\cdot[ln(x)]^2$$ 4 $f(x) = ln(2x^2 - 4)$ Solution \begin{align} f'(x) &= \frac{1}{2x^2 - 4} \cdot 4x \\ \\ &= \frac{4x}{2x^2 - 4} \end{align} 5 $f(x) = \frac{ln(x)}{x}$ Solution \begin{align} f'(x) &= \frac{x \left( \frac{1}{x} \right) - (1) ln(x)}{x^2} \\ \\ &= \frac{1 - ln(x)}{x^2} \end{align}

 6 $f(x) = [ln(ln(x))]^2$ Solution \begin{align} f'(x) &= 2[ln(ln(x))] \cdot \\ &\frac{1}{ln(x)}\cdot \frac{1}{x} \\ \\ &= \frac{2 ln(ln(x))}{x\cdot ln(x)} \end{align} Be careful with that result. The ln(x) terms can't be canceled because the top one is inside of another function. 7 $f(x) = x^2 log_3(x)$ Solution $$f'(x) = \\ 2x \cdot log_3 (x) + \frac{x^2}{x \cdot ln(3)}$$ 8 $f(x) = ln(sin(x))$ Solution $$f'(x) = \frac{cos(x)}{sin(x)} = cot(x)$$ 9 $f(x) = ln \left( \frac{x + 1}{x^2 - 1} \right)$ Solution \begin{align} f'(x) &= \frac{x^2 - 1}{x + 1} \cdot \\ &\left( \frac{(x^2 - 1)(1) - (x + 1)(2x)}{(x^2 - 1)^2} \right)\\ \\ &= \frac{1}{x + 1} \cdot \\ &\left( \frac{(x - 1)(x + 1) - (x + 1)(2x)}{x^2 - 1} \right) \\ \\ &= \frac{(x - 1) - (2x)}{x^2 - 1} = \frac{x + 1}{1 - x^2} \end{align} I made the last step to avoid having a bunch of dangling negative signs around. It's a good practice; those often get lost in later algebra steps. 10 $f(x) = log_5(x^2 + 2x - 5)$ Solution $$f'(x) = \frac{2x + 2}{ln(5) \cdot (x^2 + 2x - 5)}$$

## Video examples

Here are some examples of how to find derivatives of exponential and log functions. Some use the chain rule. If you haven't yet studied the chain rule, come back to those.

#### Example 1

Derivatives of functions containing f(x) = ex.

#### Example 2

Derivatives of functions containing f(x) = ax, where a is any base.

#### Example 3

Derivatives of functions containing f(x) = ln(x), the natural log function.  