Solution (source code)

= Solution

Assume Newtonian spherical <hydrostatic equilibrium>, neglect rotation and thermal density changes, and require continuous pressure at the layer boundary. Write
$$
C=M_1-\frac{4\pi}{3}\rho_2R_1^3,
\qquad
D=\frac{4\pi}{3}\rho_2,
$$
so the mantle mass profile is $M(r)=C+Dr^3$. Integrating $dP/dr=-G\rho_2M(r)/r^2$ inward from $P(R_p)=P_0$ gives the boundary pressure
$$
\boxed{P_b=P_0+G\rho_2\left[
C\left(\frac1{R_1}-\frac1{R_p}\right)
+\frac D2(R_p^2-R_1^2)
\right]}.
$$