How to integrate a pdf, $f_{XYZ}$ within a 3-D sphere? Say that I have $f_{XYZ} = C$ that is defined within a 3-D sphere and that it's constant. If I want to obtain $f_X$, I have to integrate over $Y$ and $Z$ dimensions. What is the easiest way to do this, and how do I determine the limits of integration?
For within a sphere, I know we have to satisfy
$$
X^2 + Y^2 + Z^2 < R^2 
$$
with $R$ being radius of sphere.
So my attempt looks something like this:
$$
f_X(x) = \int_?^? \int_{-\sqrt{R^2 - x^2 - z^2}}^{\sqrt{R^2 - x^2 - z^2}} f_{XYZ}dydz
$$
But I am confused what the limits should be for $Z$. Is it simply from $0$ to $R$, or does it depend on $x$?
 A: If you interset the plane $\{X=x\}\cap\mathbb{R}^3$ with the ball $\{X^2+Y^2+Z^2 \leq R^2\}\cap\mathbb{R}^3$ for fixed $x\in[-R,R]$ and project onto the $yz-$plane you're looking at the disc $$\{Y^2+Z^2\leq R^2-x^2\}\cap\mathbb{R}^2$$ That being said,
$$f_X(x)=\int_{-\sqrt{R^2-x^2}}^{\sqrt{R^2-x^2}}\int_{-\sqrt{R^2-x^2-y^2}}^{\sqrt{R^2-x^2-y^2}}f_{XYZ}(x,y,z)dzdy$$ whenever $x\in[-R,R]$ and $f_X(x)=0$ otherwise. You can evaluate this integral by converting to polar coordinates: $$\int_{0}^{2\pi}\int_{0}^{\sqrt{R^2-x^2}}rf_{XYZ}(x,r\cos(\theta),r\sin(\theta))drd\theta$$
Moreover, $C$ must equal $\frac{3}{4\pi R^3}$ to ensure $\int_{\{x^2+y^2+z^2\leq R^2\}}f_{XYZ}dV=1$.
A: Easiest way is to see that when you solve your result for $z$, you get
$$
z = \pm \sqrt{R^2-x^2-y^2},
$$
which will be the bounds on the inner integral. Now when you collapse the sphere to the $xy$-plane, you end up with $x^2+y^2 < R^2$ and so $y = \pm \sqrt{R^2-x^2}$, so you have
$$
f_X(x)
 = \int_{y=-\sqrt{R^2-x^2}}^{y=\sqrt{R^2-x^2}}
      \left[ \int_{z=-\sqrt{R^2-x^2-y^2}}^{z=\sqrt{R^2-x^2-y^2}} f_{XYZ}(x,y,z) dz \right] dy
$$
UPDATE
To integrate, since $f_{XYZ} \equiv C$ is constant, the inner integral is just $2C\sqrt{R^2-x^2-y^2}$ and you can use a trig substitution or a standard tabled integral, say #30 in this list
