We are given a cone $z^2 = x^2 +y^2$ and between the spheres $x^2 + y^2 + z^2 = 1$ and $x^2 + y^2 + z^2 = 4$
Also the mass density is equal to $z$ and we are asked z coordinate of centroid of volume inside the cone and above the xy plane.
Now for z coordinate of centroid $$I = \iiint \rho z\,dx\,dy\,dz$$ divided by mass $M$.
So now translating to spherical coordinates we get $$I=\iiint \rho zr^2\sin\theta\, dr\, d\theta\, d\phi$$
As volume inside the cone is asked then z lies between $\sqrt{x^2 + y^2}$ and the plane $z = 2$. Evaluating that after putting the value of x and y in spherical coordinate and $r$ between 2 and 1, $\rho$ = z I am getting the wrong answer. Have I made a mistake somewhere?
Considering the following image, projection on the $yz$ plane
we have \begin{align} &\int_1^2dr\int_0^{\pi/4}d\theta\int_0^{2\pi}d\phi\,(r\cos\theta)r^2\sin\theta=\\ &2\pi\int_1^2dr\int_0^{\pi/4}d\theta\,r^3\sin\theta\cos\theta=\\ &2\pi\int_1^2dr\,r^3\left.\left(\frac{1}{2}\sin^2\theta\right)\right|_0^{\pi/4}=\\ &\frac{\pi}{2}\int_1^2dr\,r^3=\\ &\frac{\pi}{2}\left.\left(\frac{1}{4}r^4\right)\right|_1^2=\frac{15}{8}\pi\\ \end{align}