Find the maximum and minimum values of $f(x, y) = x^2 + y^2$

subject to the constraint $x^2 − 2x + y^2 − 4y = 0$

So I have to use lagrange multipliers

$ \nabla f(x,y) = \lambda\nabla g(x,y) $

$$ \nabla f(x,y)= <2x,2y> $$

$$ \lambda\nabla g(x,y) = \lambda<2x-2,2y-4> $$

making x and y the subjects gives:

$$ x = x\lambda - \lambda$$ $$ y = y\lambda - 2\lambda$$

I need to plug these x and y's back into the original constraint ($x^2 − 2x + y^2 − 4y = 0$), but I'm not sure how to go about it without having a very big equation. Any help here would be much appreciated.

  • 1
    $\begingroup$ $$x = x\lambda - \lambda \implies x-x\lambda = -\lambda \implies x(1-\lambda) = -\lambda \implies x = \frac{-1}{1-\lambda}$$ and $y$ is the same. Is that what you're asking? $\endgroup$
    – Eff
    Jun 20 '16 at 16:31
  • 1
    $\begingroup$ Small error, do you mean $y=y\lambda-2\lambda$? $\endgroup$ Jun 20 '16 at 16:36
  • $\begingroup$ @Eff $y$ is not the same. $\endgroup$ Jun 20 '16 at 16:39
  • $\begingroup$ Opps! Yes, just edited it. My problem is that once I solve for x and y, then I have to substitute those equations back into the original constraint, no? Once I do this, the equation is going to be very large I think. Just wanted to make sure I was on the right track with lagrange multipliers. $\endgroup$
    – says
    Jun 20 '16 at 16:42
  • $\begingroup$ Plugging in $x=\frac{1}{\lambda - 1}$ and $y = \frac{2}{\lambda - 1}$ should end up you with a quadratic in $\lambda$. Should be doable. $\endgroup$
    – Eff
    Jun 20 '16 at 16:46

You can divide one equation by the other. For this purpose we assume, for the moment, that the denominators are unequal $0$.


Multipliying both sides by $y$ and $y-2$



Substracting xy on both sides.



Plugging in the term for y into the constraint.

$x^2-2x+(2x)^2-4\cdot 2x=0$


$x_1=2$ and $x_2=0$

Thus $y_1=4$ and $y_2=0$

This are the two critical points. Now you can use the bordered Hessian to determine if one is a maximum or a minimum.

The bordered Hessian is

H = $\left( \begin{array}{} 0 & g_{x} & g_{y} \\ g_{x} & L_{xx} & L_{yy} \\ g_{y} & L_{yx} & L_{yy}\end{array}\right)$

with $g=x^2-2x+y^2-4y$

And $L=x^2+y^2+\lambda(x^2-2x+y^2-4y)$

For example $L_{xx}=2+2\lambda$. You differentiate $L$ twice w.r.t. $x$. Thus you have to calculte $\lambda_1$ and $\lambda_2$ for the two different critical points. When you have calculated all values of H then you calculate the determinant of H.

If $det \ H(x_0,y_0) >0 \Rightarrow \texttt{it´s a (local) maximum}$

If $det \ H(x_0,y_0) <0 \Rightarrow \texttt{it´s a (local) minimum}$

  • $\begingroup$ Thank you! I'm not sure how to compute the bordered hessian though. Is it the same as just the hessian? $\endgroup$
    – says
    Jun 20 '16 at 17:28
  • $\begingroup$ @says You don’t need to use a bordered Hessian for something this simple. Just plug the points you’ve found into the objective function, which is just the square of the distance from the origin. The constraint is the equation of a circle, so it should be pretty straightforward to convince yourself that you’ve found a constrained maximum and minimum. $\endgroup$
    – amd
    Jun 20 '16 at 17:31
  • $\begingroup$ So the minimum is @ (0,0) and the maximum is at (2,4)? I thought the objective function was the circle, and the constraint was the other function? $\endgroup$
    – says
    Jun 20 '16 at 17:43
  • $\begingroup$ @says I you want to make a comment for amd then you have to add an (at) infront of his username- like I do with your username in this comment. $\endgroup$ Jun 20 '16 at 17:51
  • $\begingroup$ @amd So the minimum is @ (0,0) and the maximum is at (2,4)? I thought the objective function was the circle, and the constraint was the other function? $\endgroup$
    – says
    Jun 20 '16 at 17:55

The constraint defines the circle $$(x-1)^2+(y-2)^2=5$$ going through the origin, and you are told to find the two points on this circle which are at maximal, resp., minimal distance from the origin. The nearest point is $(0,0)$, of course, and the farthest point is the other end of the diameter through $(0,0)$, i.e., the point $(2,4)$. It follows that $\max f$ under the given constraint is $20$, and $\min f$ is $0$.


For this problem, you may not use Lagrange multiplier. The objective function is a cone and the constraint is, as you said, circle with center (1,2) and radius $\sqrt5$. So the max-min is on the curve which is the intersection between the cone and the cylinder. You can vision that there are two points on the curve corresponding to min (close to the origin) and max along the line (0,0) to (1,2), or $y=2x$

Plugging the above line into the constraint, you can get x=0 and x=2. So the minimum is at x=0 with value 0 and the maximum is at 2 with the value 20.


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.