Skip to main content

Subsection 2.10.2 Logarithmic Differentiation

We want to go back to some previous slightly messy examples (Examples 2.6.6 and 2.6.18) and now show you how they can be done more easily.

Consider again the derivative of the product of 3 functions:

\begin{align*} P(x) &= F(x) \cdot G(x) \cdot H(x) \end{align*}

Start by taking the logarithm of both sides:

\begin{align*} \log P(x) &= \log \left( F(x) \cdot G(x) \cdot H(x) \right)\\ &= \log F(x) + \log G(x) + \log H(x)\\ \end{align*}

Notice that the product of functions on the right-hand side has become a sum of functions. Differentiating sums is much easier than differentiating products. So when we differentiate we have

\begin{align*} \diff{}{x}\log P(x) &= \diff{}{x}\log F(x) + \diff{}{x}\log G(x) + \diff{}{x}\log H(x)\\ \end{align*}

A quick application of the chain rule shows that \(\diff{}{x}\log f(x) = f'(x) / f(x)\text{:}\)

\begin{align*} \frac{P'(x)}{P(x)} &= \frac{F'(x)}{F(x)}+\frac{G'(x)}{G(x)}+\frac{H'(x)}{H(x)}\\ \end{align*}

Multiply through by \(P(x)=F(x)G(x)H(x)\text{:}\)

\begin{align*} P'(x) &= \left(\frac{F'(x)}{F(x)}+\frac{G'(x)}{G(x)}+\frac{H'(x)}{H(x)}\right)\cdot F(x)G(x)H(x)\\ &= F'(x)G(x)H(x) + F(x)G'(x)H(x) + F(x)G(x)H'(x) \end{align*}

which is what found in Example 2.6.6 by repeated application of the product rule. The above generalises quite easily to more than 3 functions.

This same trick of “take a logarithm and then differentiate” — or logarithmic differentiation — will work any time you have a product (or ratio) of functions.

Lets use logarithmic differentiation on the function from Example 2.6.18:

\begin{align*} f(x) &=\frac{(\sqrt{x}-1)(2-x)(1-x^2)}{\sqrt{x}(3+2x)} \end{align*}

Beware however, that we may only take the logarithm of positive numbers, and this \(f(x)\) is often negative. For example, if \(1 \lt x \lt 2 \text{,}\) the factor \((1-x^2)\) in the definition of \(f(x)\) is negative while all of the other factors are positive, so that \(f(x)\lt 0 \text{.}\) None–the–less, we can use logarithmic differentiation to find \(f'(x)\text{,}\) by exploiting the observation that \(\diff{}{x}\log|f(x)|=\frac{f'(x)}{f(x)}\text{.}\) (To see this, use the chain rule and Example 2.10.4.) So we take the logarithm of \(|f(x)|\) and expand.

\begin{align*} \log |f(x)| & = \log \frac{|\sqrt{x}-1|\,|2-x|\,|1-x^2|}{\sqrt{x}|3+2x|}\\ & = \log|\sqrt{x}\!-\!1| + \log|2\!-\!x| + \log|1\!-\!x^2| - \underbrace{\log(\sqrt{x})}_{=\frac{1}{2}\log x} - \log|3\!+\!2x| \end{align*}

Now we can essentially just differentiate term-by-term:

\begin{align*} \diff{}{x}\log |f(x)| &= \diff{}{x} \Big( \log|\sqrt{x}-1| + \log|2-x| + \log|1-x^2| \\ \amp\hskip2in- \frac{1}{2}\log|x| - \log|3+2x| \Big)\\ \frac{f'(x)}{f(x)} &= \frac{1/(2\sqrt{x})}{\sqrt{x}-1} + \frac{-1}{2-x} + \frac{-2x}{1-x^2} - \frac{1}{2x} - \frac{2}{3+2x}\\ f'(x) &= f(x) \cdot \left( \frac{1}{2 \sqrt{x} (\sqrt{x}\!-\!1)} - \frac{1}{2\!-\!x} - \frac{2x}{1\!-\!x^2} - \frac{1}{2x} - \frac{2}{3\!+\!2x} \right)\\ &= \frac{(\sqrt{x}-1)(2-x)(1-x^2)}{\sqrt{x}(3+2x)} \cdot \\ \amp\hskip0.5in\left( \frac{1}{2 \sqrt{x} (\sqrt{x}-1)} - \frac{1}{2-x} - \frac{2x}{1-x^2} - \frac{1}{2x} - \frac{2}{3+2x} \right) \end{align*}

just as we found previously.