How can the total gravitational potential energy of a galaxy be calculated?
Lets assume for simplicity that the entire galaxy follows an exponential mass density function for an infinitely small thickness:
$\rho_r = \rho_0 e^{(-r/h)}$
with $\rho$ being mass density in $kg/m^2$, $\rho_0$ density at $r=0$, $r$ radius and $h$ scale length.
I can calculate it by imagining that it is pulled apart by successively moving ring shells to infinity, the outermost first, and finding the total energy needed for that.
The equation for gravitational potential energy is:
$dU = -GM_r m_idr/r$
with mass of ring:
$dm_i = 2\pi r\rho(r)dr$
and mass interior:
$m_i=2\pi\rho_0h^2(1-(1+r/h)e^{(-r/h)})$
I get:
$U=-G\pi^2\rho_0^2h^2(e^{(-2r/h)}(h(3-4e^{(r/h)})+2r)+h)$
which fits dimensions.
Is this derivation correct?