# Mass of a Sphere with varying Density

1. Feb 27, 2013

### johnaaronrose

What is the mass of a sphere of radius a*R where the density at any point distance x*R from the sphere's centre is f(x) where f(x) is an algebraic function of x? R is the radius of a sphere with a common centre to this one but of larger or equal radius and a thus takes a value between 0 & 1.

My solution:
Consider sphere made up of infinite number of spherical shells. Assume that a spherical shell is at distance x*R from centre with infinitesimal thickness dx.
Volume of spherical shell = its surface area * its thickness = 4Pi((x*R)^2) * d(x*R)
Mass of spherical shell = mass of spherical shell * density of spherical shell
= 4Pi((x*R)^2) * d(x*R) * f(x) = 4Pi(R^3)(x^2)f(x)dx
Mass of sphere = Integral from a to 0 of 4Pi(R^3)(x^2)f(x)dx = 4Pi(R^3) * Integral from a to 0 of (x^2)f(x)dx

The reason I ask this is that Brian Cox & Jeff Forshaw in the footnote on p235 of their book "The Quantum Universe: everything that can happen does happen" state:
g(a) = 4Pi(R^3)p * Integral from a to 0 of (x^2)f(x)dx
where g(a) is the fraction of a star's mass lying in a sphere of radius aR (e.g. a=0.5 means that this sphere has half the radius of the star), R is the radius of the spherical star, p is the average density of the star, f(x) is the density of the star at a point distance x*R from the star's centre.

My view is that:
g(a) = 4Pi(R^3) * Integral from a to 0 of (x^2)f(x)dx / ((4Pi(R^3)/3) * p)
= Integral from a to 0 of (x^2)f(x)dx / (1/3) * p)

Am I correct in this result?

PS apologies for not using the mathematical symbols for Integral, Pi etc: I haven't figured out how to get them into this webpage.

Last edited: Feb 27, 2013
2. Feb 27, 2013

### hapefish

I approached the problem as a triple integral in spherical coordinates and got $$\int_0^{aR} \int_0^{2\pi} \int_0^{\pi} f(\frac{r}{R})r^2 \sin (\phi) d\phi d\theta dr$$
Doing a simple substitution of $x= \frac{r}{R}$ and doing the two inner integrals gives the same result as you: $$4\pi R^3 \int_0^a f(x)x^2 dx$$

Your second assertion about the fraction of the star's mass seems quite reasonable, but I would probably need to look at the book (which I do not own) to be 100% certain that you interpreted it correctly.

Good Luck!

3. Feb 27, 2013

### pasmith

This is the right idea. For a spherically symmetric star of radius R with density $\rho(r)$ varying with distance from the centre, the star's mass will be
$$M = 4\pi \int_0^R r^2\rho(r)\,\mathrm{d}r.$$

If we set $x = r/R$ and $\rho(r) = f(x)$ then we obtain
$$M = 4\pi R^3 \int_0^1 x^2 f(x)\,\mathrm{d}x.$$

I suppose, having non-dimensionalised distance it would be strange not to non-dimensionalise density as well, so we should have set $\rho(r) = \rho_0 f(x)$ for some reference density $\rho_0$. Doing that we obtain
$$M = 4\pi \rho_0 R^3 \int_0^1 x^2 f(x)\,\mathrm{d}x.$$

"The fraction of a star's mass lying in a sphere of radius $aR$" is (taking $\rho_0 = p$)
$$\frac{1}{M} 4\pi \int_0^{aR} \rho(r)r^2\,\mathrm{d}r = \frac{4\pi p R^3}{M} \int_0^a x^2f(x)\,\mathrm{d}x = 3 \int_0^a x^2f(x)\,\mathrm{d}x$$
using the fact that $M = (4\pi p R^3)/3$, which, allowing for the fact that I rescaled f, is what you obtained.

Why, then, do Cox and Forshaw obtain a different result? I think there are some inaccuracies in the quoted passage: firstly they seem to be taking $\rho(r) = pf(x)$, which as explained above is reasonable, and secondly $g(a)$ appears to be the total mass within the distance $aR$ of the origin, rather than the fraction of the star's mass within that distance. Making those changes, we find
$$4\pi \int_0^{aR} \rho(r)r^2\,\mathrm{d}r = 4\pi pR^3 \int_0^a x^2f(x)\,\mathrm{d}x$$
which is the given g(a).