Find $\iiint_D z^{2}dV$ where $D$ is restricted to the given surfaces Find the following triple integral where $D$ is restricted to the the surfaces $x^2+y^2+z^2=R^2$ and $x^2+y^2+z^2=2Rz$
$$\iiint_D z^{2}dV$$

The surface $x^2+y^2+z^2=R^2$ represents a sphere centered at the origin and $x^2+y^2+z^2=2Rz$ can be written as $x^2+y^2+(z-R)^2=R^2$ which is a sphere centered at $(0,0,R)$, I used geogebra to see the graph of the surfaces, though I'm unable to determine the limits of the integration.
 A: I'm going to set the integral up in spherical coordinates, which are a good choice here because the domain is bounded by spheres.
First, let's look at the bounds on the radius, $\rho$. Let's rewrite the equations of the spheres using spherical coordinates. The equation for the sphere centered at the origin should be $\rho^2 = R^2 \to \rho = R$, and the equation for the off-centered sphere should be $\rho^2 = 2R\rho\cos\phi \to \rho = 2R\cos\phi$.
Now, if you imagine looking from the origin outwards, in the region of interest you should see that if we look straight up then we're bounded by the sphere centered at the origin, then as we start looking further down our upper bound gets switched to the sphere centered at $(0, 0, R)$. So, we're going to have to split our domain at the intersection.
To get information about the intersection, we can set our two equations for our spheres equal to get $R = 2R\cos\phi \to \cos\phi = \frac{1}{2}$, and because $0 \leq \phi \leq \pi$, this gives us $\phi = \frac{\pi}{3}$ at the intersection. So, for $0 \leq \phi \leq \frac{\pi}{3}$, we should have $0 \leq \rho \leq R$, and for $\frac{\pi}{3} \leq \phi \leq \frac{\pi}{2}$, we should have $0 \leq \rho \leq 2R\cos\phi$.
Finally, we need bounds for the polar angle, $\theta$. This is the easiest one here because we just need to go through one full rotation: $0 \leq \theta \leq 2\pi$.
Now we can write out our iterated integral, remembering to include the Jacobian. ($dV = \rho^2 \sin\phi d\rho d\phi d\theta)$
$$\iiint_D z^2 dV = \int_0^{2\pi} \int_0^{\frac{\pi}{3}} \int_{0}^{R} \rho^4 \cos^2\phi \sin\phi d\rho d\phi d\theta + \int_0^{2\pi} \int_{\frac{\pi}{3}}^{\frac{\pi}{2}} \int_{0}^{2R\cos{\phi}} \rho^4 \cos^2\phi \sin\phi d\rho d\phi d\theta $$
And from here we integrate just like a normal multiple integral.
$$\int_0^{2\pi} \int_0^{\frac{\pi}{3}} \int_{0}^{R} \rho^4 \cos^2\phi \sin\phi d\rho d\phi d\theta = \int_0^{2\pi} \int_0^{\frac{\pi}{3}} \dfrac{\rho^5}{5}\Bigg|_{0}^R \cos^2\phi \sin\phi d\phi d\theta$$
$$= \frac{R^5}{5}\int_0^{2\pi} \int_0^{\frac{\pi}{3}} \cos^2 \phi \sin\phi d\phi d\theta$$
$$u = \cos\phi, du = -\sin\phi d\phi$$
$$\frac{R^5}{5}\int_0^{2\pi} \int_{\frac{1}{2}}^{1} u^2 du d\theta = \frac{R^5}{5}\int_0^{2\pi}  \frac{1}{3}u^3\Bigg|_{\frac{1}{2}}^{1} du d\theta = \frac{7\pi R^5}{60}$$
$$\int_0^{2\pi} \int_{\frac{\pi}{3}}^{\frac{\pi}{2}} \int_{0}^{2R\cos{\phi}} \rho^4 \cos^2\phi \sin\phi d\rho d\phi d\theta = \int_0^{2\pi} \int_{\frac{\pi}{3}}^{\frac{\pi}{2}}\dfrac{\rho^5}{5}\Bigg|_{0}^{2R\cos\phi} \cos^2\phi \sin\phi d\phi d\theta$$
$$= \frac{32R^5}{5}\int_0^{2\pi} \int_{\frac{\pi}{3}}^{\frac{\pi}{2}} \cos^7 \phi \sin\phi d\phi d\theta = \frac{32R^5}{5}\int_0^{2\pi} \int_{0}^{\frac{1}{2}} u^7 du d\theta = \frac{\pi R^5}{160}$$
$$\iiint_D z^2 dV = \frac{7\pi R^5}{60} + \frac{\pi R^5}{160} = \frac{59\pi R^5}{480}$$
Hope this helps!
