How to find the minimum and maximum of a multivariable function given two constraints

calculusderivativeslagrange multipliermultivariable-calculuspartial derivative

Find the minimum and maximum of $f(x, y, z) = y + 4z$ subject to two constraints, $3x + z = 5$ and $x^2 + y^2 = 1$.

Having a hard time figuring out how to do this problem. I think I'm doing it right but I can't seem to get the correct answer in exact terms.

Here's what I got so far (the labels are respectively up and down is left to right so $g(x,y,z)=3x+z=5$:

$$f_x = g_xλ + h_x\delta$$
$$f_y = g_yλ + h_y\delta$$
$$f_z = g_zλ + h_z\delta$$


$$0 = (3)λ + (2x)\delta$$
$$1 = (0)λ + (2y)\delta$$
$$4 = (1)λ + (0)\delta$$

After doing the calculations I get $λ = 4$.


Now I solve for $x$ and $y$ by plugging in that value into the equations.

I get:

$$x=-\frac{6}{\delta}$$
$$y=\frac{1}{2\delta}$$

Then I plug it into $f(x,y,z)$ and get:

$$\frac{6}{\delta}^2+\frac{1}{2\delta}^2=1$$

$$\delta = \frac{\sqrt{(145)}}{2}$$


So solving for $x$ and $y$ again:

$$x=-\frac{-12}{\sqrt{145}}$$
$$y=\frac{1}{\sqrt{145}}$$


Then I solve for $z$ by using $g(x,y,z)$:

$$-\frac{-12}{\sqrt{145}}*3+z=5$$
$$z=5+\frac{36\sqrt{145}}{145}$$


So then my point is: $$(\frac{12}{\sqrt{145}},\frac{1}{\sqrt{145}},5+\frac{36\sqrt{145}}{145})$$


I plug this into $f(x,y,z)$:

$$f(x,y,z)=\frac{1}{\sqrt{145}}+4\left(5-\frac{36\sqrt{145}}{145}\right)$$

and get: $$f(x,y,z)=\sqrt{145}+20$$


And so I use the opposite point to get the other value (each value multiplied by -1):

$$f(x,y,z)=-\frac{1}{\sqrt{145}}+4\left(5-\frac{36\sqrt{145}}{145}\right)$$

$$f(x,y,z)=-\sqrt{145}+20\quad $$


So my final answers are:

$$maximum = \sqrt{145}+20\quad$$
$$minimum = -\sqrt{145}+20\quad$$

Yet they're both wrong. I have no clue what's happening. I've checked my calculations a lot of times. I must be missing steps somewhere.

I don't know how to solve this problem.

If you just want to provide a final answer that'll at least help me back track. Thank you.

Best Answer

Since the objective function is a function of $y,z$ can we rewrite the constraints to eliminate x, and have objective and constraints in the same variables?

$3x + z = 5\\ x = \frac {5-z}{3}\\ x^2 + y^2 = 1\\ \left(\frac {5-z}{3}\right)^2 + y^2 = 1$

We have an ellipse. We need to find where the tangent of the ellipse is parallel to $y+4z$

$-2\frac {5-z}{9}\ dz + 2y\ dy = 0\\ \frac {dy}{dz} = \frac {5-z}{9y}\\ \frac {dy}{dz} = -4\\ 5-z = -36y$

and plug this back into our constraint.

$145 y^2 = 1\\ y = \pm \frac {1}{\sqrt {145}}\\ z = 5 \pm \frac {36}{\sqrt{145}}\\ f(x,\frac {1}{\sqrt {145}},5+\frac {36}{\sqrt{145}}) = 20 + \sqrt{145}\\ f(x,-\frac {1}{\sqrt {145}},5-\frac {36}{\sqrt{145}}) = 20 -\sqrt{145}$

Which is the same as you have above.

Otherwise, we could do something with Lagrange multipliers

$F(x,y,z,\lambda,\mu) = y+4z + \lambda (x^2 + y^2 - 1) + \mu (3x + z -5)\\ \frac {\partial F}{\partial x} = 2\lambda x + 3\mu = 0\\ \frac {\partial F}{\partial y} = 1 + 2\lambda y = 0\\ \frac {\partial F}{\partial z} = 4 + \mu = 0\\ \frac {\partial F}{\partial \lambda} = x^2+y^2 - 1 = 0\\ \frac {\partial F}{\partial \mu} = 3x+z - 5 = 0$

And solve.

Related Question