I was attempting to calculate the moment of inertia for a ball of radius R about the z axis when a mistake still led me to the correct answer and the seemingly correct method leads to the wrong answer.
Using the result of the moment of inertia for a solid hoop of radius R we have $I=\frac{1}{2}mR^2$ where $m$ is the mass of one solid hoop gives $dI=\frac{1}{2}r^2dm$, now for a sphere of radius $R$ and mass $M$ the density is $\rho=\frac{3M}{4\pi R^3}$ therefore $dm=\rho\cdot\pi r^2\, dz$ $$I=\frac{1}{2}\int_{-R}^{R} r^2(\rho\pi r^2)dz=\frac{\rho\pi}{2}\int_{-R}^{R}r^4\, dz$$ now if I choose to integrate this with by changing to the variable $\theta$ then $dz$ should become $Rd\theta$ then the integral becomes ($r=R\cos\theta$) $$I=\frac{\rho\pi}{2}\int_{-\pi /2}^{\pi /2}R^4\cos^4\theta Rd\theta=\rho\pi R^5\int_{0}^{\pi /2} \cos^4 \theta d\theta=\rho\pi R^5(\frac{3\pi}{16})=(\frac{3M}{4\pi R^3})*\pi R^5*\frac{3\pi}{16}=\frac{9\pi M R^2}{64}$$ which is clearly the wrong result. However if instead the substitution $dz=rd\theta$ is made $$I=\rho\pi\int_{0}^{\pi /2}r^5d\theta=\rho\pi R^5\int_0^{\pi /2}cos^5\theta d\theta=(\frac{3M}{4\pi R^3})\pi R^5(\frac{8}{15})=\frac{2MR^2}{5}$$ which is the correct result however I can't see why $dz$ would be equal to $rd\theta$ and not $Rd\theta$.