Problem 2.5: Find the electric field a distance $z$ above the center of a circular loop of radius $r$ which carries a uniform line charge $\lambda$.
This problem is in refereced here (with solution): http://teacher.pas.rochester.edu/PHY217/LectureNotes/Chapter2/LectureNotesChapter2.html
But it is solved using a trick. The trick is: okay we know there is symmetry so let us just take the magnitude and not use the vectors. The problem I have is I am unable to solve it without using the trick and I would appreciate someones help in doing the problem without the shortcut, using the vectors. When I do it the r compontent doesn't cancel.
Using polar coordinates here is the setup:
$$dE = \frac{1}{4 \pi \epsilon_0} \frac{\lambda}{\rho^2} ~ \hat{\rho} ~ r d \theta$$
$$\hat{\rho} = \frac{z \hat{k} + r \hat{r}}{\sqrt{z^2 + r^2}} $$
$$ E = \frac{\lambda}{4 \pi \epsilon_0} \int_0^{2 \pi} \frac{r z \hat{z} + r^2 \hat{r} }{(z^2 + r^2)^{3/2}} ~ d \theta$$
$$ E = \frac{\lambda}{4 \pi \epsilon_0} \int_0^{2 \pi} \frac{r z \hat{z} }{(z^2 + r^2)^{3/2}} ~ d \theta + \frac{\lambda}{4 \pi \epsilon_0} \int_0^{2 \pi} \frac{r^2 \hat{r} }{(z^2 + r^2)^{3/2}} ~ d \theta $$
If I now evaluate the $z$ component I get the correct answer. When I evaluate the $r$ component, shown below the $r$ doesn't not cancel the way it should. why not?
$$\frac{\lambda}{4 \pi \epsilon_0} \frac{r^2 2 \pi }{(z^2 + r^2)^{3/2}} - \frac{\lambda}{4 \pi \epsilon_0} \frac{r^2 0 }{(z^2 + r^2)^{3/2}} $$
$$ = \frac{\lambda}{4 \pi \epsilon_0} \frac{r^2 2 \pi }{(z^2 + r^2)^{3/2}} \hat{r}$$