I am aware that the gravitational energy of one layer of thickness dr is

[itex]dU=-\frac{GM(r)dm}{r}[/itex]

and that ultimately I will have to integrate this over all radii but I am unclear about the expression for [itex]\rho_{center}[/itex]. The only thing that springs to mind is

[itex]\rho=\frac{M}{\frac{4}{3}\pi R^3}[/itex]

but this must be for an average density over the whole star. Can anyone point me in the direction of how to establish an expression for [itex]\rho_{center}[/itex]?

However the question says "give an expression for [itex]\rho_{center}[/itex], so presumably I have to calculate the value of [itex]\rho_{center}[/itex] from scratch rather than looking it up. For example I know that the value for the center density quoted from many sources is [itex]1.622\times10^5\textrm{ kg m}^{-3}[/itex] however it is clear from the question I cannot simply use this value but I need to form an expression and then set r=0, but anything I try always ends up with r in the denominator thus resulting in infinity.