# Understanding the integral for the electric dipole moment of a charge distribution

In problem 3.35 of Griffiths' Introduction to electrodynamics, he states:

A solid sphere, radius $R$, is centered at the origin. The “northern” hemisphere carries a uniform charge density $\rho_0$, and the “southern” hemisphere a uniform charge density $−\rho_0$. Find the approximate ﬁeld $E(r,θ)$ for points far from the sphere ($r \gg R$).

The dipole moment is by definition

$$\textbf{p}=\iiint \textbf{r}'\rho(\textbf{r}') \;\mathrm{dV}$$

But Griffiths uses $z=r'\cos \theta$ and says

$$\textbf{p}=\iiint \textbf{z}\rho(\textbf{r}') \;\mathrm{dV}$$

How does this work? Aren't you supposed to use $r'$ in the integral?

In my calculations I get

$$\textbf{p}= \iiint_\text{northern hemisphere} \textbf{r}'\rho_0 \;\mathrm{dV} -\iiint_\text{southern hemisphere} \textbf{r}'\rho_0\;\mathrm{dV}$$

which gives $$\textbf{p}=0$$

when evaluated, which is wrong. Where have I setup my integral wrong?

Remember that the dipole moment is a vector quantity! The definition of the electric dipole moment is: $$\mathbf p = \int_{\Bbb R^3}\mathbf x \rho(\mathbf x) d^3\mathbf x$$ Now plug in in $\mathbf x =\rho\ \hat\rho+z\hat k$ and use cylindrical coordinates. $$\mathbf p =\int_{\Bbb R^3} \rho \, \hat \rho \; \rho(\mathbf x) d^3\mathbf x + \hat k\int_{\Bbb R^3} z \rho(\mathbf x) d^3\mathbf x$$ Since the volume charge density is independent of $\phi$ (azimuthal symmetry), $\rho(\mathbf x) = \mathcal p(z,\rho)$, where $\mathcal p$ is some arbitrary function , and the first integral vanishes: $$\int_{\Bbb R^3} \rho \, \hat \rho \; \rho(\mathbf x) d^3\mathbf x =\int_{0}^{2\pi} d\phi(\cos\phi \hat i+\sin\phi \hat j) \int_z\int_\rho dz \ d\rho \ \rho \; \mathcal p(z,\rho) =0$$ Thus, only the integral on z remains, which is the one Griffiths is using: $$\mathbf p =\hat k\int_{\Bbb R^3} z \rho(\mathbf x) d^3\mathbf x=\hat k\int_0^{2 \pi}d\phi \ [ \ \rho_0\int_0^{\pi/2} \int_0^R dr d\theta\ r^2 \sin\theta \ (r \cos\theta) \ -\rho_0\int_{\pi/2}^{3\pi/2} \int_0^R dr d\theta\ r^2 \sin\theta \ (r \cos\theta) \ ]$$ This gives: $$\mathbf p = 2 \pi \rho_0\hat k \ (\frac 14 R^4)(\int_0^{\pi/2} [ \ (\frac12)\sin(2\theta)\ d\theta -\int_{\pi/2}^{3\pi/2} (\frac12)\sin(2\theta)\ d\theta \ ]$$ $$\mathbf p = 2 \pi \rho_0\hat k \ (\frac 14 R^4)(\frac12 - 0)$$ Finally: $$\mathbf p = \frac \pi 4 \rho_0 R^4\hat k$$