In this explainer, we will learn how to find the derivatives of positive functions by taking the natural logarithm of both sides before differentiating.

We sometimes encounter functions we would like to differentiate but on which our usual methods, such as the chain, product, or quotient rules, are difficult to or cannot be directly applied. For example, in each of the functions below, it is not clear how we might differentiate each function with respect to :

Each of these functions has a complicated exponent involving the variable , which makes applying our usual rules of differentiation problematic. In such cases, one method we can use to differentiate is logarithmic differentiation.

### Definition: Logarithmic Differentiation

Logarithmic differentiation is a four-step process used to differentiate awkward or complicated functions that do not lend themselves easily, if at all, to the usual methods of differentiation. For a differentiable function the steps are as follows:

- Apply the natural logarithm to both sides where the natural logarithm .
- Use the laws of logarithms to simplify or distribute the right-hand side.
- Differentiate both sides with respect to .
- Solve for .

Note that while we have specified that these steps apply when , if we want to apply logarithmic differentiation for all values of , we take the natural logarithm of the absolute value of : . This then covers both positive and negative values of our function .

Aside from taking the natural logarithm, the key step that makes this process so useful is the second step: using the laws of logarithms to simplify the right-hand side. This is because,

- if involves a product, then involves a sum, since by the product rule for logarithms
- if involves a quotient, then involves a difference, since by the quotient rule for logarithms
- if involves an exponent or power, then involves a product, since by the law of exponents for logarithms

Once we have rewritten our function in a more manageable form, we can then differentiate the resulting expressions using the usual methods and/or known results.

On the left-hand side of our equation, , and since we are now differentiating a function of where is itself a function of , we use implicit differentiation. This involves the chain rule for differentiating a composite function where . Applying this to our left-hand side, differentiating with respect to gives us

Then, using the known result , we have

Now that we know the steps to follow for logarithmic differentiation, let us try them out on some quite complicated functions.

### Example 1: Finding the First Derivative of a Function Having a Variable in Its Base and Exponent Using Logarithmic Differentiation

Find if .

### Answer

Let us begin by isolating on the left-hand side. Dividing both sides by 6, we have

Since our function is an exponential function whose base and exponent are variables, we use the process of logarithmic differentiation to evaluate its derivative. Our first step in logarithmic differentiation is to take the natural logarithms of both sides. This gives us

In taking the natural logarithm, we have specified that since the logarithm is only defined for positive, nonzero input values. Our second step in logarithmic differentiation is to use the laws of logarithms to simplify our right-hand side. In this case, we note that our function consists of the variable with the exponent , all multiplied by the constant . We first use the product rule for logarithms, to separate the constant. Thus,

We may then use the power rule for logarithms, to expand the second term on the right-hand side and bring our exponent down. This gives us

Our function is now in a form amenable to the usual rules of differentiation, so we can apply step three of logarithmic differentiation. That is, we can differentiate both sides with respect to . Since the derivative of a sum of two functions is equal to the sum of their derivatives, we have

Applying implicit differentiation to our left-hand side, where is a function of , gives us , and since is a constant, its derivative is zero. We therefore have

On the right-hand side, we are differentiating a product of two functions and can therefore use the product rule for differentiation. We know that the derivative of with respect to is and that the derivative of with respect to is . Hence, by the product rule for differentiation, we have

Our final step in logarithmic differentiation is to isolate on the left-hand side. To do this, we multiply both sides by . And since , we have

Combining exponents of , we then have

Let us now consider an example of how to use logarithmic differentiation to differentiate a function involving a trigonometric ratio with a variable exponent.

### Example 2: Differentiating Functions Involving Trigonometric Ratios Using Logarithmic Differentiation

Use logarithmic differentiation to find the derivative of the function .

### Answer

Logarithmic differentiation is useful when a function we wish to differentiate does not lend itself to the usual rules of differentiation. This is the case in the given function, where both the argument of the cosine and the exponent are variable. Our first step in logarithmic differentiation is to apply the natural logarithm to both sides of our function so that

In taking the natural logarithm, we have specified that since the logarithm is only defined for positive, nonzero input values. We then use the laws of logarithms to expand the right-hand side into something we can easily differentiate. To separate the constant, 2, from , we use the product rule for logarithms:

Applying this rule gives us

Our second term on the right-hand side involves an exponent , so we can apply the power rule for logarithms, to bring our exponent down:

As hoped, on our right-hand side we now have a collection of expressions that we are able to easily differentiate. Thus, we can apply the third step in logarithmic differentiation. That is, we differentiate both sides with respect to . And since the derivative of a sum of two functions is equal to the sum of their derivatives, we have

Applying implicit differentiation to our left-hand side, where is a function of , gives us , and since is a constant so that its derivative is zero, we have,

On our right-hand side, we are now differentiating a product with factors and and can therefore apply the product rule for differentiation. In order to do this, however, we will need to know the derivative of with respect to . Since this is a function of a function, in other words, a composite function, we can apply the chain rule. Letting , where , then and

And since , we have

We are now able to apply the product rule for differentiation to our right-hand side above. Letting and , so that and , by the product rule,

Having taken the natural logarithm on both sides and then differentiated with respect to , we then have

Our final step in logarithmic differentiation is to isolate on the left-hand side. We do this by multiplying both sides by to obtain

Now, recalling that our function , we have

In our next example, we use logarithmic differentiation to differentiate a composite function with variable exponent.

### Example 3: Finding the First Derivative of a Function Using Logarithmic Differentiation

Find if .

### Answer

If the exponent outside the parentheses in our function were a constant, we would simply use the chain rule to differentiate. However, the exponent is itself a function of and the easiest way to tackle differentiating a function of this type is to use logarithmic differentiation.

The first step is to apply the natural logarithm to both sides of our function so that

In taking the natural logarithm, we have specified that , since the logarithm is only defined for positive, nonzero input values. We then use the laws of logarithms to expand the right-hand side into something we can easily differentiate. Our right-hand side involves an exponent so we can apply the power rule for logarithms, to bring our exponent down:

On our right-hand side we now have a function that is the product of two differentiable functions that we know how to differentiate. Thus, we can apply the third step in logarithmic differentiation. That is, we differentiate both sides with respect to so that

Applying implicit differentiation to our left-hand side, where is a function of , gives us so that

On our right-hand side, we are now differentiating a product with factors and . This means we can apply the product rule for differentiation. To do this, however, we need to know the derivative of with respect to . Since this is a function of a function, we can apply the chain rule. Letting , where , then and

Since so that , we then have and we can now apply the product rule for differentiation to the right-hand side above. Letting and so that by the product rule,

Rearranging and taking the common factor of 8 outside the parentheses, we now have

Our final step in logarithmic differentiation is to isolate on the left-hand side. We do this by multiplying both sides by to obtain

We may want the derivative purely in terms of , so with , we have

Let us now consider an example where we use logarithmic differentiation to differentiate a function which is a constant raised to a complicated exponent involving exponential and trigonometric functions.

### Example 4: Differentiating a Composition of Exponential and Trigonometric Functions Using Logarithmic Differentiation

Given that , determine .

### Answer

Considering that the exponent in our function is a complicated function of , the easiest method we have to differentiate this function is by using logarithmic differentiation. Our first step in this process is to take the natural logarithms of both sides, giving us

In taking natural logarithms, we have specified that since the logarithm is only defined for positive, nonzero input values. Although this looks possibly even more complicated, our next step will help us simplify things so that we are able to differentiate quite easily. The second step of logarithmic differentiation is to use the laws of logarithms to change our right-hand side into something more manageable. In our case, since we have an exponent, we use the power rule, or law of exponents for logarithms,

Using this to bring down our exponent gives us and on our right-hand side now we have the constant, , multiplied by the expression . We know how to differentiate this, so we apply step three of logarithmic differentiation. That is, we differentiate both sides with respect to , giving (taking the constant, , outside of the derivative).

Applying implicit differentiation to the left-hand side, where is a function of , we have

Now recalling that and , differentiating the right-hand side gives us

Our final step in logarithmic differentiation is to isolate on the left-hand side. We can do this by multiplying both sides by so that

Finally recalling that and rearranging our right-hand side, we have

In our final example, we will use logarithmic differentiation to differentiate a slightly strange function with repeated exponents of .

### Example 5: Finding the First Derivative of a Function in the Form 𝑥^{𝑥𝑥} Using Logarithmic Differentiation

Given , find .

### Answer

The exponents in the given function are variables and the easiest way to differentiate a function of this type is using logarithmic differentiation. To do this, we first take the natural logarithms on both sides. Applying this to our function , we have

In taking natural logarithms, we have specified that , since the logarithm is only defined for positive, nonzero input values.

Our next step in logarithmic differentiation is to use the laws of logarithms to expand our right-hand side. This should give us something that we can easily differentiate, although with this particular function we will see that we must apply these first two steps twice to reach the point where we can differentiate.

Since our function involves exponents, we can use the power or exponent law for logarithms to expand our right-hand side. This says that and applying it to our function so that we bring down our exponent, we have

This appears a little more manageable since we now have a product on our right-hand side. However, one of the factors, , is still not something we can easily differentiate. To remedy this, we return to step one and again take natural logarithms on both sides. By doing this, we will then be able to again apply the laws of logarithms to expand our right-hand side. So, taking the natural logarithms once more, we have

Now, on our right-hand side, we can use the product rule for logarithms; that is,

Applying this to our right-hand side, we have

We can use the power rule for logarithms once more to expand the first term on the right-hand side so that we have and now we have something we can actually differentiate using the usual rules of differentiation. This brings us to our third step of logarithmic differentiation, which is to differentiate both sides with respect to : (noting that on the right-hand side we have used the fact that the derivative of a sum is equal to the sum of the derivatives). Let us begin our differentiation with the first term on the right-hand side.

We have a product with factors and . Using the product rule for differentiation and the fact that , then

Considering now the second term on our right-hand side, we may observe that the technique we will use applies similarly to the expression on the left-hand side. We have an expression, . This is of the form, , where is a differentiable function of . So, we have a function of a function where, in our case, . We know that and that (for ). We therefore have

We now have the derivatives of both terms of our right-hand side, so all that remains is to evaluate the derivative on the left-hand side of our equation. That is, . As noted, we can apply the same technique as used for the second term on our right-hand side.

Now we wish to differentiate the expression , where . This time we must take into account the fact that is a function of , so

We can now assemble the results of our differentiation as follows:

In the final step of logarithmic differentiation, we isolate on the left-hand side by multiplying both sides by and rearranging; we have

We conclude our discussion of logarithmic differentiation by noting some key points.

### Key Points

- For complicated functions where the usual methods of differentiation are either difficult or impossible to apply, we use the method of logarithmic differentiation by taking the natural logarithm, where the natural logarithm “” is . This is particularly useful when applied to functions involving a variable exponent.
- For a differentiable function of , we
- apply the natural logarithm to both sides
- use the laws of logarithms to simplify or expand the right-hand side;
- differentiate both sides with respect to ;
- solve for .

- In taking natural logarithms on both sides, we specify that since the logarithm is only defined for positive, nonzero input values.