Logarithmic Differentiation
The calculation of the derivatives of functions involving products, powers, or quotients can be simplified with logarithmic differentiation (because of the properties of logarithms).
Let's see first how to differentiate the functions that already have a product and/or a quotient under the logarithm.
Example 1. Find the derivative of $$${y}={\ln{{\left(\frac{{{\cos{{\left({x}\right)}}}}}{{{{x}}^{{2}}+{1}}}\right)}}}$$$.
First, we use the properties of logarithms to simplify the expression: $$${y}={\ln{{\left({\cos{{\left({x}\right)}}}\right)}}}-{\ln{{\left({{x}}^{{2}}+{1}\right)}}}$$$.
$$${y}'={\left({\ln{{\left({\cos{{\left({x}\right)}}}\right)}}}-{\ln{{\left({{x}}^{{2}}+{1}\right)}}}\right)}'={\left({\ln{{\left({\cos{{\left({x}\right)}}}\right)}}}\right)}'-{\left({\ln{{\left({{x}}^{{2}}+{1}\right)}}}\right)}'=$$$
$$$=\frac{{1}}{{{\cos{{\left({x}\right)}}}}}\cdot{\left({\cos{{\left({x}\right)}}}\right)}'-\frac{{1}}{{{{x}}^{{2}}+{1}}}\cdot{\left({{x}}^{{2}}+{1}\right)}'=$$$
$$$=\frac{{1}}{{{\cos{{\left({x}\right)}}}}}\cdot{\left(-{\sin{{\left({x}\right)}}}\right)}-\frac{{1}}{{{{x}}^{{2}}+{1}}}\cdot{2}{x}=-{\tan{{\left({x}\right)}}}-\frac{{{2}{x}}}{{{{x}}^{{2}}+{1}}}$$$.
But what to do if we have products and powers but don't have the logarithm? The answer is to add the logarithm, or, in other words, to take the logarithms of both sides of the function.
Steps in Logarithmic Differentiation:
- Take natural logarithms of both sides of the equation and use the properties of logarithms to simplify.
- Differentiate implicitly with respect to $$$x$$$ (or another independent variable).
- Solve the resulting equation for $$${y}$$$.
Example 2. Find the derivative of $$${y}=\frac{{{{x}}^{{3}}{\sin{{\left({x}\right)}}}}}{{{\left({{x}}^{{2}}+{4}{x}+{1}\right)}}^{{5}}}$$$.
Without logarithmic differentiation, we need to use the product and quotient rules. The calculations would be very complex.
So, we use logarithmic differentiation:
$$${\ln{{\left({y}\right)}}}={\ln{{\left(\frac{{{{x}}^{{3}}{\sin{{\left({x}\right)}}}}}{{{\left({{x}}^{{2}}+{4}{x}+{1}\right)}}^{{5}}}\right)}}}$$$
$$${\ln{{\left({y}\right)}}}={\ln{{\left({{x}}^{{3}}{\sin{{\left({x}\right)}}}\right)}}}-{\ln{{\left({{\left({{x}}^{{2}}+{4}{x}+{1}\right)}}^{{5}}\right)}}}$$$
$$${\ln{{\left({y}\right)}}}={\ln{{\left({{x}}^{{3}}\right)}}}+{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}-{5}{\ln{{\left({{x}}^{{2}}+{4}{x}+{1}\right)}}}$$$
$$${\ln{{\left({y}\right)}}}={3}{\ln{{\left({x}\right)}}}+{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}-{5}{\ln{{\left({{x}}^{{2}}+{4}{x}+{1}\right)}}}$$$.
Differentiate implicitly with respect to $$${x}$$$:
$$$\frac{{1}}{{y}}{y}'=\frac{{3}}{{x}}+\frac{{1}}{{{\sin{{\left({x}\right)}}}}}\cdot{\left({\sin{{\left({x}\right)}}}\right)}'-\frac{{5}}{{{{x}}^{{2}}+{4}{x}+{1}}}\cdot{\left({{x}}^{{2}}+{4}{x}+{1}\right)}'$$$
$$$\frac{{1}}{{y}}{y}'=\frac{{3}}{{x}}+\frac{{1}}{{{\sin{{\left({x}\right)}}}}}\cdot{\cos{{\left({x}\right)}}}-\frac{{5}}{{{{x}}^{{2}}+{4}{x}+{1}}}\cdot{\left({2}{x}+{4}\right)}$$$
$$$\frac{{1}}{{y}}{y}'=\frac{{3}}{{x}}+{\cot{{\left({x}\right)}}}-{10}\frac{{{x}+{2}}}{{{{x}}^{{2}}+{4}{x}+{1}}}$$$
$$${y}'={y}{\left(\frac{{3}}{{x}}+{\cot{{\left({x}\right)}}}-{10}\frac{{{x}+{2}}}{{{{x}}^{{2}}+{4}{x}+{1}}}\right)}$$$
$$${y}'=\frac{{{{x}}^{{3}}{\sin{{\left({x}\right)}}}}}{{{\left({{x}}^{{2}}+{4}{x}+{1}\right)}}^{{5}}}{\left(\frac{{3}}{{x}}+{\cot{{\left({x}\right)}}}-{10}\frac{{{x}+{2}}}{{{{x}}^{{2}}+{4}{x}+{1}}}\right)}$$$.
Using the logarithmic function, we can easily prove that $$${\left({{x}}^{{n}}\right)}'={n}{{x}}^{{{n}-{1}}}$$$ for any real number $$${n}$$$.
Indeed, let $$${y}={{x}}^{{n}}$$$; then,
$$${\ln{{\left({y}\right)}}}={\ln{{\left({{x}}^{{n}}\right)}}}$$$, or $$${\ln{{\left({y}\right)}}}={n}{\ln{{\left({x}\right)}}}$$$ $$$\left({x}\ne{0}\right)$$$.
Differentiating implicitly with respect to $$${x}$$$ gives: $$$\frac{{1}}{{y}}{y}'=\frac{{n}}{{x}}$$$.
So, $$${y}'={n}\frac{{y}}{{x}}={n}\frac{{{{x}}^{{n}}}}{{x}}={n}{{x}}^{{{n}-{1}}}$$$.
Example 3. Find the derivative of $$${y}={{x}}^{{x}}$$$.
Solution 1. Use logarithmic differentiation:
$$${\ln{{\left({y}\right)}}}={\ln{{\left({{x}}^{{x}}\right)}}}={x}{\ln{{\left({x}\right)}}}$$$.
Differentiate implicitly with respect to $$${x}$$$. Note that in the right part we need to use the product rule.
$$$\frac{{1}}{{y}}{y}'={x}'{\left({\ln{{\left({x}\right)}}}\right)}+{x}{\left({\ln{{\left({x}\right)}}}\right)}'$$$
$$$\frac{{1}}{{y}}{y}'={\ln{{\left({x}\right)}}}+{1}$$$
$$${y}'={y}{\left({\ln{{\left({x}\right)}}}+{1}\right)}$$$
$$${y}'={{x}}^{{x}}{\left({\ln{{\left({x}\right)}}}+{1}\right)}$$$.
So, $$${\left({{x}}^{{x}}\right)}'={{x}}^{{x}}{\left({\ln{{\left({x}\right)}}}+{1}\right)}$$$.
Solution 2. We can represent $$${{x}}^{{x}}$$$ as $$${{x}}^{{x}}={{e}}^{{{\ln{{\left({{x}}^{{x}}\right)}}}}}={{e}}^{{{x}{\ln{{\left({x}\right)}}}}}$$$:
$$${\left({{x}}^{{x}}\right)}'={\left({{e}}^{{{x}{\ln{{\left({x}\right)}}}}}\right)}'={{e}}^{{{x}{\ln{{\left({x}\right)}}}}}\cdot{\left({x}{\ln{{\left({x}\right)}}}\right)}'={{x}}^{{x}}{\left({\left({x}'\right)}{\ln{{\left({x}\right)}}}+{x}{\left({\ln{{\left({x}\right)}}}\right)}'\right)}={{x}}^{{x}}{\left({\ln{{\left({x}\right)}}}+{1}\right)}$$$.
In general, if you have a function of the form $$${h}{\left({x}\right)}={{f{{\left({x}\right)}}}}^{{{g{{\left({x}\right)}}}}}$$$, you should apply one of the two techniques presented in the Example 3.
Example 4. Differentiate $$${y}={{\sin{{\left({x}\right)}}}}^{{{{x}}^{{2}}+{1}}}$$$.
$$${\ln{{\left({y}\right)}}}={\ln{{\left({{\sin{{\left({x}\right)}}}}^{{{{x}}^{{2}}+{1}}}\right)}}}={\left({{x}}^{{2}}+{1}\right)}{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}$$$
Differentiating implicitly with respect to $$${x}$$$ gives:
$$$\frac{{1}}{{y}}{y}'={\left({{x}}^{{2}}+{1}\right)}'{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}+{\left({{x}}^{{2}}+{1}\right)}{\left({\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}\right)}'$$$
$$$\frac{{1}}{{y}}{y}'={2}{x}{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}+{\left({{x}}^{{2}}+{1}\right)}\frac{{1}}{{{\sin{{\left({x}\right)}}}}}\cdot{\left({\sin{{\left({x}\right)}}}\right)}'$$$
$$$\frac{{1}}{{y}}{y}'={2}{x}{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}+{\left({{x}}^{{2}}+{1}\right)}\frac{{1}}{{{\sin{{\left({x}\right)}}}}}\cdot{\cos{{\left({x}\right)}}}$$$
$$$\frac{{1}}{{y}}{y}'={2}{x}{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}+{\left({{x}}^{{2}}+{1}\right)}{\cot{{\left({x}\right)}}}$$$
$$${y}'={y}{\left({2}{x}{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}+{\left({{x}}^{{2}}+{1}\right)}{\cot{{\left({x}\right)}}}\right)}$$$
$$${y}'={{\sin{{\left({x}\right)}}}}^{{{{x}}^{{2}}+{1}}}{\left({2}{x}{\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}+{\left({{x}}^{{2}}+{1}\right)}{\cot{{\left({x}\right)}}}\right)}$$$.