# Triple integral in spherical coordinate, where am I wrong

$$\iiint_{D} z\left(x^{2}+y^{2}+z^{2}\right) \mathrm{d} x \mathrm{~d} y \mathrm{~d} z$$ D is given by $$x^{2}+y^{2}+z^{2}\leq 2z$$ I try to use $$\left\{\begin{matrix} x=r\sin \phi \cos \theta \\ y=r\sin \phi \sin \theta \\ z=r\cos\phi \end{matrix}\right.$$ while the Jacobian is $$r^2 \sin \phi$$ and $$\left\{\begin{matrix} 0\leq \theta \leq 2\pi\\ 0\leq \phi \leq \frac{\pi}{2} \\0\leq r \leq 1\end{matrix}\right.$$

$$\Rightarrow$$ $$\int^{2\pi}_0 \mathrm{d}\theta\int^{\pi/2}_0\mathrm{d}\phi\int_0^{2\cos\phi}r^4\sin^2\phi \cos \phi\mathrm{d}r$$ $$\Rightarrow$$ $$2\pi\int^{\pi/2}_0\cos^6\phi-\cos^8\phi \ \mathrm{d}\phi$$ $$I_{n}=\int_{0}^{\frac{\pi}{2}} \cos ^{n} x d x\Rightarrow I_{n}=\frac{n-1}{n} I_{n-2}\text{ integral by part }$$ $$I_{2 m}=\frac{2 m-1}{2 m} \cdot \frac{2 m-3}{2 m-2} \cdot \cdots \cdot \frac{3}{4} \cdot \frac{1}{2} I_{0}\\ I_{2 m+1}=\frac{2 m}{2 m+1} \cdot \frac{2 m-2}{2 m-1} \cdot \cdots \cdot \frac{4}{5} \cdot \frac{2}{3} I_{1}\\ I_{0}=\int_{0}^{\frac{\pi}{2}} d x=\frac{\pi}{2}, I_{1}=\int_{0}^{\frac{\pi}{2}} \cos x d x=1\\$$ $$\Rightarrow$$ $$2\pi\int^{\pi/2}_0\cos^6\phi-\cos^8\phi \ \mathrm{d}\phi=\frac{\pi^2}{4}$$ but the answer is $$\frac{8\pi}{3}$$, where am I wrong. I used wolframalpha to calculate $$\int^{\pi/2}_0\mathrm{d}\phi\int_0^{2\cos\phi}r^4\sin^2\phi \cos \phi\mathrm{d}r$$ the answer is $$\frac{\pi}{8}$$, am I wrong at first?

• you should $r^5$ in the integrand to begin with, not $r^4.$ Commented Nov 13, 2022 at 5:42
• also why did your $\sin\phi$ become $\sin^2\phi ?$ Commented Nov 13, 2022 at 5:43
• $r\leq 1$ is incorrect, but you seem to have given the correct boundaries for $r$ anyway. Commented Nov 13, 2022 at 5:49
• @dezdichado thanks a lot! I'll correct the two mistakes. Commented Nov 13, 2022 at 5:49
• @DavidK yeah, thank you Commented Nov 13, 2022 at 5:50

Firstly, I have a typo it is $$r\leq2\cos \phi$$.
Secondly, it is $$\int^{2\pi}_0 \mathrm{d}\theta\int^{\pi/2}_0\mathrm{d}\phi\int_0^{2\cos\phi}r^5\sin\phi \cos \phi\mathrm{d}r$$ and it is easy to integrate $$\Rightarrow$$ $$-2\pi \int_0^{\pi/2}\frac{2^6}{6}\sin \phi \cos^7\phi d\phi\Rightarrow-\frac{2^7\pi}{6}\int_0^{\pi/2} \cos^7\phi d\cos\phi\\ \Rightarrow-\frac{2^7\pi}{6\times2^3}\cos^8 \phi \bigg|^{\pi/2}_0=\frac{8\pi}{3}$$