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:


$$\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)$:


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)=-\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.

  • 1
    $\begingroup$ First, I would recommend avoiding solving for $\delta$. Instead, combine your equations to eliminate $\delta$ and yet $x=-12y$. Second, and more important, you lost a root when you solve the equations. In particular, $y=\pm 1/\sqrt{145}$. I think you messed up a sign, since you have $x=+12y$, not $x=-12y$. Regardless, the arithmetic is yuck. $\endgroup$ – Ted Shifrin Oct 10 '20 at 22:37
  • $\begingroup$ @TedShifrin thanks for the feedback. $\endgroup$ – Si Random Oct 10 '20 at 22:39
  • $\begingroup$ I see. You didn't lose a root. But your exposition is mathematically sloppy. At the end, you just took the negative of the solution you had. Be careful; this doesn't always work. $\endgroup$ – Ted Shifrin Oct 10 '20 at 22:47
  • $\begingroup$ @TedShifrin i retried with your suggestion and i'm still getting the wrong answer. I don't know what's happening. I spent 5 hours on this one problem and i'm so desperate. $\endgroup$ – Si Random Oct 10 '20 at 22:49
  • 1
    $\begingroup$ $y=\pm 1/\sqrt{145}$, $x=-12y$, $z=5-3(-12y)=5+36y$. So we get $\big(-\frac{12}{\sqrt{145}},\frac1{\sqrt{145}},5+\frac{36}{\sqrt{145}}\big)$. Aha, note that as I cautioned you, you can't just take the negative. The other solution is $\big(\frac{12}{\sqrt{145}},-\frac1{\sqrt{145}},5-\frac{36}{\sqrt{145}}\big)$, and the $z$ coordinate is far from the negative. The $f$-values are $y+4z=y+4(5+36y)=20+145y$, very conveniently. So we get $20\pm\sqrt{145}$, nice and simple. I see that you've now gotten this as well. So what's the problem? ... Note that the final formula makes things pretty easy. $\endgroup$ – Ted Shifrin Oct 10 '20 at 23:40

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.

  • $\begingroup$ my answer was wrong because I had them in the wrong slots... also thank you so much. I am forever in your debt. this is much faster approach. i tried 5 discord servers and so many other places and no one could help me so thank you so much $\endgroup$ – Si Random Oct 10 '20 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.