Optimize function over unit ball

Click For Summary
The discussion focuses on optimizing the function f(x,y,z) = xy(z+1) over the unit ball defined by x² + y² + z² ≤ 1, with constraints x, y, z ≥ 0. Participants explore methods to find maximum and minimum values, initially using gradients and spherical coordinates, but face challenges in correctly maximizing the function. It is established that the minimum value is 0, while the maximum should be 16/27, achieved on the boundary of the unit sphere. The use of Lagrange multipliers is suggested as a more effective method for finding the maximum under the given constraints. Overall, the conversation emphasizes the importance of careful calculations and understanding the optimization process.
Inertigratus
Messages
123
Reaction score
0

Homework Statement


Find the maximum and minimum value of the function, defined over x2 + y2 + z2 \leq 1.
x \geq 0, y \geq 0, y \geq 0.


Homework Equations


f(x,y,z) = xy(z+1)


The Attempt at a Solution


\nablaf = (y(z+1), x(z+1), xy) = 0
Gets me (0, y, -1), (x, 0, -1), (0, 0, z) and they all result in f(x,y,z) = 0.
Then I wasn't sure how to find the values on the sphere.
What I did was I switched to spherical coordinates with r = 1 and plugged them into the eq.
f(\theta, \varphi) = sin2\theta(cos\theta + 1)cos\varphisin\varphi.
Then it's rather obvious that to get max, \theta = +-\pi/2 and \varphi = \pi/4.
Plugging that back into the cartesian coordinates and into the function gives +- 1/2.
Maximum is supposed to be 16/27 and minimum 0.

By the way, this problem comes before the problems that are about optimizing functions with constraints. So no need to use the lagrange multiplier.

Any ideas? :)
 
Physics news on Phys.org
To do it in cartesian coordinates, try substituting z = \sqrt{1 - x^2 - y^2} into the formula for f and maximizing with respect to x and y.

Your spherical coordinate formula is right, but you didn't maximize it correctly.
 
Last edited:
Inertigratus said:

Homework Statement


Find the maximum and minimum value of the function, defined over x2 + y2 + z2 \leq 1.
x \geq 0, y \geq 0, y \geq 0.


Homework Equations


f(x,y,z) = xy(z+1)


The Attempt at a Solution


\nablaf = (y(z+1), x(z+1), xy) = 0
Gets me (0, y, -1), (x, 0, -1), (0, 0, z) and they all result in f(x,y,z) = 0.
Then I wasn't sure how to find the values on the sphere.
What I did was I switched to spherical coordinates with r = 1 and plugged them into the eq.
f(\theta, \varphi) = sin2\theta(cos\theta + 1)cos\varphisin\varphi.
Then it's rather obvious that to get max, \theta = +-\pi/2 and \varphi = \pi/4.
Plugging that back into the cartesian coordinates and into the function gives +- 1/2.
Maximum is supposed to be 16/27 and minimum 0.

By the way, this problem comes before the problems that are about optimizing functions with constraints. So no need to use the lagrange multiplier.

Any ideas? :)

Look at f(x,y,z). For x , y and z >= 0, all its factors are >= 0, so f >= 0. Since you can have f = 0 (for example, by taking x=0 or y=0, etc.) the minimum value is f = 0. The gradient of f need not be zero at these minimizing points. Now consider the case f(x0,y0,z0) > 0 (so x0 > 0, y0 > 0 and z0 < -1). If x0^2 + y0^2 + z0^2 < 1 we can set x = c*x0, y = c*y0 and z = z0 to get f(cx0,cy0,z0) = c^2*f(x0,y0,z0) > f(x0,y0,z0) if c > 1. Increase c until we have c^2(x0^2 + y0^2) + z0^2 = 1, and the resulting point (x,y,z) will have a larger f-value than (x0,y0,z0). In other words, the solution to the max f problem must *always* lie on the boundary x^2 + y^2 + z^2 = 1.

RGV
 
Ray Vickson said:
Look at f(x,y,z). For x , y and z >= 0, all its factors are >= 0, so f >= 0. Since you can have f = 0 (for example, by taking x=0 or y=0, etc.) the minimum value is f = 0. The gradient of f need not be zero at these minimizing points. Now consider the case f(x0,y0,z0) > 0 (so x0 > 0, y0 > 0 and z0 < -1). If x0^2 + y0^2 + z0^2 < 1 we can set x = c*x0, y = c*y0 and z = z0 to get f(cx0,cy0,z0) = c^2*f(x0,y0,z0) > f(x0,y0,z0) if c > 1. Increase c until we have c^2(x0^2 + y0^2) + z0^2 = 1, and the resulting point (x,y,z) will have a larger f-value than (x0,y0,z0). In other words, the solution to the max f problem must *always* lie on the boundary x^2 + y^2 + z^2 = 1.

RGV

I think I understand, but how does that help us find the point at which maximum occurs?
My problem is, I don't know how to analyze the border when the border is a surface.

jbunniii said:
To do it in cartesian coordinates, try substituting z = \sqrt{1 - x^2 - y^2} into the formula for f and maximizing with respect to x and y.

Your spherical coordinate formula is right, but you didn't maximize it correctly.

I tried substituting for z = \sqrt{1 - x^2 - y^2} but that makes it kinda complicated, is there no faster/easier way?

When you say maximizing with respect to x and y, do you mean setting the gradient of f(x, y, h(x, y)) to 0? where h(x, y) = \sqrt{1 - x^2 - y^2}.
 
Substitution and then setting gradient to 0 got me (x, y) = (+- 1, +- 1) for which z = sqrt(-1)...
 
Inertigratus said:
I think I understand, but how does that help us find the point at which maximum occurs?
My problem is, I don't know how to analyze the border when the border is a surface.

For the surface, I would use a Lagrange multiplier method: you want to maximize f(x,y,z)= xy(z+ 1) subject to the condition that g(x,y,z)= x^2+ y^2+ z^2= 1
That will happen the two gradient vectors are parallel- when \nabla f= \lambda \nabla g for some constant \lambda.
 
Inertigratus said:
I think I understand, but how does that help us find the point at which maximum occurs?
My problem is, I don't know how to analyze the border when the border is a surface.



I tried substituting for z = \sqrt{1 - x^2 - y^2} but that makes it kinda complicated, is there no faster/easier way?

When you say maximizing with respect to x and y, do you mean setting the gradient of f(x, y, h(x, y)) to 0? where h(x, y) = \sqrt{1 - x^2 - y^2}.

Yes, exactly, since you are not yet "allowed" to use Lagrange multipliers.

RGV
 
Inertigratus said:
Substitution and then setting gradient to 0 got me (x, y) = (+- 1, +- 1) for which z = sqrt(-1)...

What is your expression for the gradient?

For

g(x,y) = f(x,y,\sqrt{1-x^2-y^2}) = xy(\sqrt{1-x^2-y^2} + 1)

I get

\frac{\partial g}{\partial x} = y\left(\sqrt{1-x^2-y^2} + 1 - \frac{x^2}{\sqrt{1 - x^2 - y^2}}\right)

and a similar expression for \partial g/\partial y:

\frac{\partial g}{\partial y} = x\left(\sqrt{1-x^2-y^2} + 1 - \frac{y^2}{\sqrt{1 - x^2 - y^2}}\right)

If (x,y) is a critical point, and x and y are nonzero, then the expressions in parentheses must be zero.

I'll let you fill in the details. After a bit of manipulation, you can show that x^2 = y^2, and then substituting this into each equation yields one equation that depends only on x, and another that depends only on y. I ended up getting (x,y) = (\pm 2/3, \pm 2/3).
 
Last edited:
jbunniii said:
What is your expression for the gradient?

For

g(x,y) = f(x,y,\sqrt{1-x^2-y^2}) = xy(\sqrt{1-x^2-y^2} + 1)

I get

\frac{\partial g}{\partial x} = y\left(\sqrt{1-x^2-y^2} + 1 - \frac{x^2}{\sqrt{1 - x^2 - y^2}}\right)

and a similar expression for \partial g/\partial y:

\frac{\partial g}{\partial y} = x\left(\sqrt{1-x^2-y^2} + 1 - \frac{y^2}{\sqrt{1 - x^2 - y^2}}\right)

If (x,y) is a critical point, and x and y are nonzero, then the expressions in parentheses must be zero.

I'll let you fill in the details. After a bit of manipulation, you can show that x^2 = y^2, and then substituting this into each equation yields one equation that depends only on x, and another that depends only on y. I ended up getting (x,y) = (\pm 2/3, \pm 2/3).
Oh, yes I got that too... but I think I forgot the " + 1" on the partial derivatives, which changed it all.

Ray Vickson said:
Yes, exactly, since you are not yet "allowed" to use Lagrange multipliers.

RGV

HallsofIvy said:
For the surface, I would use a Lagrange multiplier method: you want to maximize f(x,y,z)= xy(z+ 1) subject to the condition that g(x,y,z)= x^2+ y^2+ z^2= 1
That will happen the two gradient vectors are parallel- when \nabla f= \lambda \nabla g for some constant \lambda.

Right..., I tried the Lagrange multiplier and got that the right answer. Was just going to write how I did it, because I did something wrong at first and got something else. It's crazy how many mistakes I do sometimes...

Thanks all, now I understand it better!

I just hope I won't be keep making these "minor" mistakes on the exam...
 

Similar threads

Replies
8
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
Replies
12
Views
2K
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 40 ·
2
Replies
40
Views
4K
Replies
9
Views
2K
Replies
6
Views
2K