Find extreme values for $f(x,y,z)=xyz$ given the constraints $g_{1}(x,y,z)=x+y+z-5$ and $g_{2}(x,y,z)=xy+yz+zx-8$ using Lagrange multipliers method.

1.6k Views Asked by At

I want to calculate extreme values for $f(x,y,z)=xyz$ given the constraints $g_{1}(x,y,z)=x+y+z-5$ and $g_{2}(x,y,z)=xy+yz+zx-8$ using Lagrange multipliers method. Im skeptical about my solution for this problem which goes as follow. First I got:

$$\nabla f= (yz)i+(xz)j+(xy)k,$$

$$\nabla g_{1}=i+j+k,$$

and

$$\nabla g_{2}=(y+z)i+(x+z)j+(y+x)k.$$

So from having the equality $\nabla f = \lambda_{1} \nabla g_{1} + \lambda_{2} \nabla g_{2}$ I got the following equation system:

\begin{align*} yz&= \lambda_{1} + \lambda_{2}(y+z) \\ xz&=\lambda_{1} + \lambda_{2}(x+z)\\ xy&=\lambda_{1} + \lambda_{2}(y+z)\\ \end{align*}

But Im really stucked finding the extrem values from the last equations system. So far, I realize that if I sum up the three equations from the system and the way $g_{2}(x,y,z)$ is defined I obtained:

$$xy+yz+zx=8=3(\lambda_{1})+3(\lambda_{2})(x+y+z).$$

But from the way $g_{1}(x,y,z)$ is defined I got that last equation is

$$8=3(\lambda_{1})+3(\lambda_{2})(5).$$

So I found by trial and error that $\lambda_{1}=1$ and $\lambda_{2}=\frac{1}{3}$, im not sure if there is more possible values for $\lambda_{1}$ and $\lambda_{2}$ satysfing the last equation. Anyways, from here I have been trying to find the values for $x,y$ and $z$ substituting the values I obtained for $\lambda_{1}$ and $\lambda_{2}$ in the equation from the original system of equations. For example, from the first equation I got

$$yz=1+\frac{1}{3}(y+z)$$

But finding $x,y$ and $z$ that way is hard. I´ve been thinking also that from some equation before I have that:

$$8=3\lambda_{1}+3\lambda_{2}(x+y+z)=3+(x+y+z)$$.

The problem of finding $x,y$ and $z$ this way is that I got a lot of points satisfying this last equation. Just to list a few:

$$(5,0,0),(0,5,0),(0,0,5),(1,1,3),...$$. Basically, all the points $(x,y,z) \in \mathbb{R}^{3}$ which satisfy $g_{1}(x,y,z)=0$ but I can tell there is something wrong from the fact a lot of these points dont satisfy the equations system obtained from $\nabla f = \lambda_{1} \nabla g_{1} + \lambda_{2} \nabla g_{2}$.

2

There are 2 best solutions below

4
On BEST ANSWER

Here $f(x,y,z) = xyz$, $g(x, y, z) = x+y+z-5$, $h(x, y, z) = xy+yz+zx-8$

So $L(x, y, z, \lambda, \mu) = f(x, y, z) + \lambda g(x, y, z) + \mu h(x, y, z)$

$L_x = yz + \lambda +\mu(y+z) = 0$ --(1)

$L_y = xz + \lambda +\mu(x+z) = 0$ --(2)

$L_z = xy + \lambda +\mu(x+y) = 0$ --(3)

$L_{\lambda} = x+y+z = 5$ --(4)

$L_{\mu} = xy+yz+zx = 8$ --(5)

Multiply (1),(2),(3) by $x,y,z$ respectively, we get

$xyz +\lambda x +\mu(xy+xz) = 0$ --(6)

$xyz +\lambda y +\mu(xy+yz) = 0$ --(7)

$xyz +\lambda z +\mu(xz+yz) = 0$ --(8)

from (6) - (7) we get $(x-y)(\lambda+\mu z) = 0$ --(9)

from (7) - (8) we get $(y-z)(\lambda+\mu x) = 0$ --(10)

from (8) - (6) we get $(z-x)(\lambda+\mu y) = 0$ --(11)

Now if we take $x=y$ from (9), we see that it satisfies (10) and (11) also where $\lambda = -\mu x = -\mu y$, we are $\textbf{not}$ assuming here $z=x=y$

Then putting the vaue of x in (4) we get $2y+z = 5$, putting these values in (5) we get

$y^2 + 2y(5-2y) = 8$ or $3y^2 - 10y + 8 = 0$

Solving for y we get $y = 2,4/3$, so one solution is $2,2,1$ another solution is $4/3,4/3,7/3$

The solution $4/3,4/3,7/3$ gives the maximum value 4.148148,

solution $2,2,1$ gives the minimum value 4.

I am actually amazed to see such a narrow band!.

1
On

Note that you've made a mistake in \eqref{3}.

\begin{align*} yz&= \lambda_{1} + \lambda_{2}(y+z) \tag1\label1\\ zx&= \lambda_{1} + \lambda_{2}(z+x) \tag2\label2\\ xy&= \lambda_{1} + \lambda_{2}(x+y) \tag3\label3\\ \end{align*}

$$\eqref{1} + \eqref{2} + \eqref{3}: 8 = 3\lambda_1 + 10 \lambda_2 \tag4 \label4$$

We can eliminate $\lambda_2$ from \eqref{4}, but we conserve it to simplify the writing.

Each of the first three equations represents a hyperbola.

\begin{align} (y-\lambda_2)(z-\lambda_2) &= \lambda_1 + \lambda_2^2 \\ (z-\lambda_2)(x-\lambda_2) &= \lambda_1 + \lambda_2^2 \\ (x-\lambda_2)(y-\lambda_2) &= \lambda_1 + \lambda_2^2 \end{align}

  • $\lambda_1 + \lambda_2^2 = 0$, so two of the three factors on the LHS is zero. WLOG, say $x = y = \lambda_2$. Then $z = 5 - 2\lambda_2$. Substitute this into the second constraint to get $2 \lambda_2 (5 - 2\lambda_2) + \lambda_2^2 = 8$. This gives $3\lambda_2^2 - 10 \lambda_2 + 8 = (3\lambda_2 - 4)(\lambda_2 - 2)$, so $\lambda_2 = 2$ or $\lambda_2 = 4/3$.
  • $\lambda_1 + \lambda_2^2 \ne 0$, so all of the three factors on the LHS is nonzero. Take any two of the above three equations and cancel the common factor to get an equality between two variables from $x$, $y$ and $z$. Take another one to see that $x = y = z$. Using the first constraint, we see that $x = y = z = 5/3$, but this violates the second constraint since $xy + yz + zx = 3(5/3)^2 = 25/3 > 8$.

(First version, TL;DR)

$$\eqref{4} \to \eqref{3}: \bbox[yellow, 5px, border:1px solid black]{ xy = \lambda_1 + \frac{8-3\lambda_1}{10} (x+y) } \tag5 \label5$$

Eliminate $z$ from the constraint $x + y + z = 5$. \eqref{5} represents a hyperbola $$\left( x - \frac{8-3\lambda_1}{10} \right) \left( y - \frac{8-3\lambda_1}{10} \right) = \lambda_1 + \left(\frac{8-3\lambda_1}{10} \right)^2.$$

  • If $x = \dfrac{8-3\lambda_1}{10}$ or $y = \dfrac{8-3\lambda_1}{10}$, solving quadratic equation with respect to $\lambda_1$ would give $\lambda_1 = -4$ or $\lambda_1 = -\dfrac{16}{9}$, which gives respectively $\lambda_2 = 2$ or $\lambda_2 = \dfrac43$.
    • $(\lambda_1, \lambda_2) = (-4, 2)$: \eqref{3} gives $xy = -4 + 2(x + y)$ iff $(x - 2)(y - 2) = 0$ iff $x = 2$ or $y = 2$. WLOG, say $x = 2$. Similarly, \eqref{1} tells us that $y = 2$ or $z = 2$. WLOG, say $y = 2$, so $z = 5 - 2 - 2 = 1$, so $(x,y,z) = (2,2,1)$ up to permutation.
    • $(\lambda_1, \lambda_2) = \left(-\dfrac{16}{9}, \dfrac43 \right)$: similarly, up to permutation, $(x,y,z) = \left( \dfrac43, \dfrac43, \dfrac73 \right)$
  • Otherwise, $$y = \frac{\lambda_1 + \left(\dfrac{8-3\lambda_1}{10} \right)^2}{x - \dfrac{8-3\lambda_1}{10}} + \frac{8-3\lambda_1}{10}$$

    • except that $\lambda_1 \ne \dfrac83$, since that would give $\lambda_2 = 0$, so from \eqref{1}–\eqref{3}, $y = \lambda_1 / z$, $xy = x (\lambda_1 / z) = \lambda_1$, $z = x$. Since $x$, $y$ and $z$ are symmetric, $x = y = z = \dfrac53$ won't satisfy the second constraint.
    • Then I tried substituting some values and make some calculations from this, but the second constraint can't be satisfied. I tried with Julia without success.

      x = 1
      y(l,x) = (l + (8-3*l)^2/100)/(x - (8-3*l)/10) + (8-3*l)/10
      l1 = 1                 # set sample lambda_1 = 1
      xv = -5/3:0.1:5/3      # set sample range x from -5/3 to 5/3 with increment 0.1
      yv = y.(l1, xv)        # calculate y from x
      zv = 5 .- xv .- yv     # calculate z from x and y
      fv = xv .* yv .* zv    # calculate f = x*y*z
      fmax = maximum(fv)     # find the sample maximum value of f
      # returns 4.6176754133025755
      pos = [i for (i, x) in enumerate(fv) if x == fmax] # find maximizing array index
      # returns 1-element Array: [34]
      xvp,yvp,zvp,fvp = xv[pos[1]], yv[pos[1]], zv[pos[1]], fv[pos[1]]  # save typing for upcoming checking
      # returns tuple: (1.6333333333333333, 1.6029411764705883, 1.7637254901960784, 4.6176754133025755)
      xvp*yvp + yvp*zvp + zvp*xvp # verify second constraint
      # returns 8.326037101114956
      
    • The above hyperbola is due to $\eqref{4} \to \eqref{3}$. Similarly, by $\eqref{4} \to \eqref{1}$ and $\eqref{4} \to \eqref{2}$, we get two other hyperbolae. Observe that the RHS of the above hyperbolae only depends on $\lambda_1$, so by symmetry \begin{align} \left( y - \frac{8-3\lambda_1}{10} \right) \left( z - \frac{8-3\lambda_1}{10} \right) &= \lambda_1 + \left(\frac{8-3\lambda_1}{10} \right)^2 \\ \left( z - \frac{8-3\lambda_1}{10} \right) \left( x - \frac{8-3\lambda_1}{10} \right) &= \lambda_1 + \left(\frac{8-3\lambda_1}{10} \right)^2 \end{align}

      Pick anyone of the above hyperbolae and equate this with the first one. $$\left( x - \frac{8-3\lambda_1}{10} \right) \left( y - \frac{8-3\lambda_1}{10} \right) = \left( y - \frac{8-3\lambda_1}{10} \right) \left( z - \frac{8-3\lambda_1}{10} \right)$$

      Since the case where the common factor $y - \dfrac{8-3\lambda_1}{10} = 0$ has already been discussed, we can cross out this common factor and conclude that $x = z$. Assuming that the RHS of the above equation for hyperbolae is nonnegative, we see that $x - \dfrac{8-3\lambda_1}{10} = \pm \sqrt{\lambda_1 + \left(\frac{8-3\lambda_1}{10} \right)^2}$ from the third hyperbolae. Substitute this back to the second hyperbolae with $z = x$ to see that $y - \dfrac{8-3\lambda_1}{10} = \pm \sqrt{\lambda_1 + \left(\frac{8-3\lambda_1}{10} \right)^2}$. Since $x + y + z = 5 > 0$, the negative solutions are rejected, so $x = y = z = \dfrac53$ from the first constraint, but this doesn't suit the second one.

Hence, $(x,y,z) = \left( \dfrac43, \dfrac43, \dfrac73 \right)$ is the constraint maximum with $f(x,y,z) = \dfrac{112}{27}$, and $(x,y,z) = (2,2,1)$ is the constraint minimum with $f(x,y,z) = 4$.

Remarks: Working on \eqref{1} and \eqref{2} won't give any more useful information.

\begin{align} \eqref{1} + \eqref{2}: 8 - xy &= 2\lambda_1 + \lambda_2(5 + z) \tag6 \label6 \\ \eqref{4} \to \eqref{6}: 8 - xy - 2\lambda_1 &= \frac{8-3\lambda_1}{10} \; (5+z) \\ \frac{10(8 - xy - 2\lambda_1)}{8-3\lambda_1} &= (5+z) \\ z &= \bbox[yellow, 5px, border:1px solid black]{\frac{10(8 - xy - 2\lambda_1)}{8-3\lambda_1} - 5 = \frac{5(8 - 2xy - \lambda_1)}{8-3\lambda_1}} \tag7 \label7 \\ \eqref{5} \to \eqref{7}: z &= \frac{5(8 - 2(\lambda_1 + \frac{8-3\lambda_1}{10} (x+y)) - \lambda_1)}{8-3\lambda_1} \\ &= \frac{40 - 15\lambda_1 - (8-3\lambda_1)(x+y)}{8-3\lambda_1} = 5-(x+y)\tag8 \label8 \end{align}