SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 2.4.1 Maxima and minimaConcept · 25 min
      2. 2.4.2 Concavity and the second derivativeConcept · 25 min
      3. 2.4.3 Newton's method with derivativesConcept · 30 min
      4. 2.4.4 Practice set: using derivativesPractice set · 25 min
      5. 2.4.5 Case study: convexity and risk aversionCase study · 30 min
      6. 2.4.6 Case study: implied volatility by Newton's methodCase study · 30 min

Level 2, Single-variable calculus 2.4 Using derivatives Lesson 1 of 6

ConceptLesson 2.4.1 in Level 2, Single-variable calculus. About 25 minutes.

Maxima and minima

Peaks and valleys

A local maximum is a point of the graph higher than every point near it: a hilltop. A local minimum is lower than every point near it: a valley floor. "Near" means within some small distance on either side.

The global maximum of a function on an interval is its highest value there, and the global minimum its lowest. A local maximum need not be global: another hill may be taller.

An answer has two parts: where, an input xx in input units, and how much, the value f(x)f(x) in output units. For f(x)=x3−3xf(x) = x^3 - 3x there is a hilltop at x=−1x = -1 of height 2. Yet f(2.5)=8.125f(2.5) = 8.125, higher than the hilltop.

Critical points

At a smooth hilltop the graph rises, then falls. The slope goes from positive to negative and passes through 0 on the way, so the tangent is flat for an instant. At a valley floor the slope goes from negative to positive.

A graph can also turn at a corner, where there is no tangent at all. ∣x∣|x| has its lowest point at 0, where lesson 2.2.2 found no derivative.

Rule: Critical point

f′(c)=0or f′(c) does not exist\begin{gathered} f'(c) = 0 \\ \text{or } f'(c) \text{ does not exist} \end{gathered}

A point cc in the domain of ff where either holds is a critical point. Every local maximum or minimum inside the domain is one. The reverse fails: a critical point can be neither, so test each one.

For f(x)=x3−3xf(x) = x^3 - 3x, the power and sum rules (lesson 2.3.1) give f′(x)=3x2−3f'(x) = 3x^2 - 3. It factorises as 3(x−1)(x+1)3(x - 1)(x + 1), which is zero at x=−1x = -1 and x=1x = 1. The values there are f(−1)=2f(-1) = 2 and f(1)=−2f(1) = -2.

A polynomial has a slope everywhere, so these two are its only critical points.

The first-derivative test

The slope can change sign only at a critical point. So one test input in each gap between critical points tells you the sign of f′f' on the whole gap.

Rule: First-derivative test

f′ ⁣:+ then −  ⇒  maximumf′ ⁣:− then +  ⇒  minimum\begin{gathered} f' \colon + \text{ then } - \;\Rightarrow\; \text{maximum} \\ f' \colon - \text{ then } + \;\Rightarrow\; \text{minimum} \end{gathered}

Rising then falling is a peak; falling then rising is a valley. If f′f' has the same sign on both sides, the point is neither.

For x3−3xx^3 - 3x, test one input in each gap:

xx−2-2−1-1012
f′(x)f'(x)90−3-309
graphrisingflatfallingflatrising

So x=−1x = -1 is a local maximum and x=1x = 1 a local minimum. The factors give the same signs without test inputs. In 3(x−1)(x+1)3(x - 1)(x + 1), both brackets are negative below −1-1 and both positive above 1, so the product is positive there; in between, they have opposite signs.

Slide the point across x=−1x = -1 below. The slope graph underneath crosses zero from above to below: rising turns into falling. At x=1x = 1 it crosses from below to above.

Then switch to ∣x∣|x|. At 0 the slope jumps from −1-1 to 1, and the sign still changes from minus to plus.

Explore

Slide the point along the curve. Its tangent shows the slope there, and the lower graph plots that slope for every x: the derivative.

−2−1012−4−2024

The slope of y = x³ − 3x, which is 3x² − 3

−2−10120510
Point
(−1.8, −0.432)
Slope there
6.72
The curve is
rising: the slope is positive, so the slope graph is above zero

Neither: a flat point on a rising curve

x3x^3 has slope 3x23x^2, which is zero at 0, so 0 is a critical point. But 3x23x^2 is positive on both sides: 0.03 at −0.1-0.1 and at 0.10.1. The graph rises to 0, flattens for an instant, and keeps rising.

So 0 is neither a maximum nor a minimum. Just left of it the value is lower (−0.001-0.001 at −0.1-0.1), and just right it is higher (0.0010.001 at 0.10.1). Lesson 2.2.1 met this point: the flat tangent y=0y = 0 crosses the curve there.

A corner

∣x∣|x| has slope −1-1 for x<0x < 0 and 1 for x>0x > 0 (lesson 2.2.2). Minus then plus: 0 is a minimum, with value 0. The test needs a slope on each side, not at the point itself.

Try it

SymPy differentiates x3−3xx^3 - 3x, solves f′(x)=0f'(x) = 0, and evaluates ff at the two answers.

The loop prints the slope at one test input in each gap: −2-2, 0 and 2.

⌘/Ctrl + Enter runs the cell

Try it

Central differences (lesson 2.2.2) estimate the slope just left and just right of 0, for x3x^3 and for ∣x∣|x|.

For x3x^3 both sides give 0.03: no sign change, so neither. For ∣x∣|x| they give −1-1 and 1: a minimum.

⌘/Ctrl + Enter runs the cell

Largest and smallest on a closed interval

A closed interval [a,b][a, b] includes its two ends. A continuous function on a closed interval always has a largest and a smallest value there. Each one sits either at a critical point inside the interval or at an end.

Rule: Extremes on a closed interval

compare f(a) and f(b)with f(c) at eachcritical point a<c<b\begin{gathered} \text{compare } f(a) \text{ and } f(b) \\ \text{with } f(c) \text{ at each} \\ \text{critical point } a < c < b \end{gathered}

The largest of these values is the global maximum on [a,b][a, b], and the smallest is the global minimum. Critical points outside the interval do not count.

For x3−3xx^3 - 3x on [−2,2.5][-2, 2.5], the candidates are both ends and the two critical points:

xx−2-2 (end)−1-112.5 (end)
f(x)f(x)−2-22−2-28.125

The largest value is 8.125, at the right end. The smallest is −2-2, reached twice: at the left end and at the local minimum.

The cubic x3−3xx^3 - 3x on [−2,2.5][-2, 2.5]. The tangents are flat at the local maximum and minimum, but the largest value, 8.125, is at an end. The smallest, −2-2, is reached at an end and at the local minimum.

A second example: xe−xxe^{-x} on [0,4][0, 4]

Start with a table of g(x)=xe−xg(x) = xe^{-x}:

xx00.5124
g(x)g(x)00.30330.36790.27070.0733

The values climb, then fall, so the peak is near 1. Algebra pins it down. The product rule (lesson 2.3.2), with −e−x-e^{-x} as the slope of e−xe^{-x} (lesson 2.3.4), gives

g′(x)=e−x−xe−x=(1−x)e−xg'(x) = e^{-x} - xe^{-x} = (1 - x)e^{-x}

e−xe^{-x} is always positive, so g′g' has the sign of 1−x1 - x: plus before 1, minus after. So 1 is a maximum, with g(1)=e−1≈0.3679g(1) = e^{-1} \approx 0.3679. Comparing with the ends, g(0)=0g(0) = 0 and g(4)≈0.0733g(4) \approx 0.0733, the largest value is 0.3679 at 1 and the smallest is 0 at the left end.

Critical points outside, and no ends at all

For x2−4xx^2 - 4x on [3,6][3, 6], the slope 2x−42x - 4 is zero only at 2, outside the interval. So only the ends compete: the smallest value is −3-3 at 3, the largest 12 at 6.

Without ends there is no guarantee. On the whole number line x3−3xx^3 - 3x has no largest value: it is 970 at x=10x = 10 and 999,700 at x=100x = 100.

Try it

candidates lists both ends and every critical point strictly inside, with the value of ff at each. max(values, key=values.get) picks the input with the largest value.

The three lines are the three examples of this section. 5/2 is SymPy's exact 2.5.

⌘/Ctrl + Enter runs the cell

Lesson 2.4.2 tells a maximum from a minimum with the second derivative. When f′(x)=0f'(x) = 0 has no formula, lesson 2.4.3 solves it with Newton's method.

Common mistakes

  1. f′(c)=0f'(c) = 0 does not guarantee a peak or a valley. x3x^3 is flat at 0 and still rising on both sides.
  2. A critical point can have no derivative. ∣x∣|x| has its minimum at 0, where f′f' does not exist.
  3. Read the sign on both sides. A maximum needs plus then minus; one side alone decides nothing.
  4. Check the ends of a closed interval. For x3−3xx^3 - 3x on [−2,2.5][-2, 2.5] the largest value is at the end 2.5.
  5. Drop critical points outside the interval. For x2−4xx^2 - 4x on [3,6][3, 6], the critical point 2 does not count.
  6. Local is not global. The hilltop 2 of x3−3xx^3 - 3x is not its largest value on [−2,2.5][-2, 2.5].
  7. Report where and how much: the xx of the maximum and the value f(x)f(x) there.

Maxima and minima

0 of 10 correct

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 7.
  8. 8.
  9. 9.
  10. 10.
How to type answers
  • Powers with ^: x^7, 2^(1/3), a^-2.
  • Multiply with * or by writing side by side: 3x^2, 2(x+1).
  • ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
  • Your first answer to each question is saved: it counts towards your score and brings the question back for review.
  • Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.

Summary card

  • A local maximum or minimum is higher or lower than every nearby point; the global ones on an interval are the highest and lowest of all.
  • A critical point is where f′(c)=0f'(c) = 0 or f′(c)f'(c) does not exist. Every local maximum or minimum inside the domain is one, but not every critical point is either (x3x^3 at 0).
  • First-derivative test: f′f' goes plus to minus at a maximum, minus to plus at a minimum, and keeps its sign at neither.
  • On [a,b][a, b], compare ff at both ends and at each critical point inside.

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.