# Continuous version of Coulomb's law for infinite charge distributions

This might seem naive or have a trivial resolution, but I'm still searching for one and have been unable to find it.

Consider an infinitely long line charge with uniform line charge density $\lambda$. The electric field at any point in space is easily found using Gauss's law for a cylinder enclosing a portion of the line charge. The correct result is $$E_r=\frac{\lambda}{2\pi\epsilon_0 r}.$$ However, if you use the Coulomb law

$$\frac{1}{4\pi\epsilon_0} \int_{-\infty}^{\infty} \lambda \frac{dx}{x^2+r^2}$$

you get a different answer ($\frac{\lambda}{4\epsilon_0 r}$) for the electric field at a distance $r$ from the wire (which of course is purely radial, due to translational symmetry in the $x$ direction). Is there an explanation for this discrepancy?

$$\vec{E} = \frac{1}{4\pi\epsilon_0} \int_{-\infty}^\infty dx\,\frac{\lambda}{x^2 +r^2} \times \sin{\theta}\, \hat r,$$ where the factor of $\sin \theta$ is what picks out just the radial component, as required by symmetry. But since
$$\sin\theta = \frac{r}{\sqrt{x^2 + r^2}},$$
$$\frac{1}{4\pi\epsilon_0} \int_{-\infty}^\infty dx\,\frac{\lambda\, r}{(x^2 +r^2)^{3/2}} = \frac{1}{2\pi \epsilon_0} \frac{\lambda}{r}.$$