\section{The Method of Lagrange Multipliers}
\begin{enumerate}[1.]
\item
{\it Find the largest and smallest values of the function $f(x,y,z)=x+2y$ in the closed disc $x^2+y^2\leq 25$.}


\medskip




Since $\nabla f=\langle 1,2\rangle \neq 0$, there are no critical points. Therefore the largest and smallest values 
are attained on the circle $x^2+y^2=25$. 

We use Lagrange multipliers with $g(x,y)=x^2+y^2-25$. We have
$\nabla g=\langle 2x,2y\rangle$, so that if $\nabla f=\lambda \nabla g$, then $1=2\lambda x$, 
$2=2\lambda y$. Hence $\lambda\neq 0$ and $2\lambda y=2=4\lambda x$, $y=2x$. Plugging this into the 
equation of the circle we get $x^2+(2x)^2=5x^2=25$, $x^2=5$, $x=\pm\sqrt{5}$.

This yields two critical points, $( \sqrt{5},  2\sqrt{5})$ and $(- \sqrt{5}, - 2\sqrt{5})$.
We have $f( \sqrt{5},  2\sqrt{5})=5\sqrt{5}$, the largest value, and 
$f( -\sqrt{5},  -2\sqrt{5})=-5\sqrt{5}$, the smallest value.

\bigskip

\item {\it 
Find the largest and smallest values of the function $f(x,y)=x^2-3x-\frac{y^2}{2}$ in the closed disc $x^2+y^2\leq 4$.}


\medskip



We first look for critical points.
From $\nabla f=\langle 2x-3, -y \rangle = 0$, we get $y=0$ and $x=3/2$. The corresponding value of $f$
is 
$$f\left(\frac{3}{2},0\right)=\frac{9}{4}-\frac{9}{2}=-\frac{9}{4}.$$ 


Next, we look for the largest and smallest values 
on the circle $x^2+y^2=4$. We use Lagrange multipliers with $g(x,y)=x^2+y^2-4$. Then
$\nabla g=\langle 2x,2y\rangle$, so that $\nabla f=\lambda \nabla g$ implies $2x-3=2\lambda x$, 
$-y=2\lambda y$. From the second equation, we have $y=0$ or $2\lambda=-1$.

\begin{itemize}

\item If $y=0$, then from the equation of the circle we get $x^2=4$, $x=\pm 2$,
with the corresponding values of $f$:
$$
f(2,0)= 4-6=-2,\ \ f(-2,0)=4+6=10.
$$

\item If $2\lambda=-1$, then from the first equation we have $2x-3=-x$, $3x=3$, $x=1$. From the
equation of the circle, we then have $y^2=3$, $y=\pm\sqrt{3}$. The corresponding values of $f$ are
$$
f(1, \pm \sqrt{3})= 1-3-\frac{3}{2}=-\frac{7}{2}.
$$
\end{itemize}


Finally, we choose the largest and smallest of these values: the largest value is $f(-2,0)=4+6=10$,
and the smallest value is $f(1, \pm \sqrt{3})= 1-3-\frac{3}{2}=-\frac{7}{2}$.

\bigskip

\item {\it Find the largest and smallest values of the function $f(x,y)=\frac{x}{y}$ in the closed region 
$x^2+(y-2)^2 \leq 1$.}


\medskip



Note that the function is continuous in the region: if $x^2+(y-2)^2 \leq 1$, then $(y-2)^2 \leq 1$,
$|y-2|\leq 1$, $1\leq y\leq 3$, so that in particular 
$y\neq 0$.

We first check for critical points:
from $\nabla f=\langle \frac{1}{y}, -\frac{x}{y^2} \rangle = 0$, we get no solutions. Therefore the largest and
smallest values have to be attained on the boundary.


Next, we look for the largest and smallest values 
on the circle $x^2+(y-2)^2=1$. We use Lagrange multipliers with $g(x,y)=x^2+(y-2)^2$.
We have
$\nabla g=\langle 2x,2(y-2) \rangle$. For convenience, we will use the equation
$\nabla f=\frac{\lambda}{2} \nabla g$, so that 
$$
\frac{1}{y}=\lambda x,\ \ -\frac{x}{y^2}=\lambda(y-2).
$$
The first equation implies that $x\neq 0$ (otherwise we would have $1/y=0$, which is impossible), and 
$\lambda=1/(xy)$. From the second equation, we then have
$$
-\frac{x}{y^2}=\frac{y-2}{xy},\ \ -\frac{x}{y}=\frac{y-2}{x},\ \ -x^2=y(y-2) = y^2-2y.
$$
But then from the equation of the circle, 
$$
1= x^2 + (y-2)^2 = - y^2+ 2y + y^2 -4y +4 = -2y +4.
$$
Therefore $2y=3$, $y=3/2$, and $x^2=-(y^2-2y) = -(\frac{9}{4}-3)=\frac{3}{4}$, $x=\pm\frac{\sqrt{3}}{2}$.
Finally, we have
$$
f\left( \frac{\sqrt{3}}{2},\frac{3}{2}\right) = \frac{1}{\sqrt{3}},\ \ 
f\left( -\frac{\sqrt{3}}{2},\frac{3}{2}\right) =- \frac{1}{\sqrt{3}},\ \ 
$$
and these are the largest and smallest values, respectively.

\bigskip

\item {\it Let $A > 0$ be some real number. 
Find the point(s) on the surface $xyz= A^3$ that is closest to the origin, and calculate the minimum distance of this surface to the origin.  Your answer will depend upon the constant $A$.}

\medskip

We want to minimize the square of the distance to the origin, 
$f(x,y,z)=x^2+y^2+z^2$, with the constraint $g(x,y,z)=xyz=A^3$.
We have $\nabla f=\langle 2x,2y,2z \rangle$ and $\nabla g=\langle yz,xz, xy \rangle$.
Hence we need to solve
\begin{equation*}
2x=\lambda yz,\ 2y=\lambda xz,\ 2z=\lambda xy,\ xyz=A^3.
\end{equation*}
Since $xyz= A^3 \neq 0$, all of $x,y,z$ are nonzero. We therefore rewrite the first three equations as
$$\frac{\lambda}{2}=\frac{x}{yz}=\frac{y}{xz}=\frac{z}{xy}.
$$
Cross-multiplying, we get $x^2z=y^2z$ and $xy^2=xz^2$, so that (using again that $x,y,z$ are all nonzero) we have
$x^2=y^2=z^2$, so that $x=\pm y$ and $y=\pm z$. This gives up to 8 possible points. Now, from the final equation we have 
$$
A^3 = xyz=\pm x^3.
$$
Now,  since $A > 0$,  we see that $xyz$ \textit{must be positive}! This will further restrict our choices, leaving us with four points:
$$
(A,A,A), \ (A,-A,-A), (-A,A,-A),\ (-A,-A,A).
$$
Clearly, all four points have the same distance from the origin, which is
$\sqrt{3A^2}$. 


Since the surface $xyz=A^3$ is not bounded, we should also explain why the distance function has a global minimum (and not just a critical point) at the four points listed above. This is because if any of $x,y,z$ tend to infinity, so does the distance to the origin. The details could be worked out as in Notes 4.2.  The two figures below illustrate the surface $xyz = A$ for two distinct values of $A$. Minimizing points for the distance to the origin are shown in red.

\begin{figure}[h!]
    \centering
    \begin{minipage}{0.5\textwidth}
        \centering
        \includegraphics[width=\textwidth]{43solnfig1} % first figure itself
        \caption{$A=5$}
    \end{minipage}\hfill
    \begin{minipage}{0.5\textwidth}
        \centering
        \includegraphics[width=\textwidth]{43solnfig2} % second figure itself
        \caption{$A = 1$}
    \end{minipage}
\end{figure}


\item
{\it Find the maximum and minimum values of $xy^2+yz^2$ in the ball $x^2+y^2+z^2\leq 1$.}

\medskip

Let $f(x,y,z)=xy^2+yz^2$. We first look for critical points: $\nabla f=\langle y^2, 2xy+z^2, 2yz\rangle$, so that at a critical point
we must have $y=0, z=0$. There is no equation for $x$, so we have a family of critical points $(x,0,0)$ with $f(x,0,0)=0$.

Next, we look for the extreme values on the surface of the ball. We use Lagrange multipliers. Let $g(x,y,z)=x^2+y^2+z^2$,
then $\nabla g =\langle 2x, 2y, 2z \rangle$. We get equations 
$$
y^2=2\lambda x,\ \  2xy+z^2= 2\lambda y,\ \  2yz= 2\lambda z.
$$
From the last equation, $z=0$ or $\lambda=y$.
\begin{itemize}
\item If $z=0$, then from the second equation $2xy=2\lambda y$, so that $y=0$ (a case we've covered already) or 
$\lambda=x$. In the latter case, from the first equation $y^2=2x^2$, and plugging it into the equation of the sphere,
$x^2+y^2+z^2=3x^2=1$, $x=\pm 1/\sqrt{3}$. We get four critical points
$$
f \Big(\sqrt{\frac{1}{3}}, \pm\sqrt{\frac{2}{3}} ,0 \Big)=\frac{2}{3\sqrt{3}}, \ \ 
f \Big(-\sqrt{\frac{1}{3}}, \pm\sqrt{\frac{2}{3}}, 0 \Big)=-\frac{2}{3\sqrt{3}}.
$$
\item If $\lambda=y$, then from the first two equations we have $y^2=2xy$ and $2xy+z^2=2y^2$, so that $y^2+z^2=2y^2$,
$y^2=z^2$. Also, from $y^2=2xy$ we have $y=0$ or $y=2x$. If $y=0$, then also $z=0$ and we've covered this case already. 
If $y=2x$, then $x^2+y^2+z^2=y^2+4x^2+4x^2=9x^2=1$, so that $x=\pm 1/3$. We get four critical points:
$$
f \Big( \frac{1}{3}, \frac{2}{3}, \pm \frac{2}{3} \Big) = \frac{4}{9},\ \ 
f \Big( -\frac{1}{3}, -\frac{2}{3}, \pm \frac{2}{3} \Big) = -\frac{4}{9}.
$$


\end{itemize}

Since $\frac{4}{9}>\frac{2}{3\sqrt{3}}$, the maximum and minimum values are $4/9$ and $-4/9$, at the above points.
\end{enumerate}
