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$?$) 
 A: I think your mistake in first approach is that you take that as a line integral, whereas it is not: you can not put $\;x^2+y^2+z^2=a^2\;$ for the integrand, as this is a scalar function over the sphere $\;x^2+y^2+z^2=a^2\;$ , so you actually get (in spherical coordinates)
$$\iiint_S(x^2+y^2+z^2)dV=\int_0^a\int_0^{2\pi}\int_0^\pi\rho^4\sin\theta d\theta\,d\phi\,d\rho=$$
$$=\frac{a^5}5\cdot2\pi\int_0^\pi\sin\theta\,d\theta=\frac{4\pi a^5}5$$
which is basically the same as the second approach once one understands the first part...
The above is because in spherical coordinates we get $\;x^2+y^2+z^2=\rho^2\;$ , of course
A: 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}$$
A: 
Suppose $a>0$ and $S = \{(x,y,z) \in \mathbb R^3 : \color{blue}{x^2+y^2+z^2}=a^2\}$ then 

Firstly, if it is a triple integral over $S$ where $S$ is the volume enclosed by the sphere, then $S$ should be (notice $\color{purple}{\le}$ instead of $=$):
$$S = \{(x,y,z) \in \mathbb R^3 : \color{blue}{x^2+y^2+z^2} \color{purple}{\le} a^2\}$$
With the equality, you would have a surface integral over the surface of the sphere only.

MY FIRST APPROACH: $$\int\int\int\left(\color{red}{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$$

Your mistake lies in replacing $\color{red}{x^2+y^2+z^2}$ by $a^2$. The blue and red expressions happen to be the same, but in general they don't have to be. Because they are the same, you were perhaps tempted to substitute but don't forget you are supposed to integrate the red function over the volume enclosed by the sphere. You could make the same mistake in the second approach, since substituting $\color{red}{x^2+y^2+z^2}=\color{blue}{a^2}$ in that integral would also give you $a^2$ multiplied by the volume of the sphere; it doesn't matter if you do that in cartesian or spherical coordinates.
