# Lagrange Multipliers with Two Constraints Examples 2

Recall that if we want to find the extrema of the function $w = f(x, y, z)$ subject to the constraint equations $g(x, y, z) = C$ and $h(x, y, z) = D$ (provided that extrema exist and assuming that $\nabla g(x_0, y_0, z_0) \neq (0, 0, 0)$ and $\nabla h(x_0, y_0, z_0) \neq (0, 0, 0)$ where $(x_0, y_0, z_0)$ produces an extrema in $f$) then we ultimately need to solve the following system of equations for $x$, $y$ and $z$ with $\lambda$ and $\mu$ as the Lagrange multipliers for this system:

(1)Let's look at some more examples of using the method of Lagrange multipliers to solve problems involving two constraints.

## Example 1

**Find the extreme values of the function $f(x, y, z) = x$ subject to the constraint equations $x + y - z = 0$ and $x^2 + 2y^2 + 2z^2 = 8$.**

Let $g(x, y, z) = x + y - z = 0$ and $h(x, y, z) = x^2 + 2y^2 + 2z^2 = 8$. Then in computing the necessarily partial derivatives we have that:

(2)We will begin by adding the second and third equations together to get that $0 = 4 \mu y + 4 \mu z$ which implies that $0 = \mu y + \mu z$ which implies that $\mu (y + z) = 0$. So either $\mu = 0$ or $y = -z$. If $\mu = 0$ then equations 1 and 2 give us a contradiction as that would imply that $\lambda = 1$ and $\lambda = 0$. Thus $y = -z (*)$, and so:

(3)Now equation 2 implies that $x = 2z (**)$. and plugging this into equation 4 yields $8z^2 = 8$, so $z^2 = 1$ and $z = \pm 1$.

Now for $z = 1$ and from $(**)$ and $(*)$ we have that one such point of interest is $\left (2, -1, 1 \right )$.

For $z = -1$ and from $(**)$ and $(*)$ we have that another such point of interest is $\left (-2,1, -1 \right )$.

In plugging these values into $f$ we see that the maximum is achieved at $(2, -1, 1)$ and is $f(2, -1, 1) = 2$, while the minimum is achieved at $(-2, 1, -1)$ and is $f(-2, 1, -1) = -2$.

## Example 2

**Find the extreme values of $f(x, y, z) = 4 - z$ subject to the constraint equations $x^2 + y^2 = 8$ and $x + y + z = 1$.**

Let $g(x, y, z) = x^2 + y^2 = 8$ and let $h(x, y, z) = x + y + z = 1$. In computing the appropriate partial derivatives we get that:

(4)The third equation immediately gives us that $\mu = 1$, and so substituting this into the other two equations and we have that:

(5)We will then subtract the second equation from the first to get $0 = 2 \lambda x - 2 \lambda y$ which implies that $0 = \lambda x - \lambda y$ which implies that $0 = \lambda (x - y)$. Therefore $\lambda = 0$ or $x = y$. Note that if $\lambda = 0$ then we get a contradiction in equations 1 and 2. Therefore $x = y (*)$. Plugging this into the third equation and fourth equations and we get that:

(6)From the first equation we have that $x = \pm 2$.

Now if $x = 2$, then the second equation implies that $z = -3$, and from $(*)$ we have that a point of interest is $(2, 2, -3)$.

If $x = -2$ then the second equation implies that $z = 5$, and from $(*)$ again, we have that a point of interest is $(-2, -2, 5)$.

Evaluating $f$ at these points and we see that a maximum is achieved at the point $(2, 2, -3)$ and $f(2, 2, -3) = 7$. Similarly, a minimum is achieved at the point $(-2, -2, 5)$ and $f(-2, -2, 5) = -1$.