In [17]:

```
graph('x**2 + 6*x - 20', -20, 20)
```

In [18]:

```
graph('2*x + 6', -20, 20)
```

$z = f(x,y)$

(Local) Maximum: \begin{align*} f_x, \ f_y &= 0 \\ f_{xx}, \ f_{yy} &< 0 \\ f_{xx}, \ f_{yy} &> (f_{xy})^2 \\ \end{align*}

(Local) Minimum: \begin{align*} f_x, \ f_y &= 0 \\ f_{xx}, \ f_{yy} &> 0 \\ f_{xx}, \ f_{yy} &> (f_{xy})^2 \\ \end{align*}

Need more details on finding the maximum or minimum of a function?

What if the function has more than one variable?

See page 86 of Dowling.

We use the Lagrangian function:

$$L(x,y,\lambda) = f(x,y) - \lambda[g(x,y)-c]$$

*Two forms $+$ or $-$. Which do you use? How do you remember?*

Step 1: Write down $L$

Step 2: Differentiate $L$ with respect to $x$ and $y$, and equate to $0$.

Step 3: These two equations and the constraint give you three equations.

$$ L_x = f_x - \lambda g_x = 0 \\ L_y = f_y - \lambda g_y = 0 \\ g(x,y) = c $$

Solve these three equations for the three unknowns $x$, $y$, and $\lambda$.

Sydsæter, Hammond, and Strøm Page 498-502 Example 1-4

Sydsæter, Hammond, and Strøm Page 507 Example 1 for multiple solutions.

$x^*$ and $y^*$ are the optimal solutions.

If we change the constraint, $c$, these optimal solutions will change: $$ x^* = x^*(c) \\ y^* = y^*(c) $$ Plug these back into the objective function and we get the value function: $$ f^*(c) = f(x^*(c),y^*(c)) $$ and if we differentiate the value function with respect to $c$, we find: $$ \dfrac{d f^*(c)}{dc} = \lambda(c) = \lambdaˆ* $$

Refer to page 504 of Sydsæter, Hammond, and Strøm for the proof.

Watch this Khan Academy video on constrained optimisation.

Page 509-511 in Sydsæter, Hammond, and Strøm have a geometric and analytic explanation.

Start with *unconstrained* optimisation problem of maximise $U = f(x,y,\phi)$.

Plug the solutions back into the objective function to find a maximum value function (indirect objective function).

Take the derivative of the value function with respect to an exogenous parameter.

What do you find?

Best explanation is for unconstrained optimisation by Chiang and Wainwright on Page 428.

13.30, 13.31, 13.32 of Dowling

Problem to maximise $f(x,y)$ subject to $g(x,y) \leq c$.

Step 1: Define the Lagrangian $$ L(x,y) = f(x,y) - \lambda (g(x,y)-c) $$

Step 2: Equate the partial derivatives to zero: $$ L_x = f_x - \lambda g_x = 0\\ L_y = f_y - \lambda g_y = 0 $$

Step 3: Introduce the *complementary slackness condition*.
$$
\lambda \geq 0 \\
\lambda \cdot [g(x,y)-c] = 0
$$
Step 4: The solution must satisfy the constraint.
$$
g(x,y) \leq c
$$

Work through Chiang and Wainwright Page 404 Step 2

We could treat non-negativity constraints as normal and introduce additional Lagrange multipliers.

Working from Sydsæter, Hammond, and Strøm Page 538, let's try this out on the board.

How could we simplify the first order conditions? (Hint: By removing the additional Lagrange multipliers.)

Show the graphical intuition Chiang and Wainwright Page 403, Figure 13.1.

First order conditions: $$ L_x = f_x - \lambda g_x \leq 0 \\ x \cdot L_x = 0 \\ $$ $$ L_y = f_y - \lambda g_y \leq 0 \\ y \cdot L_y = 0 \\ $$ Complementary slackness: $$ \lambda \geq 0 \\ \lambda \cdot [g(x,y)-c] = 0 \\ $$ Constraints: $$ g(x,y) \leq c \\ x \geq 0 \\ y \geq 0 $$

Sydsæter, Hammond, and Strøm Page 538-539 Example 1.