Derivatives of exponential and logarithmic functions
Exponential functions describe growth and decay: populations, money with compound interest, and radioactive material. In this section, we find their derivatives. We also find the derivatives of logarithms, which are their inverses.
For a review, see exponential functions and logarithmic functions.
The derivative of $a^x$
Let $f(x)=a^x$, where $a>0$. Use the definition of the derivative:
$\begin{align*}&f'(x)\\&=\lim_{h\to 0}\dfrac{a^{x+h}-a^x}{h}\end{align*}$
By the rules of exponents, $a^{x+h}=a^x\cdot a^h$:
$\begin{align*}&=\lim_{h\to 0}\dfrac{a^x\cdot a^h-a^x}{h}\end{align*}$
Factor out $a^x$:
$\begin{align*}&=\lim_{h\to 0}a^x\cdot\dfrac{a^h-1}{h}\end{align*}$
The factor $a^x$ does not depend on $h$, so it moves in front of the limit:
$\begin{align*}&f'(x)=a^x\cdot\lim_{h\to 0}\dfrac{a^h-1}{h}\end{align*}$
This says something surprising. The derivative of $a^x$ is $a^x$ times a constant. The constant depends only on $a$. Here are its values for ${a=2}$ and ${a=3}$:
| $h$ | $\dfrac{2^h-1}{h}$ | $\dfrac{3^h-1}{h}$ |
|---|---|---|
| $0.1$ | $0.7177$ | $1.1612$ |
| $0.01$ | $0.6956$ | $1.1047$ |
| $0.001$ | $0.6934$ | $1.0992$ |
| $0.0001$ | $0.6932$ | $1.0987$ |
For $a=2$, the constant is about $0.693$. For $a=3$, it is about $1.099$. So for some base between $2$ and $3$, the constant is exactly $1$.
The number $e$
The number $e$ is the base for which
$\displaystyle\lim_{h\to 0}\dfrac{e^h-1}{h}=1$.
Its value is $e\approx 2.71828$. Like $\pi$, it is an irrational number: its decimals never end or repeat. Here is the check:
| $h$ | $\dfrac{e^h-1}{h}$ |
|---|---|
| $0.1$ | $1.0517$ |
| $0.01$ | $1.0050$ |
| $0.001$ | $1.0005$ |
| $0.0001$ | $1.0001$ |
The constant is $1$, so the derivative of $e^x$ is $e^x$ itself:
$\dfrac{d}{dx}(e^x)=e^x$.
In words: $e^x$ is its own derivative. At every point, the slope of the graph equals its height. For example, at $(0,1)$ the slope is $1$.
The function $e^x$ is called the natural exponential function. It is the most important exponential function in calculus.
With the chain rule, if $u$ is a function of $x$, then
$\dfrac{d}{dx}(e^u)=e^u\cdot u'$.
Example 1: Find each derivative.
(a) $y=5e^x-x^2$
(b) $y=e^{3x}$
(c) $y=e^{-x^2}$
(d) $y=xe^x$
Solution:
(a) $y'=5e^x-2x$
(b) Let $u=3x$, so $u'=3$.
$y'=e^{3x}\cdot 3=3e^{3x}$
(c) Let $u=-x^2$, so $u'=-2x$.
$y'=e^{-x^2}\cdot(-2x)=-2xe^{-x^2}$
(d) Use the product rule:
$\begin{align*}&y'\\&=1\cdot e^x+x\cdot e^x\\&=e^x(1+x)\end{align*}$
The natural logarithm
The natural logarithm is the logarithm with base $e$. We write it $\ln x$:
$\ln x=\log_e x$.
On a calculator, the "ln" button gives the natural logarithm. The "log" button gives the logarithm with base $10$.
The functions $\ln x$ and $e^x$ are inverses. Each one undoes the other:
$e^{\ln x}=x$ for $x>0$, and $\ln(e^x)=x$.
The domain of $\ln x$ is $x>0$, because $e^y$ is always positive.
The derivative of $\ln x$
$\dfrac{d}{dx}(\ln x)=\dfrac{1}{x}$, for $x>0$.
Why: Let $y=\ln x$. Then $e^y=x$. Differentiate both sides with respect to $x$, using implicit differentiation:
$e^y\cdot y'=1$
Divide both sides by $e^y$:
$\begin{align*}&y'=\dfrac{1}{e^y}\end{align*}$
Since $e^y=x$,
$\begin{align*}&\dfrac{d}{dx}(\ln x)=\dfrac{1}{x}\end{align*}$
With the chain rule, if $u$ is a positive function of $x$, then
$\dfrac{d}{dx}(\ln u)=\dfrac{1}{u}\cdot u'=\dfrac{u'}{u}$.
Negative $x$: The function $\ln|x|$ is defined for every $x\ne 0$. Its derivative is also $\dfrac{1}{x}$. For $x<0$, we have $|x|=-x$, so by the chain rule
$\dfrac{d}{dx}\ln(-x)=\dfrac{-1}{-x}=\dfrac{1}{x}$.
Example 2: Find each derivative.
(a) $y=\ln(x^2+1)$
(b) $y=x^2\ln x$
(c) $y=\ln(\cos x)$, where $\cos x>0$
Solution:
(a) Let $u=x^2+1$, so $u'=2x$.
$y'=\dfrac{2x}{x^2+1}$
(b) Use the product rule:
$\begin{align*}&y'\\&=2x\ln x+x^2\cdot\dfrac{1}{x}\\&=2x\ln x+x\end{align*}$
(c) Let $u=\cos x$, so $u'=-\sin x$.
$\begin{align*}&y'\\&=\dfrac{-\sin x}{\cos x}\\&=-\tan x\end{align*}$
Simplify with the properties of logarithms
The properties of logarithms (see logarithmic functions) can turn a hard derivative into an easy one. For $a,b>0$:
- $\ln(ab)=\ln a+\ln b$
- $\ln\left(\dfrac{a}{b}\right)=\ln a-\ln b$
- $\ln(a^p)=p\ln a$
Example 3: Find $y'$ for
$y=\ln\left(\dfrac{x^3}{x+1}\right)$, $x>0$.
Solution:
First, expand with the properties of logarithms:
$\begin{align*}&y\\&=\ln(x^3)-\ln(x+1)\\&=3\ln x-\ln(x+1)\end{align*}$
Now differentiate one term at a time:
$y'=\dfrac{3}{x}-\dfrac{1}{x+1}$
Without expanding, we would need the chain rule and the quotient rule together.
Other bases
Any positive base $a$ can be written as a power of $e$: ${a=e^{\ln a}}$. So
$a^x=\left(e^{\ln a}\right)^x=e^{x\ln a}$.
$\begin{align*}&\dfrac{d}{dx}(a^x)\\&=\dfrac{d}{dx}\left(e^{x\ln a}\right)\end{align*}$
Use the chain rule. The inner function is $x\ln a$. Its derivative is the constant $\ln a$:
$\begin{align*}&=e^{x\ln a}\cdot\ln a\end{align*}$
Since $e^{x\ln a}=a^x$,
$\begin{align*}&\dfrac{d}{dx}(a^x)=a^x\ln a\end{align*}$
This explains the table at the top of the page. The constant for $a=2$ was about $0.693$, and $\ln 2\approx 0.693$. The constant for $a=3$ was about $1.099$, and $\ln 3\approx 1.099$.
For logarithms with base $a$, use the change-of-base formula:
$\log_a x=\dfrac{\ln x}{\ln a}$
$\begin{align*}&\dfrac{d}{dx}(\log_a x)\\&=\dfrac{d}{dx}\left(\dfrac{\ln x}{\ln a}\right)\end{align*}$
The number $\ln a$ is a constant, so it stays in front:
$\begin{align*}&=\dfrac{1}{\ln a}\cdot\dfrac{1}{x}\end{align*}$
Multiply:
$\begin{align*}&\dfrac{d}{dx}(\log_a x)=\dfrac{1}{x\ln a}\end{align*}$
Example 4: Find each derivative.
(a) $y=2^x$
(b) $y=10^{3x}$
(c) $y=\log_{10}x$
Solution:
(a) $y'=2^x\ln 2$
(b) Let $u=3x$, so $u'=3$.
$y'=10^{3x}\ln 10\cdot 3=3\ln 10\cdot 10^{3x}$
(c) $y'=\dfrac{1}{x\ln 10}$
Growth
Example 5: A colony of bacteria has
$P(t)=200e^{0.3t}$
bacteria after $t$ hours.
(a) Find the growth rate $P'(t)$.
(b) How fast is the colony growing after $5$ hours?
Solution:
(a) Let $u=0.3t$, so $u'=0.3$.
$P'(t)=200e^{0.3t}\cdot 0.3=60e^{0.3t}$
(b) $P'(5)=60e^{1.5}\approx 268.9$
After $5$ hours, the colony grows by about $269$ bacteria per hour.
Notice that $P'(t)=0.3\cdot P(t)$. The growth rate is proportional to the size of the colony. The bigger the colony, the faster it grows. This is what makes a function exponential.
Logarithmic differentiation
Some functions have $x$ in both the base and the exponent, such as $x^x$. Neither the power rule nor the rule for $a^x$ applies. The power rule needs a constant exponent. The rule for $a^x$ needs a constant base.
The trick is to take the natural logarithm of both sides first. This is called logarithmic differentiation:
- Take $\ln$ of both sides.
- Simplify with the properties of logarithms.
- Differentiate both sides implicitly. The left side, $\ln y$, gives $\dfrac{y'}{y}$.
- Multiply both sides by $y$, and replace $y$ by its formula.
Example 6: Find $y'$ for $y=x^x$, $x>0$.
Solution:
Take $\ln$ of both sides, and use $\ln(a^p)=p\ln a$:
$\ln y=x\ln x$
Differentiate both sides. The right side needs the product rule:
$\begin{align*}\dfrac{y'}{y}&=1\cdot\ln x+x\cdot\dfrac{1}{x}\\\dfrac{y'}{y}&=\ln x+1\end{align*}$
Multiply both sides by $y=x^x$:
$y'=x^x(\ln x+1)$
The power rule for every real exponent
In basic differentiation rules, we said the power rule works for any real number $n$. We proved it for integers and for fractions. Logarithmic differentiation proves it for every real $n$, for example $n=\sqrt{2}$ or $n=\pi$.
Let $y=x^n$, with $x>0$. Then
$\ln y=n\ln x$.
Differentiate both sides:
$\dfrac{y'}{y}=\dfrac{n}{x}$
Multiply both sides by $y=x^n$:
$\begin{align*}&y'=\dfrac{n}{x}\cdot x^n\end{align*}$
Since $\dfrac{x^n}{x}=x^{n-1}$,
$\begin{align*}&\dfrac{d}{dx}(x^n)=nx^{n-1}\end{align*}$
For example, $\dfrac{d}{dx}\left(x^{\sqrt{2}}\right)=\sqrt{2}\,x^{\sqrt{2}-1}$.
Summary
Here $u$ is a differentiable function of $x$ (positive for $\ln u$), and $a>0$, $a\ne 1$:
| Function | Derivative |
|---|---|
| $e^x$ | $e^x$ |
| $e^u$ | $e^u\cdot u'$ |
| $\ln x$ | $\dfrac{1}{x}$ |
| $\ln|x|$ | $\dfrac{1}{x}$ |
| $\ln u$ | $\dfrac{u'}{u}$ |
| $a^x$ | $a^x\ln a$ |
| $\log_a x$ | $\dfrac{1}{x\ln a}$ |