Solution
= Solution
Let $R_1$ be the core radius and $R_p$ the planetary radius. For the <two-layer constant-density planet>,
$$
\boxed{R_1=\left(\frac{3M_1}{4\pi\rho_1}\right)^{1/3}},
$$
and the mantle volume gives
$$
\boxed{R_p=\left[R_1^3+
\frac{3(M_p-M_1)}{4\pi\rho_2}\right]^{1/3}}.
$$
The enclosed mass profile is
$$
\boxed{M(r)=
\begin{cases}
\dfrac{4\pi}{3}\rho_1r^3,&0\leq r\leq R_1,\\[6pt]
M_1+\dfrac{4\pi}{3}\rho_2(r^3-R_1^3),
&R_1\leq r\leq R_p.
\end{cases}}
$$