Hi,
I have the function f(x,y) = x^3 + 3y^2 +2y and I need to maximize it on the unit circle, x^2 + y^2 = 1. From here I defined a function g(x,y) = x^2 + y^2 - 1 = 0.
I have tried 2 methods of solving this:
Substitution:
x^2 = 1 - y^2 in the unit circle into f(x,y) yields:
f(y) = y^4 + y^2 + 2y + 1
f'(y) = 4y^3 + 2y + 2 = 0
From the answer to this problem, I know that y should be 1, which is not returned by this method.
I have also tried using a Lagrange Multiplier:
del f = 2x i + (6y + 2) j
del g = 2x i + 2y j
def f = lambda del g gives:
2x = lamba 2x => lamba = 1
Substituted into the y partials yields y = -1/2 != 1, so I cannot get this to work this way either. What am I doing wrong? Help greatly appreciated.
I have the function f(x,y) = x^3 + 3y^2 +2y and I need to maximize it on the unit circle, x^2 + y^2 = 1. From here I defined a function g(x,y) = x^2 + y^2 - 1 = 0.
I have tried 2 methods of solving this:
Substitution:
x^2 = 1 - y^2 in the unit circle into f(x,y) yields:
f(y) = y^4 + y^2 + 2y + 1
f'(y) = 4y^3 + 2y + 2 = 0
From the answer to this problem, I know that y should be 1, which is not returned by this method.
I have also tried using a Lagrange Multiplier:
del f = 2x i + (6y + 2) j
del g = 2x i + 2y j
def f = lambda del g gives:
2x = lamba 2x => lamba = 1
Substituted into the y partials yields y = -1/2 != 1, so I cannot get this to work this way either. What am I doing wrong? Help greatly appreciated.
-
Both methods should get you there, but you seem to be changing the function f. If
f(x, y) = x^3 + 3y² + 2y,
then x² = 1 - y² gives upon substitution
f(y) = (1 - y²)^(3/2) + 3y² + 2y.
I don't know how you got y^4 + y² + 2y + 1 out of this. In your Lagrange multiplier approach, your gradient of f is incorrect.
∇f = 3x² i + (6y + 2) j.
This gives
3x² = 2λx, 6y + 2 = 2λy, and x² + y² = 1.
The first equation has two possible solutions, x = 0 or x = (2/3)λ. If x = 0, then y = 1 and you get
f(0, 1) = 5.
If x ≠ 0, then x = (2/3)λ. From the second equation y = 1/(3 - λ). Plugging into the constraint
4λ²/9 + 1/(3 - λ)² = 1
It turns out that there are two real solutions λ ≈ -1.46184 and λ ≈ 1.23576. It is kind of a pain, but you can show that the x and y values associated with these are minimums of f. So the maximum is 5 taken at (0,1).
f(x, y) = x^3 + 3y² + 2y,
then x² = 1 - y² gives upon substitution
f(y) = (1 - y²)^(3/2) + 3y² + 2y.
I don't know how you got y^4 + y² + 2y + 1 out of this. In your Lagrange multiplier approach, your gradient of f is incorrect.
∇f = 3x² i + (6y + 2) j.
This gives
3x² = 2λx, 6y + 2 = 2λy, and x² + y² = 1.
The first equation has two possible solutions, x = 0 or x = (2/3)λ. If x = 0, then y = 1 and you get
f(0, 1) = 5.
If x ≠ 0, then x = (2/3)λ. From the second equation y = 1/(3 - λ). Plugging into the constraint
4λ²/9 + 1/(3 - λ)² = 1
It turns out that there are two real solutions λ ≈ -1.46184 and λ ≈ 1.23576. It is kind of a pain, but you can show that the x and y values associated with these are minimums of f. So the maximum is 5 taken at (0,1).