The form that this integral will take is
[tex]I=\int l^{2}\: dm[/tex]
Where l is the distance from the axis of rotation.
Sorry, I am too lazy to draw any figures but here is one that will suffice.
In our case the distance from the axis of rotation (z) is given by
[tex]l=rsin\phi[/tex]
as seen in the figure. We need to find dm now, and it is pretty easy. Use the volume element for spherical coordinates multiplied by the density. This is the little piece of mass.Density is given by
[tex]\rho=\frac{M}{\frac{4}{3}\pi R^{3}}[/tex]So dm is
[tex]dm=\rho r^{2}sin\phi dr\:d\theta\:d\phi[/tex]Our integral turns from this
[tex]I=\int l^{2}\: dm[/tex]
into
[tex]I=\int (rsin\phi)^{2}\: \rho r^{2}sin\phi dr\:d\theta\:d\phi[/tex]Of course this is not a single integral but a triple integral over our entire spherical volume. So
[tex]\rho \int^{\pi}_{0}\int^{2\pi}_{0}\int^{R}_{0} (rsin\phi)^{2}\: r^{2}sin\phi dr\:d\theta\:d\phi[/tex]
And we can condense it some
[tex]\rho \int^{\pi}_{0}\int^{2\pi}_{0}\int^{R}_{0} r^{4}sin^{3}\phi \:dr\:d\theta\:d\phi[/tex]
Now even further
[tex]\rho \int^{\pi}_{0}sin^{3}\phi\:d\phi \int^{2\pi}_{0}d\theta \int^{R}_{0} r^{4} \:dr[/tex]
Solving a couple of the integrals
[tex]\frac{\rho2\pi\:R^{5}}{5} \int^{\pi}_{0}sin^{3}\phi\:d\phi[/tex]
Now we just need to solve the last integral.
[tex]\int^{\pi}_{0}sin^{3}\phi\:d\phi[/tex]
Convert
[tex]sin^{2}\phi=1-cos^{2}\phi[/tex]
So
[tex]\int^{\pi}_{0}(1-cos^{2}\phi)sin\phi\:d\phi[/tex]
Break up the integrals
[tex]\int^{\pi}_{0}sin\phi\:d\phi -\int^{\pi}_{0} cos^{2}\phi sin\phi\:d\phi[/tex]The first integral is equal to 2, and the second is equal to 2/3
[tex]\int^{\pi}_{0}sin\phi\:d\phi -\int^{\pi}_{0} cos^{2}\phi sin\phi\:d\phi=2-\frac{2}{3}=\frac{4}{3}[/tex]
This means that the total integral (moment of inertia) is
[tex]I=\frac{\rho2\pi\:R^{5}}{5}\frac{4}{3}[/tex]When we substitute in for rho we see that
[tex]I=\frac{M}{\frac{4}{3}\pi R^{3}}\frac{2\pi\:R^{5}}{5}\frac{4}{3}[/tex]Which after canceling yields
[tex]I=\frac{2MR^{2}}{5}[/tex]
If you want it for the case where it is merely a shell, don't do the integration over r, and multiply the result by dr.