#### xaktly | Calculus

Logarithmic differentiation

### Exploiting the unique algebra of logs to find difficult derivatives

Some of the unique properties of the algebra of logarithms (logs), coupled with our implicit differentiation skills, allow us to find some more difficult derivatives more easily.

These properties will allow us to tease apart some complicated functions   $y = f(x),$   by taking the log or natural log (ln) of both sides, then simplifying before differentiation. The best way to learn logarithmic definition is to dive in and do some examples.

The key properties of logs we'll use are:

$$log(f(x)\cdot g(x)) = log(f(x)) + log(g(x))$$

$$log\left( \frac{f(x)}{g(x)} \right) = log(f(x)) - log(g(x))$$

$$log(a^x) = x \cdot log(a)$$

### Example 1

If   $f(x) = x^x,$   find   $f'(x).$

The power rule of differentiation just won't work here:

$$f'(x) \ne (x)x^{x - 1}$$

Solution: To find this derivative, first take the natural log (any log will work, but ln(x) is the "native" log to calculus) of both sides of   $y = x^x.$

$$ln(y) = ln(x^x)$$

Use the power property of logs on the right side:

$$ln(y) = x \cdot ln(x)$$

Now use implicit differentiation on both sides, making sure to use the product rule on the right:

\begin{align} \frac{1}{y} \, \frac{dy}{x} &= (1) ln(x) + x \, \frac{1}{x} \\ &= ln(x) + 1 \end{align}

Now isolate (solve for)   $\frac{dy}{dx}$:

$$\frac{dy}{dx} = y[ln(x) + 1]$$

Now we don't want that y in our solution, so we return to the original function,   $y = x^x,$   and plug that in for y to get:

$$\frac{d}{dx} \, x^x = x^x[ln|x| + 1]$$

It's customary to put absolute value bars around the argument to log functions when there is a possibility of a negative argument, beause the domain of f(x) = ln|x| is (0, ∞).

That's a pretty difficult derivative without logarithmic differentiation, but relatively simple with it.

### Example 2

Find the derivative of   $f(x) = [cos(x)]^{x^2}.$

Solution: First set this function equal to y, then take the log of both sides. We do this to get that x2 out of the exponent.

$$y = [cos(x)]^{x^2}$$

Take the log of both sides:

$$ln(y) = ln [[cos(x)]^{x^2}]$$

Use the power property of logs to move the x2 out of the exponent:

$$ln(y) = x^2 ln[cos(x)]$$

Now take the implicit derivative of both sides with respect to x, using the product rule and chain rule on the right:

$$\frac{1}{y} \, \frac{dy}{dx} = 2x\cdot ln[cos(x)] + x^2 \cdot \frac{1}{cos(x)} \cdot -sin(x)$$

Now simplify a bit:

$$\frac{1}{y} \, \frac{dy}{dx} = 2x \, ln[cos(x)] - x^2 tan(x)$$

Multiply both sides by y to isolate   $\frac{dy}{dx}$:

\begin{align} \frac{dy}{dx} &= 2xy \, ln[cos(x)] - x^2y \, tan(x) \\ &= y(2x \, ln[cos(x)] - x^2 \, tan(x)) \end{align}

Finally, re-substitute $y = [cos(x)]^{x^2}$:

\begin{align} \frac{d}{dx} &[cos(x)]^{x^2} \\ &= [cos(x)]^{x^2}[2x \, ln[cos(x)] - x^2 \, tan(x)] \end{align}

### Example 3

Find the derivative of   $f(x) = \sqrt{x}^{\sqrt{x}}.$

Solution: First, set the funtion equal to y and take the log of both sides. We do this to remove the   $\sqrt{x}$   from the exponent:

$$ln(y) = ln[\sqrt{x}^{\sqrt{x}}]$$

Use the power property of logs:

$$ln(y) = \sqrt{x} \, ln[\sqrt{x}]$$

Now differentiate both sides, using the power rule and chain rule:

\begin{align} \frac{1}{y} \, \frac{dy}{dx} &= \frac{1}{2\sqrt{x}} \, ln[\sqrt{x}] + \sqrt{x}\cdot \frac{1}{\sqrt{x}} \cdot \frac{1}{2\sqrt{x}} \\ \\ &= \frac{1}{2\sqrt{x}} \left[ ln[\sqrt{x}] + 1 \right] \end{align}

Now multiply both sides by   $y = \sqrt{x}^{\sqrt{x}}$:

$$\frac{dy}{dx} = \frac{\sqrt{x}^{\sqrt{x}}}{2\sqrt{x}} \left[ ln[\sqrt{x}] + 1 \right]$$

$$\text{or } \; \; \frac{dy}{dx} = \frac{\sqrt{x}^{\sqrt{x} - 1}}{2} \left[ ln[\sqrt{x}] + 1 \right]$$

$$\text{or } \; \; \frac{dy}{dx} = \frac{1}{2} x^{\frac{\sqrt{x} - 1}{2}} \left[ ln[\sqrt{x}] + 1 \right]$$

Those are three slightly-different ways of expressing the same solution, all related through the laws of logs and exponents.

### Example 4

Find the derivative of   $f(x) = x^3 + x^{\frac{1}{x}}.$

Solution: Only the   $x^{1/x}$   term requires logarithmic differentiation (recall that the derivative of a sum is just the sum of derivatives), so we'll just use it to find the derivative of that term and add   $3x^2$   to the result:

$$ln(y) = \frac{1}{x} \, ln{x}$$

Take the derivative:

$$\frac{1}{y} \, \frac{dy}{dx} = \frac{-1}{x^2} ln(x) + \frac{1}{x} \, \frac{1}{x}$$

Simplify a little:

$$\frac{1}{y} \, \frac{dy}{dx} = \frac{1}{x^2}[1 - ln(x)]$$

Now multiply by   $y = x^{1/x}$ on both sides, and don't forget to add the   $3x^2$:

$$\frac{dy}{dx} = 3x^2 + \frac{x^{1/x}}{x^2} [1 - ln(x)]$$

$$\text{or } \; \; \frac{dy}{dx} = 3x^2 + x^{\frac{1}{x} - 2} [1 - ln(x)]$$

$$\text{or } \; \; \frac{dy}{dx} = 3x^2 + x^{\frac{1-2x}{x}} [1 - ln(x)]$$

### Practice problems

Decide whether logarithmic differentian might help, then find the derivatives of these functions.

 1 $$f(x) = \sqrt{x} \, e^{2x^2}$$ 2 $$f(x) = \frac{[ln(x)]^2}{5^{5x}}$$ 3 $$f(x) = \frac{x^{4x}(x + 1)^2}{(2x + 4)^3}$$
 4 $$f(x) = x^{x ln(x)} [tan(x)]^{2x}$$ 5 $$f(x) = \frac{x^{2x} (x - 5)^2}{(2x - 7)^3}$$ 6 $$f(x) = x^{x^2}$$

xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.