$\newcommand{\dollar}{\} \DeclareMathOperator{\erf}{erf} \DeclareMathOperator{\arctanh}{arctanh} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&}$

## Section3.3Derivatives of Log Functions

###### Motivating Questions
• What is the derivative of the natural logarithm function?

One of the most important functions in all of mathematics is the natural exponential function $f(x) = e^x\text{.}$ Its inverse, the natural logarithm $g(x) = \ln(x)\text{,}$ is similarly important. One of our goals in this section is to learn how to differentiate the logarithm function.

### SubsectionThe Derivative of the Natural Logarithm Function

###### Derivative of the Natural Logarithm

For all positive real numbers $x\text{,}$

\begin{equation*} \frac{d}{dx}[\ln(x)] = \frac{1}{x}\text{.} \end{equation*}

Notice that for the first time in our work, differentiating a basic function of a particular type has led to a function of a very different nature: the derivative of the natural logarithm is not another logarithm, nor even an exponential function, but rather a rational one.

This rule for the natural logarithm function now joins our list of basic derivative rules. Note that this rule applies only to positive values of $x\text{,}$ as these are the only values for which $\ln(x)$ is defined. Derivatives of logarithms may now be computed in concert with all of the rules known to date.

###### Example3.17

Find the derivative of the function

\begin{equation*} f(x)=3x^2+4\ln(x)+5\text{.} \end{equation*}

In this example the only new rule is the one we have just developed for the natural log, the remaining terms can be differentiated exactly as before:

\begin{equation*} f'(x)=6x+4\left(\frac{1}{x}\right) \end{equation*}
###### Example3.18

Find the derivative of the function $f(t) = \ln(t^2 + 1)\text{.}$

For this function we will use the chain rule, where the outside function is $\ln(t)$ and the inside function is $t^2+1\text{:}$

\begin{equation*} f'(t)=\frac{1}{t^2+1}\cdot 2t=\frac{2t}{t^2+1} \end{equation*}

###### The Chain Rule with the Natural Logarithm Function

For all positive values of $g(x)\text{,}$

\begin{equation*} \frac{d}{dx}[\ln(g(x))] = \frac{g'(x)}{g(x)}\text{.} \end{equation*}

In words: the derivative of the natural log evaluated at a function $g(x)$ is the derivative of the inside function $g'(x)$ divided by the inside function.

###### Example3.19

For each function given below, find its derivative.

1. $\displaystyle h(x) = x^2\ln(x)$

2. $\displaystyle p(t) = \frac{\ln(t)}{e^t + 1}$

3. $\displaystyle s(y) = \ln(x^3 + 2x)$

4. $\displaystyle z(x) = \left(\ln(x)\right)^3$

5. $\displaystyle m(z) = \ln(\ln(z))$

1. $\displaystyle h'(x) = 2x\ln(x)+x\text{.}$

2. $\displaystyle p'(t) = \frac{ \frac{1}{t}(e^t + 1) - \ln(t) e^t}{(e^t + 1)^2}\text{.}$

3. $\displaystyle s'(x) = \frac{3x^2+2}{x^3+2x} \text{.}$

4. $\displaystyle z'(x) = 3\left(\ln(x)\right)^2\left(\frac{1}{x}\right)\text{.}$

5. $\displaystyle m'(z) = \frac{1}{z\ln(z)}\text{.}$

Solution
1. By the product rule,

\begin{equation*} h'(x) = 2x\ln(x)+x^2\cdot\frac{1}{x} = 2x\ln(x)+x\text{.} \end{equation*}
2. By the quotient rule,

\begin{equation*} p'(t) = \frac{\frac{1}{t}(e^t + 1) - \ln(t) e^t}{(e^t + 1)^2}\text{.} \end{equation*}
3. Using the chain rule with an outside function of $\ln(x)$ and an inside function of $x^3+2x$ we get:

\begin{equation*} s'(x)=\frac{3x^2+2}{x^3+2x}\text{.} \end{equation*}
4. Using the chain rule with an outside function of $(x)^3$ and an inside function of $\ln(x)$ we get:

\begin{equation*} z'(x) =3\left(\ln(x)\right)^2\left(\frac{1}{x}\right)\text{.} \end{equation*}
5. Noting that $m$ is composite with the natural logarithm function serving as both the inner and outer function, we find that

\begin{equation*} m'(z) = \frac{1}{\ln(z)} \cdot \frac{d}{dz}\left[\ln(z)\right]=\frac{1}{z\ln(z)}\text{.} \end{equation*}

In some case, although we could apply the chain rule directly, it is best to rewrite a natural log function using the properties of logs before we take a derivative.

###### Example3.20

Find the derivative of the function

\begin{equation*} f(x) = \ln\left(\frac{\sqrt{x^3+3}}{x^2+4}\right)\text{.} \end{equation*}

In this case we could apply the chain rule to take the derivative directly, however we would have to apply the chain rule twice along with the quotient rule. In this case it is much more efficient to rewrite the function first using the properties of logs:

\begin{equation*} f(x) = \ln\left(\frac{\sqrt{x^3+3}}{x^2+4}\right)=\ln\left(\sqrt{x^3+3}\right)-\ln\left(x^2+4\right)=\frac{1}{2}\ln(x^3+3)-\ln(x^2+4) \end{equation*}

Then we can take the derivative:

\begin{equation*} f'(x)=\frac{1}{2}\frac{3x^2}{x^3+3}-\frac{2x}{x^2+4} \end{equation*}

We will consider tangent lines for natural log functions. Recall that the domain of the natural log function is $(0,\infty)\text{,}$ thus any tangent line must be only for positive values of x.

###### Example3.21

Find the equation of the line tangent to

\begin{equation*} f(x) = 3\ln(x) \end{equation*}

at $x=1\text{.}$

First find the derivative:

\begin{equation*} f'(x)=3\left(\frac{1}{x}\right)=\frac{3}{x} \end{equation*}

Then the slope of the tangent at $x=1$ is:

\begin{equation*} f'(1)=\frac{3}{1}=3 \end{equation*}

Since the $\ln(1)=0$ the y-value is 0, thus the tangent line can be given by the equation:

\begin{equation*} y=3(x-1) \end{equation*}

Although the natural log has a domain $x\gt0$ if we consider $\ln(g(x))$ we may be able to evaluate this for values of $x\leq0$ as long as $g(x)\gt0\text{.}$

###### Example3.22

Find the equation of the line tangent to $h(x) = \ln(x^2+1)$ at $x=-1\text{.}$

First find the derivative:

\begin{equation*} g'(x)=\left(\frac{1}{x^2+1}\right)(2x)=\frac{2x}{x^2+1} \end{equation*}

Then the slope of the tangent at $x=-1$ is:

\begin{equation*} g'(1)=\frac{2(-1)}{(-1)^2+1}=-1 \end{equation*}

The y-value is $g(-1)=\ln((-1)^2+1)=\ln(2)\text{,}$ thus the tangent line can be given by the equation:

\begin{equation*} y=-1(x+1)+\ln(2) \end{equation*}

In Figure3.23 on the right, we are reminded that since the natural exponential function has the property that its derivative is itself, the slope of the tangent to $y = e^x$ is equal to the height of the curve at that point. For instance, at the point $A = (\ln(0.5), 0.5)\text{,}$ the slope of the tangent line is $m_A = 0.5\text{,}$ and at $B = (\ln(5), 5)\text{,}$ the tangent line's slope is $m_B = 5\text{.}$ At the corresponding points $A'$ and $B'$ on the graph of the natural logarithm function (which come from reflecting $A$ and $B$ across the line $y = x$), we know that the slope of the tangent line is the reciprocal of the $x$-coordinate of the point (since $\frac{d}{dx}[\ln(x)] = \frac{1}{x}$). Thus, at $A' = (0.5, \ln(0.5))\text{,}$ we have $m_{A'} = \frac{1}{0.5} = 2\text{,}$ and at $B' = (5, \ln(5))\text{,}$ $m_{B'} = \frac{1}{5}\text{.}$

In particular, we observe that $m_{A'} = \frac{1}{m_A}$ and $m_{B'} = \frac{1}{m_B}\text{.}$ This is not a coincidence, but in fact holds for any curve $y = f(x)$ and its inverse, provided the inverse exists. This is due to the reflection of the graphs across the line $y = x\text{:}$ the reflection changes the roles of $x$ and $y\text{,}$ thus reversing the rise and run, so the slope of the inverse function at the reflected point is the reciprocal of the slope of the original function.

### SubsectionSummary

• The derivative of $f(x) = \ln(x)$ is $f'(x) = \frac{1}{x}\text{.}$ When combined with chain rule, we see that the derivative of $f(x) = \ln\left(g(x)\right)$ is $f'(x) = \frac{g'(x)}{g(x)}\text{.}$