Finding largest (max) value for a function?

Goldberg Variations

New member
Joined
Feb 24, 2012
Messages
16
Hello!

I'm learning math on my own and I'm having a hard time solving the following question (It's translated from my native language to English):

"Find the largest value for the function \(\displaystyle f(x, y) = x^2 + 2xy + 3y^2\)

When" \(\displaystyle x^2 + y^2 = 1\)


And that's it. From my understanding I have to use something called Lagrange? Anyway my first step was to set it up as:

My constraint (\(\displaystyle x^2 + y^2 = 1\), I assume)

\(\displaystyle x^2 + 2xy + 3y^2 - \lambda(x^2+y^2-1) = F(x, y, \lambda)\)

Simplified to:

\(\displaystyle x^2 + 2xy + 3y^2 -\lambda x^2 + \lambda y^2 - \lambda\)

Then I derive (is that the right word?)

\(\displaystyle Fx = 2x + 2 - \lambda2x\)

Solved x to:
\(\displaystyle x = \sqrt{\lambda-2}\)

\(\displaystyle Fy = 2 + 6y - \lambda2y\)

Solved y to:
\(\displaystyle y = (\sqrt{\lambda-2})/3\)

And finally...

\(\displaystyle F\lambda = -x^2-y^2+1\)

Solved it to:
\(\displaystyle \lambda = 1/2\)


Needless to say I get some really strange values. I am sure I have done something terribly wrong here if even anything right at all.

Please if anyone here could help me or point me in the right direction I would really appreciate it!

Thanks in advance!
 
Partial derivatives of mixed terms are not correct.

\(\displaystyle \frac{\partial 2xy}{\partial x} = 2y \ne 2\)
 
Hello again and thanks for the help!

You have not told us whether you have got to calculus yet

Sorry, I am not sure what that means.


And yes I know how to differentiate or rather it's getting back to me since I learned it at some point in school.
Got a better understanding now after your posts but I am struggling with the equations themselves.

This is what I got after the partial derivative:

\(\displaystyle Fx = 2x + 2y - 2 \lambda x\)
\(\displaystyle Fy = 2x + 6y - 2\lambda y\)
\(\displaystyle F\lambda = -x^2-y^2 + 1\)

And you mentioned that I should set them to 0 and solve? Well what of my constraint, can't I set them equal to the constraint and solve from there?

e.g:

\(\displaystyle Fx = 2x + 2y - 2 \lambda x = \lambda * 2x\)
\(\displaystyle Fy = 2x + 6y - 2\lambda y = \lambda * 2y\)
\(\displaystyle x^2 + y^2 = 1\)

But that's not possible since I added the constrait earlier? (Check above post)

Either way the equations look tough so I'm not entirely certain this is the way to go?

Thanks in advance!
 
Last edited:
Hello and thank you again for your answer!

It has been most helpful but still a bit confusing.


The following:

\(\displaystyle x =± \sqrt{1-y^2}\)

Still leaves me with an unknown y and I don't get a clear answer from this, same if I solve y but get x as unknown instead.

Looking at this I don't see how its possible to reach the answer:
\(\displaystyle 2 + \sqrt{2} \)


EDIT:

Okay so I plugged x and y into the original function and solved and got \(\displaystyle 2 + \sqrt{2} \)

But I am not enitrely certain I did it the right way, I'll have to double check this one.
 
Last edited:
The solution is indeed \(\displaystyle \sqrt{2}+2\).

\(\displaystyle (2x+2y)i+(2x+2y)j=\lambda(2xi+2yj)\)

Equate terms:

\(\displaystyle 2x+2y=\lambda 2x\)

\(\displaystyle 2x+6y=\lambda 2y\)

Reduce:

\(\displaystyle x+y=\lambda x\)

\(\displaystyle x+3y=\lambda y\)

\(\displaystyle \lambda=1+\frac{y}{x}\)

\(\displaystyle \lambda = \frac{x}{y}+3\)

Solving for y gives \(\displaystyle y=(\sqrt{2}+1)x, \;\ y=(-\sqrt{2}+1)x\)

Sub into the constraint and solve for x gives

\(\displaystyle x=\frac{\pm \sqrt{2-\sqrt{2}}}{2}\)

\(\displaystyle y=\frac{\pm (\sqrt{2}+1)\sqrt{2-\sqrt{2}}}{2}\)

Sub these into f(x) gives us the largest value of \(\displaystyle \sqrt{2}+2\)
 
First of all thank you both for the help and JeffM, don't worry, I wouldn't have gotten much far without your help.

Galactus I have a few question concerning your solution:

The solution is indeed \(\displaystyle \sqrt{2}+2\).

\(\displaystyle (2x+2y)i+(2x+2y)j=\lambda(2xi+2yj)\)

Equate terms:

\(\displaystyle 2x+2y=\lambda 2x\)

\(\displaystyle 2x+6y=\lambda 2y\)

Reduce:

\(\displaystyle x+y=\lambda x\)

\(\displaystyle x+3y=\lambda y\)

\(\displaystyle \lambda=1+\frac{y}{x}\)

\(\displaystyle \lambda = \frac{x}{y}+3\)

Here. How did you end up with this? When solving lambda (above) what's the next step? I've tried counting on this myself but I'm not ending up with the same solution as you are. And I don't want the entire solution I think I am just confused as how the equation looks like from the beginning when trying to solve for y.
Solving for y gives \(\displaystyle y=(\sqrt{2}+1)x, \;\ y=(-\sqrt{2}+1)x\)

Since I couldn't manage the above part I skipped to this step and tried to follow your steps with the given answers for y (above), but I wasn't sure where to plug in the values at. I tried plugging in the value of y into the constraint (treated as \(\displaystyle x^2+2xy+y^2\) )
Sub into the constraint and solve for x gives

\(\displaystyle x=\frac{\pm \sqrt{2-\sqrt{2}}}{2}\)

\(\displaystyle y=\frac{\pm (\sqrt{2}+1)\sqrt{2-\sqrt{2}}}{2}\)

And finally this, do I use x and y and plug them into the original function f(x,y)? But you only state f(x).
Sub these into f(x) gives us the largest value of \(\displaystyle \sqrt{2}+2\)

I really want to get the hang of this but there are a few things I still find a bit confusing, mostly when solving the equations. When I have someone helping/leading me, I'm really learning what's going on. Thanks again guys I really appreciate it!
 
Thank you again JeffM, this does indeed answer all my questions. Both of you have been great help. I'll try to tackle this problem on my own now and other similar ones, good times!

Thanks again!
 
Hey guys!

I got another, similar one, I'm trying to solve. But the answer I get is not quite right according to the book.

It's basically the same question but with a different function.

"Find the largest value for

\(\displaystyle f(x,y) = x^2+6xy+4y^2\)
When..."
\(\displaystyle x^2+y^2 = 1\)


So I've followed the same procedure as with the previous question. I've done my partial derivative:

\(\displaystyle Fx = 2x + 6y - 2\lambda x\)
\(\displaystyle Fy = 6x + 8y - 2\lambda y\)

Solved for lambda and got the following ([1.] I hope I did something wrong here because I get a tough equation after this):
\(\displaystyle \lambda = 1 + 3\dfrac{y}{x}\)

\(\displaystyle \lambda = 3\dfrac{x}{y} + 4\)

\(\displaystyle \lambda = \lambda \implies 1 + 3\dfrac{y}{x} = 3\dfrac{x}{y} + 4\)

Solving this I get: ([2.] This looks very wrong to me, the reason I have a -1 is because I expanded with -1 on both sides to get \(\displaystyle x^2-2xy+y^2\) otherwise it would just be a \(\displaystyle x^2-xy+y^2\) and I wasn't sure what to do with the equation from there, the reason for the -1)
\(\displaystyle y = x(1\pm\sqrt{2})-1\)

Plugging this into my constraint to solve for x I get:

\(\displaystyle x^2 = 1-y^2 \implies x^2 = 1-[x(1\pm\sqrt{2})-1]^2\)

Which eventually gives me x:

\(\displaystyle x = \pm\dfrac{\sqrt{4-\sqrt{2}}}{2}\)

With x I can now solve for y

\(\displaystyle y = x(1\pm\sqrt{2})-1 \implies y = \pm\dfrac{\sqrt{4-\sqrt{2}}}{2}*(1+\sqrt{2})-1\)

And it gives me for y:

\(\displaystyle y = \pm\dfrac{\sqrt{8-5\sqrt{2}}}{2}-1\)

And with solved x & y I plug them into the original function but I get the wrong answer, of course. I won't even type that out as I am fairly certain my error lies somewhere in my above calculations. On my second red highlight I am sure my error lies. I had difficulties with that part.

If anyone could help me out I would really appreciate it if you could point out my error.

Thanks in advance!
 
Denis you think you could tell me where I went wrong?

Is my equation for variable y wrong? Your reply does not tell me much, sorry.
 
"Find the largest value for the function \(\displaystyle f(x, y) = x^2 + 2xy + 3y^2\)

When" \(\displaystyle x^2 + y^2 = 1\)


And that's it. > > From my understanding ? ? < < I have to use something called Lagrange?


Goldberg Variations,

you don't sound sure of whether or not you are required to use the method
of Lagrange multipliers.

If you are not required to do it that way, I would ask that after you have
worked out the problem that way (by the method of Lagrange multipliers),
as you and the other users have already worked out in this thread,
to do it this other way:

Avoid the lambdas, functions of two or three variables, and partial derivatives.

Solve x^2 + y^2 = 1 for, say y, in terms of x and substitute that into

x^2 + 2xy + 3y^2 to get a function in only one variable.

Take the derivative, set it equal to zero, and solve for the respective x and
y values.

Then substitute the different candidate pairs (x, y) into x^2 + 2xy + 3y^2

to see what the maximum should be.
 
Hey JeffM and thank you for your answer.

Your solution is indeed correct as according to the book, so no worries there. I have a few questions though when you are solving the equations.

Let's see if I can manage to avoid algebraic errors and extraneous roots this time.

\(\displaystyle Note\ f(x, y) = f(-x, -y)\ and\ f(x, - y) = f(-x, y).\) Consequently, we can ignore y < 0.

\(\displaystyle If\ x < 0, xy = - |xy|\le |xy| \implies f(x, y)\ is\ maximum\ when\ x \ge 0. \) Consequently, we can ignore x < 0.

\(\displaystyle x^2 + y^2 = 1 \implies x^2 = 1 - y^2 \implies x = \sqrt{1 - y^2}.\)

\(\displaystyle So\ x^2 + xy - y^2 = 0 \implies 1 - y^2 + y\sqrt{1 - y^2} - y^2 = 0 \implies\) \(\displaystyle \sqrt{y^2 - y^4} = 2y^2 - 1 \implies\)

How did you come to this conclussion here? The( \(\displaystyle y^2 - y^4 = 4y^4 - 4y^2 + 1\) )part? I assume you expand with power of 2 on both sides to get rid of the square root sign but how can the left side of the equals sign looks as it does?
\(\displaystyle y^2 - y^4 = 4y^4 - 4y^2 + 1 \implies 5y^4 -5y^2 + 1 = 0\)

Also this one, how do you end with the left side of the equation sign? Dividing by 10? Where did that one come from?
\(\displaystyle \implies y^2 = \dfrac{5 \pm \sqrt{(-5)^2 - 4*5*1}}{10} = \dfrac{5 \pm \sqrt{5}}{10}\) \(\displaystyle \implies y = \sqrt{\dfrac{5 \pm \sqrt{5}}{10}}.\)

Possibility 1:

\(\displaystyle y = \sqrt{\dfrac{5 + \sqrt{5}}{10}} \implies x = \sqrt{1 - \dfrac{5+\sqrt{5}}{10}} = \sqrt{\dfrac{10 - 5 - \sqrt{5}}{10}} = \sqrt{\dfrac{5 - \sqrt{5}}{10}} \implies\)

\(\displaystyle x^2 + 6xy + 4y^2 = \dfrac{5 - \sqrt{5}}{10} + 6\sqrt{\dfrac{5^2 - (\sqrt{5})^2}{10^2}} + \dfrac{4(5 + \sqrt{5})}{10}=\)

Also at the last step here how do you turn \(\displaystyle 6\sqrt{20}\) to \(\displaystyle 12\sqrt{5}\)?
\(\displaystyle \dfrac{5 - \sqrt{5}+ 6\sqrt{25 - 5} + 20 + 4\sqrt{5}}{10}\) \(\displaystyle = \dfrac{25 +3\sqrt{5} + 6\sqrt{20}}{10} = \dfrac{25 +15\sqrt{5}}{10}.\)

Possibility 2:

\(\displaystyle y = \sqrt{\dfrac{5 - \sqrt{5}}{10}} \implies x = \sqrt{1 - \dfrac{5-\sqrt{5}}{10}} = \sqrt{\dfrac{10 - 5 + \sqrt{5}}{10}} = \sqrt{\dfrac{5 + \sqrt{5}}{10}} \implies\)

\(\displaystyle x^2 + 6xy + 4y^2 = \dfrac{5 + \sqrt{5}}{10} + 6\sqrt{\dfrac{5^2 - (\sqrt{5})^2}{10^2}} + \dfrac{4(5 - \sqrt{5})}{10} =\)

\(\displaystyle \dfrac{5 + \sqrt{5}+ 6\sqrt{25 - 5} + 20 - 4\sqrt{5}}{10}\) \(\displaystyle = \dfrac{25 -3\sqrt{5} + 6\sqrt{20}}{10} = \dfrac{25 +9\sqrt{5}}{10}.\)

\(\displaystyle But\ \dfrac{25 + 9\sqrt{5}}{10}< \dfrac{25 + 15\sqrt{5}}{10} \implies\) \(\displaystyle possibility\ 2\ does\ not\ generate\ a\ maximum.\)

\(\displaystyle So\ maximum = \dfrac{25 + 15\sqrt{5}}{10} = \dfrac{5 + 3\sqrt{5}}{2} \approx 5.8541.\) Unless I made a stupid error of course. What does the book say? These problems are very ugly to do by hand.

Edit: I see Denis got a different answer. I probably messed up in my algebra somewhere.

Once again thank you for the answer and your time.

EDIT: lookagain, the question doesn't explicitly tell you to use Lagrange multipliers. If you could please elaborate how else to solve the question without doing so I would really like to know so. Thank you!
 
Thank you again JeffM your input has been most helpful as always. And in the future I will of course start a new topic for a new question.

I absolutely know of the quadratic formula and the fact that you can do it in such a way, which I had no idea was possible, is really interesting.

So I managed to solve the question by myself now but I have one last question and I am not sure if you last post explained this but take the following:

How can this equal each other?

\(\displaystyle (2y^2 - 1)^2 = 4y^4 - 4y^2 + 1.\)

This is how I thought it would look like:

\(\displaystyle (2y^2 - 1)^2 = 4y^4 + 1.\) Not sure where the \(\displaystyle - 4y^2\) comes from.

Thanks again.
 
Ah I feel so silly! Of course, its one of those squaring rules, not sure of the english name. I was tired so I blame it on that. Thanks again JeffM.
 
you don't sound sure of whether or not you are required to use the method
of Lagrange multipliers.

If you are not required to do it that way, I would ask that after you have
worked out the problem that way (by the method of Lagrange multipliers),
as you and the other users have already worked out in this thread,




-----------------------------------------------------------------------------
Trumpet Wedding Dresses|Wedding Dresses with Sleeves|Column Wedding Dresses
 
Top