Dipole Moment of a Ring Consider a ring with radius $R$ and charge density $\lambda=\lambda_0\cos\phi$, where $\phi$ is the angular coordinate in the cylindrical coordinate. If I want to find the dipole moment of this charge distribution, then I put it into
$$\vec{p}=\int{\mathrm d^3r~\rho(\vec{r})\vec{r}},$$ where I tried 
$$\rho(\vec{r})=\lambda_0 \cos\phi \times \delta(s-R) \delta(z)$$
and
$$\vec{r}=s\hat{s}+z\hat{z}$$
So, the dipole then becomes:
$$\vec{p}=\int_{-\infty}^{\infty}\int_{0}^{2\pi}\int_{0}^{\infty}[\lambda_0 \cos\phi \times \delta(s-R) \delta(z)](s\hat{s}+z\hat{z})s~\mathrm ds~\mathrm d\phi ~\mathrm dz$$
The delta function kills the $z$ component and leave the  $s$ component, so:
$$\vec{p}=\int_{-\infty}^{\infty}\int_{0}^{2\pi}\int_{0}^{\infty}\lambda_0 \cos\phi \times \delta(s-R) \delta(z)s^2~\mathrm ds~\mathrm d\phi ~\mathrm dz\hat{s}=\lambda_0R^2\int_{0}^{2\pi}\cos\phi~\mathrm d\phi~\hat{s}=\vec{0}$$
The answer is 
$$\vec{p}=\frac{1}{2}\lambda_0R^2\hat{x}$$
What's wrong with my solution?
Actually this is problem 4.1 from Zangwill's Modern Electrodynamics. I read it's solution, but don't get why it works under Cartesian coordinates but not under cylindrical coordinate.
 A: The previous answer is just a repeat of whats in the solution manual and the p provided in this is incorrect.  I am taking a class for grins and was assigned this problem and beat myself up trying to get the stated answer.  I finally did it in both spherical and cylindrical coordinates and got the same answer in both.  I emailed prof and he confirmed the answer in the book is incorrect.  The actual answer is $\pi \lambda_0R^2\hat{x}$
note that the $\phi$ integration is $\int_0^{2\pi}cos^2 \phi = \pi$
the $\theta$ integral is $\int_0^{\pi} sin(\theta)\delta(\theta - \frac{\pi}{2})d\theta = sin(\frac{\pi}{2}) = 1$
the $r$ integral is $\int_0^{\infty} r^2\delta(r-R) = R^2$
so the answer is $\pi\lambda_0R^2\hat{x}$
A: For a linear charge density around a ring, $\lambda=\lambda(\phi)$. The volume charge density would be:
$$\rho(r)=\lambda(\phi)\frac{\delta\left(\theta-\frac{\pi}{2}\right)}{\sin(\theta)}\frac{\delta(r-R)}{r}$$
Now the dipole moment would be:
$$p=\int_{0}^{2\pi}~\mathrm d\phi\int_{0}^{\pi}~\sin(\theta)~\mathrm d\theta \int_{0}^{\infty}~\mathrm dr~r^{2}\lambda\frac{\delta\left(\theta-\frac{\pi}{2}\right)}{\sin(\theta)}\frac{\delta(r-R)}{r}=2\pi R\lambda=Q$$
Since $\hat{r}=\hat{z}\cos\theta +\hat{y}\sin\theta \sin\phi +\hat{x}\sin\theta \cos\phi$, the dipole moment would be:
$$\int ~\mathrm d^{3}r~\rho(r)
=\int_{0}^{2\pi}~\mathrm d\phi\int_{0}^{\pi}~\sin(\theta)~\mathrm d\theta \int_{0}^{\infty}~\mathrm dr~r^{2}~[\hat{z}\cos\theta +\hat{y}\sin\theta \sin\phi +\hat{x}\sin\theta \cos\phi]~\lambda_{0}\cos\phi\frac{\delta\left(\theta-\frac{\pi}{2}\right)}{\sin(\theta)}\frac{\delta(r-R)}{r}$$
The $\hat{x}$ integral is non zero and would result in $$\boxed{p=\frac{1}{2}\lambda_{0}R^{2}\hat{x}}$$
