= Solution
A thin spherical shell has mass $4\pi r^2\rho\,dr$ and inward gravitational force $Gm(r)(4\pi r^2\rho\,dr)/r^2$. The net outward pressure force is $-4\pi r^2P'(r)\,dr$. Their balance gives the <hydrostatic equilibrium> equation
$$
\boxed{P'=-\frac{Gm\rho}{r^2}.}
$$
Since $m'=4\pi r^2\rho$, multiplying by $r^2/\rho$ and differentiating yields $\frac{d}{dr}(r^2P'/\rho)=-4\pi Gr^2\rho$.
At the centre, require $m(0)=0$ and finite $P(0)$ and $\rho(0)$. Spherical symmetry gives $P'(0)=0$; indeed $m(r)=O(r^3)$ makes the pressure gradient $O(r)$ for regular density. At the surface require $P(R)=P_{\rm ext}$, usually approximated by zero, because pressure matches the surrounding medium. If the stellar mass is prescribed, also impose $m(R)=M$. An <equation of state> is needed to close the system. A vanishing surface density is appropriate for some stellar models but is not a universal boundary condition.
Back to article page