0% found this document useful (0 votes)
12 views

Lecture 3 - Differentiation edited

Uploaded by

ALAHAKOON T.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lecture 3 - Differentiation edited

Uploaded by

ALAHAKOON T.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Differentiation

Basic idea

Q y = f(x) = x2
9

P
4

1
1 2 3

∆y y2 − y1 9 − 4 5
Average gradient/slope of line PQ = = = = = 5
∆x x2 − x1 3− 2 1
(blue line)

y = f(x)
Q
y = f(a + h) ( a + h, f(a + h) )

P
y = f(a) ( a, f(a) )

a a+h

∆y y2 − y1 f(a+h) − f(a) f(a+h) − f(a)


Average gradient/slope of line PQ = = = =
∆x x2 − x1 (a+h) − (a) h
(blue line)

f(a+h) − f(a)
The formula for the average gradient/slope of a line is =
h
Suppose we want to know the gradient/slope at x = a (at point P) rather than the average
gradient/slope over the interval from x = a to x = a + h (line PQ)

[ Gradient/slope at x = a (point P) ] = [ gradient/slope of tangent line at x = a ]

y = f(x)
Q
y = f(a + h)

tangent line

P
y = f(a)

a a+h

To calculate the gradient/slope of f(x) at x = a, we bring point Q closer and closer to point P and
calculate the new gradient/slope of line PQ each time. We study the trend in the gradients/slopes
of PQ (blue line) and use this to estimate the gradient/slope at point P (where x = a)

As point Q gets closer and closer to point P, h  0 (h approaches zero)

As h  0 , the slope of line PQ  slope of f(x) at point P

As h  0 , the slope of the blue line  slope of the tangent (red line)

We write:

f(a +h) − f(a)


Slope of f(x) = lim
h →0 h
at x = a

this slope expression above is called the derivative of f(x) at x = a


General: the derivative of a function f(x) ( ie. the slope of f(x) ) is defined as:

df f(a +h) − f(a)


[ ] 𝑥=𝑎 = lim
dx h →0 h

df f(x +h) − f(x)


= lim
dx h →0 h

df dy
Equivalent notation: = f′ = = y′
dx dx

Fortunately we don’t have to use the above definition to calculate derivatives as mathematicians
have derived some relatively simple rules
Differentiation rules

1. Constant functions

If f(x) = c c is a constant y = f(x) = c


df
= 0 gradient = 0
dx

Eg: Differentiate the following:


2
f(x) = 3 y = -2.5 f(x) = y = 4a
7

df dy df dy
= 0 = 0 = 0 = 0
dx dx dx dx

2. Power rule

If f(x) = xn

df
= nx n − 1
dx

Eg: Differentiate the following:

1 1
f(x) = x4 y = x = x1 f(x) = = 1x -3 y = 2√x = x 2
x3

df dy df dy 1 1
= 4x 4−1 = 1x 1−1 = −3x −3−1 = x2−1
dx dx dx dx 2
1 1
= 4x 3
= 1x 0
= −3x −4
= x−2
2
1

−3x−4 1 x 2
= 11 = = 
1 2 1
3 1 1
= 1 = − =  1
x4 2 x2
1
= 1
2x 2

1 1 1
f(x) = 3 = 1 = 1x − 3
√x x3

4
1 4 −
dy 1 1 1 x 3 1 1 1
= − x −
3
−1
= − x −
3 = −  = −  4 = − 4
dx 3 3 3 1 3 x3 3x3
3. Scalar multiples & sum/difference rules

If f(x) = axn

df
= anx n − 1
dx

If y = f(x) + g(x)

dy df dg
= + = f ′ (x) + g ′ (x)
dx dx dx

Eg: Differentiate the following:


8 1
f(x) = 2x4 y = 7x = 7x1 f(x) = = 8x -3 y = 3 2√x = 3x 2
x3

df dy df dy 1 1
= 24x 4−1 = 71x 1−1 = 8 − 3x −3−1 = 3 x 2 − 1
dx dx dx dx 2
3 0 −4 3 − 12
= 8x = 7x = −24x = x
2
1

−24x −4 3 x 2
= 71 = = 
1 2 1
24 3 1
= 7 = − =  1
x4 2 x2
3
= 1
2x 2

Eg: Differentiate the following:

f(x) = 2x4 + 6x2 – 9x + 108 + dx + ax3 – p

df
= 24x 4−1 + 62x 2−1 − 91x 1−1 + 0 + d1x1−1 + a3x 3−1 − 0
dx
= 8x3 + 12x1 – 9x0 + 0 + dx0 + 3ax2 – 0
= 8x3 + 12x – 91 + d1 + 3ax2

= 8x + 12x – 9 + d
3
+ 3ax2

1
3√x 6 3 6
y = 5x + 3
− = 3
5x + x 2 − x −4
5 7x4 5 7

dy 3 1 1 6
= 53x 3−1 +  x 2−1 −  − 4x −4−1
dx 5 2 7
3 1 24
2 − −5
= 15x + x 2 + x
10 7
3 24
= 15x 2 + 1 +
10x2 7x5
4. Product rule

If y = f(x)g(x) y = ab

dy df dg dy
= g + f = a′ b + ab′
dx dx dx dx

Eg: Differentiate the following:

f(x) = (3x4 + 6x)(x3 – 5)

df
= (12x3 + 6)(x3 – 5) + (3x4 + 6x)(3x2 – 0)
dx
= (12x3 + 6)(x3 – 5) + 3x2(3x4 + 6x)
= 12x6 – 60x3 + 6x3 – 30 + 9x6 + 18x3
= 21x6 – 36x3 – 30

2
f(x) = (2x3 + 5x – 9)(7x – ) = (2x3 + 5x – 9)(7x – 2x -5)
x5

df 2
= (6x2 + 5 – 0)(7x – ) + (2x3 + 5x – 9)(7 + 10x -6)
dx x5
2 10
= (6x2 + 5)(7x – ) + (2x3 + 5x – 9)(7 + )
x5 x6
12x2 10 20x3 50x 90
= 42x3 – + 35x – + 14x3 + + 35x + – 63 –
x5 x5 x6 x6 x6
12 10 20 50 90
= 42x3 – + 35x – + 14x3 + + 35x + – 63 –
x3 x5 x3 x5 x6
8 40 90
= 56x3 + + 70x + – 63 –
x3 x5 x6

5. Quotient rule

f(x) a
If y = y =
g(x) b

df dg
dy dx
g − fdx dy a′ b − ab′
= (g)2
=
dx dx b2

Eg: Differentiate the following:

x4 + 7
f(x) =
3x2 − 9x

df (4x3 + 0)(3x2 − 9x) − (x4 + 7)(6x1 − 9)


= (3x2 − 9x)2
dx
4x3 (3x2 − 9x) − (x4 + 7)(6x − 9)
= (3x2 − 9x)2
1
√x + 1 x2 + 1
y = =
3x 3x

1
1
dy ( x− 2 + 0)(3x) − (√x + 1)(3)
2
= (3x)2
dx

1
1 (3x) − 3(√x + 1)
2x2
=
9x2

6. Chain rule

If y = f(u) where u = g(x) then

dy dy du
= 
dx du dx

Eg: Differentiate the following:

f(x) = y = (x3 + 2x)4 y = (u)4 u = x3 + 2x


dy dy du
= ? = 4u3 = 3x2 + 2
dx du dx

dy dy du
= 
dx du dx

= 4u3  (3x2 + 2)
= 4(x3 + 2x)3  (3x2 + 2)

1 1 1 1
y = = 1 = 1(5x − 7)− 2 y = (u)− 2 u = 5x – 7
√5x − 7 (5x − 7)2
dy dy 1 3 du
= ? = − u− 2 = 5
dx du 2 dx
1
= − 3
2u2

dy dy du
= 
dx du dx

1
= − 3  (5)
2u2

5 n n
= − 3 am = ( m√a)
2(5x − 7)2
Slopes & Tangent lines

 Using differentiation we can determine the slope/gradient of a function for any value of x
 In turn we can find the equation of the tangent line to a function at any value of x

Eg: Consider the function f(x) = x2 + 4x – 2. Determine the equation of the tangent line at x = 3

Tangent line: y = mx + c

1. Find the gradient (m) of the function at x = 3

f(x) = x2 + 4x – 2
f ’(x) = 2x + 4
m = f ’(3) = 2(3) + 4 = 6 + 4 = 10

2. Find the y-coordinate y when x = 3

x = 3, y = f(x) = x2 + 4x – 2
y = f(3) = (3)2 + 4(3) – 2 = 9 + 12 – 2 = 19

3. Find the value of the constant c

y = mx + c
19 = 10(3) + c
19 = 30 + c
19 – 30 = c
-11 = c

Tangent line: y = mx + c


y = 10x + -11
y = 10x – 11

or

m = 10 y – yo = m(x – xo)
(xo, yo) = (3, 19) y – 19 = 10(x – 3)
y – 19 = 10x – 30
y = 10x – 30 + 19
y = 10x – 11
Differentiability

 A function is differentiable (diffy) if it has a finite derivative


 Usually this means that it must be smooth

end point
corner point
discontinuous points vertical slope

end point

 A function is not differentiable (diffy) at any of the following points: end points, corner points,
discontinuous points or points where there is a vertical slope

Two conditions for differentiability of a function y = f(x) at x = a

1. Must be continuous

lim f(x) = lim f(x) = f(a)


x → a− x → a+

2. Gradient of f(x) must approach the same finite value either side of x = a

dy dy
lim− = lim+
x→a dx x→a dx
Eg: For what values of a & b is the following function differentiable at x = 1 ?

f(x) = -2x + a , x<1


x – bx + 4 ,
2
x1

f(x) = -2x + a f(x) = x2 – bx + 4


dy dy
= -2 = 2x – b
dx dx

For differentiability at x = a

1. Must be continuous: lim f(x) = lim f(x) = f(a)


x → a− x → a+

lim f(x) = lim −2x + a = −2(1) + a = −2 + a


x → 1− x → 1−

lim+ f(x) = lim+ x 2 − bx + 4 = (1)2 − b(1) + 4 = 5−b


x→1 x→1

f(1) = x2 – bx + 4 = (1)2 – b(1) + 4 = 5 – b

-2 + a = 5 – b
a+b = 5+2
a+b = 7 …1

dy dy
2. Gradients must be the same: lim− = lim+
x→a dx x→a dx

dy
lim− = lim −2 = −2
x→1 dx x → 1−

dy
lim+ = lim 2x − b = 2(1) − b = 2−b
x→1 dx x → 1+

-2 = 2 – b
b = 2+2 = 4

From …1 a+b = 7
a+4 = 7
a = 7–4 = 3
Higher Derivatives

Consider the function y = f(x)

dy
 The first derivative = y′ is related to the gradient/slope of a function
dx

dy
If > 0 (is positive) , gradient is positive , graph slopes upwards
dx

dy
If < 0 (is negative) , gradient is negative , graph slopes downwards
dx

dy
If = 0 (is zero) , gradient is zero , graph is horizontal
dx

dy
If = undefined , no gradient , graph is vertical
dx

dy
=0
dx
dy
=0 y
dx

dy
dy dx
> 0 (+)
> 0 (+) dy
dx dy < 0 (–)
dx
< 0 (–) dx

dy
dx
=0

x
d2 y
 The second derivative = y ′′ is related to the concavity of a function –
dx2
is the graph cupped upwards or cupped downwards

happy
d2 y
If > 0 (is positive) , the function is concave up (cupped upwards)
dx2
a minimum turning point

d2 y
If < 0 (is negative) , the function is concave down (cupped downwards)
dx2
a maximum turning point

unhappy

d2 y
If = 0 (is zero) , we cannot say
dx2

d2 y
> 0 (+)
dx2

d2 y
dx2
< 0 (–)
d2 y
< 0 (–)
dx2

d2 y
dx2
=0

Eg: Using the function f(x) = x3 + 3x2 – 5x + 1 , calculate:


dy
a. and discuss the gradient/slope of the function at x = -2
dx
d2 y
b. and discuss the concavity of the function at x = 4
dx2

f(x) = x3 + 3x2 – 5x + 1

dy
a. = 3x2 + 6x – 5
dx
dy
(-2) = 3(-2)2 + 6(-2) – 5 = 3(4) – 12 – 5 = 12 – 12 – 5 = -5
dx

 gradient/slope is negative at x = -2
d2 y
b. = 6x + 6
dx2
d2 y
(4) = 6(4) + 6 = 24 + 6 = +30  concave up at x = 4
dx2

Local & Global Maxima/Minima points

 Local maxima/minima points & Global maxima/minima points can be distinguished from other
dy
points by their derivative
dx

dy
Either =0
dx
dy
or dne at end points, corner points, discontinuous points or …
dx

dy dy
 A point where = 0 or dne is called a critical point.
dx dx

dy dy
 All Local & Global maxima/minima points are critical points, where = 0 or dne
dx dx

corner point

dy
dx
=0 global max

dy
dne local max
dx

dy
dx
dne

dy
dx
=0 local min

dy
dx
dne global min

end points

 To identify these Local & Global maxima/minima points, find the value of x where
dy dy
= 0 or dne
dx dx
How to find Local maxima/minima points

 Option 1: Sign Test

Maxima points have a positive/upward gradient to left & negative/downward gradient to right

dy dy
=0 dne
dx dx

dy dy
> 0 (+) dy > 0 (+) dy
dx
dx
< 0 (-) dx < 0 (-)
dx

Minima points have a negative/downward gradient to left & positive/upward gradient to right

dy dy
dy dy
< 0 (-) > 0 (+)
< 0 (-) dx
> 0 (+) dx dx
dx

dy
dy dne
dx
=0 dx

If the sign of the derivative does not change across a critical point, it is not a max or min

dy
> 0 (+)
dx
dy
dx
< 0 (-)
dy
dx
=0
dy
dy dx
dne
> 0 (+)
dy dx
dx
< 0 (-)
 Option 2: Second Derivative Test

dy d2 y
If x = a is a critical point (ie. =0) & < 0 (–)  concave down
dx dx2

then x = a is a local maximum

dy d2 y
If x = a is a critical point (ie. =0) & > 0 (+)  concave up
dx dx2

then x = a is a local minimum

dy d2 y
If x = a is a critical point (ie. =0) & =0
dx dx2

then the second derivative test is inconclusive

Note:
dy d2 y
If or dne ,
dx dx2

then the second derivative test does not work & you must use the sign test
Eg: Determine all the local maximum or minimum points of f(x) = 2x3 + 3x2 – 12x + 3
for x ∈ R, and classify them using the sign test and the second derivative test.

1. Find the critical points:


dy dy
=0 f(x) = 2x3 + 3x2 – 12x + 3 dne no values of x
dx dx
dy
= 6x2 + 6x – 12
dx

6x2 + 6x – 12 = 0 6
x2 + x – 2 = 0
(x + 2)(x – 1) = 0
x + 2 = 0 or x – 1 = 0
x = -2 x=1
critical points are: x = -2, 1

2. Sign test:
-2 1

dy
= 6x2 + 6x – 12 + 0 – 0 +
dx

a local max at x = -2 a local min at x = 1

3. Second derivative test:

d2 y
= 12x + 6
dx2

d2 y
x = -2 (-2) = 12(-2) + 6 = -24 + 6 = -18  concave down
dx2
 a local max at x = -2

d2 y
x=1 (1) = 12(1) + 6 = 12 + 6 = +18  concave up
dx2
 a local min at x = 1
How to find Global maxima/minima points – Optimisation – Global optimisation

To find the Global maxima/minima of a function y = f(x) :


 Get the function you need to maximise or minimise in terms of one variable only
 Find the critical points of the function, including end points:
dy dy
find the values of x where = 0 or dne
dx dx
 Find the y value at all the critical points
If the interval is unbounded (no restricted domain, x ∈ R), we consider the behaviour of the
function for large values of x (ie. as x   ∞ )

The largest value of y is the Global maximum


The smallest value of y is the Global minimum

Eg: Determine the global maximum and minimum points of y = x 2 + 6x – 2 over the domain
x ∈ [−∞, 5].

1. Find y in terms of x:

y = x 2 + 6x – 2 given

2. Find the critical points:


dy dy
=0 y = x 2 + 6x – 2 dne at x = 5 (end point)
dx dx
dy
= 2x + 6
dx
2x + 6 = 0
2x = -6
x = -3

So the critical points are x = -3, 5 need to test x  -∞

3. Find the y values at the critical points x = -3, 5 and test x  -∞

x = -3 , y = (-3)2 + 6(-3) – 2 = 9 – 18 – 2 = -11 global minimum


x = 5 , y = (5)2 + 6(5) – 2 = 25 + 30 – 2 = 53

x  -∞ , y = (-∞)2 + 6(-∞) – 2 = +∞, y  ∞ lim f(x) = ∞ no global maximum


x → −∞

So there is no global maximum


and the global minimum of y = -11 is at x = -3

You might also like