Let's say we have some finite mass M of constant density that can be shaped at will. How should we shape it and where do we place it for the gravitational field in some fixed point P to be maximal?

My solution:

Let's say P is the origin of the spherical coordinate system with the force pointing in the pozitive direction of the z-axis.

We must maximize the integral , where dm is an infinitesimal element of mass with the integral summing all over the shape of the volume V. If we express dm in spherical coordinates and disregard any constants, we have for the force at the origin.

The finite mass constraint gives

How should I proceed?

Thanks