# Logarithmic Differentiation

Lesson Features »

Lesson Priority: Optional

Calculus $\longrightarrow$
Discovering Derivatives $\longrightarrow$

Objectives
• Learn the step by step method of Logarithmic Differentiation
• Recognize when Logarithmic Differentiation is required to find a derivative
• Understand what types of complicated functions are optionally (but much more easily) differentiated using Logarithmic Differentiation
Lesson Description

When working with functions of $x$ that have $x$ as both a variable exponent and part of the base expression (e.g. $f(x) = x^x$, or $g(x) = [\cos(x)]^{x^2}$), the normal rules of differentiation do not work. In this case we can get the correct derivative expression by using a technique called Logarithmic Differentiation.

Practice Problems

Practice problems and worksheet coming soon!

## Logarithms FTW Instead of WTF

Logarithmic differentiation is a technique that uses log manipulation rules » to make the task of taking derivatives easier. It is only useful in specific circumstances.This process utilizes implicit differentiation », so make sure you're up to speed with using it before trying to use and understand this logarithmic technique.

## When to Use It

There are two major situations that call for us to use logarithmic differentiation. One is a matter of convenience and the other is a matter of necessity.Products and PowersThe derivative of any expression that is a mix of products and terms raised to various powers or roots can be insanely faster and more efficient using logarithmic differentiation. Example 1 below will help us see that.Variable Bases with Variable ExponentsIf you happen to be working on taking the derivative of a term that has $x$ as both a variable and as an exponent, it can only be done with logarithmic differentiation. We'll look at this situation in Example 2.

## Logarithmic Differentiation - How To

Let's now get down to business and see how it works. We'll start with the steps, and then put it into practice using each of the two scenarios.Be warned that the steps look intimidating. My strong advice is to use them as a reference - logarithmic differentiation is not the simplest thing you'll do in differential calculus, but it's far from the most complex.Steps of L.D.
• Call the expression $y$ if it isn't already named
• Take the natural log of both sides
• Expand the right-hand side using logarithm rules so that you are left with simpler logarithm terms
• Take the derivative of both sides implicitly
• Solve for $dy/dx$
• Plug in the original expression.
I know these are famous last words, but it's easier when you're following a problem.

Example 1Find the derivative of function $y$:$$y=\frac{x^2 \cos(x)}{(x+5)^3 \sqrt[5]{(x^2+7)}}$$$\blacktriangleright$ This function is a mess. Fortunately, it is a mess that is a massive product, and its derivative is significantly easier via logarithmic differentiation than it is any other way.First, take the log of both sides.$$\ln(y)=\ln\left(\frac{x^2 \cos(x)}{(x+5)^3 \sqrt[5]{(x^2+7)}}\right)$$Now, manipulate the right side to end up with a bunch of simpler logarithms. Simpler in this case means fully expanded ».$$\ln(y) = 2\ln(x) + \ln(\cos(x))$$$$-3\ln(x+5) - \frac{1}{5} \, \ln\left(x^2 + 7\right)$$Now that we have simpler logarithms, we can take the derivative of each term with relative ease. The left side has awkward implicit behavior but we will be able to deal with it at the end.$$\frac{d}{dx} \, \ln(y) = \frac{d}{dx} \, 2\ln(x) + \frac{d}{dx} \, \ln(\cos(x))$$$$- \frac{d}{dx} \, 3\ln(x+5) - \frac{d}{dx} \, \frac{1}{5} \, \ln\left(x^2 + 7\right)$$On the left side of the equation, after implicitly differentiating, we have$$\frac{1}{y} \,\, \frac{dy}{dx}$$On the right side, we have$$\frac{2}{x} + \frac{-\sin(x)}{\cos(x)}$$$$- 3 \, \frac{1}{x-5} - \frac{1}{5} \, \frac{2x}{x^2+7}$$All that's left to do is clean up terms and coefficients, and solve for $dy/dx$. To do that, we need only to multiply both sides by $y$.$$\frac{1}{y} \,\, \frac{dy}{dx} = \frac{2}{x} - \tan(x) - \frac{3}{x-5} - \frac{2x}{5\left(x^2+7\right)}$$ $$\frac{dy}{dx} = y \cdot \Bigg[ \frac{2}{x} - \tan(x) - \frac{3}{x-5} - \frac{2x}{5\left(x^2+7\right)} \Bigg]$$However, we started the problem knowing what $y$ is. Namely:$$y=\frac{x^2 \cos(x)}{(x+5)^3 \sqrt[5]{(x^2+7)}}$$Replacing $y$ in our result gives us our final answer.$$\frac{dy}{dx} = \frac{x^2 \cos(x)}{(x+5)^3 \sqrt[5]{(x^2+7)}} \cdot \Bigg[ \frac{2}{x} - \tan(x) - \frac{3}{x-5} - \frac{2x}{5\left(x^2+7\right)} \Bigg]$$

Example 2Find the derivative of $y=x^x$.$\blacktriangleright$ Unlike the last example where logarithmic differentiation was a convenience, here it is a necessity.Again, we'll start by taking the natural logarithm of both sides.$$\ln(y) = \ln \left( x^x \right)$$Using the logarithm Power Rule, we can re-write the right-hand side.$$\ln(y) = x \ln {x}$$Now, we will take the derivative of both sides implicitly. The right side requires the product rule.$$\frac{1}{y} \, \frac{dy}{dx} = (1) \ln(x) + (x) (1/x)$$$$\frac{1}{y} \, \frac{dy}{dx} = \ln(x) + 1$$Finally, multiply both sides of this equation by $y$ to isolate $dy/dx$.$$\frac{dy}{dx} = y \cdot \left[ \ln(x) + 1 \right]$$To finalize the solution, replace $y$ with $x^x$.$$\frac{dy}{dx} = \left(x^x\right) \left[ \ln(x) + 1 \right]$$
You Should Know
When Logarithmic Differentiation is used, graders are typically a little more liberal with your clean up. Don't stress about multiplying results out - just leave your answers as-is the minute you isolate $dy/dx$.

## Put It To The Test

Example 3$$y=\frac{(x+7)^2}{x^3 \sqrt{5-x^2}}$$
Show solution
$\blacktriangleright$ Since we have a complicated product with various exponents, logarithmic differentiation will be a huge convenience but not a strict requirement. This problem could be done with the traditional product and quotient rules », but holy moly no thanks.$$\ln(y) = \ln \left( \frac{(x+7)^2}{x^3 \sqrt{5-x^2}} \right)$$$$=2\ln(x+7) -3\ln(x) -\frac{1}{2} \, \ln \left(5-x^2\right)$$ $$\frac{d}{dx} \, \ln(y) = \frac{d}{dx} \, 2\ln(x+7) - \frac{d}{dx} 3\ln(x)$$$$-\frac{d}{dx} \, \left(5-x^2\right)$$ $$\frac{1}{y} \, \frac{dy}{dx} = \frac{2}{x+7} - \frac{3}{x}$$$$+\frac{2x}{5-x^2}$$Multiply both sides by $y$, and replace $y$ with its original definition.$$\frac{dy}{dx} = y \cdot \Bigg[ \frac{2}{x+7} - \frac{3}{x} +\frac{2x}{5-x^2} \Bigg]$$$$= \frac{(x+7)^2}{x^3 \sqrt{5-x^2}} \cdot \Bigg[ \frac{2}{x+7} - \frac{3}{x} +\frac{2x}{5-x^2}\Bigg]$$

Example 4Find the derivative of$$f(x) = \sin\left(x^{\cos(x)}\right)$$
Show solution
$\blacktriangleright$ This expression does involve a variable expression with the same variable exponent, so logarithmic differentiation is required. However, we can't use it right away - our first step is based on the Chain Rule ».$$\frac{d}{dx} \, f(x) = \cos\left(x^{\cos(x)}\right)$$$$\cdot \left(x^{\cos(x)}\right)'$$It is the derivative of $\left(x^{\cos(x)}\right)$ that requires logarithmic differentiation. Let's call it $y$ and find its derivative.$$y=x^{\cos(x)}$$$$\ln(y) = \ln\left(x^{\cos(x)}\right)$$$$\ln(y) = \cos(x) \cdot \ln(x)$$$$\frac{d}{dx} \, \ln(y) =\frac{d}{dx} \left[ \cos(x) \cdot \ln(x) \right]$$$$\frac{1}{y} \cdot \frac{dy}{dx} = -\sin(x)\ln(x)$$$$+ (\cos(x))\left( \frac{1}{x} \right)$$$$\frac{dy}{dx} = y \cdot \left[ -\sin(x)\ln(x) + \frac{\cos(x)}{x} \right]$$$$\frac{dy}{dx} = \left( x^{\cos(x)} \right)$$$$\cdot \left[ -\sin(x)\ln(x) + \frac{\cos(x)}{x} \right]$$Finally, use this result to obtain our final answer.$$\frac{d}{dx} \, f(x) = \cos\left(x^{\cos(x)}\right)$$$$\cdot \left( x^{\cos(x)} \right) \cdot \left[ -\sin(x)\ln(x) + \frac{\cos(x)}{x} \right]$$

Lesson Takeaways
• Conceptually be able to follow along with the process of logarithmic differentiation
• Understand the purpose of taking logarithms of both sides before taking derivatives
• Become familiar with when this process is essential versus convenient
• Popular Content
• Get Taught
• Other Stuff

Lesson Metrics

At the top of the lesson, you can see the lesson title, as well as the DNA of Math path to see how it fits into the big picture. You can also see the description of what will be covered in the lesson, the specific objectives that the lesson will cover, and links to the section's practice problems (if available).

Key Lesson Sections

Headlines - Every lesson is subdivided into mini sections that help you go from "no clue" to "pro, dude". If you keep getting lost skimming the lesson, start from scratch, read through, and you'll be set straight super fast.

Examples - there is no better way to learn than by doing. Some examples are instructional, while others are elective (such examples have their solutions hidden).

Perils and Pitfalls - common mistakes to avoid.

Mister Math Makes it Mean - Here's where I show you how teachers like to pour salt in your exam wounds, when applicable. Certain concepts have common ways in which teachers seek to sink your ship, and I've seen it all!

Put It To The Test - Shows you examples of the most common ways in which the concept is tested. Just knowing the concept is a great first step, but understanding the variation in how a concept can be tested will help you maximize your grades!

Lesson Takeaways - A laundry list of things you should be able to do at lesson end. Make sure you have a lock on the whole list!

Special Notes

Definitions and Theorems: These are important rules that govern how a particular topic works. Some of the more important ones will be used again in future lessons, implicitly or explicitly.

Pro-Tip: Knowing these will make your life easier.

Remember! - Remember notes need to be in your head at the peril of losing points on tests.

You Should Know - Somewhat elective information that may give you a broader understanding.

Warning! - Something you should be careful about.