Let's find the moment of inertia of a solid sphere of radius \(R\) about the x-axis along its one diameter as shown in Figure 1. The centre of the sphere is the origin of our coordinate system. Instead of considering a spherical shell as the infinitesimally small element of the sphere we take an infinitesimally small disk of radius \(r\) and thickness \(dx\) at a distance \(x\) from the centre of the sphere. First we find the moment of inertia of the disk element of mass \(dm\).
To do this you know \(r = \sqrt {{R^2} - {x^2}} \) from Figure 1. And volume of the disk element is \(dV = \pi {r^2}dx = \pi ({R^2} - {x^2})dx\). The total volume of the sphere is \(\frac{4}{3}\pi {R^3}\). The ratio of the mass of the disk element to the total mass of the sphere is equal to the ratio of the volume of the disk element to the total volume of the sphere. Therefore,
\[\begin{array}{c} \frac{{dm}}{M} = \frac{{\pi ({R^2} - {x^2})dx}}{{\frac{4}{3}\pi {R^3}}}\\ {\rm{or,}}\quad dm = \frac{{3M({R^2} - {x^2})dx}}{{4{R^3}}} \end{array}\]
As already discussed, the moment of inertia of a disk about the axis through its centre perpendicular to its plane is the same as the moment of inertia of a solid cylinder about the corresponding axis. Therefore, the moment of inertia of the disk element is
\[dI = \frac{1}{2}dm{\kern 1pt} {\kern 1pt} {r^2} = \frac{{3M{{({R^2} - {x^2})}^2}dx}}{{8{R^3}}}\]
The moment of inertia of the half of the sphere is determined by integrating the above expression of the moment of inertia of the disk element from \(0\) to \(R\). So the total moment of inertia of the sphere about the axis along its diameter is twice of this:
\[I = 2\int\limits_0^R {dI} = \frac{{6M}}{{8{R^3}}}\int\limits_0^R {{{({R^2} - {x^2})}^2}dx} = \frac{2}{5}M{R^2}\]
Carry out the integration and the the result will be the same as you see here.