Solution (source code)

= Solution

The <shell theorem> gives the <gravity of a concentric hollow sphere> as $\mathbf g(r)=-GM(<r)\widehat{\mathbf r}/r^2$. There is no enclosed <mass> at the cavity boundary, whereas the entire shell has <mass> $M=\tfrac{4\pi\rho}{3}[(2a)^3-a^3]=\tfrac{28\pi}{3}\rho a^3$. Thus
$$
\boxed{\mathbf g(a)=0,\qquad
\mathbf g(2a)=-\frac{7\pi G\rho a}{3}\widehat{\mathbf r},\qquad
\mathbf g(4a)=-\frac{7\pi G\rho a}{12}\widehat{\mathbf r}.}
$$
Both nonzero fields point towards the centre. The field is continuous at each boundary; there is no surface <mass> sheet.