Change of Variable theorem and spherical coordinate transformation If $V = \{(x,y,z) \text{ such that } x^2 + y^2 + z^2 < a^2\text{ and }z>0\}$,
use the spherical coordinate transformation to express $\int_V{z}$ as an integral over an appropriate set in $(\rho, \phi, \theta)$ space. Justify you answer. 
Attempt at the solution : 
using $g(\rho, \phi, \theta) = (\rho \sin{\theta}\cos{\phi}, \rho \sin{\theta}\sin{\phi}, \rho \cos{\theta})$ and the fact that $\det Dg = \rho^2 \sin{\theta}$ gives us our limits of integration as follows: 
$ 0 < \rho < a$, $0 < \theta < \pi $, $0 < \phi < 2\pi $. 
I'm confused about the justify part, I think the diffeomrphism is defined over the set $(0, a) \times (0, \pi) \times ( 0, 2\pi)$, which implies that the positive $x$-axis is not included, so we will have to define a new set $V' = \{ x^2 + y^2 + z^2 , a^2, \text{ for }z> 0, x<0 \text{ if } y = 0\}$ and this will have the same answer since the non-negative $x$-axis has measure zero. 
I'm not sure if my intuition is right, if someone could provide me feedback on my answer that would be great .  
 A: Your limits of integration are wrong. Because $z > 0$, the limits on $\theta$ are $0 < \theta < \pi/2$. The solution is $$\int_V z\,dV = \int_0^{\pi/2}\int_0^{2\pi}\int_0^a \rho^3\cos \theta\sin\theta\,d\rho\,d\phi\,d\theta$$
The coordinate transformation is a local diffeomorphism except along the $z$-axis (not $x$). Along the $z$-axis, it becomes singular. But indeed since the axis has measure $0$, this has no effect on the integral. 
A: Let $U:=\{(x,y,z)\mid x^2+y^2+z^2<a^2\text{ and }z>0\text{ and }(x<0\text{ if } y=0\}).$
Let $T:=(0,a)\times (0,\frac{\pi}{2})\times (0,2\pi).$
Let $S:=\{(x,y,z)\mid 0\leq x<a\text{ and }y=0\text{ and }0<z<\sqrt{a^2-x^2}\}.$
The spherical coordinate transformation $g$ does not in this case define a diffeomorphism of an open set in the $(\rho,\phi,\theta)$ space with $V$. However, $g$ does define a diffeomorphism of the open set $T$ with the open set $U$ of $\mathbb{R}^3$. The set $U$ consists of $V$ with $S$ deleted. Because $S$ has measure zero, $$\int_V z=\int_U z=\int_T (\rho\cos\phi)(\rho^2\sin\phi).$$
