Solution (source code)

= Solution
{c}

For any closed surface enclosing a region $V$, <Gauss's law for gravity> states that the outward <flux> of the <gravitational field> is
$$
\boxed{\iint_{\partial V}\mathbf g\cdot\mathbf n\,dA=-4\pi G\iiint_V\rho\,dV=-4\pi GM_V.}
$$
Here $G$ is the <gravitational constant> and $M_V$ is the enclosed <mass>; the negative sign expresses attractive <gravity>.

Use the <gravitational potential sign conventions> specified by this paper: $\mathbf g=\nabla\varphi$. Thus $\varphi$ is the negative of the usual <Newtonian gravitational potential> $\Phi$ defined by $\mathbf g=-\nabla\Phi$. For example, setting the value at infinity to zero gives $\varphi=GM/r$ for a <point mass>. The <divergence theorem> now gives
$$
\iiint_V\nabla^2\varphi\,dV=-4\pi G\iiint_V\rho\,dV.
$$
Since $V$ is arbitrary, continuity of the integrands implies the local <Poisson's equation>
$$
\boxed{\nabla^2\varphi=-4\pi G\rho.}
$$
Conversely, integrating this <Poisson's equation> over any $V$ and applying the <divergence theorem> recovers <Gauss's law for gravity>. At a discontinuity of the <mass density>, the local equation is interpreted piecewise, or globally in the sense of <distributions>.