Logarithmic differentiation makes it easier to differentiate complex functions. This method is particularly useful for functions with variable exponents or intricate products. You might encounter logarithmic differentiation when calculating compound interest, analysing population growth models or optimising processes in engineering and physics.
Sometimes it is easier to differentiate the logarithm of a function than the original function. This is called logarithmic differentiation. By taking the natural logarithm (\(\log_{e}\) or \(\ln\)) of both sides of an equation, we can transform these functions into a form that is easier to differentiate.
Suppose you have to differentiate the following function.
\[\begin{align*}
y & =\frac{x^{2}-1}{x^{8}\sqrt{x^{4}+1}}
\end{align*}\]
At first sight, you would see that you need to use the quotient rule. You may also realise that you will need to use the product rule to differentiate the denominator. But if you take this approach, you will find that it gets very tricky very quickly. Logarithmic differentiation makes this much easier to handle.
To master logarithmic differentiation, you need to be confident with using the logarithm laws. Go back to Logarithms if you need a refresher.
Using logarithmic differentiation
Suppose you want to differentiate \(y=f(x)\) where \(f(x)>0\) for all \(x\) values.
We can take the natural logs of both sides. But only if \(y>0\).
\[\ln(y)=\ln(f(x))\]
When we differentiate with respect to \(x\), we use the chain rule.
\[\begin{align*} \frac{d}{dx}(\ln(y)) & = \frac{d}{dx}(\ln(f(x))\\
& = \frac{d}{dy}(\ln(y))\frac{dy}{dx}\\
& = \frac{1}{y}\frac{dy}{dx}
\end{align*}\]
The basis of logarithmic differentiation is the equation:
We assume that \(y<0\), which allows us to take the natural log of both sides. We can then use the log rules to break the function into more manageable parts.
\[\begin{align*} \ln y & = \ln\left(\frac{x^{2}-1}{x^{8}\sqrt{x^{4}+1}}\right)\\
& = \ln(x^{2}-1)-\ln(x^{8}\sqrt{x^{4}+1})\\
& = \ln(x^{2}-1)-\ln(x^{8})-\ln(\sqrt{x^{4}+1})
\end{align*}\]
We can now differentiate, using the chain rule on the left.
\[\begin{align*} \frac{d}{dx}\ln(y) & = \frac{d}{dy}(\ln(y))\frac{dy}{dx}\\
& = \frac{1}{y}\frac{dy}{dx}\\
& = \frac{x^{8}\sqrt{x^{4}+1}}{x^{2}-1}\frac{dy}{dx}
\end{align*}\]
We will look at each term on the right separately, too. For \(\ln(x^{2}-1)\), we can use the chain rule. If we let \(u=x^{2}-1\), \(\dfrac{du}{dx}=2x\). Using the chain rule:
\[\begin{align*} \frac{d}{dx}\ln(x^{2}-1) & = \frac{d}{du}\ln(u)\frac{du}{dx}\\
& = \frac{1}{u}\frac{du}{dx}\\
& = \frac{1}{x^{2}-1}2x\\
& = \frac{2x}{x^{2}-1}
\end{align*}\]
The second term on the right is calculated by setting \(u=x^{8}\). \(\dfrac{du}{dx}=8x^{7}\) and using the chain rule:
\[\begin{align*} \frac{d}{dx}\ln(x^{8}) & = \frac{d}{du}\ln(u)\frac{du}{dx}\\
& = \frac{1}{u}\frac{du}{dx}\\
& = \frac{1}{x^{8}}8x^{7}\\
& = \frac{8}{x}
\end{align*}\]
The final term on the right is calculated by setting \(u=\sqrt{x^{4}+1}\). Here, we use the chain rule twice.
\[\begin{align*} u & = (x^{4}+1)^{\frac{1}{2}}\\
\frac{du}{dx} & = \frac{1}{2}(x^{4}+1)^{-\frac{1}{2}}4x^{3}\\
& = \frac{4}{2}x^{3}(x^{4}+1)^{-\frac{1}{2}}\\
& = 2x^{3}(x^{4}+1)^{-\frac{1}{2}}\\
& = \frac{2x^{3}}{\sqrt{x^{4}+1}}
\end{align*}\] \[\begin{align*} \frac{d}{dx}\ln(\sqrt{x^{4}+1}) & = \frac{d}{du}\ln(u)\frac{du}{dx}\\
& = \frac{1}{u}\frac{du}{dx}\\
& = \frac{1}{\sqrt{x^{4}+1}}\frac{2x^{3}}{\sqrt{x^{4}+1}}\\
& = \frac{2x^{3}}{x^{4}+1}
\end{align*}\]
Just remember that depending on how you simplify, you may get a different answer.
Differentiate \(y=2^{x}\) with respect to \(x\).
Before we dive into another complicated example, let's look at a simpler one to rest our brain. Let's take the logs of both sides.
\[\begin{align*} \ln(y) & = \ln(2^{x})\\
& = x\ln(2)
\end{align*}\]
For the left side:
\[\begin{align*} \frac{d}{dx}(\ln(y)) & =\frac{1}{y}\frac{dy}{dx}
\end{align*}\]
For the first term on the right-hand side, we use the chain
rule with \(u=2x+1\) to get \(\dfrac{du}{dx}=2\). Then:
\[\begin{align*} 9\frac{d}{dx}\ln(2x+1) & =9\frac{d}{du}\ln(u)\frac{du}{dx}\\
& =\frac{9}{u}2\\
& =\frac{18}{2x+1}
\end{align*}\]
For the second term on the right-hand side, we also use the chain rule with \(u=x-2\) to get \(\dfrac{du}{dx}=1\). Then:
\[\begin{align*} -3\frac{d}{dx}\ln(x-2) & = -3\frac{d}{du}\ln(u)\frac{du}{dx}\\
& =-\frac{3}{u}1\\
& =-\frac{3}{x-2}
\end{align*}\]
For the last term on the right-hand side, we use the chain
rule with \(u=x+8\) to get \(\dfrac{du}{dx}=1\). Then:
\[\begin{align*} -6\frac{d}{dx}\ln(x+8) & = -6\frac{d}{du}\ln(u)\frac{du}{dx}\\
& =-\frac{6}{u}1\\
& =-\frac{6}{x+8}
\end{align*}\]
\(y=(1-2x)^{\sin(x)}\), so now, we multiply both sides by \(y\) to get the answer for \(\dfrac{dy}{dx}\).
\[\frac{dy}{dx} = (1-2x)^{\sin(x)}\left(\cos(x)\ln(1-2x)-\frac{2}{(1-2x)}\sin(x)\right)\]
Exercise – using logarithmic differentiation
Differentiate \(y=3^{x}\) with respect to \(x\) using logarithmic differentiation.
Using logarithmic differentiation, differentiate \(y=\dfrac{(x-1)^{3}}{(x+1)^{4}(2x+3)}\) with respect to \(x\), for \(x>1\).