---
title: Maxima, minima and critical points
heading: The largest value isn't always where the slope is zero
eyebrow: A5 · Lesson 27 · Maxima and minima
xp: 40
---

::: hook
An engineer wants the largest power a solar panel can deliver, but only over the voltages its converter can actually use. The peak might be in the middle of that range, where the slope of the power curve is zero, or it might be at one end, where the curve is still climbing when the range runs out. Finding the true maximum on a range means checking both: the critical points inside, and the endpoints.
:::

::: play
- The curve is $f(x) = x^3 - 6x^2 + 9x + 1$, studied on the interval from $a$ to $b$ (the shaded markers).
- Move the interval. When is the largest value at a critical point, and when is it at an endpoint?
- Read the critical points in the strip: $x = 1$ and $x = 3$.
:::
:::

```sim plot
view: graph
x: x = -1..5
y: y = -15..25
slider: a = -1..2 step 0.1 = 0
slider: b = 2..5 step 0.1 = 4
plot: x^3 - 6*x^2 + 9*x + 1 | label: f(x)
marker: x = a | label: a
marker: x = b | label: b
point: 1, 5 | label: local max
point: 3, 1 | label: local min
readout: f(a) = a^3 - 6*a^2 + 9*a + 1 | digits: 4
readout: f(b) = b^3 - 6*b^2 + 9*b + 1 | digits: 4
```

::: predict
## On the interval $[0, 5]$, where is the maximum of $f(x) = x^3 - 6x^2 + 9x + 1$?

- [ ] At $x = 1$, the local maximum
- [x] At $x = 5$, the right endpoint
- [ ] At $x = 3$
- [ ] At $x = 0$

::: reveal
At $x = 5$: $f(5) = 21$, more than $f(1) = 5$. The local maximum at $x = 1$ is only the highest point nearby. On a closed interval the biggest value overall can be at an end, so the endpoints must always be checked.
:::
:::

::: nameit
## Critical points

A **critical point** of $f$ is where $f'(x) = 0$ or $f'(x)$ doesn't exist (a corner, like $|x|$ at 0). Local maxima and minima of a differentiable function inside an interval can only occur at critical points, since anywhere else the function is still rising or falling.

Not every critical point is an extreme: $x^3$ has $f'(0) = 0$ but just keeps rising through it.

## The closed-interval method

**The extreme value theorem:** a continuous function on a closed interval $[a, b]$ has a largest and a smallest value there. To find them:

1. find the critical points inside $(a, b)$;
2. evaluate $f$ at each of them and at both endpoints;
3. the biggest of those values is the maximum, the smallest the minimum.

## Classifying critical points

**First derivative test:** if $f'$ changes from + to − at $c$, it's a local maximum; from − to +, a local minimum; no change, neither.

**Second derivative test:** at a point with $f'(c) = 0$,
- $f''(c) < 0$: local maximum (concave down);
- $f''(c) > 0$: local minimum (concave up);
- $f''(c) = 0$: the test says nothing; use the first test.

## In engineering

Constraints define the interval: a supply voltage can't be negative, a component value has a manufacturer's range, a duty cycle runs from 0 to 1. Many design optima sit right on a constraint ("use the largest capacitor that fits"), which is the endpoint case.
:::

::: example
## Find the maximum and minimum of $f(x) = x^3 - 6x^2 + 9x + 1$ on $[0, 4]$.

::: solution
1. **Find the critical points.**
   $$\begin{aligned} f'(x) &= 3x^2 - 12x + 9 \\ &= 3(x - 1)(x - 3) \end{aligned}$$
   zero at $x = 1$ and $x = 3$, both inside.
2. **Compare them with the ends.**

| $x$ | 0 | 1 | 3 | 4 |
|---|---|---|---|---|
| $f(x)$ | 1 | 5 | 1 | 5 |

3. **Read off the extremes.** The maximum is 5, reached at both $x = 1$ and $x = 4$; the minimum is 1, at both $x = 0$ and $x = 3$. Ties happen, and the method finds them.

**Answer:** the maximum is 5, at $x = 1$ and $x = 4$, and the minimum is 1, at $x = 0$ and $x = 3$.
:::
:::

::: example
## A converter can run a solar panel between 10 and 15 V, where the panel delivers $P(V) = 8V - 0.004V^3$ watts. What voltage maximizes power?

::: solution
1. **Find the critical point.**
   $$P'(V) = 8 - 0.012V^2$$
   which is zero at
   $$\begin{aligned} V &= \sqrt{8/0.012} \\ &= 25.8\ \text{V} \end{aligned}$$
   outside the range.
2. **Check the endpoints.** Inside $[10, 15]$ there's no critical point, so the maximum is at an endpoint:
   $$P(10) = 76\ \text{W}, \quad P(15) = 106.5\ \text{W}$$
3. **Pick the voltage.** Run the panel at 15 V, the converter's limit, where the power is still rising.

**Answer:** 15 V, where the panel delivers 106.5 W.
:::
:::

::: example
## Find the largest and smallest values of $f(x) = xe^{-x}$ on $[0, 3]$.

::: solution
1. **Differentiate.**
   $$\begin{aligned} f'(x) &= e^{-x} - xe^{-x} \\ &= e^{-x}(1 - x) \end{aligned}$$
   which is zero only at $x = 1$.
2. **Compare the critical point with the ends.**

| $x$ | 0 | 1 | 3 |
|---|---|---|---|
| $f(x)$ | 0 | $1/e = 0.368$ | $3e^{-3} = 0.149$ |

3. **Read off the extremes.** The maximum is 0.368 at $x = 1$ and the minimum is 0 at $x = 0$.
4. **Why the ends matter.** The minimum sits at an end, where the slope isn't zero at all, which is why the ends always have to be checked.

**Answer:** the largest value is $1/e = 0.368$, at $x = 1$, and the smallest is 0, at $x = 0$.
:::
:::

::: check
given: a = 1 | 2; b = 3 | 5
answer: a*b
tolerance: 0.01

## $f(x) = x^3 - \frac{3}{2}(\given{a} + \given{b})x^2 + 3\given{a}\given{b}x$ has critical points where $f'(x) = 3(x - \given{a})(x - \given{b}) = 0$. What is their product?

::: right
Right. The critical points are {a} and {b}, with product {answer}.
:::

::: misses
- [a + b] That's their sum.
- [any] Not yet. Set $f' = 0$ and read off the roots.
:::
:::

::: check
given: c = 4 | 9 | 16
answer: 2*c^1.5/3
tolerance: 0.5%

## What is the maximum value of $f(x) = \given{c}x - \frac{x^3}{3}$ for $x \ge 0$?

::: right
Right. $f' = \given{c} - x^2 = 0$ at $x = \sqrt{\given{c}}$, and $f(\sqrt c) = c^{3/2} - c^{3/2}/3 = \frac{2}{3}c^{3/2}$ = {answer}.
:::

::: misses
- [sqrt(c)] That's where the maximum is. Evaluate $f$ there.
- [c^1.5] Subtract the $x^3/3$ term too.
- [any] Not yet. Find the critical point, check it's a maximum ($f'' = -2x < 0$), and evaluate $f$.
:::
:::

::: check
given: lo = 10 | 12; hi = 15 | 20
answer: 8*hi - 0.004*hi^3

## A panel delivers $P(V) = 8V - 0.004V^3$ watts. A converter can only use voltages from {lo} to {hi} V. What is the most power it can draw?

::: right
Right. The critical point, 25.8 V, is outside the range, and $P$ is increasing on it, so the maximum is at {hi} V: {answer} W.
:::

::: misses
- [8*25.82 - 0.004*25.82^3] That's the unconstrained peak, at 25.8 V, which the converter can't reach.
- [8*lo - 0.004*lo^3] That's the low end. $P$ is still increasing across the range.
- [any] Not yet. Check the critical point is in range; if not, compare the endpoints.
:::
:::

::: check
kind: choice

## At $x = c$, $f'(c) = 0$ and $f''(c) = -3$. What is $c$?

- [x] A local maximum
- [ ] A local minimum
- [ ] An inflection point
- [ ] Can't tell

::: right
Right. Slope zero and concave down: the top of a hump.
:::

::: misses
- [2] Concave up would be a minimum; here $f'' < 0$.
- [any] Use the second derivative test.
:::
:::

::: check
given: k = 2 | 3 | 5
answer: 1/k
tolerance: 0.5%

## Where is the maximum of $f(t) = t\,e^{-\given{k}t}$ for $t \ge 0$?

::: right
Right. $f' = e^{-kt}(1 - kt) = 0$ at $t = 1/\given{k}$.
:::

::: misses
- [k] Solve $1 - kt = 0$ for $t$.
- [0] At $t = 0$, $f = 0$, the minimum.
- [any] Not yet. Product rule, then set $f' = 0$.
:::
:::

::: check
kind: parts
given: a = 1 | 2 | 4; b = 3 | 5

## Let $f(x) = x^2e^{-x/\given{a}}$ for $x \ge 0$.

::: part
answer: 2*a
tolerance: 0.5%

### Where is its critical point with $x > 0$?

::: misses
- [a] $f' = e^{-x/a}\left(2x - x^2/a\right)$: set the bracket to zero.
- [any] Factor out $xe^{-x/a}$ from $f'$.
:::
:::

::: part
answer: 4*a^2*exp(-2)
tolerance: 0.5%

### What is the maximum value of $f$?

::: misses
- [any] Put $x = 2a$ into $f$.
:::
:::

::: part
answer: b^2*exp(-b/a)
tolerance: 0.5%

### What is $f(\given{b})$?

::: misses
- [any] Put $x = \given{b}$ in.
:::
:::
:::

::: check
kind: derivation
vars: k = 0.2..5, x = 0..5

## Find the maximum of $f(x) = xe^{-kx}$ for $x \ge 0$.

::: step
answer: exp(-k*x)*(1 - k*x)

### Differentiate and factor out $e^{-kx}$.
:::

::: step
answer: 1/k

### Where is $f' = 0$?
:::

::: step
answer: 1/(k*exp(1))

### What is the maximum value?
:::

::: right
Right. The peak is at $x = 1/k$, with height $\frac{1}{ke}$: halve $k$ and the peak moves twice as far out and doubles in height.
:::
:::

::: explain
## Why must you check the endpoints of an interval, and not just the points where $f' = 0$?

::: model
Setting $f' = 0$ only finds places where the function levels off. On a closed interval the function might still be rising (or falling) when the interval ends, so its largest or smallest value there can be at an endpoint where the slope isn't zero at all. The extreme value theorem guarantees a maximum and minimum exist, and they're always either at a critical point or at an endpoint, so checking both lists every candidate.
:::
:::

::: practice

::: check
given: a = 1 | 2; b = 4 | 6
answer: (a + b)/2
tolerance: 0.5%

## Where is the maximum of $f(x) = -(x - \given{a})(x - \given{b})$?

::: misses
- [a] That's a root.
- [any] A downward parabola peaks halfway between its roots.
:::
:::

::: check
given: lo = 0 | 1; hi = 3 | 4
answer: hi^2 - 4*hi + 5

## What is the maximum of $x^2 - 4x + 5$ on $[\given{lo}, \given{hi}]$?

::: misses
- [1] That's the minimum, at $x = 2$.
- [any] Compare the critical point and the endpoints.
:::
:::

::: check
given: a = 1..6 int
answer: -2*a^3

## What is the local minimum value of $x^3 - 3\given{a}^2x$?

::: misses
- [2*a^3] That's the local maximum, at $x = -\given{a}$.
- [any] Critical points at $x = \pm\given{a}$; the minimum is at $x = +\given{a}$.
:::
:::
:::
