# Homework Help: Lagrange Multipliers/System of Equations?

1. Jul 4, 2011

### scoobiedoober

1. The problem statement, all variables and given/known data
I seem to be struggling a bit to understand how my prof solved this problem....I think it might be my diminishing system of equation skills, so forgive me if this doesn't belong in the calc section.

Use Lagrange multipliers to find all extrema of the function subject to the given constraint:

$$f(x,y)=y-x^2$$

subject to:

$$g(x,y)=x^2+y^2=1$$

2. Relevant equations

The local extrema should exist where the gradient of the function is equal to the gradient of the constraint, multiplied by a value (the Lagrange multiplier):

$$\nabla f = \lambda\nabla g$$

3. The attempt at a solution

Solving for gradient f and g was no prob:

$$\nabla f = <-2x,1>$$
$$\nabla g = <2x,2y>$$

And this helps me setup a system of equations:

$$1) -2x = 2\lambda x$$
$$2) 1 = 2\lambda y$$
$$3) x^2+y^2 = 1$$

Now at this point my professor "intuited" that with equation 1, to satisfy the equation, either x=0 or lambda = -1. I agree with it but I don't remember having to "intuit" things in a system of equations, I always remember it being a procedural solution. He takes these two conditions and runs with it and ends up finding the answers...

Now I'm sitting here trying to do it old-school procedurally, so I think equation 2 looks good:

$$2) y=\frac{1}{2\lambda}$$

plug into 3

$$3) x^2 + (\frac{1}{2\lambda})^2 = 1$$

solve for x:

$$x = +/-\sqrt{1-\frac{1}{4(\lambda)^2}}$$

putting the positive version in equation 1:

$$1) -2(x) = 2 \lambda x$$
$$1) -2 = 2 \lambda$$
$$1) \lambda = -1$$

I get the same answer with the positive version of x

$$1) \lambda = -1$$

I go back to equation 2 to solve for Y:

$$2) 1 = -2 y$$
$$2) -\frac{1}{2}=y$$

Plugging lambda into my x = sqrt equation for x:

$$x = +/- \sqrt{\frac{3}{4}}$$

So now I feel all warm and fuzzy, because I have my extrema locations:

$$(-\sqrt{\frac{3}{4}}, -\frac{1}{2}); (\sqrt{\frac{3}{4}}, -\frac{1}{2})$$

But looking back at my notes...the x=0 intuition that my professor deduced ended up being another extrema, which ended up leading to the ACTUAL maximum.

Did I screw something up? Is that "intuition" thing actually what I need to do to solve these things? Are there certain conditions that always require this kind of thinking? Is there an even better way to truly find all the solutions?

2. Jul 4, 2011

### micromass

Hi scoobiedoober!

Things look good, but there are a few subtleties:

This only holds if $\lambda\neq 0$ (indeed, if it is 0, then you divide by 0!!!). So you must solve the case $\lambda=0$ separately.

So you end up with two systems, one where lambda is 0 and one where it is not.

In the first step you divided both sides by x. This is only allowed if x is nonzero (otherwise you divide by 0!!)! So you'll have to treat the case x=0 separately.

3. Jul 5, 2011

### scoobiedoober

Alrighty, thanks! I guess my system-of-equation solving skills were always limited to linear systems. I'll just have to keep my eyes peeled for these "what if" scenarios in the future. Or maybe if I just restart the whole process multiple times with me starting by solving a different variable in every equation I will be safe.

for example: if I started solving equation (1) for x, I would see that x = 0, then I could run with that and get all the solutions I can. Then solve equation (1) for lambda, getting lambda = 1...and so on until I've expired every "starting" situation...It probably wouldn't be THAT much more work than doing these "what if" scenarios, because I imagine I would ultimately run into a bunch of repeated solutions in which I could stop at that point.

4. Jul 5, 2011

### micromass

It's not that hard really. Just solve the system first like you want to solve it. Then check your solution again to see if you didn't do anything illegal (like dividing by zero) and take these illegal values as special values for which you solve the system again...

5. Jul 5, 2011

### HallsofIvy

One generally good method of solving systems of equations that result from the Lagrange multiplier method is to first eliminate $\lambda$ by dividing one equation by another.

Here, your equations are $−2x=2\lambda x$ and $1=2\lambda y$. If you divide the second by the first, $-2x/1= -2x= (2\lambda x)/(2\lambda y)[/tex] or [itex]-2x= x/y[/tex] which gives either x= 0 or y= -1/2. Since you also have the condition that [itex]x^2+ y^2= 1$, we have x= 0 and $y= \pm 1$ or y= -1/2 and $x= \pm\sqrt{3}/2$.

6. Jul 6, 2011

### Ray Vickson

Let me use the symbol u instead of $\lambda$. Either x = 0 or $x \neq 0$. If x = 0, what does eq.(3) say about y? What does eq.(2) say about u? If x is not zero, what does eq.(1) say about u? Then, what does eq.(2) say about y? Then, what does eq.(3) give you?

RGV