# Use Lagrange multiplier to find absolute maximum and minimum

Use Lagrange multiplier to find absolute maximum and minimum of $f(x,y) =x^2+xy+y^2, x^2+y^2 =8$.

What i've done so far..

$f_x = \lambda g_x \Rightarrow 2x+y =\lambda2x, \\f_y = \lambda g_y \Rightarrow x+2y = \lambda 2y,\\g(x,y) = x^2+y^2 -8 =0$

May I know how should i proceed from here?

-
Doesn't $f_y=x+2y$? –  Ben Nov 11 '12 at 15:26
sorry about the mistake –  melyong Nov 11 '12 at 15:30

You have to determine $x,y,\lambda$. One possible way:

$$x = 2y \cdot (\lambda-1)\\ \stackrel{eq. 1}{\Rightarrow} 4y \cdot (\lambda-1) +y = 2 \lambda \cdot 2y \cdot (\lambda-1) \\ \Leftrightarrow y \cdot (8\lambda-3-4\lambda^2)=0$$

There are two cases:

1. $y=0$: From the first equation follows $x=0$, thus $x^2+y^2=0 \not= 8$. Can't be true...
2. $-4\lambda^2+8\lambda-3=0$: Determine $\lambda$. Afterwards solve $x^2+y^2=8$ by using $x = 2y \cdot (\lambda-1)$.
-
Im sorry about the error on 2nd equation. May I know how did u derive $x=2\lambda . y-1$?? Did you derive from $x+2y = \lambda 2y$. If you derive from that, shouldn't $x = 2y(\lambda -1)$? –  melyong Nov 11 '12 at 15:37
Yes, sorry, you are correct, I fixed it some minutes ago. (I forgot to check your results before solving the equations - so this mistake is caused by your former second equation.) –  saz Nov 11 '12 at 15:40
oops.my bad my bad. Thanks for explaining to me :) –  melyong Nov 11 '12 at 15:43
saz, could i ask whether m i heading towards to correct direction. I solve $4\lambda^2-8\lambda-3=(2\lambda -3)(2\lambda -1)$. Hence, $\lambda = 3/2 , \lambda = 1/2$. I proceed to solve $x^2 + y^2 = 8$. I let $y=0, x=\pm \sqrt8$. How do i proceed from here? Im confused of which x-value should i take and which $\lambda$ value should i take –  melyong Nov 11 '12 at 16:58
Let $\lambda_1 := \frac{3}{2}$, $\lambda_2 = \frac{1}{2}$. First consider $\lambda_1$: Then $x = 2y \cdot (\frac{3}{2}-1)=y$ and therefore $x^2+y^2=y^2+y^2 \stackrel{!}{=} 8$, thus $y=2$ (and hence $x=y=2$). Similar argumentation works for $\lambda_2$. –  saz Nov 11 '12 at 17:18

The best way (I think) to do this is to use the function $$\Lambda (x,y,\lambda)=f(x,y)+\lambda g(x,y)=x^2+y^2+xy+\lambda(x^2+y^2-8)$$ then solve the following system of equation $$\left\{\begin{matrix} \cfrac{d\Lambda}{dx}=0&&&&&&(1)\\ \cfrac{d\Lambda}{dy}=0&&&&&&(2)\\ \cfrac{d\Lambda}{d\lambda}=0&&&&&&(3)\\ \end{matrix} \right.$$

Find $x$ and $y$ in terms of $\lambda$, then find $\lambda$ and substitue back to find the values of $x$ and $y$.

-

On a side note, this problem can be solved very nicely with substitution since it's equivalent to:

$$f(\theta) = 8 \left ( 1 + \frac{1}{2}\sin 2\theta \right )$$

where $x = r \cos\theta$, $y = r \sin \theta$ and $r = 2\sqrt{2}$.

Since $f(\theta)$ is the same as maximizing $\sin 2 \theta$, $f(\theta)$ is maximum and minimum at $\theta = \pi n + \frac{\pi}{4}$ and $\theta = \pi n - \frac{\pi}{4}$ respectively.

So if $n = 1$, we have a maximum at $x = -2, y = -2$ and a minimum at $x = -2, y = 2$.

-

$2x+y =\lambda2x, \\x+2y = \lambda 2y$

Once you have these equations, you should see that it is merely a problem of determining the eigenvalues $\lambda_1 , \lambda_2$ of the matrix $M = \begin{pmatrix} 1 & 1/2 \\ 1/2 & 1 \\ \end{pmatrix}$ . One of them will yield you the absolute minimum, and the other the absolute maximum.

This is done by solving the characteristic polynomial. $\left| \begin{array}{ccc} 1-\lambda & 1/2 \\ 1/2 & 1-\lambda \\ \end{array} \right| = 0$

Which yields:

$(1-\lambda)^2 = 1/4 \rightarrow \lambda_1 =1/2 ,\lambda_2 =3/2$

Now you have either of the two cases:
$2x+ y = x \rightarrow (x,y)=(-1,1)*t\\ 2x+ y = 3x \rightarrow (x,y) = (1,1)*t$

In order to have them with length of 8, you should find the relevant $t$ for which $|| (-t,t)||^2=8, ||(t,t)||^2=8$

Another way to think about your problem is that you have a quadratic form $ax^2 + 2bxy + cy^2$, where $a = 1, b= 1/2 , c = 1$ . The maximal and minimal values of a quadratic form, under the constraint of constant length of $(x,y)$ is attained in its eigenvalues, and $(x,y)$ direction is the direction of the eigenvectors.

-