Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Some useful rules for derivatives to apply are:

Rulef(x)f(x)f(x)f'(x)
Constantkk0
Powerxnx^n, n0n \ne 0nxn1nx^{n-1}
Multipleku(x)k u(x)ku(x)k u'(x)
Sumu(x)+v(x)u(x) + v(x)u(x)+v(x)u'(x) + v'(x)
Differenceu(x)v(x)u(x) - v(x)u(x)v(x)u'(x) - v'(x)
Exponentialaxa^xaxlnaa^x \ln a
Logarithmlogax\log_a x1xlna\dfrac{1}{x \ln a}

Note that two special cases of the last two derivatives occur when a=ea = e:

d ⁣exd ⁣x=exd ⁣lnxd ⁣x=1x\dd{}{e^x}{x} = e^x \qquad \dd{}{\ln x}{x} = \frac{1}{x}

Here are some examples showing how to explicitly apply them:

f(x)=x3\displaystyle f(x) = x^3

f(x)=3x31=3x2f'(x) = 3x^{3-1} = 3x^2

f(x)=x2+3\displaystyle f(x) = -x^2 + 3

f(x)=ddx(x2)+ddx(3)=ddx(x2)+ddx(3)=2x21+0=2x\begin{align} f'(x) &= \frac{d}{dx}(-x^2) + \frac{d}{dx}(3) \\ &= -\frac{d}{dx}(x^2) + \frac{d}{dx}(3) \\ &= -2x^{2-1} + 0 \\ &= -2x \end{align}

f(x)=4x33x+2ex\displaystyle f(x) = \frac{4x^3}{3} - x + 2e^x

f(x)=43ddx(x3)ddx(x)+2ddx(ex)=43(3x2)1+2ex=4x21+2ex\begin{align} f'(x) &= \frac{4}{3} \frac{d}{dx}(x^3) - \frac{d}{dx}(x) + 2 \frac{d}{dx}(e^x) \\ &= \frac{4}{3}(3x^2) - 1 + 2e^x \\ &= 4x^2 - 1 + 2e^x \end{align}

f(x)=3x2+x\displaystyle f(x) = \frac{3}{x^2} + \sqrt{x}

f(x)=3ddx(x2)+ddx(x1/2)=3(2x3)+12x1/2=6x3+12x\begin{align} f'(x) &= 3 \frac{d}{dx}(x^{-2}) + \frac{d}{dx}(x^{1/2}) \\ &= 3(-2x^{-3}) + \frac{1}{2} x^{-1/2} \\ &= \frac{-6}{x^3} + \frac{1}{2\sqrt{x}} \end{align}

f(x)=log(4x)f(x) = \log(4x)

f(x)=ddx[log4+logx]=ddx(log4)+ddx(logx)=0+1xln10\begin{align} f'(x) &= \frac{d}{dx} [\log 4 + \log x] \\ &= \frac{d}{dx}(\log 4) + \frac{d}{dx}(\log x) \\ &= 0 + \frac{1}{x \ln 10} \end{align}

There are other rules related to functions that are products, quotients, compositions, or trigonometric. We will go over each of those in more detail next.

Product rule

The product rule is used to differentiate functions that can be written as the product of two smaller functions.

To demonstrate this rule, consider f(x)=(x3)(x1)f(x) = (x-3)(x-1). Previously, we would have needed to expand this function before differentiating:

f(x)=x24x+3f(x)=2x4\begin{align} f(x) &= x^2 - 4x + 3 \\ f'(x) &= 2x - 4 \end{align}

With the product rule, instead we recognize

u=x3v=x1u=1v=1\begin{align} u &= x-3 & v &= x-1 \\ u' &= 1 & v' &= 1 \end{align}

so

f(x)=uv+vu=(x3)1+(x1)1=2x4f'(x) = uv' + vu' = (x-3) \cdot 1 + (x-1) \cdot 1 = 2x - 4

This example is a little silly, but the product rule is a life saver for functions that are hard to expand! Here are some better examples:

f(x)=(x+1)(2x2+5)(5x34)f(x) = (x+1)(2x^2 + 5)(5x^3-4)

Identify:

u=x+1v=(2x2+5)(5x34)u = x+1 \qquad v = (2x^2+5)(5x^3-4)

so

f(x)=(x+1)v+(2x2+3)(5x34)(1)f'(x) = (x+1)v' + (2x^2 +3)(5x^3-4)(1)

The derivative vv' can be evaluated by a second product rule!

u=2x2+5v=5x34u=4xv=15x2\begin{align} u &= 2x^2+5 & v &= 5x^3-4 \\ u' &= 4x & v' &= 15x^2 \end{align}

finally giving

f(x)=(x+1)[(2x2+3)(15x2)+(5x34)(4x)]+(2x2+5)(5x34)\begin{align} f'(x) &= (x+1)[(2x^2+3)(15x^2) + (5x^3-4)(4x)] \\ &+ (2x^2+5)(5x^3-4) \end{align}

f(x)=1xexf(x) = \dfrac{1}{x} e^x

Identify:

u=1xv=exu=1x2v=ex\begin{align} u &= \frac{1}{x} & v &= e^x \\ u' &= -\frac{1}{x^2} & v' &= e^x \end{align}

so

f(x)=1xex+ex(1x2)=ex(1x1x2)\begin{align} f'(x) &= \frac{1}{x}e^x + e^x(-\frac{1}{x^2}) \\ &= e^x\left(\frac{1}{x} - \frac{1}{x^2}\right) \end{align}

f(x)=(x2+3)lnxf(x) = (x^2+3)\ln x

Identify:

u=x2+3v=ln(x)u=2xv=1x\begin{align} u &= x^2+3 & v &= \ln(x) \\ u' &= 2x & v' &= \frac{1}{x} \end{align}

so

f(x)=(x2+3)1x+(lnx)(2x)=x2+3x+2xlnx\begin{align} f'(x) &= (x^2+3)\cdot\frac{1}{x} + (\ln x)(2x) \\ &= \frac{x^2+3}{x} + 2x\ln x \end{align}

Quotient Rule

To demonstrate this rule, consider f(x)=(x1)/xf(x) = (x-1)/x. Previously, we would have needed to separate the numerator before differentiating:

f(x)=11xf(x)=1x2\begin{align} f(x) &= 1 - \frac{1}{x} \\ f'(x) &= \frac{1}{x^2} \end{align}

With the qoutient rule, instead we recognize

u=x1v=xu=1v=1\begin{align} u &= x - 1 & v &= x \\ u' &= 1 & v' &= 1 \end{align}

so

f=x1(x1)1x2=1x2f' = \frac{ x \cdot 1 - (x-1) \cdot 1}{x^2} = \frac{1}{x^2}

This was obviously harder than the old way, but there are other cases where it is helpful to do the quotient rule! Here are some examples you can try:

f(x)=x21x4+2\displaystyle f(x) = \frac{x^2 -1}{x^4 + 2}

u=x21v=x4+2u=2xv=4x3\begin{align} u &= x^2 -1 & v &= x^4 +2 \\ u' &= 2x & v' &= 4x^3 \end{align}

so

f(x)=(x4+2)(2x)(x21)(4x3)(x4+2)2=2x5+4x24x5+4x3x8+2x4+4\begin{align} f'(x) &= \frac{ (x^4 + 2) \cdot (2x) - (x^2 - 1) \cdot (4x^3)}{(x^4 +2)^2}\\ &= \frac{2x^5 + 4x^2 - 4x^5 +4x^3}{x^8 + 2x^4 + 4} \end{align}

f(x)=ex1+x\displaystyle f(x) = \frac{e^{x}}{1 + x}

u=exv=1+xu=exv=1\begin{align} u &= e^{x} & v &= 1 + x \\ u' &= e^{x} & v' &= 1 \end{align}

so

f(x)=(1+x)exex1(1+x)2=xex(1+x)2\begin{align} f'(x) &= \frac{(1 + x) \cdot e^{x} - e^{x} \cdot 1}{(1 + x)^2} \\ &= \frac{x e^{x}}{(1 + x)^2} \end{align}

f(x)=(x1)(x22x)x4\displaystyle f(x) = \frac{(x - 1)(x^2 - 2x)}{x^4}

u=v=x4u=3x26x+2v=4x3\begin{align} u &= & v &= x^4\\ u' &= 3x^2 - 6x + 2 & v' &= 4x^3 \\ \end{align}

so

f(x)=x4(3x26x+2)(x33x2+2x)4x3x8=x6+6x56x4x8=1x2+6x36x4\begin{align} f'(x) &= \frac{x^4 \cdot (3x^2-6x+2) - (x^3 -3x^2 +2x) \cdot 4x^3}{x^8} \\ &= \frac{-x^6 + 6x^5 - 6x^4}{x^8} \\ &= -\frac{1}{x^2} + \frac{6}{x^3} - \frac{6}{x^4} \end{align}

Note, though, that in this case we could also have expanded the numerator, divided through by x8x^8, and differentiated term-by-term to arrive at the same answer. The faster route depends on the problem!

Chain rule

The chain rule is used to differentiate composite functions, when the “inside” of the function is more complicated than what we know.

To demonstrate this rule, consider f(x)=(x1)2f(x) = (x-1)^2. Previously, we would have needed to expand this function before differentiating:

f(x)=x22x+1f(x)=2x2\begin{align} f(x) &= x^2 - 2x + 1 \\ f'(x) &= 2x - 2 \end{align}

With the chain rule, instead we recognize

u=x1f=u2u=1f=2u\begin{align} u &= x - 1 & f &= u^2 \\ u' &= 1 & f' &= 2u \end{align}

so

f(x)=d ⁣fd ⁣ud ⁣ud ⁣x=2ud ⁣ud ⁣x=2(x1)1=2x2f'(x) = \dd{}{f}{u} \dd{}{u}{x} = 2u \dd{}{u}{x} = 2(x-1) \cdot 1 = 2x - 2

The results match! Some additional examples:

f(x)=ex2f(x) = e^{x^2}

Make the replacement u=x2u = x^2:

u=x2f=euu=2xf=eu\begin{align} u &= x^2 & f &= e^u \\ u' &= 2x & f' &= e^u \end{align}

so

f(x)=d ⁣fd ⁣ud ⁣ud ⁣x=eud ⁣ud ⁣x=ex22xf'(x) = \dd{}{f}{u} \dd{}{u}{x} = e^{u} \dd{}{u}{x} = e^{x^2} \cdot 2x

f(x)=ln(1+2x)f(x) = \ln(1 + 2x)

Make the replacement u=1+2xu = 1+2x:

u=1+2xf=lnuu=2f=1u\begin{align} u &= 1 + 2x & f &= \ln u \\ u' &= 2 & f' &= \frac{1}{u} \end{align}

so

f(x)=d ⁣fd ⁣ud ⁣ud ⁣x=1ud ⁣ud ⁣x=21+2xf'(x) = \dd{}{f}{u} \dd{}{u}{x} = \frac{1}{u} \dd{}{u}{x} = \frac{2}{1 + 2x}

f(x)=21+2xf(x) = \dfrac{2}{1 + 2x}

Make the replacement u=1+2xu = 1+2x:

u=1+2xf=2u1u=2f=2u2\begin{align} u &= 1 + 2x & f &= 2u^{-1} \\ u' &= 2 & f' &= -2u^{-2} \end{align}

so

f(x)=d ⁣fd ⁣ud ⁣ud ⁣x=2u2d ⁣ud ⁣x=4(1+2x)2f'(x) = \dd{}{f}{u} \dd{}{u}{x} = -2u^{-2} \cdot \dd{}{u}{x} = \frac{-4}{(1 + 2x)^2}

Trigonometric functions

f(x)f(x)f(x)f'(x)f(x)f(x)f(x)f'(x)
sinx\sin xcosx\cos xcscx\csc xcscxcotx-\csc x \cot x
cosx\cos xsinx-\sin xsec(x)\sec(x)secxtanx\sec x \tan x
tanx\tan xsec2x\sec^2 xcotx\cot xcsc2x-\csc^2 x

All of these follow from knowing only two derivatives: sinx\sin x and cosx\cos x! For example, to find the derivative of tanx\tan x, use the quotient rule:

f(x)=tanx=sinxcosxf(x)=cosxcosxsinx(sinx)cos2x=sin2x+cos2xcos2x=1cos2x=sec2x\begin{align} f(x) &= \tan x = \frac{\sin x}{\cos x} \\ f'(x) &= \frac{\cos x \cdot \cos x - \sin x \cdot (-\sin x)}{\cos^2 x} \\ &= \frac{\sin^2 x + \cos^2 x}{\cos^2 x}\\ &= \frac{1}{\cos^2 x} \\ &= \sec^2 x \end{align}

Or, to find the derivative of cscx\csc x, use the chain rule:

f(x)=cscx=(sinx)1f(x)=(sinx)2d ⁣d ⁣x(sinx)=(sinx)2(cosx)=1sinxcosxsinx=cscxcotx\begin{align} f(x) &= \csc x = (\sin x)^{-1} \\ f'(x) &= -(\sin x)^{-2} \dd{}{}{x}(\sin x) \\ &= (\sin x)^{-2} \cdot (-\cos x) \\ &= \frac{-1}{\sin x} \frac{\cos x}{\sin x} \\ &= -\csc x \cot x \end{align}

Some additional examples to practice:

f(x)=3cosx+sinxf(x) = 3 \cos x + \sin x

f=3d ⁣d ⁣x(cosx)+4d ⁣d ⁣x(sinx)=3sinx+4cosx\begin{align} f' &= 3 \dd{}{}{x}(\cos x) + 4 \dd{}{}{x}(\sin x)\\ &= -3\sin x + 4\cos x \end{align}

f(x)=2sinxcosxf(x) = 2 \sin x \cos x

Use the product rule with:

u=sinxv=cosxu=cosxv=sinx\begin{align} u &= \sin x & v &= \cos x\\ u' &= \cos x & v' &= -\sin x \end{align}

so

f=2[sinx(sinx)+cosx(cosx)]=2(cos2xsin2x)=2cos2x\begin{align} f' &= 2[\sin x(-\sin x) + \cos x(\cos x)] \\ &= 2(\cos^2 x-\sin^2 x) \\ &= 2 \cos 2x\\ \end{align}

f(x)=sin2xf(x) = \sin 2x

Use the chain rule with

u=2xf=sinuu=2f=cosu\begin{align} u &= 2x & f &= \sin u \\ u' &= 2 & f' = \cos u \end{align}

so

f=cosu2=2cos2xf' = \cos{u} \cdot 2 = 2 \cos 2 x

f(x)=tan(x2+2x+3)f(x) = \tan({x^2+2x+3})

Use the chain rule with

u=x2+2x+3f=tanuu=2x+2f=sec2u\begin{align} u &= x^2+2x+3 & f = \tan u\\ u' &= 2x+2 & f' = \sec^2 u\\ \end{align}

so

f=sec2uu=(2x+2)sec2(x2+2x+3)\begin{align} f' &= \sec^2 u \cdot u'\\ &= (2x+2)\sec^2(x^2+2x+3)\\ \end{align}

f(x)=ecos2xf(x) = e^{\cos^2 x}

Use the chain rule with

u=cos2xf=euu=d ⁣d ⁣x(cos2x)f=eu\begin{align} u &= \cos^2 x & f = e^{u}\\ u' &= \dd{}{}{x}(\cos^2 x) & f' = e^{u} \end{align}

So

f=euu=ecos2xd ⁣d ⁣x(cos2x)f' = e^{u} u' = e^{\cos^2 x} \dd{}{}{x}(\cos^2 x)

Use the chain rule again with

u=cosxf=u2u=sinxf=2u\begin{align} u &= \cos x & f = u^{2}\\ u' &= -\sin x & f' = 2u\\ \end{align}

So

f=ecos2x(2uu)=ecos2x(2cosxsinx)=2sinxcosxecos2x\begin{align} f' &= e^{\cos^2 x}(2uu')\\ &= e^{\cos^2 x}(2\cos x \cdot -\sin x)\\ &= -2 \sin x \cos x e^{\cos^2 x}\\ \end{align}

Last, let’s look at a physics application of these techniques:

Example: Harmonic oscillator

A harmonic oscillator is a mass m on a Hookean spring. The spring force is F=kxF = -kx, where k is the spring constant and x is the displacement of the mass.

Harmonic oscillator

If the mass is initially displaced to x(0)x(0), it will then move according to:

x(t)=x(0)cos(2πtT)x(t) = x(0) \cos\left(\frac{2\pi t}{T}\right)

where

T=12πmkT = \frac{1}{2\pi} \sqrt{\frac{m}{k}}
Oscillator displacement

How fast is the oscillator moving at any given time? When is the oscillator moving fastest?


We want to calculate the velocity v=x(t)v = x'(t). Use the chain rule with:

u=2πtTf=x(0)cosuu=2πTf=x(0)sinu\begin{align} u &= \frac{2\pi t}{T} & f &= x(0) \cos u \\ u' &= \frac{2\pi}{T} & f' &= -x(0) \sin u \end{align}

so

v=d ⁣xd ⁣t=f(u)u=x(0)sinuu=2πx(0)Tsin(2πtT)\begin{align} v &= \dd{}{x}{t} = f'(u) \cdot u' \\ &= -x(0) \sin u \cdot u' \\ &= -\frac{2\pi x(0)}{T} \sin\left(\frac{2\pi t}{T}\right) \end{align}

A function is at an extrema when its derivative is zero. If the function is velocity, this derivative is the acceleration a and is equal to zero, a=v=0a = v' = 0. This means the mass is not accelerating! Using the chain rule again:

a=v=(2πT)2x(0)cos(2πtT)=0a = v' = -\left(\frac{2\pi}{T}\right)^2 x(0) \cos\left(\frac{2\pi t}{T}\right) = 0

The roots occur at t=T/4t = T/4 or 3T/43T/4, when x=0x = 0 and the spring is no longer stretched. All potential energy has been converted to kinetic energy!