# Lagrange's multiplier not working

Given the function $f(x,y):=xy+x-y$. Let $D:=\{(x,y)\in\mathbb{R}^2:x^2+y^2\leq25\wedge x \geq 0\}$. Find the absolute maximum and minimum of $f$ on $D$.

My working is as follows:

$\begin{array} & f_x(x,y)=y+1=0 & \qquad \qquad f_y(x,y)=x-1=0 \\ \Rightarrow y=-1 & \qquad \qquad \Rightarrow x=1 \end{array}$

$D(x,y)=\begin{vmatrix} f_{xx}(x,y) & f_{xy}(x,y) \\ f_{xy}(x,y) & f_{yy}(x,y) \end{vmatrix} = \begin{vmatrix} 0 & 1 \\ 1 & 0 \end{vmatrix} = -1$

$D(x,y) = D(1,-1) < 0 \Rightarrow (1,-1)$ is a saddle point.

Also, just for interest, $f(1,-1)=1$

To find the maximum and minimum of $f$ subject to $x^2+y^2=25$ I will use a Lagrange multiplier.

$\nabla f(x,y) = \lambda \nabla g(x,y)$ where $g(x,y)=x^2+y^2-25$

$\langle y+1, x-1 \rangle = \lambda \langle 2x, 2y \rangle$

$\left\{\begin{array}{llll} y+1=2\lambda x & \Rightarrow & y=2\lambda x -1 & (1) \\ x-1=2\lambda y & \Rightarrow & x=2\lambda y +1 & (2) \\ x^2+y^2=25 & & & (3) \end{array}\right.$

Putting (1) into (2) and (2) into (1) gives

$$x=\frac{1}{1+2\lambda} \qquad \text{and} \qquad y=-\frac{1}{1+2\lambda}\tag{4}$$ Where $\lambda \neq \pm \frac12$

Putting (4) into (3) gives

$$\lambda = \frac{-5\pm \sqrt2}{10} \approx -0.64 \quad \text{or} \quad -0.36$$

Subsequently,

$$x \approx \pm 3.54 \quad \text{and} \quad y \approx \mp 3.54$$

Note that $x=-y$. So,

$$f(3.54,-3.54) \approx -5.43 \quad \text{and} \quad f(-3.54,3.54) \approx -19.57$$

By this calculation, (-3.54, 3.54, -19.57) would be a point of absolute minimum on the circle $x^2+y^2=25$. But $x\geq 0$.

Hmm. Let me try evaluating $f(0,5)$. $$f(0,5)=-5 \nless f(3.54,-3.54) \approx -5.43$$ Nope. What should I do now to find the minimum in a procedurally correct way?

I also cannot find the absolute maximum. $(1,-1,1)$ is not the absolute maximum because I have found that $(3.54, 3.54, 12.5)$ exists on $D$. Why did my calculation using Lagrange's multiplier not give me this point?

• And where did the segment $\{(0,y) \mid -5 \leq y \leq 5\}$ go? Apr 11, 2015 at 17:30
• Carefully recalculate x and y interms of lambda Apr 11, 2015 at 17:32
• Indeed I get $x=1/(1+2\lambda)$... Apr 11, 2015 at 17:33
• @Siminore: I don't know how to turn the semi-circle into a formula in terms of $x$ and $y$. Apr 11, 2015 at 17:38
• The boundary of your domain consists of two pieces. You have forgotten the vertical segment. You cannot express that boundary as a unique formula, but you can (and should!) take care of the two pieces separately. Apr 11, 2015 at 17:40

Let us focus our attention on the boundary of $D$. From your system we deduce $$(4\lambda^2-1)y=1-2\lambda,$$ and then $x=-y$. This gives us a single admissible point $P_0$ whose coordinates are $x=\frac{5}{\sqrt{2}}$ and $y=-\frac{5}{\sqrt{2}}$. At this point, $f(P_0)=-\frac{25}{2}+5 \sqrt{2} \approx -5.42893$.

Now we must remember that the case $4\lambda^2-1=0$ must be treated separately. If $\lambda=1/2$, then the systems becomes $$\begin{array}{ll} y+1=x \\ x-1 = y \\ x^2+y^2=25, \end{array}$$ which gives $x=4$ (the root $x=-3$ cannot be accepted), $y=3$, $f(4,3)=13$. Similarly, for $\lambda=-1/2$, $$\begin{array}{ll} y+1=-x \\ x-1 = -y \\ x^2+y^2=25, \end{array}$$ and the same solution.

Finally, on the vertical segment $\{(0,y)\mid -5 \leq y \leq 5\}$ we have $g(x,y)=x=0$ as a constraint and therefore the system $$\begin{array}{ll} y+1=\lambda \\ x-1 = 0 \\ x=0 \end{array}$$ and no solutions. However we must also consider the two singular points $(0,-5)$ and $(0,5)$, where $$f(0,-5)=5, \quad f(0,5)=-5.$$ To summarize, the point $(5/\sqrt{2},-5/\sqrt{2})$ is the global minimum, the point $(4,3)$ is the global maximum of $f$. Here is the graph of $x \mapsto f(x,\sqrt{25-x^2})$: Remark. I do not believe that the methods of Lagrange multipliers is the best one to apply. It is much better to parametrize the boundary by polar coordinates $x=25 \cos \phi$, $y=25\sin \phi$, $-\pi/2 \leq \phi \leq \pi/2$, and to look at $f$ on the vertical segment. Alternatively, use the parametrization $y=\sqrt{25-x^2}$ for $0 \leq x$.

There was nothing "wrong" with your use of the Lagrange multipliers, but the method often leaves us with a set of equations that need to be "handled the right way" in order to be fully useful. (There is no general method for finding this "right way", since there are many ways that the system of equations can present us with an algebraic tangle. I am also offering this as an alternative approach to the fine answer Siminore has already posted.)

The geometrical situation is shown in the figure below. We can treat the problem as a search for extremal points on the surface $\ z \ = \ xy \ + \ x \ - \ y \$ within the region bounded by the right circular cylinder $\ x^2 \ + \ y^2 \ = \ 25 \$ and the plane $\ x = 0 \$ , or on those surfaces. The saddle point you found is indicated. $$2 \lambda \ x \ - \ y \ - \ x \ + \ 2 \lambda \ y \ = \ 0 \ \ \Rightarrow \ \ ( \ 2 \lambda \ - \ 1 \ ) \ ( \ x \ + \ y \ ) \ = \ 0 \ \ ,$$

from which it follows that either $\ y \ = \ -x \$ or $\ \lambda \ = \ \frac{1}{2} \$ , as Siminore has shown.

[The basic approach presented for this method in many introductory texts works well only for certain sorts of problems. It is frequently the case, however, that one wants to avoid working with rational expressions for the multiplier or the coordinates, as they can obscure ways to obtain the solutions to the system of Lagrange equations.]

For the first equation, since $\ x \$ is constrained to be non-negative, the only solution lies in the fourth quadrant, giving the point $\ ( \ \frac{5 \sqrt{2}}{2} \ , \ -\frac{5 \sqrt{2}}{2} \ )$ and the function value $\ x \ (-x) \ + \ x \ - \ (-x) \ = \ 2x \ - \ x^2 \ = \ 5 \sqrt{2} \ - \ \frac{25}{2} \ \approx \ -5.43 \$ . Applying the value for $\ \lambda \$ in the second case to your equations (1) and (2) leads to the (redundant) equation $\ y \ = \ x \ - \ 1 \$ . Inserting this into the equation for the constraining cylinder gives us

$$x^2 \ + \ (x - 1)^2 \ = \ 25 \ \ \Rightarrow \ \ 2 \ (x + 3) \ (x - 4) \ = \ 0 \ \ ,$$

from which we discard the negative solution. The second point from the Lagrange equations is then $\ (4, \ 4-1 = 3) \$ with the associated function value $\ x \ (x - 1) \ + \ x \ - \ (x - 1) \ = \ x^2 \ - \ x \ + \ 1 \ = \ 16 \ - \ 4 \ + \ 1 \ = \ 13 \$ . On the graph below, we see that the level curves $\ xy \ + \ x \ - \ y \ = \ 5 \sqrt{2} \ - \ \frac{25}{2} \$ (marked in red) and $\ xy \ + \ x \ - \ y \ = \ 13 \$ (in green) contact the constraint circle at tangent points, as the Lagrange-multiplier method is expected to do. We may also notice, though, that any such level curves, which are "rotated" hyperbolas, will not contact the constraint line $\ x = 0 \$ tangentially, so the method is not guaranteed to tell us anything useful. (In fact, the lines $\ y \ = \ -x \$ and $\ y \ = \ x - 1 \$ do intersect $\ x = 0 \$ , but we'll see momentarily that the intersection points are not significant.) To check for extrema on $\ x = 0 \$ , we may simply note that our function reduces to $\ f(0, y) \ = \ -y \$ , so the extrema there lie at the "vertices" of the semi-circular boundary. These function values are $\ f(0, 5) \ = \ -5 \$ and $\ f(0, -5) \ = \ +5 \$ , both of which are less "extreme" than the points we've already found, so the tangent points described above are the absolute extrema on $\ D \ \cup \ \partial D \$ .