# Logarithmic differentiation

In calculus, logarithmic differentiation or differentiation by taking logarithms is a method used to differentiate functions by employing the logarithmic derivative of a function f,[1]

$[\ln(f)]' = \frac{f'}{f} \quad \rightarrow \quad f' = f \cdot [\ln(f)]'.$

The technique is often performed in cases where it is easier to differentiate the logarithm of a function rather than the function itself. This usually occurs in cases where the function of interest is composed of a product of a number of parts, so that a logarithmic transformation will turn it into a sum of separate parts (which is much easier to differentiate). It can also be useful when applied to functions raised to the power of variables or functions. Logarithmic differentiation relies on the chain rule as well as properties of logarithms (in particular, the natural logarithm, or the logarithm to the base e) to transform products into sums and divisions into subtractions.[2][3] The principle can be implemented, at least in part, in the differentiation of almost all differentiable functions, providing that these functions are non-zero.

## Overview

For a function

$y=f(x)\,\!$

logarithmic differentiation typically begins by taking the natural logarithm, or the logarithm to the base e, on both sides, remembering to take absolute values[4]

$\ln|y| = \ln|f(x)|\,\!$
$\frac{1}{y} \frac{dy}{dx} = \frac{f'(x)}{f(x)}$

Multiplication by y is then done to eliminate 1/y and leave only dy/dx on the left:

$\frac{dy}{dx} = y \times \frac{f'(x)}{f(x)} = f'(x).$

The method is used because the properties of logarithms provide avenues to quickly simplify complicated functions to be differentiated.[6] These properties can be manipulated after the taking of natural logarithms on both sides and before the preliminary differentiation. The most commonly used logarithm laws:[3]

$\log(ab) = \log(a) + \log(b), \qquad \log\left(\frac{a}{b}\right) = \log(a) - \log(b), \qquad \log(a^n) = n\log(a)$

### General case

Using capital pi notation,

$f(x)=\prod_i(f_i(x))^{\alpha_i(x)}.$

Application of natural logarithms results in (with capital sigma notation)

$\ln (f(x))=\sum_i\alpha_i(x)\cdot \ln(f_i(x)),$

and after differentiation,

$\frac{f'(x)}{f(x)}=\sum_i\left[\alpha_i'(x)\cdot \ln(f_i(x))+\alpha_i(x)\cdot \frac{f_i'(x)}{f_i(x)}\right].$

Rearrange to get the derivative of the original function,

$f'(x)=\overbrace{\prod_i(f_i(x))^{\alpha_i(x)}}^{f(x)}\times\overbrace{\sum_i\left\{\alpha_i'(x)\cdot \ln(f_i(x))+\alpha_i(x)\cdot \frac{f_i'(x)}{f_i(x)}\right\}}^{[\ln (f(x))]'}$

## Applications

### Products

A natural logarithm is applied to a product of two functions

$f(x)=g(x)h(x)\,\!$

to transform the product into a sum

$\ln(f(x))=\ln(g(x)h(x))=\ln(g(x))+\ln(h(x))\,\!$

Differentiate by applying the chain and the sum rules

$\frac{f'(x)}{f(x)} = \frac{g'(x)}{g(x)}+\frac{h'(x)}{h(x)}$

and, after rearranging, get[7]

$f'(x) = f(x)\times \Bigg\{\frac{g'(x)}{g(x)}+\frac{h'(x)}{h(x)}\Bigg\}= g(x)h(x)\times \Bigg\{\frac{g'(x)}{g(x)}+\frac{h'(x)}{h(x)}\Bigg\}$

### Quotients

A natural logarithm is applied to a quotient of two functions

$f(x)=\frac{g(x)}{h(x)}\,\!$

to transform the division into a subtraction

$\ln(f(x))=\ln\Bigg(\frac{g(x)}{h(x)}\Bigg)=\ln(g(x))-\ln(h(x))\,\!$

Differentiate by applying the chain and the sum rules

$\frac{f'(x)}{f(x)} = \frac{g'(x)}{g(x)}-\frac{h'(x)}{h(x)}$

and, after rearranging, get

$f'(x) = f(x)\times \Bigg\{\frac{g'(x)}{g(x)}-\frac{h'(x)}{h(x)}\Bigg\}= \frac{g(x)}{h(x)}\times \Bigg\{\frac{g'(x)}{g(x)}-\frac{h'(x)}{h(x)}\Bigg\}$

After multiplying out and using the common denominator formula the result is the same as if after applying the quotient rule directly to $f(x)$.

### Composite exponent

For a function of the form

$f(x)=g(x)^{h(x)}\,\!$

The natural logarithm transforms the exponentiation into a product

$\ln(f(x))=\ln\left(g(x)^{h(x)}\right)=h(x) \ln(g(x))\,\!$

Differentiate by applying the chain and the product rules

$\frac{f'(x)}{f(x)} = h'(x) \ln(g(x)) + h(x)\frac{g'(x)}{g(x)}$

and, after rearranging, get

$f'(x) = f(x)\times \Bigg\{h'(x) \ln(g(x)) + h(x)\frac{g'(x)}{g(x)}\Bigg\}= g(x)^{h(x)}\times \Bigg\{h'(x) \ln(g(x)) + h(x)\frac{g'(x)}{g(x)}\Bigg\}.$

The same result can be obtained by rewriting f in terms of exp and applying the chain rule.