<s>[INST] Evaluate the Volume integral $\iiint\left(x^2+y^2+z^2\right)\mathbb dv$. Suppose $a>0$ and $S = \{(x,y,z) \in \mathbb R^3 : x^2+y^2+z^2=a^2\}$ then 
MY FIRST APPROACH: $$\int\int\int\left(x^2+y^2+z^2\right)\mathbb dv=a^2\int\int\int \mathbb dv=a^2.\frac{4}{3}\pi a^3=\frac 4 3\pi a^5$$.
MY SECOND APPROACH:If i use spherical coordinate then $dV = r^2 \sin \theta dr d\theta d\phi.$ and $\left(x^2+y^2+z^2\right)=r^2$ now $$\int\int\int\left(x^2+y^2+z^2\right)\mathbb dv=\iint d\Omega \int_0^a (r^4) dr =\frac 4 5\pi a^5$$
where $\iint d\Omega = \int_0^\pi \sin(\theta)d\theta \int_0^{2\pi} d\phi = 4\pi.$
My question is that why such discrepancy in the answer$?$ and where did i commit  mistake in my first approach.
(Note:2nd answer is correct but what's the problem with 1st$?$) 
 [/INST] Note 
$$S = \left\{(x,y,z) \in \mathbb R^3 : x^2+y^2+z^2\le a^2\right\}=\left\{(\theta,\phi,\rho) : 0\le \theta\le 2\pi\, ,\,0\le \phi\le\pi\,\,, \rho^2=a^2\right\}$$
set 
\begin{cases}
x=\rho\sin\phi\cos \theta\\
y=\rho\sin\phi\sin \theta\\
z=\rho\cos\phi
\end{cases}

we have
$$\left|\frac{\partial(x,y,z)}{\partial(\rho,\theta,\phi)}\right|=\rho^2\sin\phi$$
thus
 $$\int\int\int\left(x^2+y^2+z^2\right)\mathbb {dx\,dy\,dz}=\int_{0}^{2\pi}\int_{0}^{\pi}\int_{0}^{a} \rho^4 \sin\phi\,\mathbb{d\rho\,d\phi\,d\theta}$$
</s>