---
title: Maxima and minima in several variables
heading: Finding the peak of a surface
eyebrow: A9 · Lesson 10 · Maxima and minima
xp: 40
---

::: hook
A source with internal impedance $50 + j30\,\Omega$ drives an antenna. What load impedance takes the most power from it? Now there are two knobs, the load's resistance and its reactance, and the power is a surface over them. Its peak is where the surface is flat in every direction: where both partial derivatives vanish. The answer, **conjugate matching**, is one of the most used results in RF engineering, and finding it is a two-variable maximum problem.
:::

::: play
- The shading is the power delivered to a load $R + jX$ from a source $R_s + jX_s$ (1 V RMS). The contours are lines of equal power.
- The dot marks the peak. Move the source's resistance and reactance and watch where the peak goes.
- The readout gives the best power. Where does the dot sit relative to $R_s$ and $X_s$?
:::
:::

```sim plot
view: flow
x: R = 1..150 Ω
y: X = -100..100 Ω
slider: Rs = 10..100 step 5 = 50 Ω
slider: Xs = -60..60 step 5 = 30 Ω
shade: 1000*R/((R + Rs)^2 + (X + Xs)^2) | contours: 14
dot: Rs, -Xs | label: best load
readout: best power, mW = 1000/(4*Rs) | digits: 4
```

::: predict
## The source is $50 + j30\,\Omega$. What load takes the most power?

- [ ] $50 + j30\,\Omega$
- [x] $50 - j30\,\Omega$
- [ ] $50\,\Omega$
- [ ] $0\,\Omega$

::: reveal
$50 - j30\,\Omega$, the **complex conjugate** of the source. The load's reactance cancels the source's, leaving a purely resistive loop, and then the usual maximum-power rule sets $R = R_s$. Setting both partial derivatives of the power to zero gives exactly that.
:::
:::

::: nameit
## Critical points

At a maximum or minimum inside a region, the surface is flat: $\nabla f = \mathbf{0}$, that is, $f_x = 0$ and $f_y = 0$. Such points are **critical points**. Not all of them are extremes: a **saddle** curves up one way and down another.

## The second derivative test

At a critical point, compute

$$D = f_{xx}f_{yy} - f_{xy}^2$$

- $D > 0$, $f_{xx} > 0$: a local **minimum**.
- $D > 0$, $f_{xx} < 0$: a local **maximum**.
- $D < 0$: a **saddle**.
- $D = 0$: the test says nothing.

$D$ is the determinant of the Hessian matrix $\begin{bmatrix}f_{xx} & f_{xy}\\f_{xy} & f_{yy}\end{bmatrix}$, and the test is A7's positive definite test in disguise.

## On a closed region

The largest and smallest values over a closed, bounded region occur either at critical points inside it or on its boundary. Check both.

## Conjugate matching

With source voltage $V$ (RMS) and impedance $R_s + jX_s$, a load $R + jX$ receives

$$P = \frac{V^2R}{(R + R_s)^2 + (X + X_s)^2}$$

$\frac{\partial P}{\partial X} = 0$ gives $X = -X_s$; then $\frac{\partial P}{\partial R} = 0$ gives $R = R_s$. The maximum is $P_\text{max} = \frac{V^2}{4R_s}$.
:::

::: example
## Find and classify the critical points of $f = x^2 + xy + y^2 - 3x$.

::: solution
1. **Set both partials to zero.** $f_x$ and $f_y$ must both vanish:
   $$\begin{aligned} 2x + y - 3 &= 0 \\ x + 2y &= 0 \end{aligned}$$
   These give $x = 2$, $y = -1$.
2. **Second partials.**
   $$f_{xx} = 2, \quad f_{yy} = 2, \quad f_{xy} = 1$$
3. **Classify.**
   $$\begin{aligned} D &= 4 - 1 \\ &= 3 > 0 \end{aligned}$$
   and $f_{xx} > 0$, so it's a minimum.
4. **Its value.**
   $$\begin{aligned} f(2, -1) &= 4 - 2 + 1 - 6 \\ &= -3 \end{aligned}$$

**Answer:** the only critical point is $(2, -1)$, a minimum where $f = -3$.
:::
:::

::: example
## A source of 10 V RMS has impedance $50 + j30\,\Omega$. What is the most power it can deliver?

::: solution
1. **Match the load.** With the conjugate load $50 - j30\,\Omega$, the loop is 100 Ω of pure resistance, so 0.1 A flows.
2. **Load power.**
   $$\begin{aligned} P &= 0.1^2 \times 50 \\ &= 0.5\ \text{W} \end{aligned}$$
3. **Check with the formula.**
   $$\begin{aligned} P &= \frac{100}{4 \times 50} \\ &= 0.5\ \text{W} \end{aligned}$$

**Answer:** at most 0.5 W, delivered into a $50 - j30\,\Omega$ load.
:::
:::

::: example
## Find and classify the critical point of $f = 4x + 6y - x^2 - y^2$.

::: solution
1. **Set both partials to zero.** $f_x$ and $f_y$ must both vanish:
   $$\begin{aligned} 4 - 2x &= 0 \\ 6 - 2y &= 0 \end{aligned}$$
   These give $(2, 3)$.
2. **Its value.**
   $$\begin{aligned} f(2, 3) &= 8 + 18 - 4 - 9 \\ &= 13 \end{aligned}$$
3. **Classify.** The second partials are $f_{xx} = -2$, $f_{yy} = -2$ and $f_{xy} = 0$, so
   $$\begin{aligned} D &= f_{xx}f_{yy} - f_{xy}^2 \\ &= 4 > 0 \end{aligned}$$
   with $f_{xx} < 0$: a maximum.
4. **Check by completing the square.** It shows the shape directly:
   $$f = 13 - (x - 2)^2 - (y - 3)^2$$
   a dome with its peak at $(2, 3)$.

**Answer:** the critical point is $(2, 3)$, a maximum where $f = 13$.
:::
:::

::: check
given: a = 4 | 6; b = 2 | -8
answer: a/2

## Where is the critical point of $f = x^2 + y^2 - \given{a}x - \given{b}y$? Give its $x$-coordinate.

::: right
Right. $f_x = 2x - a = 0$ gives $x = a/2$ = {answer}.
:::

::: misses
- [a] Divide by 2: $f_x = 2x - a$.
- [b/2] That's the $y$-coordinate.
- [any] Not yet. Set $f_x = 0$.
:::
:::

::: check
given: a = 1 | 3; b = 1 | 4; c = 2 | 5
answer: 4*a*c - b^2

## For $f = \given{a}x^2 + \given{b}xy + \given{c}y^2$, what is $D = f_{xx}f_{yy} - f_{xy}^2$ at the origin?

::: right
Right. $f_{xx} = 2a$, $f_{yy} = 2c$, $f_{xy} = b$: $D = 4ac - b^2$ = {answer}.
:::

::: misses
- [a*c - b^2] The second derivatives of $ax^2$ and $cy^2$ are $2a$ and $2c$.
- [4*a*c - 4*b^2] $f_{xy}$ is $b$, not $2b$.
- [any] Not yet. Compute the three second derivatives.
:::
:::

::: check
given: c = 3 | 6 | 9
answer: -c^2/3
tolerance: 0.5%

## What is the minimum value of $f = x^2 + xy + y^2 - \given{c}x$?

::: right
Right. The critical point is $(\frac{2c}{3}, -\frac{c}{3})$, where $f = -\frac{c^2}{3}$ = {answer}.
:::

::: misses
- [-c^2/4] With the $xy$ term, the minimum isn't at $x = c/2$, $y = 0$.
- [any] Not yet. Solve $2x + y = c$, $x + 2y = 0$, then evaluate.
:::
:::

::: check
given: Xs = 30 | -20 | 75
answer: -Xs
unit: Ω

## A source has reactance {Xs} Ω. What load reactance takes the most power from it?

::: right
Right. Conjugate matching: $X = -X_s$ = {answer}, cancelling the source's reactance.
:::

::: misses
- [Xs] Equal reactances add instead of cancelling.
- [0] Zero reactance leaves the source's own reactance in the loop.
- [any] Not yet. Set $\partial P/\partial X = 0$.
:::
:::

::: check
given: V = 5 | 10; Rs = 50 | 75
answer: V^2/(4*Rs)*1000
unit: mW
tolerance: 0.5%

## A source of {V} V RMS with impedance $\given{Rs} + j20\,\Omega$ is conjugate-matched. What power does the load receive?

::: right
Right. $\frac{V^2}{4R_s}$ = {answer}: the reactance doesn't affect the maximum once it's cancelled.
:::

::: misses
- [V^2/Rs*1000] Half the voltage appears across the load: $\frac{V^2}{4R_s}$.
- [V^2/(2*Rs)*1000] The load gets half the voltage, so a quarter of $V^2/R_s$.
- [any] Not yet. With $X = -X_s$ and $R = R_s$.
:::
:::

::: check
kind: choice

## What is the critical point of $f = x^2 - y^2$?

- [x] A saddle at the origin
- [ ] A minimum at the origin
- [ ] A maximum at the origin
- [ ] It has no critical point

::: right
Right. $D = (2)(-2) - 0 = -4 < 0$: up along $x$, down along $y$.
:::

::: misses
- [2] Along $y$ it goes down.
- [4] $\nabla f = (2x, -2y)$ is zero at the origin.
- [any] Compute $D$.
:::
:::

::: check
kind: parts
given: a = 4 | 6; b = 2 | 8

## Find the maximum of $f = \given{a}x + \given{b}y - x^2 - y^2$.

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

### Where is it, in $x$?

::: misses
- [a] $f_x = a - 2x = 0$.
- [any] Set $f_x = 0$.
:::
:::

::: part
answer: (a^2 + b^2)/4
tolerance: 0.5%

### What is the maximum value?

::: misses
- [any] $f = \frac{a^2 + b^2}{4} - \left(x - \frac a2\right)^2 - \left(y - \frac b2\right)^2$.
:::
:::
:::

::: check
kind: derivation
vars: a = -2..2, b = -2..2, c = -2..2

## Classify the critical point of $f = ax^2 + bxy + cy^2$ at the origin.

::: step
answer: 4*a*c - b^2

### What is $D = f_{xx}f_{yy} - f_{xy}^2$?
:::

::: step
answer: 2*a

### What is $f_{xx}$, whose sign decides max or min when $D > 0$?
:::

::: right
Right. $D < 0$ is a saddle; $D > 0$ with $f_{xx} > 0$ a minimum, with $f_{xx} < 0$ a maximum.
:::
:::

::: explain
## Why must both partial derivatives be zero at the peak of a smooth surface?

::: model
At the peak, moving a little in any direction can't increase the height. If $f_x$ were positive, stepping in the $+x$ direction would go uphill; if negative, stepping in $-x$ would. Either way the point wouldn't be the peak. The same holds for $y$. So at an interior maximum (or minimum) the slope in every direction is zero, which means $\nabla f = \mathbf{0}$. The converse fails: a flat point can be a saddle, which is why the second derivative test is needed.
:::
:::

::: practice

::: check
given: a = 2 | 6; b = 4 | 10
answer: b/2

## Where is the critical point of $f = x^2 + y^2 - \given{a}x - \given{b}y$? Give its $y$-coordinate.

::: misses
- [a/2] That's $x$.
- [any] $f_y = 2y - b = 0$.
:::
:::

::: check
given: Rs = 8 | 25 | 50 | 75 | 100 | 300 | 600
answer: Rs
unit: Ω

## A source has resistance {Rs} Ω and its reactance is already cancelled. What load resistance takes the most power?

::: misses
- [any] $R = R_s$.
:::
:::

::: check
given: a = 1 | 2; c = 3 | 4; b = 5 | 6
answer: 4*a*c - b^2

## For $f = \given{a}x^2 + \given{b}xy + \given{c}y^2$, what is $D$? (Negative means a saddle.)

::: misses
- [any] $(2a)(2c) - b^2$.
:::
:::
:::
