Differentiation of a Logarithm

Let y=lnx. To differentiate, we follow the steps:

Step 1: y+Δy=ln(x+Δx) Step 2:
Δy=ln(x+Δx)lnx=ln(x+Δxx)=ln(1+Δxx)
Step 3:
ΔyΔx=1Δxln(1+Δxx)=ln(1+Δxx)1/Δx=1xln(1+Δxx)xΔx
Dividing the logarithm by x and at the same time multiplying the exponent of the parentheses by x changes the form of the expression but not its value. That is, lnu=1alnua.] Step 4:
dydx=limΔx0ΔyΔx=limΔx0[1xln(1+Δxx)xΔx]=1xlimΔx0[ln(1+Δxx)xΔx]=1xln[limΔx0(1+Δxx)xΔx]=1xlne=1x.
[Note than when Δx0, Δxx0. Therefore, limΔx0(1+Δxx)xΔx=e from placing u=Δxx in limu0(1+u)1/u=e
(see here)].

Hence
(a)ddxlnx=1x,(x>0).

Now consider y=logax. What is dy/dx?
We write y=logax=lnxlna. Therefore
dydx=1lnaddxlnx=1lna1x.
(b)ddxlogax=1xlna,(x>0).

  • If u(x)>0 is a differentiable function, applying the chain rule to (a) produces: ddxlnu=1ududx
  • When possible, to differentiate a function involving logarithms, first use the properties of logarithms to convert products to sums, quotients to differences and exponents to constant multiples then differentiate the result.
Example 1

Find the equation of the tangent line to the curve of y=ln(x2+1) when x=0.

Solution

The slope of the tangent is dy/dx
dydx=ddxln(x2+1u)=1ududx=1x2+1(2x)=2xx2+1
The slope of the tangent mtan when x=0 is obtained by substituting 0 for x in the above equation: mtan=2xx2+1|x=0=0 Because when x=0, y=ln(0+1)=0, the horizontal line y=0 is tangent to the graph of y=ln(x2+1) at the origin. The graph of y=ln(x2+1) is shown below.

Fig 1: The tangent line to the graph of y=ln(1+x2) at (0,0) is horizontal.
Example 2

Find ddx[lnx+1(2+cosx)x2]

Solution

ddx[lnx+1(2+cosx)x2]=ddx[lnx+1+ln(2+cosx)lnx2]=ddx[12ln(x+1)+ln(2+cosx)2lnx]=12(x+1)+12+cosx(ddxcosx)2x=12(x+1)sinx2+cosx2x

Now an important example:

Example 3

Find ddxln|x|.

Solution

We consider two cases:

(a) x>0. Then |x|=x and ddxln|x|=ddxlnx=1x. (b) x<0. Then |x|=x and
ddxln|x|=ddxln(x)=1xddx(x)=1x(1)=1x.
Because we get the same results in both cases, we conclude
ddxln|x|=1x.

From the above example, we conclude

(c)ddxln|x|=1x.

Example 4

Find ddxln|cosx|.

Solution

Let u=cosx. Then ddxln|cosx|=ddxln|u| and it follows from Equation (c) that

ddxln|cosx|=1ududx=1cosx(sinx)=tanx.

Logarithmic Differentiation

To differentiate a function y=f(x) with respect to x and f composed of products, quotients, and exponents, it is sometimes easier to:

  1. Take the natural logarithm of both sides of y=f(x)
  2. Expand the right side using the properties of logarithms.
  3. Eake derivative of both sides
  4. Isolate dy/dx and replace y with the original function.

Example 5

Find y given
y=xsinx(2x)1+x4

Solution

This would be really messy to differentiate y directly. Instead we can use logarithmic differentiation.

First we take the natural logarithm of both sides and exapnd the right hand side using the properties of logarithms:
lny=lnxsinx(2x)1+x4=lnx+lnsinxln(2x)12ln(1+x4).
Now we can differentiate both sides:
1yy=1x+1sinx(ddxsinx)12x(ddx(2x))12(1+x4)ddx(1+x4)
or
yy=1x+cosxsinx(1)2x4x32(1+x4)
Multiplying both sides by y:
y=y[1x+cosxsinx+12x2x31+x4]=xsinx(2x)1+x4[1x+cosxsinx+12x2x31+x4]
We have found the solution, but we may want to simplify it further:
y=sinx(2x)1+x4+xcosx(2x)1+x4+xsinx(2x)21+x42x4sinx(2x)(1+x4)3=sinx+xcosx(2x)1+x4+xsinx(2x)21+x42x4sinx(2x)(1+x4)3