# Finding max/min through lagrangian

I am trying to solve this problem, but I am doing something wrong: $$f(x,y,z)=x^2-y^2,M=\{[x,y,z]\in\mathbb{R}^3:x^2+y^2+z^2=9,x+z\ge1\}$$

And let $g(x,y,z)=x^2+y^2+z^2-9$. Set M is closed and bounded ($M\subset K(0,3))$. M is therefore compact and $f$ is continuous $\Rightarrow$ $f$ has max/min.

I use Lagrangian multiplier:

1) $\nabla g(x,y,z)=(2x,2y,2z)=\vec{0}\leftrightarrow x=y=z=0$, but $[0,0,0]\not \in M$

2)$\nabla f-\lambda \nabla g=0$ $$(2x-\lambda2x=0$$ $$-2y-\lambda 2y=0$$ $$0-\lambda 2z=0$$ $$x^2+y^2+z^2=9$$

A) $\lambda=0$:First critical point$[0,0,3]$$x=y=0\rightarrow z=3$$ B)$\lambda\not=0,z=0\lambda =\pm 1:x=y=0,[0,0,0]\not \in M$So I have only point that could be extrema, but that is entirely wrong. Can you please identify the mistake? edit: I found that for$\lambda = 1 $or$y=0$we have$[3,0,0]\in M$, which is maxima, but I still can't determine minima. - ## 1 Answer The second constraint given turns out to be of some importance in locating the minimum value for$ \ f(x,y,z) \ $. We will need to "turn it on and off" as we proceed, since an inequality is used in describing the region$ \ M \ $. Here is a graph of the geometrical arrangement: As you already found from the Lagrange equations, $$\ 2x \ ( \ \lambda \ - \ 1 \ ) \ = \ 0 \ \ , \ \ 2y \ ( \ \lambda \ + \ 1 \ ) \ = \ 0 \ \ , \ \ 2z \ \lambda \ = \ 0 \ \ , \ \$$ we may have: I : from the third equation,$ \ \lambda \ = \ 0 \ , \ z \ $unspecified $$\Rightarrow \quad \ 2x \ (-1) \ = \ 0 \ \ \Rightarrow \ x \ = \ 0 \ \ , \ \ 2y \ (1) \ = \ 0 \ \ \Rightarrow \ y \ = \ 0 \ \ \Rightarrow \ \ z \ = \ \pm 3 \ \ ,$$ from the equation for the sphere;$ \ x \ + \ z \ \ge \ 1 \ $requires that$ \ z \ = \ 3 \ $; and$ \ f(0, 0, 3) \ = \ 0 \ $, which proves not to be extremal II : from the first equation,$ \ \lambda \ = \ 1 \ , \ x \ $unspecified $$\Rightarrow \quad \ 2y \ (2) \ = \ 0 \ \ \Rightarrow \ y \ = \ 0 \ \ , \ \ 2z \ (1) \ = \ 0 \ \ \Rightarrow \ z \ = \ 0 \ \ \Rightarrow \ \ x \ = \ \pm 3 \ \ ,$$ from the equation for the sphere;$ \ x \ + \ z \ \ge \ 1 \ $requires that$ \ x \ = \ 3 \ $; and$ \ f(3, 0, 0) \ = \ 9 \ , $which is the maximal value [more on this shortly] III : from the second equation,$ \ \lambda \ = \ -1 \ , \ y \ $unspecified $$\Rightarrow \quad \ 2x \ (-2) \ = \ 0 \ \ \Rightarrow \ x \ = \ 0 \ \ , \ \ 2z \ (-1) \ = \ 0 \ \ \Rightarrow \ z \ = \ 0 \ \ \Rightarrow \ \ y \ = \ \pm 3 \ \ ,$$ from the equation for the sphere; but these points lies below the plane$ \ x \ + \ z \ \ge \ 1 \ $, so they are not in the region$ \ M \ $. Case I above corresponds to the "level surface" for$ \ f \ , \ x^2 \ - \ y^2 \ = \ 0 \ $, which is the pair of "crossed planes"$ \ y \ = \ \pm x \ $intersecting on the$ \ z-$axis. Case II corresponds to the hyperbolic cylinder$ \ x^2 \ - \ y^2 \ = \ 9 \ $, which is just tangent to the sphere at$ \ (3, \ 0, \ 0) \ $as seen in the graph below. (The constant for the hyperbolic cylinder is made a little "too small" in order to make the tangent point visible.) We need to explore the boundary of the region in order to locate the minimal value for$ \ f \ $. If we insert the equation for the plane,$ \ x \ + \ z \ = \ 1 \ $into the equation for the sphere, we obtain $$x^2 \ + \ y^2 \ + \ (1-z)^2 \ = \ 1 \ \ \Rightarrow \ \ 2x^2 \ - \ 2x \ + \ y^2 \ = \ 8 \ \ .$$ We can use this to construct a Lagrange equation, which we can then put together with the one for$ \ y \ $: $$2x \ = \ \lambda \ ( \ 4x \ - \ 2 \ ) \ \ , \ \ 2y \ ( \ \lambda \ + \ 1 \ ) \ = \ 0 \ \ ,$$ giving us two cases to examine: A --$ \ y \ = \ 0 \ \ \Rightarrow \ \ 2x^2 \ - \ 2x \ - \ 8 \ = \ 0 \ \ $$$\Rightarrow \ \ x \ = \ \frac{1 \ + \ \sqrt{17}}{2} \ , \ z \ = \ \frac{1 \ - \ \sqrt{17}}{2}$$ $$f \left(\frac{1 \ + \ \sqrt{17}}{2} \ , \ 0 \ , \ \frac{1 \ - \ \sqrt{17}}{2} \right) \ = \ \frac{9 \ + \ \sqrt{17}}{2} \ \approx \ 6.56$$ or $$\Rightarrow \ \ x \ = \ \frac{1 \ - \ \sqrt{17}}{2} \ , \ z \ = \ \frac{1 \ + \ \sqrt{17}}{2}$$ $$f \left(\frac{1 \ - \ \sqrt{17}}{2} \ , \ 0 \ , \ \frac{1 \ + \ \sqrt{17}}{2} \right) \ = \ \frac{9 \ - \ \sqrt{17}}{2} \ \approx \ 2.44 \ \ ,$$ neither of which is extremal B --$ \ \lambda \ = \ -1 \ \ \Rightarrow \ y \ $unspecified,$ \ 2x \ = \ (-1) \ ( \ 4x \ - \ 2 \ ) \ \ \Rightarrow \ \ 6x \ = \ 2 \ \ \Rightarrow \ \ x \ = \ \frac{1}{3} \ $; from the equation for the plane,$ \ z \ = \ 1 \ - \ x \ = \ \frac{2}{3} \ $; from the equation for the sphere,$ \ y^2 \ = \ 9 \ - \ \left(\frac{1}{3} \right)^2 \ - \ \left(\frac{2}{3} \right)^2 \ = \ \frac{76}{9} \ \ \Rightarrow \ \ y \ = \ \pm \frac{2 \ \sqrt{19}}{3} $$$\Rightarrow \ \ f \left(\frac{1}{3} \ , \ \pm \frac{2 \ \sqrt{19}}{3} \ , \ \frac{2}{3} \right) \ = \ -\frac{75}{9} \ \approx \ -8.33 \ \ .$$ This is in fact the minimal value for the function, its level surface represented by the hyperbolic cylinder$ \ x^2 \ - \ y^2 \ = \ -\frac{75}{9} \ $or$ \ y^2 \ - \ x^2 \ = \ \frac{75}{9} \ , $which is rotated 90º with respect to the maximal level surface. (In the graph below, its constant is again taken a trifle smaller in absolute value in order to make a tangent point visible; the other point is on the "far side" of the figure.) This works out a bit more directly if we use Lagrange multipliers for both constraints. We use the constraint functions$ \ g(x,y,z) \ = \ x^2 \ + \ y^2 \ + \ z^2 \ - 9 \ $and$ h(x,y,z) \ = \ x \ + \ z \ - \ 1 \ $, together with the gradient equation$ \ \nabla f \ = \ \lambda \ \nabla g \ + \ \mu \ \nabla h \ $to produce $$2x \ = \ \lambda \cdot 2x \ + \ \mu \cdot 1 \ \ , \ \ -2y \ = \ \lambda \cdot 2y \ \ , \ \ 0 \ = \ \lambda \cdot 2z \ + \ \mu \cdot 1 \ \ .$$ We have already seen from Cases II and A above that we will need to "relax" the constraint from the plane, and instead make use of the inequality$ \ x \ + \ z \ \ge \ 1 \ $to locate the tangent point$ \ ( 3, \ 0, \ 0) \ $on the surface of the sphere, where$ \ f(x,y,z) \ $is maximized. On the other hand, if we use$ \ \lambda \ = \ -1 \ $with$ \ y \ $being unspecified in the second Lagrange equation immediately above, the third equation now gives us$ \ 2 z \ = \ \mu \ $. We then have from the first equation$ \ 4x \ = \ 2z \ \Rightarrow \ z \ = \ 2x \ $. The equation for the plane yields$ \ x \ + \ z \ = \ x \ + \ 2x \ = \ 1 \ \Rightarrow \ x \ = \ \frac{1}{3} \ $, from which we may now derive the information for the points where$ \ f(x,y,z) \ $is minimal, in the manner we carried out above. - thank you, I didn't expect to get such detailed answer with graphs(not sure if it is correct word to use here). So if I understood it correctly solving this as either$\nabla f =\lambda \nabla g +\mu \nabla h$or as expressing$z=1-x$and inserting it to$x^2+y^2+z^2=9$would lead me to same results(then solving equation with 1 constraint and two variable function)? – cgnx Jun 15 '14 at 6:35 I felt the graphs were somewhat needful, since the region and the function to be extremized fit together a little oddly. I wanted to show how the problem might be solved with one multiplier, since that is most people's introduction to the method; but it requires a certain amount of jiggering to get at the minimal value of the function. Solving with two multipliers is rather less awkward. So you can do this either way; the one complication is that the maximum value is on the spherical surface, but not on the plane, so that constraint has to be "lifted" to completely solve the extremization. – RecklessReckoner Jun 15 '14 at 22:24 Yes the graphs were helpful as it is hard for me to imagine.But basically by lifting you mean that I break it to two parts one with two multipliers and the second one I solve it for$M_2=\{[x,y,z]\in x^2+y^2+z^2=9,x+z>1\}$, where I use only first constraint, and I only need to check if the critical points are in the$M_2$,right? I tried to solve few more problems, and it seems to work. – cgnx Jun 16 '14 at 5:28 You can work through the whole problem with either one or two multipliers. What I meant is that the two constraints only apply together for the circumference of the "bottom" of the region$ \ M \ $, which is in the plane$ \ x \ + \ z \ = \ 1 \ $. Since the region is defined using an inequality, there isn't really any way to work with$ \ x \ + \ z \ > \ 1 \ $, so we drop the planar constraint and just use the equation of the sphere as the one constraint for the rest of the surface, and discard any points we obtain from the calculations that are not in$ \ M \ \$ . – RecklessReckoner Jun 16 '14 at 5:44
I'm glad to hear that the same approach works for you on other problems. I hadn't done an extremization over that sort of surface before, so I was trying out something that seemed reasonable. – RecklessReckoner Jun 16 '14 at 5:48