Lagrange Multipliers

Find the extreme values of the function $f(x,y) = 2x^2 +y^2$ on the circle $x^2 + y^2 = 1$.


\begin{maximasession}
f(x,y) := 2 * x^2 + y^2;
g: x^2 + y^2;
\maximaoutput*
\i1....
...in{:=}2 x^2+y^2 \\
\i2. g: x^2 + y^2; \\
\o2. y^2+x^2 \\
\end{maximasession}

We set up the system of equations grad(f) = h * grad(g), g = 1. (We do not use "lambda" because that name is already reserved for an existing function in Maxima.)


\begin{maximasession}
eq1: diff(f(x,y), x) = h * diff(g, x);
eq2: diff(f(x,y), y...
...o4. 2 y=2 h y \\
\i5. eq3: g = 1; \\
\o5. y^2+x^2=1 \\
\end{maximasession}

Now we solve the system for x, y, and h.


\begin{maximasession}
solve([eq1, eq2, eq3], [x, y, h]);
\maximaoutput*
\i6. sol...
...1 , h=1 \right] , \left[ x=0 , y=1 , h=1 \right] \right] \\
\end{maximasession}

We see that the extreme values lie among $(1,0)$, $(-1,0)$, $(0,-1)$, $(0,1)$.


\begin{maximasession}[f(1,0), f(-1,0), f(0,-1), f(0,1)];
\maximaoutput*
\i7. [f(...
... f(0,-1), f(0,1)]; \\
\o7. \left[ 2 , 2 , 1 , 1 \right] \\
\end{maximasession}

So the minima occur at $(1,0)$ and $(-1,0)$; the maxima occur at $(0,-1)$ and $(0,1)$.





G. Jay Kerns 2009-12-01