Change of variable in triple integrals The problem: find the volume of indicated region inside the cone: $z = \sqrt{x^2 + y^2}$ and inside the sphere: $x^2 + y^2 + z^2 = a^2$
When i see the solution manual it don't make any sense at all to me. The solution manual says that i can rewrite it as:
$$\int_0^{2\pi} \;dθ \int_0^{\frac{\pi}{2}} \sin φ \;dφ \int_0^a R^2 \;dR$$. 
How is it possible to get that? i have no clue how they got it that way. So all I want is for someone to thoroughly explain every part for me, i can solve the integrals for myself from that point with ease, but just that transformation don't make any sense at all for me.
I just noticed that my code does not work, hopefully you can understand and maybe rewrite it for me.
 A: Take a look at 

Let $u^2 = x^2 + y^2$.
The volume you look for is the region
$$
0<r<a\\
0< \frac uz< 1 \iff 0<\tan\phi <1 \iff 0<\phi<\frac\pi 4\\
0<\theta<2\pi
$$
So the integral is 
$$
V = \int_0^a r^2 dr \int_0^{\frac\pi 4}\sin\phi d\phi\int_0^{2\pi} d\theta\\
= \frac {a^3}3 \left(1-\frac {\sqrt 2}2\right) 2\pi
$$
A: You'll want to convert this into spherical coordinates
$$x = R\cos\theta \sin\phi$$
$$y = R\sin\theta \sin\phi$$
$$z = R\cos \phi$$
where $R \ge 0, 0 \le \theta \le 2\pi, 0 \le \phi \le \pi$
Since $R = \sqrt{x^2+y^2+z^2}$, the equation for the sphere is just $R = a$, so the bounds for $R$ are $0 \le R \le a$
The equation for the cone is:
$$ R\cos\phi = \sqrt{R^2\cos^2\theta\sin^2\phi + R^2\sin^2\theta\sin^2\phi}$$
$$ R\cos\phi = R\sin\phi \sqrt{\cos^2\phi + \sin^2\phi}$$
$$ R\cos\phi = R\sin\phi $$
$$ \cos\phi = \sin\phi $$
Since $z \ge 0 $, $\cos\phi \ge 0$ so $\phi = \pi/4$. Therefore the bounds for $\phi$ are $0 \le \phi \le \pi/4$
Finally the bounds for $\theta$ are $0 \le \theta \le 2\pi$ since there are no constraints for $\theta$
In spherical coordinates, the volume element is $dV = R^2\sin\phi \, dR\,d\phi\,d\theta$
Put it all together, the integral is
$$ \int_{\theta=0}^{\theta=2\pi} \int_{\phi=0}^{\phi=\frac{\pi}{4}} \int_{R=0}^{R=a} R^2 \sin\phi \, dR \, d\phi \, d\theta$$
or
$$ \int_0^a R^2 dR \int_0^{\frac{\pi}{4}} \sin\phi \, d\phi \int_0^{2\pi} d\theta$$
