Logarithmic Differentiation

In this page we will talk about how we can use logarithmic differentiation to simplify what would otherwise be much more difficult differential calculus problems. It probably goes without saying that in order to carry out logarithmic differentiation, you need to be reasonably well acquainted with the laws of logarithms and how they are used. Essentially, we use logarithmic differentiation in situations where it is easier to differentiate the logarithm of a function than to differentiate the function itself. For example, we might have a function that is the product of a number of complex expressions. Taking the logarithm of the function reduces the function to the sum of the logarithms of the individual expressions. This enables us to differentiate each element of the function separately, rather than having to apply the product rule.

Since you are studying calculus, you are presumably familiar with the laws of logarithms. Nevertheless, just to refresh your memory, we will review the three most important laws of logarithms, and briefly explain how they can help us to differentiate complex functions. We will then work through some examples to demonstrate the techniques involved. Before we do that, we should clarify a couple of points.

First of all, the process of logarithmic differentiation (as the name suggests) involves taking the logarithmic derivative of a function. This is actually more straightforward than it sounds, as we shall see. Second, although we could theoretically use the logarithm to any base of a function, we will only be using natural logarithms (i.e. log to base e). Using the natural log of a function makes differentiation easier because of the unique properties of natural logarithms. Using the logarithm to any other base, although possible, would increase the complexity of our calculations.


Logarithmic differentiation and the laws of logarithms

The first law of logarithms tells us that that the logarithm to base b of the product of two numbers (i.e. the result of multiplying two numbers together) can be found by adding together their individual logarithms. This is expressed formally as:

logb (m × n)  =  logb (m) + logb (n)

If we want to find the product of two or more numbers, we simply add their individual logarithms together and take the antilogarithm of the result. We can do pretty much the same kind of thing with functions that are the product of a number of complex expressions. Without logarithmic differentiation, we must either apply the product rule to the function as it stands, or multiply out the terms to get it into a form that is easier to differentiate. This kind of approach can often involve tedious and error-prone calculations. Logarithmic differentiation turns the problem into one of addition, allowing us to isolate complex expressions and differentiate them separately.

The second law of logarithms states that the logarithm to base b of the quotient of two numbers (i.e. the result of dividing one number by another) can be found by subtracting the logarithm of the divisor (the number we are dividing by) from the logarithm of the dividend (the number we want to divide). This is expressed formally as:

logb (m ÷ n)  =  logb (m) - logb (n)

In order to find the quotient of two numbers, we just subtract the logarithm of the divisor from the logarithm of the dividend and then take the antilogarithm of the result. We can apply this technique to functions that are the quotient of complex expressions. Thus, instead of trying to apply the quotient rule, we can use logarithmic differentiation to turn the problem into one of simple subtraction. This again allows us to isolate complex expressions and differentiate them individually.

The third law of logarithms tells us that the logarithm to base b of a number raised to a power (the exponent) can be found by multiplying the logarithm of the number by the exponent. This is expressed formally as:

logb (m n)  =  n logb (m)

In order to find the value of a number raised to a power, we multiply the logarithm of the number by the exponent, and then take the antilogarithm of the result. This will work for functions as well. Functions sometimes contain expressions that have complex exponents, or exponents that are variables, or even exponents that are functions in their own right. In cases like this, the normal rules of differentiation no longer apply. Fortunately, we can use the third law of logarithms to eliminate the exponent, and turn a problem involving exponentiation into one involving multiplication, thus reducing its complexity.


The logarithmic derivative

We said above that logarithmic differentiation involves finding the logarithmic derivative of a function, but just how do we do that? Well, the definition of the logarithmic derivative of a function is that it is the derivative of the logarithm of the function. So far that probably doesn't sound like a particularly helpful definition. Suppose, however, that we ignore the function for the moment and concentrate on the derivative of the logarithm. If you have read the page "Exponential and Logarithmic Functions" in this section, you may recall that the derivative of the natural logarithm function (i.e. log to base e) is given by:

d(ln (x))  =  1
dxx

Now, suppose we want to find the logarithmic derivative (i.e. the derivative of the natural logarithm) of some function ƒ(x). We are now dealing with a composite function, because we are applying the natural logarithm function to ƒ(x). This means we need to apply the chain rule. Remember that the chain rule tells us that we must multiply the derivative of the outer function by the derivative of the inner function. This gives us the following:

d(ln (ƒ(x)))  =  1 · ƒ′(x)  =  ƒ′(x)
dxƒ(x)ƒ(x)

The logarithmic derivative of a function ƒ(x) is therefore simply ƒ′(x)/ƒ(x), i.e. the derivative of the function divided by the function itself.


The procedure

The general procedure for finding the derivative of a function using logarithmic differentiation is fairly straightforward. Supposing we have a function expressed as follows:

y  =  ƒ(x)

We begin the process of logarithmic differentiation by taking the natural log of both sides of the equation, as follows:

ln (y)  =  ln (ƒ(x))

We can then carry out implicit differentiation. Taking the derivative of both sides of the equation (and remembering that we need to use the chain rule) will give us:

1 · dy  =  ƒ′(x)
ydxƒ(x)

The last step is to multiply both sides of the equation by y, which leaves us with:

dy  =  ƒ′(x)
dx

This is, of course, only an outline procedure. We really need to work through some examples to see how it all works.


Some worked examples

We'll start off with an example of how logarithmic differentiation can be used to simplify a function that is the product of several complex expressions. Suppose we want to differentiate the following function:

ƒ(x)  =  (2x 3 + 8) (6x 2 - 1) (3x 5 - 2x 2 + 11)

Hopefully you can see straight away that attempting to multiply out the brackets or apply the product rule to this function could get somewhat messy, so this problem is a good candidate for logarithmic differentiation. Let's start, then, by taking the natural logarithm of both sides of the equation:

ln (ƒ(x))  =  ln ((2x 3 + 8) (6x 2 - 1) (3x 5 - 2x 2 + 11))

We can now apply the first law of logarithms to the right-hand side of the equation to get the following:

ln (ƒ(x))  =  ln (2x 3 + 8) + ln (6x 2 - 1) + ln (3x 5 - 2x 2 + 11)

Now we take the derivative of both sides of the equation:

ƒ′(x)  =  6x 2 + 12x + 15x 4 - 4x
ƒ(x)2x 3 + 86x 2 - 13x 5 - 2x 2 + 11

And finally we multiply by ƒ(x) to get the derivative:

ƒ′(x)  =  (6x 2 + 12x + 15x 4 - 4x)(2x 3 + 8) (6x 2 - 1) (3x 5 - 2x 2 + 11)
2x 3 + 86x 2 - 13x 5 - 2x 2 + 11

The end result is still rather messy, but at least we obtained it without having to spend a lot of time on lengthy calculations. In fairness, most of the problems you come across involving a function that is the product of complex expressions probably won't look like this. Even so, you will often encounter problems of this nature that are easier to solve using logarithmic differentiation.

*   *   *

Let's look at a somewhat more realistic example. Suppose we need to differentiate the following function:

y  =  e x 2 · cos (x) · (x + 1) 5

Taking the natural logarithm of both sides, we get:

ln (y)  =  x 2 + ln (cos (x)) + 5 ln (x + 1)

There are a couple of interesting things about this equation. First, note that the natural logarithm of ex 2 - the first term on the right-hand side of the equation - evaluates to x 2, because as you may recall the natural logarithm (i.e. the logarithm to base e) of e raised to an exponent is simply the exponent itself. This follows from the third law of logarithms, which says that the logarithm (to any base) of a number or expression raised to an exponent is the exponent multiplied by the logarithm of the number or expression. Hence we have:

loge  (ex 2)  =  x 2 loge  (e)  =  x 2 · 1  =  x 2

Second, note that when we take the natural logarithm of the expression (x + 1) 5, we again need to apply the third law of logarithms because the expression has an exponent. So, this example may look easier than the previous example, but it is not quite so straightforward as it appears. Even so, logarithmic differentiation makes it easier than it would otherwise have been. Consider for example that now, instead of differentiating (x + 1) 5, we will be differentiating 5 ln (x + 1). Anyway, let's continue. Differentiating both sides of the equation gives us:

y  =  2x + -sin (x) + 5
ycos (x)x + 1

Multiplying both sides of the equation by y gives us:

y′  =  ex 2 · cos (x) · (x + 1) 5(2x - tan (x) + 5)
x + 1
*   *   *

Let's try differentiating a function expressed as the quotient of complex expressions. This time we'll try something a little bit more difficult, as we attempt to differentiate the following function:

y  =  (1 - 2x) 3
√(1 + x 2)

First of all we take the natural logarithm of both sides in order to get rid of the fraction:

ln (y)  =  ln ((1 - 2x) 3) - ln ((1 + x2) 1/2 )

Note that we have rewritten the expression √(1 + x 2) as (1 + x 2) 1/2 . This just makes it a bit easier to deal with. We will now apply the third law of logarithms to the right-hand side of the equation to get rid of the exponents:

ln (y)  =  3 ln (1 - 2x) -  1/2  ln (1 + x 2)

Now we can differentiate both sides of the equation:

y  =  -6 - x
y1 - 2x1 + x 2
  =  -6 (1 + x 2) - x (1 - 2x)
(1 - 2x) (1 + x 2)
  =  -6 - 6x 2 - x + 2x 2
(1 - 2x) (1 + x 2)
  =  -6 - 4x 2 - x
(1 - 2x) (1 + x 2)

Multiplying both sides of the equation by y gives us:

y′  =  -6 - 4x 2 - x × (1 - 2x) 3
(1 - 2x) (1 + x 2)√(1 + x 2)
*   *   *

Let's try differentiating another function expressed as a quotient. It might be interesting to differentiate a function that is the quotient of a trigonometric function and e raised to a variable exponent! Let's differentiate the following function:

y  =  tan (x)
ex

As before, we start by taking the natural logarithm of both sides:

ln (y)  =  ln (tan (x)) - x

Now we differentiate both sides of the equation:

y  =  sec 2 (x) - 1
ytan (x)

Now we multiply both sides of the equation by y:

y′  =  ( sec 2 (x)  - 1) · tan (x) 
tan (x)ex
  =  sec 2 (x) · tan (x) -  tan (x) 
tan (x) · exex
  =  sec 2 (x) · tan (x) · e x - tan (x) 2 · ex
tan (x) · (ex) 2
  =  sec 2 (x) - tan (x)
ex

That wasn't so bad, was it? The presence of e raised to a variable exponent in the denominator didn't have you worried for a second, did it! Seriously though, we have already mentioned the fact that the natural logarithm of e raised to an exponent is just the exponent itself, so this was never going to cause us any major headaches. Things are not always going to be quite so straightforward when it comes to exponents, though.

*   *   *

You will often come across problems in which you must differentiate an expression that contains a term raised to an exponent that is a variable, or a complex expression, or even a function in its own right. In this kind of situation, the normal rules of differentiation simply don't apply. For example, suppose we are asked to differentiate the following function:

y  =  xx

This looks simple enough, doesn't it? The classic mistake when presented with this kind of problem, however, is to attempt to solve it using the power rule. Unfortunately, this simply doesn't work unless the exponent is a constant. So how do we find the derivative of y = xx? The answer is, of course, by applying logarithmic differentiation. As always, the first step is to take the natural logarithm of both sides:

ln (y)  =  ln (xx)

We can expand the right-hand side using the third law of logarithms:

ln (y)  =  x · ln (x)

Now, we need to differentiate both sides of the equation. We will need to use the product rule for the right-hand side of the equation. Remember that the product rule tells us to add the first function multiplied by the derivative of the second function to the second function multiplied by the derivative of the first function. If we do this, we will get:

y  =  x1 + ln (x) · 1
yx
  =  1 + ln (x)

Multiplying both sides by y gives us:

y′  =  (1 + ln (x)) · xx

*   *   *

Sometimes, the functions we are asked to differentiate may have a term raised to an exponent that is a function in its own right. Again, the normal rules of differentiation cannot be applied here, and we have to use logarithmic differentiation. Let's work through an example. Supposing we want to differentiate the following function:

y  =  x sin (x)

By now, you are hopefully becoming familiar with the procedure. The first thing we need to do, of course, is to take the natural logarithm of both sides:

ln (y)  =  ln (x sin (x))

Next, we expand the right-hand side using the third law of logarithms:

ln (y)  =  sin (x) · ln (x)

Now, we differentiate both sides of the equation, remembering to use the product rule for the right-hand side. This will give us:

y  =  sin (x)1 + ln (x) · cos (x)
yx
  =  sin (x) + ln (x) · cos (x)
x
  =  sin (x) + x · ln (x) · cos (x)
x

The last step is to multiply both sides by y:

y′  =  sin (x) + x · ln (x) · cos (x) · x sin (x)
x

There are numerous situations in which you may find it easier to carry out logarithmic differentiation than to apply the normal rules of differentiation. In fact, it will often be the only approach that works. We have only looked at a handful of examples here, but hopefully you can see how useful logarithmic differentiation can be. As with many other areas of mathematics, the more you practice the techniques involved, the easier they get. Before long, you should be able to look at a function and determine straight away whether or not logarithmic differentiation is called for.