# Gravitational Binding energy of a sphere of 2 uniform densities

So I know that the gravitational binding energy of a sphere of uniform density can be given by: $$U=-\frac{16}{3}G\pi^2\rho^2\int_0^Rr^4dr$$ Which if integrated gives: $$U=-\frac{3GM^2}{5R}$$ As desired. But say I had a density function given by: $$\rho(r)=\begin{cases}\rho_a&\text{ for } r\leq r_a\\\\\rho_b&\text { for } r_a Could I then write that: $$U=-\frac{16}{3}G\pi^2\int_0^R\rho(r)^2r^4dr$$ $$U=-\frac{16}{3}G\pi^2\left[\int_0^{r_a}\rho_a^2r^4dr+\int_{r_a}^R\rho_b^2r^4dr\right]$$ Or am I missing some nuance? I feel like I am because I don't think I'm taking into account the mass of the first density in the second integral, but I am honestly not sure. Any clarification would be much appreciated.

• No way that from the first formula, you can get the second one. That is the potential energy of two spheres of mass $M$ at a distance $R$. But is it relevant to your question? Dec 5, 2020 at 10:43
• Although the problem is different, this question physics.stackexchange.com/questions/341065/… could be relevant to your problem. Dec 5, 2020 at 10:51
• $U=-GM/R^2$ is incorrect. The binding energy of a uniform sphere has a factor of 3/5. See Wikipedia. You should figure out your mistake before moving on to a non-uniform sphere. Dec 5, 2020 at 17:45
• @G.Smith it was just a typo my bad. Dec 5, 2020 at 20:05

Could I then write that...

No, it's more complicated than that. You didn't show how you got your first integral, but one way to do it is as in Wikipedia:

Imagine that it is pulled apart by successively moving spherical shells to infinity, the outermost first, and find the total energy needed for that.

The mass $$dm$$ of a shell between $$r$$ and $$r+dr$$ is

$$dm_\text{shell}=\begin{cases} 4\pi r^2 \rho_a\,dr, & 0

and the mass inside this shell is

$$m_\text{interior}=\begin{cases} \frac43 \pi r^3 \rho_a, & 0

The potential energy between these is

$$dU=-G\frac{m_\text{interior}dm_\text{shell}}{r}.$$

Integrate this over the entire sphere in two parts, $$0 and $$r_a.