# Lagrange Multipliers with One Constraint Examples 4

Recall from The Method of Lagrange Multipliers page that with the Method of Lagrange Multipliers that if we have a function $z = f(x, y)$ subject to the constraint $g(x, y) = C$, then if extreme values exist and $\nabla g (x, y) \neq (0, 0)$ on the level curve $g(x, y) = C$ then we can obtain the critical points subject to the constraint by solving the system of equations below and then comparing the values of $f$ at these critical points.

(1)Furthermore, if we have a function $w = f(x, y, z)$ subject to the constraint $g(x, y, z) = C$, then if extreme values exist and $\nabla g(x, y, z) \neq (0,0,0)$ on the level surface $g(x, y, z) = C$, then we can find these extreme values by solving the system of equations below and then comparing the values of $f$ at these critical points.

(2)We will now look at some more examples of solving problems regarding Lagrange multipliers.

## Example 1

**Find the greatest product of three numbers for which their sum equals $S ≥ 0$.**

Notice that in this example, we are not given any equations. We will need to come up with these equations ourselves. Let $x$, $y$, and $z$ be these three numbers mentioned in the question above. We want to maximize their product, that is, we want to maximize:

(3)Our constraint is that the sum of these three numbers equals $S$, that is:

(4)We can now proceed by using the method of Lagrange multipliers. Computing the necessary partial derivatives and we have that:

(5)We immediately see from the first three equations that $yz = xz = xy$, and so:

(6)If $x = y = z = 0$, then this would contradict equation 4 unless $S = 0$. Note that there is no case when only one of $x$, $y$, or $z$ is zero, otherwise we would have a contradict in equations 1 and 2. In the case where only two numbers are zero, then we have that the third number automatically equals $S$, but the product of these three numbers is equal to zero. In fact, when any of the numbers are zero, then the product is equal to zero which is trivially a minimum.

Now to find the maximum product, consider the case when none of the numbers are equal. Then we can divide freely by $x$, $y$ and $z$. We divide the first equation by $z$ and the second equation by $x$ to get that $y = x$ and $z = y$. Thus $x = y = z$. Plugging this into the fourth equation and we have that:

(7)Thus $\left ( \frac{S}{3}, \frac{S}{3}, \frac{S}{3} \right )$ is our only point of interest, and so the maximum product is achieved when $f$ is evaluated at this point to get $\frac{S^3}{27} ≥ 0$.

## Example 2

**Find the greatest and least distance from the point $(2, 1, -2)$ to the unit sphere $x^2 + y^2 + z^2 = 1$ using Lagrange multipliers.**

Notice that in this example, we do not have two functions to work with. Upon examining the question further, we note that the distance between any point $(x, y, z) \in \mathbb{R}^3$ and the point $(2, 1, -2)$ is given by the distance formula in $\mathbb{R}^3$, that is by the function:

(8)In fact, all we need to do is minimize the terms under the radical, that is, minimize:

(9)Thus, we want to maximize and minimize the function $f$ subject to the constraint that the point $(x, y, z)$ for which we're computing the distance from $(2, 1, -2)$ to lies on the unit sphere $x^2 + y^2 + z^2 = 1$. So our constraint equation is:

(10)Solving for the necessary partial derivatives and we get that:

(11)From equation 1 we have that $2x - 4 = 2\lambda x$ which implies that $x - 2 = \lambda x$ which implies that $x - \lambda x = 2$ which implies that $x(1 -\lambda) = 2$.

From equation 2 we have that $2y - 2 = \lambda 2y$ which implies that $y - \lambda y = 1$ which implies that $y(1 - \lambda) = 1$

From equation 3 we have that $2z + 4 = \lambda 2z$ which implies that $z - \lambda z = -2$ which implies that $z(1 - \lambda) = -2$.

Thus equations 1-4 can be rewritten as:

(12)Notice that equations 1 through 3 imply that $x \neq 0$, $y \neq 0$ and $z \neq 0$, for if they did, then that would lead to a contradiction in each of these equations (for example, if $x = 0$, then $0 = 2$!) Thus, we can divide by $x$, $y$, and $z$ freely. Take the first equation and divide by $x$. Take the second equation and divide by $y$, and take the third equation and divide by $z$ to get:

(13)Equations 1 through 3 imply that $\frac{2}{x} = \frac{1}{y} = -\frac{2}{z}$. Now $\frac{2}{x} = \frac{1}{y}$ implies that $y = \frac{x}{2} (*)$. Similarly, $\frac{2}{x} = - \frac{2}{x}$ implies that $\frac{x}{2} = -\frac{z}{2}$ which implies that $z = -x (**)$. Plugging $(*)$ and $(**)$ into equation 4 and we have that:

(14)From $(*)$ and $(**)$, by plugging in $x = \pm \frac{2}{3}$ we get that $y = \pm \frac{1}{3}$, and $z = \mp \frac{2}{3}$. Thus we have two points of interest, namely $\left ( \frac{2}{3}, \frac{1}{3}, -\frac{2}{3} \right )$ and $\left ( - \frac{2}{3}, - \frac{1}{3}, \frac{2}{3} \right )$.

If we evaluate $f$ at these two points, we see that:

(15)Thus $f(x, y, z)$ has a minimum of $4$ and a maximum of $16$. However, we're actually wanting to maximize/minimize the distance between the point $(2, 1, -2)$ and the unit sphere, so in actuality, we're minimizing $\sqrt{f(x, y, z)}$ and so $2$ is the minimum distance, and $4$ is the maximum distance (excluding negative numbers since distances are nonnegative).