Optimize function over unit ball

Yes, that looks right. So you have two equations in two variables. You need to solve for x and y. I get x
  • #1
Inertigratus
128
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
  • #2
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:
  • #3
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
 
  • #4
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].
 
  • #5
Substitution and then setting gradient to 0 got me (x, y) = (+- 1, +- 1) for which z = sqrt(-1)...
 
  • #6
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].
 
  • #7
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
 
  • #8
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:
  • #9
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...
 

FAQ: Optimize function over unit ball

What is meant by "optimize function over unit ball"?

Optimizing a function over a unit ball means finding the maximum or minimum value of a given function while restricting the values of its variables to be within a unit ball, which is a set of points that are all within a certain distance from the origin.

Why is optimizing over a unit ball useful in scientific research?

Optimizing over a unit ball is useful because it allows scientists to study the behavior of a function within a specific range of values, which can give insight into its overall behavior. It also helps to simplify complex problems and make them more manageable.

How is the optimal value of a function over a unit ball determined?

The optimal value of a function over a unit ball is determined by using mathematical optimization techniques, such as gradient descent or Lagrange multipliers, to find the global maximum or minimum of the function within the unit ball.

What are some real-world applications of optimizing over a unit ball?

Optimizing over a unit ball has many applications in fields such as machine learning, data analysis, and engineering. It can be used to find the best parameters for a model, optimize the performance of a system, or analyze data within a specific range.

Are there any limitations to optimizing over a unit ball?

One limitation of optimizing over a unit ball is that it only considers values within a specific range, which may not accurately represent the behavior of the function outside of that range. Additionally, the optimal value may change if the unit ball is changed, so it is important to carefully choose the size and shape of the unit ball for accurate results.

Back
Top