Differentiation

Chapter 1
Di↵erentiation
1.1
Introduction
Why di↵erentiation? Well, it is a useful tool because many real-world problems rely on the
rates of change of quantities. For example, speed is the rate of change of distance of a
moving object.
Sometimes an engineer will need to look at a graph of, for example, distance vs time. In
that case, questions about rate of change become questions about gradients, i.e. slopes of
the tangent to a curve.
Slope of the chord PQ
=
Change in y
f (x + x)
=
Change in x
x
f (x)
,
and as x ! 0, chord ! tangent.
Therefore: Slope of the tangent at x
=
dy
= lim
x!0
dx
✓
f (x + x)
x
2
f (x)
◆
.
CHAPTER 1. DIFFERENTIATION
3
Example 1.1. Use the above definition to di↵erentiate y = f (x) = x2 .
✓
◆
dy
(x + x)2 x2
= lim
x!0
dx
x
!
x2 + 2x x + ( x)2 x2
= lim
x!0
x
= lim (2x + x)
x!0
= 2x.
1.2
Basic di↵erentiation
Now let’s consider the functions given in Table 1.1. These are the basic building blocks
of the many functions an engineer will need to di↵erentiate (chances are you already saw
these in A-Level).
Let us start by calculating some basic derivatives. . .
Example 1.2. Compute
d
(2ex
dx
3 cos x) .
Applying the addition formula (Rule 1 in Table 1.2) yields
d
(2ex
dx
d x
d
(e ) 3
(cos x)
dx
dx
= 2ex 3( sin x)
3 cos x) = 2
= 2ex + 3 sin x.
So we can find derivatives for sums of functions. However, if we are handling a product of
functions, we need the Product Rule instead:
f (x)
df
dx
xn
nxn
1
1
0
ln (x)
ex
sin (x)
x 1
ex
cos (x)
cos (x)
sin (x)
sinh (x)
cosh (x)
cosh (x)
sinh (x)
Table 1.1: Table of Basic Derivatives
CHAPTER 1. DIFFERENTIATION
Rule
f (x)
1
u+v
2
Cu
3
uv
4
u/v
5
f (u(x))
6
dx
dy
4
df
dx
Notes
dv
dx
C du
dx
dv
v du
+
u dx
dx
du
dv
v dx u dx
v2
0
f (u(x)) du
dx
1
Addition Rule
du
dx
+
dy
dx
(C =constant)
Product Rule
Quotient Rule
Chain Rule
For Inverse Functions
Table 1.2: Table of Rules for Di↵erentiation
Example 1.3. Compute
d
x3 sin x .
dx
This is a product of two functions, hence the Product Rule is required (Rule 3 in Table 2).
This is:
d
du
dv
(uv) = v
+u .
dx
dx
dx
For this example, let u = x3 and v = sin x. Then we have. . .
d
d
d
x3 sin x =
x3 sin x + x3
(sin x) ,
dx
dx
dx
i.e.
d
x3 sin x = 3x2 sin x + x3 cos x.
dx
The Product Rule still works if you want to compute the derivative of a function that is a
product of three or more functions.
Example 1.4. Compute
=
+
+
=
d
x2 ex sin x
dx
d
x2 ex sin x
dx
d x
x2
(e ) sin x
dx
d
x2 ex
(sin x)
dx
(2xex + x2 ex ) sin x + x2 ex cos x.
This next example shows a standard use of the Quotient Rule:
Example 1.5. Compute
d
dx
✓
x 1
x2 + 1
◆
.
CHAPTER 1. DIFFERENTIATION
5
Applying the Quotient Rule gives
d
dx
✓
x 1
x2 + 1
◆
x2 + 1
=
d
dx
(x
1)
d
1) dx
x2 + 1
(x
2
(x2 + 1)
(x 1) ⇥ 2x
x2 + 1 ⇥ 1
=
(x2 + 1)2
x2 + 2x + 1
.
(x2 + 1)2
=
Example 1.6 (Di↵erentiate tanh x using the quotient rule).
✓
◆
d
d sinh x
(tanh x) =
dx
dx cosh x
=
=
=
d
cosh x dx
(sinh x)
d
sinh x dx
(cosh x)
cosh2 x
cosh ⇥ cosh x sinh x ⇥ sinh x
cosh2 x
cosh2 x sinh2 x
,
cosh2 x
and now using the hyperbolic identity
cosh2 x
sinh2 x ⌘ 1,
this leads to
d
(tanh x) =
dx
and since
sech x ⌘
this leads to the result
1
cosh x
=)
1
,
cosh2 x
sech2 x ⌘
1
,
cosh2 x
d
(tanh x) = sech2 x.
dx
This looks very similar to the following result. . .
d
(tan x) = sec2 x,
dx
which uses the trigonometric functions instead of hyperbolic ones. You will get to prove
this result for yourself in the Problem Sheet!
1.3
The Chain Rule
So far, we have calculated derivatives of sums, products and quotients of functions. But
what happens when you have a function of a function?
CHAPTER 1. DIFFERENTIATION
6
Example 1.7. Compute the following derivative
d
(sin 2x) .
dx
The Chain Rule says that
d
du
(f (u(x))) = f 0 (u(x)) .
dx
dx
So we let
du
= 2,
dx
df
= cos u
du
u(x) = 2x,
f (u) = sin u
then applying the chain rule gives
d
d
du
(sin 2x) =
(f (u))
= 2 cos u,
dx
du
dx
and rewriting back in terms of the original variable x gives
d
(sin 2x) = 2 cos 2x.
dx
Let’s try another example. . .
Example 1.8. Compute the following derivative
d
ln x2
dx
1
.
Put
u(x) = x2
1,
f (u) = ln u,
u0 (x) = 2x,
1
f 0 (u) = ,
u
then applying the chain rule gives
d
ln x2
dx
1
=
2x
2x
= 2
.
u
x
1
You will want to brace yourself for the next example! This one shows you how to use the
chain rule more than once.
Example 1.9. Compute the following derivative
d
sin ln x2 ex
dx
First apply chain rule with f (u) = sin u, u = ln x2 ex
d
= cos ln x2 ex ⇥
ln x2 ex
dx
Then apply chain rule again, this time with f (u) = ln u, u = x2 ex
1 d
= cos ln x2 ex
x2 ex
x2 ex dx
Finally, apply the product rule with u = x2 , v = ex
⇤
1 ⇥ 2 x
= cos ln x2 ex
x e + 2xex .
2
x
x e
CHAPTER 1. DIFFERENTIATION
7
Example 1.10 (2009 Exam Question). Compute the following derivative:
✓ x◆
dy
e
for y = sin
.
dx
x
This problem requires the chain rule with
df
= cos u,
du
du
e x
=
dx
x
f (u) = sin u,
Hence
1.3.1
x
e
u =
x
dy
= cos
dx
✓
,
x
e
x
◆✓
x
e
x
e x
.
x2
e x
x2
◆
.
Implicit di↵erentiation
Sometimes you can’t write a function in terms of x only. In that case, if you are di↵erentiating w.r.t. x, you use implicit di↵erentiation.
Example 1.11 (Slope of a circle with radius 1). Suppose x2 + y 2 = 1.
• This is the equation of a circle, centre O, radius 1.
• y is an implicit function of x, i.e. not in the form
y = Stu↵ depending on x only
• To find
dy
dx
we take
d
dx
of all terms:
d
d
d
x2 +
y2 =
(1) ,
dx
dx
dx
i.e
2x + 2y
dy
=0
dx
)
dy
=
dx
x
.
y
Example 1.12. If the equation of a curve satisfies
x2 + 3xy + y 2 = 7,
find
dy
dx
in terms of x and y.
Proceed by di↵erentiating each term w.r.t. x:
2x + 3y + 3x
dy
dy
+ 2y
=0
dx
dx
(Common error: Forgetting to di↵erentiate the 7!)
i.e
dy
=
dx
2x + 3y
.
3x + 2y
CHAPTER 1. DIFFERENTIATION
8
Logarithmic di↵erentiation
Sometimes it is useful to take logs on both sides of an equation before di↵erentiating. By
doing this you are setting up an implicit equation, making this an example of implicit
di↵erentiation.
Example 1.13. Di↵erentiate the function y = 10x with respect to x.
y = 10x ,
)
ln y = x ln 10.
and so in di↵erentiating w.r.t x
1 dy
= ln 10,
y dx
dy
= 10x ln 10.
dx
Example 1.14. Find
d
(xx ) .
dx
First let y = xx , then ln y = ln xx = x ln x.
)
)
)
Example 1.15.
d
d
(ln y) =
(x ln x)
dx
dx
1 dy
x
⇢
= ln x +
y dx
x
⇢
dy
= y (1 + ln x)
dx
dy
= xx (1 + ln x) .
dx
x2 cos x
y=
sin 2x
✓
x2
=
2 sin x
◆
.
Take logs and di↵erentiate with respect to x to give
ln y
1 dy
y dx
dy
)
dx
dy
dx
= ln x2 + ln cos x ln sin 2x
2x sin x
cos 2x
=
2
.
2
x
cos x
sin 2x
✓
◆
2
= y
tan x 2 cot 2x
x
✓
◆
x2 cos x 2
=
tan x 2 cot 2x .
sin 2x
x
Di↵erentiating Inverse functions
Believe it or not, when you di↵erentiate an inverse function, you are using implicit
di↵erentiation (again!)
CHAPTER 1. DIFFERENTIATION
Example 1.16.
9
dy
dx
Find
when
y = sin
1
y = sin
1
x.
x
sin y = x
d
(sin y) = 1
dx
dy
cos y
=1
dx
dy
1
1
=
=p
.
dx
cos y
1 x2
Example 1.17.
dy
dx
Find
y = cosh
1
when
y = cosh
1
x.
x
x = cosh y
1 = sinh y
dy
dx
(Implicit di↵erentiation)
dy
1
=
dx
sinh y
1
=p
cosh2 y
1
=p
.
2
x
1
Therefore
1.4
1
(cosh2 y
dy
1
=p
2
dx
x
1
sinh2 y ⌘ 1)
.
Higher derivatives
dy
d2 y
, we can di↵erentiate this again, which gives is the second derivative
.
dx
dx2
d3 y d4 y
If we then di↵erentiate again, we get
,
, etc. These are collectively known as higher
dx3 dx4
derivatives.
Having found
CHAPTER 1. DIFFERENTIATION
10
Example 1.18.
y
dy
dx
d2 y
dx2
d3 y
dx3
d4 y
dx4
d5 y
dx5
d6 y
dx6
d7 y
dx7
d8 y
dx8
= x6
= 6x5
= 6 ⇥ 5x4 = 30x4
= 30 ⇥ 4x3 = 120x3
= 360x2
= 720x
= 720
=0
= 0.
For convenience the following notation is sometimes used for higher derivatives:
dn y
= y (n) ,
dxn
and so
d2 y
= y (2) ,
dx2
d3 y
= y (3) ,
dx3
Example 1.19.
For
y = sin 2x,
find
dy
,
dx
etc.
d2 y
,
dx2
y (3) .
dy
= 2 cos 2x,
dx
d2 y
= 4 sin 2x
dx2
y (3) = 8 cos 2x.
Example 1.20. If y = e2x , what is
dn y
?
dxn
dy
= y (1) = 2e2x ,
dx
)
1.4.1
y (2) = 4e2x ,
y (3) = 8e2x
y (n) = 2n e2x .
Computing the nth derivative of a product
Suppose we have a function defined as a product, i.e. given by
y = uv,
where
u = u(x), v = v(x).
CHAPTER 1. DIFFERENTIATION
11
In general if y = uv then applying the product rule gives:
y (1) = u(1) v + uv (1)
y (2) = u(2) v + u(1) v (1) + u(1) v (1) + uv (2)
y (3) = u(3) v + 3u(2) v (1) + 2u(2) v (1) + 2u(1) v (2)
+ u(1) v (2) + uv (3)
= u(3) + 3u(2) v (1) + 3u(1) v (2) + uv (3) .
Notice that the binomial coefficients are appearing.
In fact. . .
y
(n)
✓ ◆
✓ ◆
n (n 1) (1)
n (n
= u v+
u
v +
u
1
2
✓
◆
n
+
u(1) v (n 1) + uv (n)
n 1
n ✓ ◆
X
n (n k) (k)
=
u
v ,
k
(n)
2) (2)
v
+ ···
(1.1)
k=0
where
✓ ◆
n
n!
=
.
k
(n k)!k!
Equation 1.1 is known as the Leibniz rule for di↵erentiating a product n times.
Example 1.21.
If
y = xex ,
what is
dn y
dxn
Using the Leibniz rule with v = x, u = ex gives
✓ ◆
dn
n d
dn
y (n) = x n (ex ) +
(x) n
dx
1 dx
dx
0
:
⇠
✓ ◆ 2
n⇠
2 ⇠⇠
n d
d⇠
x
⇠
⇠
+
⇠2⇠(x) dxn 2 (e ) + 0
2 ⇠dx
⇠⇠
= xex + n.1.ex
?
1
1
(ex )
= ex (x + n).
Example 1.22.
d17 y
.
dx17
Tip: When applying the Leibniz rule for the function uv you should choose v such that it
becomes zero when di↵erentiated a relatively few number of times (if this is possible). So
we choose u = sin x, v = x2 .
✓ ◆
17
17
d16
(17)
2 d
y
=x
(sin
x)
+
2x
(sin x)
dx17
1
dx16
✓ ◆ 15
17
d
+
2 15 (sin x) + 0.
2
dx
Let
y = x2 sin x.
Find