Differentiation of a logarithm

Let \(y=\ln x\). To differentiate, we follow the steps:

Step 1: \[y+\Delta y=\ln(x+\Delta x)\] Step 2:
\[\begin{align} \Delta y & =\ln(x+\Delta x)-\ln x\\ & =\ln\left(\frac{x+\Delta x}{x}\right)\\ & =\ln\left(1+\frac{\Delta x}{x}\right)\end{align}\]
Step 3:
\[\begin{align} \frac{\Delta y}{\Delta x} & =\frac{1}{\Delta x}\ln\left(1+\frac{\Delta x}{x}\right)\\ & =\ln\left(1+\frac{\Delta x}{x}\right)^{1/\Delta x}\\ & =\frac{1}{x}\ln\left(1+\frac{\Delta x}{x}\right)^{\frac{x}{\Delta x}}\end{align}\]
Dividing the logarithm by \(x\) and at the same time multiplying the exponent of the parentheses by \(x\) changes the form of the expression but not its value. That is, \(\ln u=\frac{1}{a}\ln u^{a}\).] Step 4:
\[\begin{align} \frac{dy}{dx} & =\lim_{\Delta x\to0}\frac{\Delta y}{\Delta x}\\ & =\lim_{\Delta x\to0}\left[\frac{1}{x}\ln\left(1+\frac{\Delta x}{x}\right)^{\frac{x}{\Delta x}}\right]\\ & =\frac{1}{x}\lim_{\Delta x\to0}\left[\ln\left(1+\frac{\Delta x}{x}\right)^{\frac{x}{\Delta x}}\right]\\ & =\frac{1}{x}\ln\left[\lim_{\Delta x\to0}\left(1+\frac{\Delta x}{x}\right)^{\frac{x}{\Delta x}}\right]\\ & =\frac{1}{x}\ln e\\ & =\frac{1}{x}.\end{align}\]
[Note than when \(\Delta x\to0\), \(\frac{\Delta x}{x}\to0\). Therefore, \({\displaystyle \lim_{\Delta x\to0}\left(1+\frac{\Delta x}{x}\right)^{\frac{x}{\Delta x}}=e}\) from placing \(u=\frac{\Delta x}{x}\) in \({\displaystyle \lim_{u\to0}(1+u)^{1/u}=e}\) (see page)].

Hence
\[\bbox[#F2F2F2,5px,border:2px solid black]{\frac{d}{dx}\ln x=\frac{1}{x},\qquad(x>0).\tag{a}}\]

Now consider \(y=\log_{a}x\). What is \(dy/dx\)?
We write \[y=\log_{a}x=\frac{\ln x}{\ln a}.\] Therefore
\[\begin{align} \frac{dy}{dx} & =\frac{1}{\ln a}\frac{d}{dx}\ln x\\ & =\frac{1}{\ln a}\frac{1}{x}.\end{align}\]
\[\bbox[#F2F2F2,5px,border:2px solid black]{\frac{d}{dx}\log_{a}x=\frac{1}{x\ln a},\qquad(x>0).\tag{b}}\]

  • If \(u(x)>0\) is a differentiable function, applying the chain rule to (a) produces: \[\dfrac{d}{dx}\ln u=\frac{1}{u}\frac{du}{dx}\]
  • When possible, to differentiate a function involving logarithms, first use the properties of logarithms to convert products to sums, quotients to differences and exponents to constant multiples then differentiate the result.
Example 1

Find the equation of the tangent line to the curve of \(y=\ln(x^{2}+1)\) when \(x=0\).

Solution

The slope of the tangent is \(dy/dx\)
\[\begin{align} \frac{dy}{dx} & =\frac{d}{dx}\ln(\overbrace{x^{2}+1}^{u})\\ & =\frac{1}{u}\frac{du}{dx}\\ & =\frac{1}{x^{2}+1}(2x)\\ & =\frac{2x}{x^{2}+1}\end{align}\]
The slope of the tangent \(m_{\text{tan}}\) when \(x=0\) is obtained by substituting 0 for \(x\) in the above equation: \[m_{\text{tan}}=\left.\frac{2x}{x^{2}+1}\right|_{x=0}=0\] Because when \(x=0\), \(y=\ln(0+1)=0\), the horizontal line \(y=0\) is tangent to the graph of \(y=\ln(x^{2}+1)\) at the origin. Graph of \(y=\ln(x^{2}+1)\) is shown below.

Example 2

Find \(\dfrac{d}{dx}\left[\ln\dfrac{\sqrt{x+1}(2+\cos x)}{x^{2}}\right]\)

Solution

\[\begin{align} \dfrac{d}{dx}\left[\ln\dfrac{\sqrt{x+1}(2+\cos x)}{x^{2}}\right] & =\dfrac{d}{dx}\left[\ln\sqrt{x+1}+\ln(2+\cos x)-\ln x^{2}\right]\\ & =\dfrac{d}{dx}\left[\frac{1}{2}\ln(x+1)+\ln(2+\cos x)-2\ln x\right]\\ & =\frac{1}{2(x+1)}+\frac{1}{2+\cos x}\left(\dfrac{d}{dx}\cos x\right)-\frac{2}{x}\\ & =\frac{1}{2(x+1)}-\frac{\sin x}{2+\cos x}-\frac{2}{x}\\\end{align}\]

Now an important example:

Example 3

Find \(\dfrac{d}{dx}\ln|x|\).

Solution

We cosnider two cases:

(a) \(x>0\). Then \(|x|=x\) and \[\dfrac{d}{dx}\ln|x|=\dfrac{d}{dx}\ln x=\frac{1}{x}.\] (b) \(x<0\). Then \(|x|=-x\) and
\[\dfrac{d}{dx}\ln|x|=\dfrac{d}{dx}\ln(-x)=\frac{1}{-x}\frac{d}{dx}(-x)=\frac{1}{-x}(-1)=\frac{1}{x}.\]
Because we get the same results in both cases, we conclude
\[\frac{d}{dx}\ln|x|=\frac{1}{x}.\]

From the above example, we conclude

\[\bbox[#F2F2F2,5px,border:2px solid black]{\frac{d}{dx}\ln|x|=\frac{1}{x}.\tag{c}}\]

Example 4

Find \(\dfrac{d}{dx}\ln|\cos x|\).

Solution

Let \(u=\cos x\). Then \(\dfrac{d}{dx}\ln|\cos x|=\dfrac{d}{dx}\ln|u|\) and it follows from Equation (c) that

\[\begin{align} \dfrac{d}{dx}\ln|\cos x| & =\frac{1}{u}\frac{du}{dx}\\ & =\frac{1}{\cos x}(-\sin x)\\ & =-\tan x.\end{align}\]

Logarithmic differentiation

To differentiate a function \(y=f(x)\) with respect to \(x\) and \(f\) composed of products, quotients, and exponents, it is sometimes easier to:

  1. take the natural logarithm of both sides of \(y=f(x)\)
  2. expand the right side using the properties of logarithms.
  3. take derivative of both sides
  4. isolate \(dy/dx\) and replace \(y\) with the original function.
Example 5

Find \(y’\) given
\[y=\frac{x\sin x}{(2-x)\sqrt{1+x^{4}}}\]

Solution

It would be really messy to differentiate it directly. Instead we can use logarithmic differentiation.

First we take the natural logarithm of both sides and exapnd the right hand side using the properties of logarithms
\[\begin{align} \ln y & =\ln\frac{x\sin x}{(2-x)\sqrt{1+x^{4}}}\\ & =\ln x+\ln\sin x-\ln(2-x)-\frac{1}{2}\ln(1+x^{4})\end{align}\]
Now we can differentiate both sides:
\[\begin{align} \frac{1}{y}y’ & =\frac{1}{x}+\frac{1}{\sin x}\left(\frac{d}{dx}\sin x\right)\\ & \hspace{1em}-\frac{1}{2-x}\left(\frac{d}{dx}(2-x)\right)-\frac{1}{2(1+x^{4})}\frac{d}{dx}(1+x^{4})\end{align}\]
or
\[\frac{y’}{y}=\frac{1}{x}+\frac{\cos x}{\sin x}-\frac{(-1)}{2-x}-\frac{4x^{3}}{2(1+x^{4})}\]
Multiplying both sides by \(y\):
\[\begin{align} y’ & =y\left[\frac{1}{x}+\frac{\cos x}{\sin x}+\frac{1}{2-x}-\frac{2x^{3}}{1+x^{4}}\right]\\ & =\frac{x\sin x}{(2-x)\sqrt{1+x^{4}}}\left[\frac{1}{x}+\frac{\cos x}{\sin x}+\frac{1}{2-x}-\frac{2x^{3}}{1+x^{4}}\right]\end{align}\]
We have found the solution, but we may want to simplify it further:
\[\begin{align} y’ & =\frac{\sin x}{(2-x)\sqrt{1+x^{4}}}+\frac{x\cos x}{(2-x)\sqrt{1+x^{4}}}\\ & \qquad+\frac{x\sin x}{(2-x)^{2}\sqrt{1+x^{4}}}-\frac{2x^{4}\sin x}{(2-x)\sqrt{(1+x^{4})^{3}}}\\ & =\frac{\sin x+x\cos x}{(2-x)\sqrt{1+x^{4}}}+\frac{x\sin x}{(2-x)^{2}\sqrt{1+x^{4}}}\\ & \qquad-\frac{2x^{4}\sin x}{(2-x)\sqrt{(1+x^{4})^{3}}}\end{align}\]

Close Menu