You are on page 1of 48

MAT6105 Module 3.

3
Higher derivatives – Video 1
Critical points of single-variable functions

Dr Julia Collins
In Module 3.2…

In Module 3.2 we saw how we could use the method of steepest ascent/descent
and the concept of gradient vectors to find maximum and minimum values of
surfaces.
For example, following the gradient vectors leads
to this peak.
In Module 3.2…

In Module 3.2 we saw how we could use the method of steepest ascent/descent
and the concept of gradient vectors to find maximum and minimum values of
surfaces.
For example, following the gradient vectors leads
to this peak.

Note that the


max/min values
we find will
depend on
where we start!
Questions

In this module we will answer the following questions:

• How can we (theoretically!) find ALL of the maximum/minimum values of a


function, particularly a curve or surface?
• How can we identify features like saddle shapes?
• How can we use higher derivatives to classify the
nature of critical points?
• How do we know whether we have found a local max
or min instead of a global max or min?
Extreme values of a single-valued function

Consider the function 𝑓: ℝ → ℝ defined by

𝑓 𝑥 = 𝑥 3 − 3𝑥 2 + 4.

On the plot of 𝑓 we see that the slope changes


from positive to negative and then back to
positive.
I.e. The function is increasing, then decreasing,
then increasing again.

We want to identify the points where the


behaviour of the function changes. This must
happen when the slope is zero.
Critical points

𝑑𝑓
A point 𝑎 ∈ ℝ such that 𝑎 = 0 is called a critical point of the
𝑑𝑥
function 𝑓. I.e. a critical point is one where the first derivative is zero.

Example 1
Find the critical points of 𝑓 𝑥 = 𝑥 3 − 3𝑥 2 + 4.

Solution
𝑓 ′ (𝑥) = 3𝑥 2 − 6𝑥 = 3𝑥(𝑥 − 2)
The critical points are when 𝑓′ 𝑥 = 0.
This happens at 𝑥 = 0 and 𝑥 = 2.
Classifying critical points

Note that the critical points of 𝑓 𝑥 = 𝑥 3 − 3𝑥 2 + 4 coincide with


a local maximum (𝑥 = 0) and a local minimum (𝑥 = 2).

Let 𝑓: ℝ → ℝ be a function and 𝑝 ∈ ℝ. local maximum

• 𝑓 has a local maximum at 𝑝 if 𝑓(𝑝) is greater


than or equal to the values of 𝑓 for points near 𝑝. local minimum

• 𝑓 has a local minimum at 𝑝 if 𝑓(𝑝) is less than


or equal to the values of 𝑓 for points near 𝑝.
Sign test for local maxima and minima

We can identify whether a critical point of 𝑓 is a maximum or a minimum by


looking at how the derivative of 𝑓 changes sign before and after the critical point.

𝑓′ 𝑝 = 0

𝑓′ 𝑝 > 0 𝑓′ 𝑝 < 0
𝑓 increasing 𝑓 decreasing

𝑓′ 𝑝 = 0
𝑓′ 𝑝 < 0 𝑓′ 𝑝 > 0
𝑓 decreasing 𝑓 increasing

𝑝 𝑝
A different type of critical point…

Example 2
Find the critical points of 𝑓 𝑥 = 𝑥 3 .

Solution
𝑓 ′ (𝑥) = 3𝑥 2 , so there is one critical point
when 𝑥 = 0.

If 𝑥 < 0 then 𝑓 ′ 𝑥 > 0 Neither a local


maximum nor
If 𝑥 > 0 then 𝑓 ′ 𝑥 > 0 local minimum!

Here the critical point is called a


point of inflection.
There are two ways to determine the type of critical point
for a function 𝑓(𝑥) of one variable.

1. Sign test
2. Second derivative test
1. Sign test

• 𝑓 has a local maximum at 𝑥 = 𝑎, if 𝑓 ′ 𝑎 = 0 and


• for 𝑥 < 𝑎 we have 𝑓 ′ 𝑥 > 0 (i.e. function increasing before)
• for 𝑥 > 𝑎 we have 𝑓 ′ 𝑥 < 0 (i.e. the function is decreasing after)

• 𝑓 has a local minimum at 𝑥 = 𝑎, if 𝑓 ′ 𝑎 = 0 and


• for 𝑥 < 𝑎 we have 𝑓 ′ 𝑥 < 0 (i.e. function decreasing before)
• for 𝑥 > 𝑎 we have 𝑓 ′ 𝑥 > 0 (i.e. the function is increasing after)

• 𝑓 has an inflection point at 𝑥 = 𝑎, if 𝑓 ′ 𝑎 = 0 and


• 𝑓 ′ 𝑎 > 0 for both 𝑥 < 𝑎 and 𝑥 > 𝑎 (i.e. function increasing before and after)
• 𝑓 ′ 𝑎 < 0 for both 𝑥 < 𝑎 and 𝑥 > 𝑎 (i.e. function decreasing before and after)
2. Second derivative test

• 𝑓 has a local maximum at 𝑥 = 𝑎, if 𝑓 ′ 𝑎 = 0 and

𝑑2𝑓
2
𝑎 = 𝑓′′(𝑎) < 0.
𝑑𝑥

• 𝑓 has a local minimum at 𝑥 = 𝑎, if 𝑓 ′ 𝑎 = 0 and


𝑑2 𝑓 ′′ 𝑎 > 0.
𝑎 = 𝑓
𝑑𝑥 2

• The second derivative test is inconclusive if 𝑓 ′′ 𝑎 = 0. (I.e. the critical point


could be a minimum, maximum or inflection point.)
Examples

Example 1 (revisited)
Use the second derivative test to classify the two critical points of
𝑓 𝑥 = 𝑥 3 − 3𝑥 2 + 4.

Solution
𝑓 ′ 𝑥 = 3𝑥 2 − 6𝑥 and critical points are 𝑥 = 0, 2.
𝑓 ′′ 𝑥 = 6𝑥 − 6.

If 𝑥 = 0 then 𝑓 ′′ 0 = −6, so this is a local max.


If 𝑥 = 2 then 𝑓 ′′ 2 = 6, so this is a local min.
Examples

Examples 2, 3
Find and classify the critical points of 𝑓 𝑥 = 𝑥 3 and 𝑔 𝑥 = 𝑥 4 .

Solution
𝑓 ′ 𝑥 = 3𝑥 2 and 𝑔′ 𝑥 = 4𝑥 3 , each with one critical point at 𝑥 = 0.
𝑓 ′′ 𝑥 = 6𝑥 and 𝑔′′ 𝑥 = 12𝑥 2 so 𝑓 ′′ 0 = 0 = 𝑔′′(0).
So the second derivative test is inconclusive in both cases.

• 𝑓 ′ 𝑥 > 0 before and after 𝑥 = 0, so this is an inflection point.


• 𝑔′ 𝑥 < 0 if 𝑥 < 0 and 𝑔′ 𝑥 > 0 if 𝑥 > 0, so this is a minimum.
Examples

𝑓 𝑥 = 𝑥3 𝑔 𝑥 = 𝑥4
Inflection point at 𝑥 = 0 Local minimum at 𝑥 = 0
Example

Example 4
Find and classify the critical points of 𝑓 𝑥 = 𝑥 + sin(𝑥).

Solution
𝑓 ′ 𝑥 = 1 + cos(𝑥) and critical points are where cos 𝑥 = −1.
Thus the critical points are at 𝑥 = ±𝜋, ±3𝜋, ±5𝜋, …

𝑓 ′′ 𝑥 = −sin(𝑥). This means that 𝑓 ′′ 𝑥 = 0 for all critical points.

We see that 𝑓 ′ 𝑥 = 1 + cos(𝑥) ≥ 0 for all 𝑥, so critical points are inflection points.
Examples

Example 4

𝑓 𝑥 = 𝑥 + sin(𝑥)

Infinitely many
inflection points
Examples

Example 5
Find and classify the critical points of 𝑓 𝑥 = |𝑥|, where
𝑥 for 𝑥 ≥ 0
𝑥 =ቊ
−𝑥 for 𝑥 < 0

Solution
The first derivative of 𝑓 is
1 for 𝑥 > 0
𝑓′(𝑥) = ቊ
−1 for 𝑥 < 0
This is a discontinuous function and it is not defined at 𝑥 = 0. If 𝑓 ′ 𝑝 is undefined for a
Although there are no points where 𝑓 ′ 𝑥 = 0, 𝑥 = 0 is point 𝑝 in the domain of 𝑓,
then 𝑝 is also called a
considered to be a critical point. critical point.
MAT6105 Module 3.3
Higher derivatives – Video 2
Critical points of surfaces

Dr Julia Collins
Finding extrema of surfaces

We now wish to find local extrema


(maxima and minima) of functions of two
variables – aka surfaces.

With an extra dimension, more scenarios


are possible, but the analysis will be
similar.

We will see how to use partial derivatives


to find and classify critical points.
Extreme values of surfaces

local maximum
Let 𝑓: ℝ × ℝ → ℝ be a function of two variables
and (𝑎, 𝑏) ∈ ℝ × ℝ.

• 𝑓 has a local maximum at (𝑎, 𝑏) if 𝑓(𝑎, 𝑏) is


greater than or equal to the values of 𝑓(𝑥, 𝑦)
for points (𝑥, 𝑦) near (𝑎, 𝑏). The number
𝑓(𝑎, 𝑏) is called the local maximum value.

• 𝑓 has a local minimum at (𝑎, 𝑏) if 𝑓(𝑎, 𝑏) is


less than or equal to the values of 𝑓(𝑥, 𝑦) for
points (𝑥, 𝑦) near (𝑎, 𝑏). The number 𝑓(𝑎, 𝑏) is
called the local minimum value.
local minimum
Critical points of surfaces

Suppose 𝑓: ℝ × ℝ → ℝ is a function of two variables.

A point (𝑎, 𝑏) is called a critical point of 𝑓 if


𝜕𝑓 𝜕𝑓
• 𝑎, 𝑏 = 𝑎, 𝑏 = 0 (i.e. ∇𝑓 𝑎, 𝑏 = (0,0) ) or
𝜕𝑥 𝜕𝑦
𝜕𝑓 𝜕𝑓
• 𝑎, 𝑏 or 𝑎, 𝑏 is undefined / does not exist.
𝜕𝑥 𝜕𝑦

Note that all maxima and minima of surfaces will be critical points, but not all
critical points are maxima or minima.
Critical points of surfaces

Example 1
Find the critical points of 𝑓 𝑥 = 2𝑥 2 + 3𝑦 2 − 5𝑥 + 8𝑦 − 1.

Solution
𝜕𝑓 𝜕𝑓
= 𝑓𝑥 = 4𝑥 − 5 ; = 𝑓𝑦 = 6𝑦 + 8
𝜕𝑥 𝜕𝑦

The critical points occur when 𝑓𝑥 = 𝑓𝑦 = 0.

5 4
This happens at 𝑥 = and 𝑦 = − , so there is a
4 3
single critical point.
Critical points of surfaces

Example 2
Find the critical points of 𝑓 𝑥 = 𝑥 2 − 𝑦 2 .

Solution
𝜕𝑓 𝜕𝑓
= 𝑓𝑥 = 2𝑥 ; = 𝑓𝑦 = −2𝑦
𝜕𝑥 𝜕𝑦

The critical points occur when 𝑓𝑥 = 𝑓𝑦 = 0.

This happens at 𝑥 = 0 and 𝑦 = 0, so there is a


single critical point.
Critical points from gradient vector plot

Looking at the plot of the gradient fields, we see that the critical points occur when
the gradient vectors are zero.
𝑓 𝑥 = 2𝑥 2 + 3𝑦 2 − 5𝑥 + 8𝑦 − 1 𝑓 𝑥 = 𝑥2 − 𝑦2
Classifying critical points of surfaces

The best way to determine what type of critical point you have found is to
do the second derivative test for surfaces.

For this we will need to compute second partial derivatives. For a function
of two variables 𝑓(𝑥, 𝑦) there are four of these:

𝜕 𝜕𝑓 𝜕2𝑓 𝜕 𝜕𝑓 𝜕2𝑓
= 2 = 𝑓𝑥𝑥 ; = 2 = 𝑓𝑦𝑦
𝜕𝑥 𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑦
𝜕 𝜕𝑓 𝜕2𝑓 𝜕 𝜕𝑓 𝜕2𝑓
= = 𝑓𝑥𝑦 ; = = 𝑓𝑦𝑥
𝜕𝑥 𝜕𝑦 𝜕𝑥𝜕𝑦 𝜕𝑦 𝜕𝑥 𝜕𝑦𝜕𝑥
Classifying critical points of surfaces

Second derivative test for surfaces


Suppose that (𝑎, 𝑏) is a critical point of a function 𝑓.
Let
2
𝐷 = 𝑓𝑥𝑥 𝑎, 𝑏 𝑓𝑦𝑦 𝑎, 𝑏 − 𝑓𝑥𝑦 𝑎, 𝑏 Called the determinant

Then
• If 𝐷 > 0 and 𝑓𝑥𝑥 𝑎, 𝑏 > 0 then 𝑓(𝑎, 𝑏) is a local minimum
• If 𝐷 > 0 and 𝑓𝑥𝑥 𝑎, 𝑏 < 0 then 𝑓(𝑎, 𝑏) is a local maximum
• If 𝐷 < 0 then 𝑓(𝑎, 𝑏) is a saddle point
• If 𝐷 = 0 then the test is inconclusive (anything can happen!)
Critical points of surfaces

Example 1 revisited
Classify the critical points of 𝑓 𝑥 = 2𝑥 2 + 3𝑦 2 − 5𝑥 + 8𝑦 − 1.

Solution
5 4
We found a critical point at , − .
4 3
𝜕𝑓 𝜕𝑓
= 𝑓𝑥 = 4𝑥 − 5 ; = 𝑓𝑦 = 6𝑦 + 8
𝜕𝑥 𝜕𝑦
so 𝑓𝑥𝑥 = 4, 𝑓𝑦𝑦 = 6, 𝑓𝑥𝑦 = 0 and 𝐷 = 4 × 6 − 02 = 24 for all values of (𝑥, 𝑦).

5 4
Since 𝐷 > 0 and 𝑓𝑥𝑥 > 0, the point ,− is a local minimum (as expected).
4 3
Critical points of surfaces

Example 1 revisited
This result is confirmed by the plot of the gradient field, as all gradient vectors
point outwards, away from the critical point.
Critical points of surfaces

Example 2 revisited
Classify the critical points of 𝑓 𝑥 = 𝑥 2 − 𝑦 2 .

Solution
We found a critical point at 0,0 .
𝜕𝑓 𝜕𝑓
= 𝑓𝑥 = 2𝑥 ; = 𝑓𝑦 = −2𝑦
𝜕𝑥 𝜕𝑦
so 𝑓𝑥𝑥 = 2, 𝑓𝑦𝑦 = −2, 𝑓𝑥𝑦 = 0 and 𝐷 = 2 × −2 − 02 = −4 for all values of (𝑥, 𝑦).

Since 𝐷 < 0, the point 0,0 is a saddle point (as expected).


Critical points of surfaces

Example 2 revisited
This result is confirmed by the plot of the gradient field, as some gradient vectors
point outwards, away from the critical point, while others point inwards, towards
the critical point.
Critical points of surfaces

Example 3
Classify the critical points of 𝑓 𝑥, 𝑦 = 1 + 4𝑦 2 .

Solution
First we find the critical points:
𝜕𝑓 𝜕𝑓
= 𝑓𝑥 = 0 ; = 𝑓𝑦 = 8𝑦
𝜕𝑥 𝜕𝑦
So setting 𝑓𝑥 = 𝑓𝑦 = 0 we find infinitely many critical points along the line 𝑦 = 0.
We have 𝑓𝑥𝑥 = 0, 𝑓𝑦𝑦 = 8, 𝑓𝑥𝑦 = 0 and 𝐷 = 0 × 8 − 02 = 0 for all values of (𝑥, 𝑦).

Since 𝐷 = 0, the critical points 𝑥, 0 are unclassified.


Critical points of surfaces

Example 3
We can see from the gradient field that all gradient vectors point away from the
line, so each point on this line is a local minimum.
Critical points of surfaces

Example 4
Classify the critical points of 𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥𝑦 2 .

Solution
First we find the critical points:
𝜕𝑓 2 2
𝜕𝑓
= 𝑓𝑥 = 3𝑥 − 3𝑦 ; = 𝑓𝑦 = −6𝑥𝑦
𝜕𝑥 𝜕𝑦
So setting 𝑓𝑥 = 𝑓𝑦 = 0 we see that 𝑥 = 𝑦 = 0 so there is a critical point at (0,0).
We have 𝑓𝑥𝑥 = 6𝑥, 𝑓𝑦𝑦 = 6𝑥, 𝑓𝑥𝑦 = −6𝑦 and 𝐷 = 0 × 0 − 02 = 0 at (0,0).

Since 𝐷 = 0, the critical points 0,0 is unclassified.


Critical points of surfaces

Example 4
This is a strange type of critical point, called a monkey saddle. The contour lines
divide the plane into 3 regions around this point with 𝑓 alternating from positive to
negative as it crosses each line.
MAT6105 Module 3.3
Higher derivatives – Video 3
Global vs local maxima/minima

Dr Julia Collins
Local vs global

So far we have considered local minima and local maxima of curves and
surfaces.

For a point 𝑝 in the domain of a function 𝑓:


• 𝑓 has a global maximum at 𝑝 if 𝑓(𝑝) is the largest value of 𝑓.
• 𝑓 has a global minimum at 𝑝 if 𝑓(𝑝) is the smallest value of 𝑓.

A function may or may not have a global max/min.


A global max/min may or may not coincide with a local max/min.
A continuous function whose domain is an interval [𝑎, 𝑏] will always have both a
global maximum and global minimum.
Global vs local extrema

Consider the function


𝑓 𝑥 = 𝑥 3 − 3𝑥 2 + 4.

• If we define 𝑓: ℝ → ℝ with domain all of ℝ


then 𝑓 has no global maximum or local maximum
minimum.

• If we define 𝑓: −2,4 → ℝ then 𝑓 has a local minimum

global minimum at 𝑥 = −2 and a global


maximum at 𝑥 = 4.
Global vs local extrema

Example
Consider the function 𝑓: ℝ → ℝ

𝑓 𝑥 = 𝑥4

Then 𝑓 has a local and global


minimum at 𝑥 = 0 but no global
maximum. local and global
minimum
Global vs local extrema

Example
Consider the function 𝑓: [−10,10] → ℝ
global
local
𝑓 𝑥 = 𝑥 cos(𝑥) max
max
local
max
Then 𝑓 has a global max and min local
max
and six local maxima/minima.
local
min
local
min
local
min global
min
Strategy for finding global maximum/minimum

For a continuous function 𝑓: 𝐴 → 𝐵


• Find all critical points 𝑓 ′ 𝑥 = 0.
• Classify the type of critical points to determine which are local minima or
maxima.
• Evaluate 𝑓 at all critical points and also at any potential endpoints of the
domain 𝐴.
• Choose the largest/smallest values of 𝑓 (if they exist) at critical
points/endpoints and these are the global max/min.
Example

Example
For the function 𝑓: [0, ∞) → ℝ defined by
𝑓 𝑥 = 𝑥𝑒 −𝑥
find and classify all maxima and minima.

Solution
We have 𝑓 ′ 𝑥 = 𝑒 −𝑥 − 𝑥𝑒 −𝑥 = (1 − 𝑥)𝑒 −𝑥
so there is a single critical point at 𝑥 = 1.

When 0 ≤ 𝑥 < 1, 𝑓 ′ 𝑥 > 0, and for 𝑥 > 1, 𝑓 ′ 𝑥 < 0, so this is a local maximum.
At 𝑥 = 0, 𝑓 𝑥 = 0, and as 𝑥 → ∞, 𝑓(𝑥) → 0, So the global min is at 𝑥 = 0 and the
global max is at 𝑥 = 1.
Global vs local extrema for surfaces

The same comparison of local vs global extrema can be done for surfaces as
well as curves.
global
max

local
local
max
max

local
min global
min
Example

Example
2 −𝑥 2 −𝑦 2
For the function on ℝ × ℝ defined by 𝑓 𝑥, 𝑦 = 𝑥 𝑒 find and classify all
extrema.

Solution
First we find the critical points:
𝜕𝑓 2 2 2 2 𝜕𝑓 2 2
= 𝑓𝑥 = 2𝑥𝑒 −𝑥 −𝑦 − 2𝑥 3 𝑒 −𝑥 −𝑦 ; = 𝑓𝑦 = −2𝑥 2 𝑦𝑒 −𝑥 −𝑦
𝜕𝑥 𝜕𝑦
2 −𝑦 2
So setting 𝑓𝑦 = 0 we see that either 𝑥 = 0 or 𝑦 = 0. If 𝑓𝑥 = 2𝑥 1 − 𝑥2 𝑒 −𝑥
=0
then either 𝑥 = 0 or 𝑥 = ±1. Therefore there are 3 critical points: 0, 𝑦 , 1,0 , (−1,0).

Note that the first critical point denotes an infinite line.


Example

Example
2 −𝑥 2 −𝑦 2
For the function on ℝ × ℝ defined by 𝑓 𝑥, 𝑦 = 𝑥 𝑒 find and classify all
extrema.

Solution
You can use MATLAB (!) to check the following:

−𝑥 2 −𝑦 2 2 −𝑥 2 −𝑦 2 4 −𝑥 2 −𝑦 2 −𝑥 2 −𝑦 2
𝑓𝑥𝑥 = 2𝑒 − 10𝑥 𝑒 + 4𝑥 𝑒 = 2𝑒 (1 − 5𝑥 2 + 2𝑥 4 )
2 2 −𝑥 2 −𝑦 2 2 −𝑥 2 −𝑦 2 2 −𝑥 2 −𝑦 2
𝑓𝑦𝑦 = 4𝑥 𝑦 𝑒 − 2𝑥 𝑒 = 2𝑥 𝑒 𝑦2 − 1
3 −𝑥 2 −𝑦 2 −𝑥 2 −𝑦 2 −𝑥 2 −𝑦 2
𝑓𝑥𝑦 = 4𝑥 𝑦𝑒 − 4𝑥𝑦𝑒 = 4𝑥𝑦𝑒 (𝑥 2 − 1)
We now need to evaluate each of these at each critical point.
Example

Example
2 −𝑥 2 −𝑦 2
For the function on ℝ × ℝ defined by 𝑓 𝑥, 𝑦 = 𝑥 𝑒 find and classify all
extrema.

Solution
We see from the analysis that we have two local maxima.
These have the same value and are both global maxima.
The points on the critical line can be seen to be minimum values for the surface.
Critical point (𝒂, 𝒃) 𝒇𝒙𝒙 (𝒂, 𝒃) 𝒇𝒚𝒚 (𝒂, 𝒃) 𝒇𝒙𝒚 (𝒂, 𝒃) 𝑫 Classification

2
(0, 𝑦) 2𝑒 −𝑦 0 0 0 Inconclusive – but points are minima
(1,0) −4𝑒 −1 −2𝑒 −1 0 8𝑒 −2 ≈ 1.08 Local maximum
(−1,0) −4𝑒 −1 −2𝑒 −1 0 8𝑒 −2 ≈ 1.08 Local maximum
Example

The contour plot here also shows the two local maxima which are of equal
height, and the line 𝑥 = 0 which is a local minimum.
𝑥=0

(−1,0) (1,0)
A final warning!

Analysis of curves and surfaces using


second (and higher!) derivatives can be a
very useful tool to find extreme values of a
function.

However, the equations for critical values


cannot always be solved exactly.

MATLAB often requires the use of


steepest ascent/descent (“vpasolve”) to
find solutions, with input from the user to
determine the starting point for the
algorithm.

You might also like