# 5. Derivative of the Logarithmic Function

by M. Bourne

### Later On this Page

Derivative of *y* = ln *x*

Derivative of a log of a function

Derivative of logs with base other than *e*

First, let's look at a graph of the log function with base *e*, that is:

f(x) = log_{e}(x) (usually written "lnx").

The tangent at *x* = 2 is included on the graph.

The **slope** of the tangent of *y* = ln *x* at `x = 2` is `1/2`. (We can observe this from the graph, by looking at the ratio rise/run).

If *y* = ln *x*,

`x` | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|

slope of graph | `1` | `1/2` | `1/3` | `1/4` | `1/5` |

`1/x` | `1` | `1/2` | `1/3` | `1/4` | `1/5` |

We see that the slope of the graph for each value of *x* is equal to `1/x`. This works for **any** positive value of *x* (we cannot have the logarithm of a negative number, of course).

If we did many more examples, we could conclude that the derivative of the logarithm function *y* = ln *x* is

`dy/dx = 1/x`

**Note 1: **Actually, this result comes from first principles.

**Note 2:** We are using logarithms with base *e*. If you need a reminder about log functions, check out Log base *e* from before.

## Derivative of the Logarithm Function *y* = ln *x*

The derivative of the logarithmic function *y* = ln *x * is given by:

`d/(dx)(ln\ x)=1/x`

You will see it written in a few other ways as well. The following are equivalent:

`d/(dx)log_ex=1/x`

If

y= lnx, then `(dy)/(dx)=1/x`

We now show where the formula for the derivative of `log_e x` comes from, using first principles.

Proof of formula

For this proof, we'll need the following background mathematics.

First principles formula for the derivative of a function `f(x)`, that is:

`(df)/(dx) = lim_{h->0}(f(x+h)-f(x))/h`

`log a - log b= log (a/b)`

and

`n log a = log a^n`.

The fact "log" and `e` are inverses, so

`log_e(e) = 1`.

The well-known limit

`lim_{t->0}(1+t)^{1"/"t} = e`

(We will not prove this limit here. The graph on the right demonstrates that as `t->0`, the graph of `y=(1+t)^{1"/"t}` approaches the value `e~~2.71828`.)

I will write `log(x)` to mean `log_e(x) = ln(x)`, to make it easier to read.

We have `f(x) = log(x)` so the derivative will be given by:

`(df)/(dx) = lim_{h->0}(log(x+h)-log(x))/h `

Now the top of our fraction is

`log(x+h)-log(x)` ` = log((x+h)/x)` ` = log(1 + h/x)`.

To simplify the algebra, we now substitute `t=h/x` and this gives us `h = xt`. Of course,

`lim_{h->0}(h) = lim_{t->0}(xt) = 0`.

So we have now:

`(log(x+h)-log(x))/h` ` = 1/(xt)log(1 + t)`.

We write this as:

`1/x[1/tlog(1 + t)]`.

Considering the expression in square brackets, we use the log law

`n log a = log a^n`

and write:

`1/tlog(1 + t) = log(1+t)^(1"/"t}`

Next, the limit of the expression `(1+t)^(1"/"t}` is:

`lim_{t->0}(1 + t)^{1"/"t} = e`.

Because `log(e)=1`, we can conclude:

`(dlog(x))/(dx) = lim_{h->0}(log(x+h)-log(x))/h`

`= 1/x log(lim_{t->0}(1 + t)^{1"/"t})`

` = 1/x log(e)`

` = 1/x`

Please support IntMath!

### Tip

For some problems, we can use the logarithm laws to simplify our log expression before differentiating it.

### Example 1

Find the derivative of

y= ln 2x

Answer

We use the log law:

log

ab= loga+ logb

We can write our question as:

y= ln 2x= ln 2 + lnx

Now, the derivative of a constant is 0, so

`d/(dx)ln\ 2=0`

So we are left with (from our formula above)

`d/(dx)(ln\ x)=1/x`

The final answer is:

`(dy)/(dx)=1/x`

We can see from the following graph that the slope of *y* = ln 2*x* (curve in green, tangent in magenta) is the same as the slope of *y* = ln *x* (curve in gray, tangent in dashed gray), at the point *x* = 2.

### Example 2

Find the derivative of

y= lnx^{2}

Answer

We use the log law:

log

a=^{n}nloga

So we can write the question as

y= lnx^{2}= 2 lnx

The derivative will be simply 2 times the derivative of ln *x*.

So the answer is:

`d/(dx)ln\ x^2=2 d/(dx)ln\ x=2/x`

We can see from the graph of *y* = ln *x*^{2} (curve in black, tangent in red) that the slope is twice the slope of *y* = ln *x* (curve in blue, tangent in pink).

NOTE: The graph of `y=ln(x^2)` actually has 2 "arms", one on the negative side and one on the positive. The above graph only shows the positive arm for simplicity.

Please support IntMath!

## Derivative of *y* = ln *u* (where *u* is a function of *x*)

Unfortunately, we can only use the logarithm laws to help us in a limited number of logarithm differentiation question types.

Most often, we need to find the derivative of a logarithm of some function of *x*. For example, we may need to find the derivative of *y* = 2 ln (3*x*^{2} − 1).

We need the following formula to solve such problems.

If

y= lnu

and *u* is some function of *x*, then:

`(dy)/(dx)=(u')/u`

where

u'is the derivative ofu

Another way to write this is

`(dy)/(dx)=1/u(du)/(dx)`

You might also see the following form. It means the same thing.

If

y= lnf(x),

then the derivative of *y* is given by:

`(dy)/(dx)=(f'(x))/(f(x)`

### Example 3

Find the derivative of

y= 2 ln (3x^{2}− 1).

Answer

We put

u= 3x^{2}− 1

Then the derivative of *u* is given by:

`u'=(du)/dx=6x`

So the final answer is :

`(dy)/(dx)=2 (u')/u`

`=2xx(6x)/(3x^2-1)`

`=(12x)/(3x^2-1)`

### Example 4

Find the derivative of

y= ln(1 − 2x)^{3}.

Answer

First, we simplify our log expression using the log law:

log

a=^{n}nloga

We can write

y= ln(1−2x)^{3}= 3 ln(1−2x)

Then we put

u= 1 − 2x

So

`u' = (du)/dx=-2`

So our answer is:

`(dy)/(dx)=3 (u')/u`

`=3xx(-2)/(1-2x)`

`=(-6)/(1-2x)`

### Example 5

Find the derivative of `y=ln[(sin 2x)(sqrt(x^2+1))]`

Answer

First, we use the following log laws to simplify our logarithm expression:

log

ab= loga+ logb

and

log

a=^{n}nloga

So we can write our question as:

`y=ln[(sin 2x)(sqrt(x^2+1))]`

`=ln(sin 2x)+ln(sqrt(x^2+1))`

`=ln(sin 2x)+ln(x^2+1)^(1/2)`

`=ln(sin 2x)+1/2ln(x^2+1)`

Next, we use the following rule (twice) to differentiate the two log terms:

`(dy)/(dx)=(u')/u`

For the first term,

u= sin 2x

u' = 2 cos 2x

For the second term, we put

u=x^{2}+ 1,

giving

u' = 2x

So our final answer is:

`(dy)/(dx)=(2\ cos 2x)/(sin 2x)+1/2 (2x)/(x^2+1)`

`=2\ cot\ 2x+x/(x^2+1)`

Easy to understand math videos:

MathTutorDVD.com

## Differentiating Logarithmic Functions with Bases other than *e*

If

u=f(x) is a function ofx,

and

y= log_{b}uis a logarithm with baseb,

then we can obtain the derivative of the logarithm function with base *b* using:

`(dy)/(dx)=(log_be)(u')/u`

where

`u'` is the derivative of

ulog

is a constant. See change of base rule to see how to work out such constants on your calculator.)_{b}e

**Note 1:** This formula is derived from first principles.

**Note 2: **If we choose *e* as the base, then the derivative of ln *u*, where *u* is a function of *x*, simply gives us our formula above:

`(dy)/(dx)=(u')/u`

[Recall that log

= 1. ]_{e}e

[See the chapter on Exponential and Logarithmic Functions base *e* if you need a refresher on all this.]

### Example 6

Find the derivative
of *y* = log_{2}6*x*.

Answer

We begin by using the following log rule to simplify our question:

log

ab= loga+ logb

We can write our question as:

y= log_{2}6x= log_{2}6 + log_{2}x

The first term, log_{2}6, is a constant, so its derivative is 0.

The derivative of the second term is as follows, using our formula:

`(dy)/(dx)=(log_2e) (1/x)=(log_2e)/x`

The term on the top, log_{2}*e*, is a constant. If we need a decimal value, we can work it out using change of base as follows:

`log_2e=(log_10e)/(log_10 2)=1.442695041`

### Example 7

Find the derivative
of *y* = 3 log_{7}(*x*^{2} + 1).

Answer

We put

u=x^{2}+ 1,

giving

u' = 2x

Applying the formula, we have:

`(dy)/(dx)=3\ (log_7e)(2x)/(x^2+1)`

`=6\ (log_7e) x/(x^2+1)`

`=3.083 x/(x^2+1)`

The value 3.083 comes from using the change of base rule.

**Note: **Where possible, always use the properties of logarithms to simplify
the process of obtaining the derivatives.

## Exercises

1. Find the derivative of

y= ln(2x^{3}−x)^{2}.

Answer

Using the Log Law `log a^n = n log a`, we can write:

*y* = ln(2*x*^{3} − *x*)^{2} = 2 ln(2*x*^{3} − *x*)

Put

`u = 2x^3 − x`

so

`u' = 6x^2 − 1`

This gives us:

`(dy)/(dx)=` `(dy)/(du)(du)/(dx) ` `=2(6x^2-1)/(2x^3-x`

`x ≠ ±sqrt(0.5)`,

`x ≠ 0`

**NOTE:** We need to be careful with the domain of this solution, as it is only correct for certain values
of *x*.

The graph of *y* = ln(2*x*^{3} − *x*)^{2} (which has **power 2**) is defined for all *x* except

` Âħsqrt(0.5), 0`

Its graph is as follows:

The graph of *y* = 2 ln(2*x*^{3} − *x*), however, (it has **2 ×** at the front) is only defined for a more limited
domain (since we cannot have the logarithm of a negative
number.)

So we can only have *x* in the range `-sqrt 0.5 < x < 0` and `x > sqrt0.5.`

So when we find the differentiation of a logarithm using the shortcut given above, we need to be careful that the domain of the function and the domain of the derivative are stated.

2. Find the derivative of

y= ln(cosx^{2}).

Answer

Firstly,

`d/(dx)cos x^2=-2x\ sin x^2`

So

`(dy)/(dx)=(-2x\ sin x^2)/(cos x^2)=-2x\ tan x^2`

Get the Daily Math Tweet!

IntMath on Twitter

3. Find the derivative of

y=xln^{3}x.

Answer

The notation

`y = x(ln^3 x)`

means

`y = x(ln x)^3`

Note that we **cannot** use the log law

`log a^n= n log a`

Our expression is **not**

`y = x\ ln x^3`

The brackets make all the difference!

This is a product of *x* and `(ln x)^3`. So

`(dy)/(dx)=x(3(ln x)^2)/x+(ln x)^3(1)`

`=3(ln x)^2+(ln x)^3`

`=(ln x)^2(3+ln x)`

Get the Daily Math Tweet!

IntMath on Twitter

4. Find the derivative of

3 ln

xy+ siny=x^{2}.

Answer

We need to recognise that this is an **implicit function.** We can simplify it first:

`3(ln\ x+ln\ y)+sin y=x^2`

Taking derivatives:

`3(1/x+1/y(dy)/(dx))+cos y (dy)/(dx)=2x`

Collecting terms gives us:

`3/y(dy)/(dx)+cos y(dy)/(dx)=2x-3/x`

`(dy)/(dx)(3/y+cos y)=2x-3/x`

So

`(dy)/(dx)=(2x-3/x)/(3/y+cos y)`

`=(2x^2y-3y)/(3x+xy\ cos y)`

Easy to understand math videos:

MathTutorDVD.com

5. Find the derivative of

y= (sinx)^{x}

by first taking logarithms of each side of the equation.

Answer

**NOTE**: This has an exponent which is **variable.** We cannot use our formula

`d/dx x^n=nx^(n-1)`

from before.

Now

`ln\ y=ln[(sin x)^x]=x\ ln(sin x)`

So

`1/y(dy)/(dx)=x(cos x)/(sin x)+ln(sin x)(1)`

Multiplying through by `y` gives:

`(dy)/(dx)=y(x\ cot\ x+ln(sin x))`

`=(sin x)^x(x\ cot\ x+ln(sin x))`

The graph of the function in Exercise 5 is quite interesting:

The graph of *y* = (sin *x*)^{x}.

### Search IntMath, blog and Forum

### Online Calculus Solver

This calculus solver can solve a wide range of math problems.

Go to: Online algebra solver

### Calculus Lessons on DVD

Math videos by MathTutorDVD.com

Easy to understand calculus lessons on DVD. See samples before you commit.

More info: Calculus videos

### The IntMath Newsletter

Sign up for the free **IntMath Newsletter**. Get math study tips, information, news and updates each fortnight. Join thousands of satisfied students, teachers and parents!