Optimize function over unit ball

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
8 replies · 4K views
Inertigratus
Messages
123
Reaction score
0

Homework Statement


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


Homework Equations


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


The Attempt at a Solution


[itex]\nabla[/itex]f = (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([itex]\theta[/itex], [itex]\varphi[/itex]) = sin2[itex]\theta[/itex](cos[itex]\theta[/itex] + 1)cos[itex]\varphi[/itex]sin[itex]\varphi[/itex].
Then it's rather obvious that to get max, [itex]\theta[/itex] = +-[itex]\pi[/itex]/2 and [itex]\varphi[/itex] = [itex]\pi[/itex]/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 [itex]z = \sqrt{1 - x^2 - y^2}[/itex] into the formula for [itex]f[/itex] and maximizing with respect to [itex]x[/itex] and [itex]y[/itex].

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 [itex]\leq[/itex] 1.
x [itex]\geq[/itex] 0, y [itex]\geq[/itex] 0, y [itex]\geq[/itex] 0.


Homework Equations


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


The Attempt at a Solution


[itex]\nabla[/itex]f = (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([itex]\theta[/itex], [itex]\varphi[/itex]) = sin2[itex]\theta[/itex](cos[itex]\theta[/itex] + 1)cos[itex]\varphi[/itex]sin[itex]\varphi[/itex].
Then it's rather obvious that to get max, [itex]\theta[/itex] = +-[itex]\pi[/itex]/2 and [itex]\varphi[/itex] = [itex]\pi[/itex]/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 [itex]z = \sqrt{1 - x^2 - y^2}[/itex] into the formula for [itex]f[/itex] and maximizing with respect to [itex]x[/itex] and [itex]y[/itex].

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

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

When you say maximizing with respect to [itex]x[/itex] and [itex]y[/itex], do you mean setting the gradient of [itex]f(x, y, h(x, y))[/itex] to 0? where [itex]h(x, y) = \sqrt{1 - x^2 - y^2}[/itex].
 
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 [itex]g(x,y,z)= x^2+ y^2+ z^2= 1[/itex]
That will happen the two gradient vectors are parallel- when [itex]\nabla f= \lambda \nabla g[/itex] for some constant [itex]\lambda[/itex].
 
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 [itex]z = \sqrt{1 - x^2 - y^2}[/itex] but that makes it kinda complicated, is there no faster/easier way?

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

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

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

I get

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

and a similar expression for [itex]\partial g/\partial y[/itex]:

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

If [itex](x,y)[/itex] is a critical point, and [itex]x[/itex] and [itex]y[/itex] 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 [itex]x^2 = y^2[/itex], 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 [itex](x,y) = (\pm 2/3, \pm 2/3)[/itex].
 
Last edited:
jbunniii said:
What is your expression for the gradient?

For

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

I get

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

and a similar expression for [itex]\partial g/\partial y[/itex]:

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

If [itex](x,y)[/itex] is a critical point, and [itex]x[/itex] and [itex]y[/itex] 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 [itex]x^2 = y^2[/itex], 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 [itex](x,y) = (\pm 2/3, \pm 2/3)[/itex].
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 [itex]g(x,y,z)= x^2+ y^2+ z^2= 1[/itex]
That will happen the two gradient vectors are parallel- when [itex]\nabla f= \lambda \nabla g[/itex] for some constant [itex]\lambda[/itex].

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...