An object occupies the solid region in the first octant bounded by the coordinate planes and two cylinders $x^2 + y^2 = 4$ and $y^2 + z^2 = 4$ If the charge density at any point is $x$, what's the total charge?
So I know $Q = pV$, where $p$ is charge density and $V$ is volume.
I think that I need to do this in spherical coordinates, but I'm not too sure. I define $f(x, y, z) = x$, then I have $f( \theta, \phi) = ??$
I've never used spherical coordinates before. I'm learning multivariable calc through self study, so any help would be appreciated. I think my integral will be something like this
$$\int_{0}^{2\pi}\int_{0}^{\pi} f(\theta, \phi) d\theta d\phi \cdot x,$$
but I'm not sure about how to get the function. Any help is appreciated.
Firstly, $Q=pV$ only holds if the charge density is uniform. In this case $p(\vec{x})=x$, so it varies spatially and instead we must evaluate the total charge using an integral. To do so, we integrate the charge density over the charged volume;
$$Q=\int_{V}p(\vec{x})dV$$
Where $V$ is the volume you described.
We now need to pick a coordinate system and describe $V$ in terms of it. I don't think spherical or cylindrical coordinates quite work here (the union of the cylinders is a bit messy to describe), so we'll stick with good old cartesian coordiantes.
Since for any point $(x, y, z)$ we have $x^{2}+y^{2}=4$ and since $x\geq 0$ as we are in the first octant, we must have;
$$0\leq x\leq\sqrt{4-y^{2}}$$
Similarly, $0\leq y\leq\sqrt{4-z^{2}}$. For $z$ we know we are in the first octant and from $z^{2}+y^{2}=4$ we know that $z\leq 2$, so our final inequality is $0\leq z\leq 2$.
We now have our volume $V$ described in terms of three inequalities in cartesian coordinates, so our integral becomes;
$$Q=\int_{0}^{2}\int_{0}^{\sqrt{4-z^{2}}}\int_{0}^{\sqrt{4-y^{2}}}xdxdydz$$
The first two integrals are pretty easy;
$$ Q = \int_{0}^{2}\int_{0}^{\sqrt{4-z^{2}}}\int_{0}^{\sqrt{4-y^{2}}}xdxdydz = \frac{1}{2}\int_{0}^{2}\left(4\sqrt{4-z^{2}}-\frac{1}{3}(4-z^{2})^{\frac{3}{2}}\right)dz $$
The last one can be solved with the triginometric substitution $x=2\sin(\theta)$ (let me know if you need help with this), and is pretty messy. It is doable however, and the final result comes out to $Q=\frac{3\pi}{2}$.