Optimization Problems (Maxima/Minima) in Multivariable Functions

Nerd Cafe

Goal

To find maximum or minimum values of a multivariable function, often subject to certain conditions (e.g., within a region or constraint).

Step 1: Understand the Problem

For a function f(x,y), you want to find points where the function reaches:

  • Maximum value (peak)

  • Minimum value (valley)

  • Saddle point (neither max nor min, like a horse saddle)

These occur where the gradient vector is zero:

fx=0    and    fy=0\frac{\partial f}{\partial x}=0 \;\;and\;\; \frac{\partial f}{\partial y}=0

Step 2: Mathematical Steps for Finding Critical Points

Let’s say we have:

f(x,y)=x2+y24x6y+13f(x,y)=x^{2}+y^{2}-4x-6y+13

Step A: Compute First-Order Partial Derivatives

fx=fx=2x4f_{x}=\frac{\partial f}{\partial x}=2x-4

and

fy=fy=2y6f_{y}=\frac{\partial f}{\partial y}=2y-6

Step B: Set the Partial Derivatives to Zero

2x4=0x=22y6=0y=3\begin{matrix} 2x-4=0\Rightarrow x=2 \\ \\ 2y-6=0\Rightarrow y=3 \end{matrix}

So the critical point is (2,3).

Step C: Use Second Derivative Test

Let’s define:

fxx=2fx2=2fyy=2fy2=2fxy=2fxy=0\begin{matrix} f_{xx}=\frac{\partial^{2}f }{\partial x^{2}}=2 \\ \\ f_{yy}=\frac{\partial^{2}f }{\partial y^{2}}=2 \\ \\ f_{xy}=\frac{\partial^{2}f }{\partial x \partial y}=0 \end{matrix}

Now compute the discriminant:

D=fxxfyy(fxy)2=(2×2)0=4D=f_{xx}f_{yy}-\left( fxy \right)^{2}=(2\times 2)-0=4

Interpretation:

  • If D>0 and fxx>0 → local minimum

  • If D>0 and fxx<0 → local maximum

  • If D<0 → saddle point

In our case:

Since D=4>0 and fxx=2>0, it's a local minimum at (2,3).

Python Code Using SymPy

Outline

Visualize the Function in 3D

Outline

Summary Table

Step
Action

1

Compute𝑓𝑥,𝑓𝑦

2

Solve𝑓𝑥=0,𝑓𝑦=0

3

Compute second-order partials: 𝑓 𝑥𝑥 , 𝑓 𝑦𝑦 , 𝑓 𝑥𝑦

4

Find discriminant 𝐷 = 𝑓 𝑥𝑥.𝑓 𝑦𝑦 − ( 𝑓 𝑥𝑦 )2

5

Determine max/min/saddle based on D and 𝑓 𝑥𝑥

Keywords

optimization, multivariable calculus, critical points, maxima, minima, saddle point, gradient, partial derivatives, second derivative test, discriminant, local minimum, local maximum, unconstrained optimization, sympy, Python math, calculus with Python, function analysis, 3D plotting, mathematical optimization, surface plot, nerd cafe

Last updated