Lecture 3 - Differentiation edited
Lecture 3 - Differentiation edited
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
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)
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 h 0 , the slope of the blue line slope of the tangent (red line)
We write:
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
df dy df dy
= 0 = 0 = 0 = 0
dx dx dx dx
2. Power rule
If f(x) = xn
df
= nx n − 1
dx
1 1
f(x) = x4 y = x = x1 f(x) = = 1x -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
= 11 = =
1 2 1
3 1 1
= 1 = − = 1
x4 2 x2
1
= 1
2x 2
1 1 1
f(x) = 3 = 1 = 1x − 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) = axn
df
= anx n − 1
dx
If y = f(x) + g(x)
dy df dg
= + = f ′ (x) + g ′ (x)
dx dx dx
df dy df dy 1 1
= 24x 4−1 = 71x 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
= 71 = =
1 2 1
24 3 1
= 7 = − = 1
x4 2 x2
3
= 1
2x 2
df
= 24x 4−1 + 62x 2−1 − 91x 1−1 + 0 + d1x1−1 + a3x 3−1 − 0
dx
= 8x3 + 12x1 – 9x0 + 0 + dx0 + 3ax2 – 0
= 8x3 + 12x – 91 + d1 + 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
= 53x 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 = ab
dy df dg dy
= g + f = a′ b + ab′
dx dx dx dx
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 − fdx dy a′ b − ab′
= (g)2
=
dx dx b2
x4 + 7
f(x) =
3x2 − 9x
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
dy dy du
=
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
f(x) = x2 + 4x – 2
f ’(x) = 2x + 4
m = f ’(3) = 2(3) + 4 = 6 + 4 = 10
x = 3, y = f(x) = x2 + 4x – 2
y = f(3) = (3)2 + 4(3) – 2 = 9 + 12 – 2 = 19
y = mx + c
19 = 10(3) + c
19 = 30 + c
19 – 30 = c
-11 = c
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
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
1. Must be continuous
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 ?
For differentiability at x = a
-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
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
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 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
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
dy d2 y
If x = a is a critical point (ie. =0) & > 0 (+) concave up
dx dx2
dy d2 y
If x = a is a critical point (ie. =0) & =0
dx dx2
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.
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
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
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