1.5. Rules for derivatives#

Some useful rules for derivatives to apply are:

Rule

\(f(x)\)

\(f'(x)\)

Constant

\(k\)

\(0\)

Power

\(x^n\), \(n \ne 0\)

\(nx^{n-1}\)

Multiple

\(k u(x)\)

\(k u'(x)\)

Sum

\(u(x) + v(x)\)

\(u'(x) + v'(x)\)

Difference

\(u(x) - v(x)\)

\(u'(x) - v'(x)\)

Exponential

\(a^x\)

\(a^x \ln a\)

Logarithm

\(\log_a x\)

\(\dfrac{1}{x \ln a}\)

Note that two special cases of the last two derivatives occur when \(a = e\):

(1.70)#\[\begin{equation} \dd{}{e^x}{x} = e^x \qquad \dd{}{\ln x}{x} = \frac{1}{x} \end{equation}\]
  1. \(\displaystyle f(x) = x^3\)

    Solution
    (1.71)#\[\begin{equation} f'(x) = 3x^{3-1} = 3x^2 \end{equation}\]
  2. \(\displaystyle f(x) = -x^2 + 3\)

    Solution
    (1.72)#\[\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}\]
  3. \(\displaystyle f(x) = \frac{4x^3}{3} - x + 2e^x\)

    Solution
    (1.73)#\[\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}\]
  4. \(\displaystyle f(x) = \frac{3}{x^2} + \sqrt{x}\)

    Solution
    (1.74)#\[\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}\]
  5. \(f(x) = \log(4x)\)

    Solution
    (1.75)#\[\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.

1.5.1. 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) = (x-3)(x-1)\). Previously, we would have needed to expand this function before differentiating:

(1.77)#\[\begin{align} f(x) &= x^2 - 4x + 3 \\ f'(x) &= 2x - 4 \end{align}\]

With the product rule, instead we recognize

(1.78)#\[\begin{align} u &= x-3 & v &= x-1 \\ u' &= 1 & v' &= 1 \end{align}\]

so

(1.79)#\[\begin{equation} f'(x) = uv' + vu' = (x-3) \cdot 1 + (x-1) \cdot 1 = 2x - 4 \end{equation}\]

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

  1. \(f(x) = (x+1)(2x^2 + 5)(5x^3-4)\)

    Solution

    Identify:

    (1.80)#\[\begin{equation} u = x+1 \qquad v = (2x^2+5)(5x^3-4) \end{equation}\]

    so

    (1.81)#\[\begin{equation} f'(x) = (x+1)v' + (2x^2 +3)(5x^3-4)(1) \end{equation}\]

    The derivative \(v'\) can be evaluated by a second product rule!

    (1.82)#\[\begin{align} u &= 2x^2+5 & v &= 5x^3-4 \\ u' &= 4x & v' &= 15x^2 \end{align}\]

    finally giving

    (1.83)#\[\begin{align} f'(x) &= (x+1)[(2x^2+3)(15x^2) + (5x^3-4)(4x)] \\ &+ (2x^2+5)(5x^3-4) \end{align}\]
  2. \(f(x) = \dfrac{1}{x} e^x\)

    Solution

    Identify:

    (1.84)#\[\begin{align} u &= \frac{1}{x} & v &= e^x \\ u' &= -\frac{1}{x^2} & v' &= e^x \end{align}\]

    so

    (1.85)#\[\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}\]
  3. \(f(x) = (x^2+3)\ln x\)

    Solution

    Identify:

    (1.86)#\[\begin{align} u &= x^2+3 & v &= \ln(x) \\ u' &= 2x & v' &= \frac{1}{x} \end{align}\]

    so

    (1.87)#\[\begin{align} f'(x) &= (x^2+3)\cdot\frac{1}{x} + (\ln x)(2x) \\ &= \frac{x^2+3}{x} + 2x\ln x \end{align}\]

1.5.2. Quotient Rule#

Hint

One mnemonic that may or may not help remember this:

If the quotient rule you wish to know, it’s “low-d-high less high-d-low”… then draw the line and, down below, denominator squared will go.

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

(1.89)#\[\begin{align} f(x) &= 1 - \frac{1}{x} \\ f'(x) &= \frac{1}{x^2} \end{align}\]

With the qoutient rule, instead we recognize

(1.90)#\[\begin{align} u &= x - 1 & v &= x \\ u' &= 1 & v' &= 1 \end{align}\]

so

(1.91)#\[\begin{equation} f' = \frac{ x \cdot 1 - (x-1) \cdot 1}{x^2} = \frac{1}{x^2} \end{equation}\]

This was obviously harder than the old way, but there are other cases where it is helpful to do the quotient rule!

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

    Solution
    (1.92)#\[\begin{align} u &= x^2 -1 & v &= x^4 +2 \\ u' &= 2x & v' &= 4x^3 \end{align}\]

    so

    (1.93)#\[\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}\]
  2. \(\displaystyle f(x) = \frac{e^{x}}{1 + x}\)

    Solution
    (1.94)#\[\begin{align} u &= e^{x} & v &= 1 + x \\ u' &= e^{x} & v' &= 1 \end{align}\]

    so

    (1.95)#\[\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}\]
  3. \(\displaystyle f(x) = \frac{(x - 1)(x^2 - 2x)}{x^4}\)

    Solution
    (1.96)#\[\begin{align} u &= & v &= x^4\\ u' &= 3x^2 - 6x + 2 & v' &= 4x^3 \\ \end{align}\]

    so

    (1.97)#\[\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 \(x^8\), and differentiated term-by-term to arrive at the same answer. The faster route depends on the problem!

1.5.3. 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) = (x-1)^2\). Previously, we would have needed to expand this function before differentiating:

(1.99)#\[\begin{align} f(x) &= x^2 - 2x + 1 \\ f'(x) &= 2x - 2 \end{align}\]

With the chain rule, instead we recognize

(1.100)#\[\begin{align} u &= x - 1 & f &= u^2 \\ u' &= 1 & f' &= 2u \end{align}\]

so

(1.101)#\[\begin{equation} f'(x) = \dd{}{f}{u} \dd{}{u}{x} = 2u \dd{}{u}{x} = 2(x-1) \cdot 1 = 2x - 2 \end{equation}\]

The results match! Some additional examples:

  1. \(f(x) = e^{x^2}\)

    Solution

    Make the replacement \(u = x^2\):

    (1.102)#\[\begin{align} u &= x^2 & f &= e^u \\ u' &= 2x & f' &= e^u \end{align}\]

    so

    (1.103)#\[\begin{equation} f'(x) = \dd{}{f}{u} \dd{}{u}{x} = e^{u} \dd{}{u}{x} = e^{x^2} \cdot 2x \end{equation}\]
  2. \(f(x) = \ln(1 + 2x)\)

    Solution

    Make the replacement \(u = 1+2x\):

    (1.104)#\[\begin{align} u &= 1 + 2x & f &= \ln u \\ u' &= 2 & f' &= \frac{1}{u} \end{align}\]

    so

    (1.105)#\[\begin{equation} f'(x) = \dd{}{f}{u} \dd{}{u}{x} = \frac{1}{u} \dd{}{u}{x} = \frac{2}{1 + 2x} \end{equation}\]
  3. \(f(x) = \dfrac{2}{1 + 2x}\)

    Solution

    Make the replacement \(u = 1+2x\):

    (1.106)#\[\begin{align} u &= 1 + 2x & f &= 2u^{-1} \\ u' &= 2 & f' &= -2u^{-2} \end{align}\]

    so

    (1.107)#\[\begin{equation} f'(x) = \dd{}{f}{u} \dd{}{u}{x} = -2u^{-2} \cdot \dd{}{u}{x} = \frac{-4}{(1 + 2x)^2} \end{equation}\]

1.5.4. Trigonometric functions#

\(f(x)\)

\(f'(x)\)

\(f(x)\)

\(f'(x)\)

\(\sin x\)

\(\cos x\)

\(\csc x\)

\(-\csc x \cot x\)

\(\cos x\)

\(-\sin x\)

\(\sec(x)\)

\(\sec x \tan x\)

\(\tan x\)

\(\sec^2 x\)

\(\cot x\)

\(-\csc^2 x\)

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

(1.108)#\[\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 \(\csc x\), use the chain rule:

(1.109)#\[\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}\]

Example: Harmonic oscillator

A harmonic oscillator is a mass m on a Hookean spring. The spring force is \(F = -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)\), it will then move according to:

(1.110)#\[\begin{equation} x(t) = x(0) \cos\left(\frac{2\pi t}{T}\right) \end{equation}\]

where

(1.111)#\[\begin{equation} T = \frac{1}{2\pi} \sqrt{\frac{m}{k}} \end{equation}\]
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)\). Use the chain rule with:

(1.112)#\[\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

(1.113)#\[\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' = 0\). This means the mass is not accelerating! Using the chain rule again:

(1.114)#\[\begin{equation} a = v' = -\left(\frac{2\pi}{T}\right)^2 x(0) \cos\left(\frac{2\pi t}{T}\right) = 0 \end{equation}\]

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

  1. \(f(x) = 3 \cos x + \sin x\)

    Solution
    (1.115)#\[\begin{align} f' &= 3 \dd{}{}{x}(\cos x) + 4 \dd{}{}{x}(\sin x)\\ &= -3\sin x + 4\cos x \end{align}\]
  2. \(f(x) = 2 \sin x \cos x\)

    Solution

    Use the product rule with:

    (1.116)#\[\begin{align} u &= \sin x & v &= \cos x\\ u' &= \cos x & v' &= -\sin x \end{align}\]

    so

    (1.117)#\[\begin{align} f' &= 2[\sin x(-\sin x) + \cos x(\cos x)] \\ &= 2(\cos^2 x-\sin^2 x) \\ &= 2 \cos 2x\\ \end{align}\]
  3. \(f(x) = \sin 2x\)

    Solution

    Use the chain rule with

    (1.118)#\[\begin{align} u &= 2x & f &= \sin u \\ u' &= 2 & f' = \cos u \end{align}\]

    so

    (1.119)#\[\begin{equation} f' = \cos{u} \cdot 2 = 2 \cos 2 x \end{equation}\]
  4. \(f(x) = \tan({x^2+2x+3})\)

    Solution

    Use the chain rule with

    (1.120)#\[\begin{align} u &= x^2+2x+3 & f = \tan u\\ u' &= 2x+2 & f' = \sec^2 u\\ \end{align}\]

    so

    (1.121)#\[\begin{align} f' &= \sec^2 u \cdot u'\\ &= (2x+2)\sec^2(x^2+2x+3)\\ \end{align}\]
  5. \(f(x) = e^{\cos^2 x}\)

    Solution

    Use the chain rule with

    (1.122)#\[\begin{align} u &= \cos^2 x & f = e^{u}\\ u' &= \dd{}{}{x}(\cos^2 x) & f' = e^{u} \end{align}\]

    So

    (1.123)#\[\begin{equation} f' = e^{u} u' = e^{\cos^2 x} \dd{}{}{x}(\cos^2 x) \end{equation}\]

    Use the chain rule again with

    (1.124)#\[\begin{align} u &= \cos x & f = u^{2}\\ u' &= -\sin x & f' = 2u\\ \end{align}\]

    So

    (1.125)#\[\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}\]