# Logarithmic Differentiation

The method of differentiating functions by first taking logarithms and then differentiating is called logarithmic differentiation. We use logarithmic differentiation in situations where it is easier to differentiate the logarithm of a function than to differentiate the function itself. This approach allows calculating derivatives of power, rational and some irrational functions in an efficient manner.

Consider this method in more detail. Let y = f (x). Take natural logarithms of both sides:

$\ln y = \ln f\left( x \right).$

Next, we differentiate this expression using the chain rule and keeping in mind that y is a function of x.

$\left( {\ln y} \right)^\prime = \left( {\ln f\left( x \right)} \right)^\prime,\;\; \Rightarrow \frac{1}{y}y'\left( x \right) = \left( {\ln f\left( x \right)} \right)^\prime.$

It's seen that the derivative is

$y' = y{\left( {\ln f\left( x \right)} \right)^\prime } = f\left( x \right){\left( {\ln f\left( x \right)} \right)^\prime }.$

The derivative of the logarithmic function is called the logarithmic derivative of the initial function $$y = f\left( x \right).$$

This differentiation method allows to effectively compute derivatives of power-exponential functions, that is functions of the form

$y = u{\left( x \right)^{v\left( x \right)}},$

where $$u\left( x \right)$$ and $$v\left( x \right)$$ are differentiable functions of $$x.$$

In the examples below, find the derivative of the function $$y\left( x \right)$$ using logarithmic differentiation.

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

$y = {x^x},\;x \gt 0.$

### Example 2

$y = {x^{{\frac{1}{x}}}},\;x \gt 0.$

### Example 3

$y = {x^{\ln x}},\;x \gt 0.$

### Example 4

$y = {x^{\cos x}},\;x \gt 0.$

### Example 5

$y = {x^{\arctan x}},\;x \gt 0.$

### Example 6

$y = {x^{2x}}\;\left( {x \gt 0,x \ne 1} \right)$

### Example 7

$y = {\left( {x - 1} \right)^2}{\left( {x - 3} \right)^5}$

### Example 8

$y = {\left( {x + 1} \right)^2}{\left( {x - 2} \right)^4}$

### Example 1.

$y = {x^x},\;x \gt 0.$

Solution.

First we take logarithms of the left and right side of the equation:

$\ln y = \ln {x^x},\;\; \Rightarrow \ln y = x\ln x.$

Now we differentiate both sides meaning that $$y$$ is a function of $$x:$$

${\left( {\ln y} \right)^\prime } = {\left( {x\ln x} \right)^\prime },\;\; \Rightarrow \frac{1}{y} \cdot y' = x'\ln x + x{\left( {\ln x} \right)^\prime },\;\; \Rightarrow \frac{{y'}}{y} = 1 \cdot \ln x + x \cdot \frac{1}{x},\;\; \Rightarrow \frac{{y'}}{y} = \ln x + 1,\;\; \Rightarrow y' = y\left( {\ln x + 1} \right),\;\; \Rightarrow y' = {x^x}\left( {\ln x + 1} \right),\;\;\text{where}\;\;x \gt 0.$

### Example 2.

$y = {x^{{\frac{1}{x}}}},\;x \gt 0.$

Solution.

First we take logarithms of both sides:

$\ln y = \ln {x^{\frac{1}{x}}},\;\; \Rightarrow \ln y = \frac{1}{x}\ln x.$

Differentiate the last equation with respect to $$x:$$

$\left( {\ln y} \right)^\prime = \left( {\frac{1}{x}\ln x} \right)^\prime,\;\; \Rightarrow \frac{1}{y} \cdot y^\prime = \left( {\frac{1}{x}} \right)^\prime\ln x + \frac{1}{x}\left( {\ln x} \right)^\prime,\;\; \Rightarrow \frac{{y^\prime}}{y} = - \frac{1}{{{x^2}}} \cdot \ln x + \frac{1}{x} \cdot \frac{1}{x},\;\; \Rightarrow \frac{{y^\prime}}{y} = \frac{1}{{{x^2}}}\left( {1 - \ln x} \right),\;\; \Rightarrow y^\prime = \frac{y}{{{x^2}}}\left( {1 - \ln x} \right).$

Substitute the original function instead of $$y$$ in the right-hand side:

$y^\prime = \frac{{{x^{\frac{1}{x}}}}}{{{x^2}}}\left( {1 - \ln x} \right) = {x^{\frac{1}{x} - 2}}\left( {1 - \ln x} \right) = {x^{\frac{{1 - 2x}}{x}}}\left( {1 - \ln x} \right).$

### Example 3.

$y = {x^{\ln x}},\;x \gt 0.$

Solution.

Apply logarithmic differentiation:

$\ln y = \ln \left( {{x^{\ln x}}} \right),\;\; \Rightarrow \ln y = \ln x\ln x = {\ln ^2}x,\;\; \Rightarrow {\left( {\ln y} \right)^\prime } = {\left( {{{\ln }^2}x} \right)^\prime },\;\; \Rightarrow \frac{{y'}}{y} = 2\ln x{\left( {\ln x} \right)^\prime },\;\; \Rightarrow \frac{{y'}}{y} = \frac{{2\ln x}}{x},\;\; \Rightarrow y' = \frac{{2y\ln x}}{x},\;\; \Rightarrow y' = \frac{{2{x^{\ln x}}\ln x}}{x} = 2{x^{\ln x - 1}}\ln x.$

### Example 4.

$y = {x^{\cos x}},\;x \gt 0.$

Solution.

Take the logarithm of the given function:

$\ln y = \ln \left( {{x^{\cos x}}} \right),\;\; \Rightarrow \ln y = \cos x\ln x.$

Differentiating the last equation with respect to $$x,$$ we obtain:

$\left( {\ln y} \right)^\prime = \left( {\cos x\ln x} \right)^\prime,\;\; \Rightarrow \frac{1}{y} \cdot y' = {\left( {\cos x} \right)^\prime }\ln x + \cos x{\left( {\ln x} \right)^\prime },\;\; \Rightarrow \frac{{y'}}{y} = \left( { - \sin x} \right) \cdot \ln x + \cos x \cdot \frac{1}{x},\;\; \Rightarrow \frac{{y'}}{y} = - \sin x\ln x + \frac{{\cos x}}{x},\;\; \Rightarrow y' = y\left( {\frac{{\cos x}}{x} - \sin x\ln x} \right).$

Substitute the original function instead of $$y$$ in the right-hand side:

$y' = {x^{\cos x}}\cdot \left( {\frac{{\cos x}}{x} - \sin x\ln x} \right),$

where $$x \gt 0.$$

### Example 5.

$y = {x^{\arctan x}},\;x \gt 0.$

Solution.

Taking logarithms of both sides, we get

$\ln y = \ln {x^{\arctan x}},\;\; \Rightarrow \ln y = \arctan x\ln x.$

Differentiate this equation with respect to $$x:$$

$\left( {\ln y} \right)^\prime = \left( {\arctan x\ln x} \right)^\prime,\;\; \Rightarrow \frac{1}{y} \cdot y^\prime = \left( {\arctan x} \right)^\prime\ln x + \arctan x\left( {\ln x} \right)^\prime,\;\; \Rightarrow \frac{{y^\prime}}{y} = \frac{1}{{1 + {x^2}}} \cdot \ln x + \arctan x \cdot \frac{1}{x},\;\; \Rightarrow \frac{{y^\prime}}{y} = \frac{{\ln x}}{{1 + {x^2}}} + \frac{{\arctan x}}{x},\;\; \Rightarrow y^\prime = y\left( {\frac{{\ln x}}{{1 + {x^2}}} + \frac{{\arctan x}}{x}} \right),$

where $$y = {x^{\arctan x}}.$$

### Example 6.

$y = {x^{2x}}\;\left( {x \gt 0,x \ne 1} \right)$

Solution.

Taking logarithms of both sides, we can write the following equation:

$\ln y = \ln {x^{2x}},\;\; \Rightarrow \ln y = 2x\ln x.$

Further we differentiate the left and right sides:

${\left( {\ln y} \right)^\prime } = {\left( {2x\ln x} \right)^\prime },\;\; \Rightarrow \frac{1}{y} \cdot y' = {\left( {2x} \right)^\prime } \cdot \ln x + 2x \cdot {\left( {\ln x} \right)^\prime },\;\; \Rightarrow \frac{{y'}}{y} = 2 \cdot \ln x + 2x \cdot \frac{1}{x},\;\; \Rightarrow \frac{{y'}}{y} = 2\ln x + 2,\;\; \Rightarrow y' = 2y\left( {\ln x + 1} \right)\;\;\text{or}\;\;y' = 2{x^{2x}}\left( {\ln x + 1} \right).$

### Example 7.

$y = {\left( {x - 1} \right)^2}{\left( {x - 3} \right)^5}$

Solution.

First we take logarithms of both sides:

$\ln y = \ln \left[ {{{\left( {x - 1} \right)}^2}{{\left( {x - 3} \right)}^5}} \right],\;\; \Rightarrow \ln y = \ln {\left( {x - 1} \right)^2} + \ln {\left( {x - 3} \right)^5},\;\; \Rightarrow \ln y = 2\ln \left( {x - 1} \right) + 5\ln \left( {x - 3} \right).$

Now it is easy to find the logarithmic derivative:

${\left( {\ln y} \right)^\prime } = {\left[ {2\ln \left( {x - 1} \right) + 5\ln \left( {x - 3} \right)} \right]^\prime },\;\; \Rightarrow \frac{1}{y} \cdot y' = 2 \cdot \frac{1}{{x - 1}} + 5 \cdot \frac{1}{{x - 3}},\;\; \Rightarrow y' = y\left( {\frac{2}{{x - 1}} + \frac{5}{{x - 3}}} \right),\;\; \Rightarrow y' = {\left( {x - 1} \right)^2}{\left( {x - 3} \right)^5}\cdot \left( {\frac{2}{{x - 1}} + \frac{5}{{x - 3}}} \right).$

In this example it is assumed that $$x \gt 3.$$

### Example 8.

$y = {\left( {x + 1} \right)^2}{\left( {x - 2} \right)^4}$

Solution.

We will assume here that $$x \gt 2.$$ Take logarithms of both sides:

$\ln y = \ln \left[ {{{\left( {x + 1} \right)}^3}{{\left( {x - 2} \right)}^4}} \right],\;\; \Rightarrow \ln y = \ln {\left( {x + 1} \right)^3} + \ln {\left( {x - 2} \right)^4}, \Rightarrow \ln y = 3\ln \left( {x + 1} \right) + 4\ln \left( {x - 2} \right).$

Now we can differentiate this expression with respect to $$x:$$

$\left( {\ln y} \right)^\prime = \left( {3\ln \left( {x + 1} \right)} \right)^\prime + \left( {4\ln \left( {x - 2} \right)} \right)^\prime,\;\; \Rightarrow \frac{{y^\prime}}{y} = \frac{3}{{x + 1}} + \frac{4}{{x - 2}},\;\; \Rightarrow \frac{{y^\prime}}{y} = \frac{{3\left( {x - 2} \right) + 4\left( {x + 1} \right)}}{{\left( {x + 1} \right)\left( {x - 2} \right)}},\;\; \Rightarrow \frac{{y^\prime}}{y} = \frac{{\color{blue}{3x} - \color{red}{6} + \color{blue}{4x} + \color{red}{4}}}{{\left( {x + 1} \right)\left( {x - 2} \right)}},\;\; \Rightarrow \frac{{y^\prime}}{y} = \frac{{\color{blue}{7x} - \color{red}{2}}}{{\left( {x + 1} \right)\left( {x - 2} \right)}},\;\; \Rightarrow y^\prime = y\frac{{7x - 2}}{{\left( {x + 1} \right)\left( {x - 2} \right)}},\;\; \Rightarrow y^\prime = \frac{{{{\left( {x + 1} \right)}^3}{{\left( {x - 2} \right)}^4}\left( {7x - 2} \right)}}{{\left( {x + 1} \right)\left( {x - 2} \right)}},\;\; \Rightarrow y^\prime = {\left( {x + 1} \right)^2}{\left( {x - 2} \right)^3}\left( {7x - 2} \right).$

See more problems on Page 2.