Uniformly charged rod electric field A uniformly charged rod of length $L$ and total charge $Q$ lies along the $x$ axis as shown in in the figure. (Use the following as necessary: $Q$, $L$, $d$, and $k_e$.)
(a) Find the components of the electric field at the point $P$ on the $y$ axis a distance $d$ from the origin. $E_x=\,?$, $E_y=\,?$ 
I think I am getting close to a solution (maybe) but I keep getting turned around and confused. This is what I have so far. So, I know that I need $\lambda=Q/L$ and $r=\sqrt{d^2+L^2}$. My first thought was that the formula I need is $$E=\int_0^L \dfrac{\lambda \,k_e}{x^2}dx$$  but then it becomes a problem when I integrate and have to evaluate $\dfrac{-\lambda k_e}{x}$ at $x=0$. So then I tried to integrate the $x$ and $y$ components separately with respect to $\theta$. I found the following formulas at this site on the second slide. 
$$E_x=\frac{-k_e\lambda}{L}(\sin\theta_2-\sin\theta_1)$$
$$E_y=\frac{-k_e\lambda}{L}(\cos\theta_2-\cos\theta_1)$$ 
Where, for this problem, $\theta_1=0$ and $\theta_2$ is the angle when x=L, so that $\tan^{-1}(\frac{d}{L})$, and this is where I really got lost. Are those formulas right for this problem? I had a thought to use the inverse sin and cos instead of the tan for $\theta_2$ but that made the formulas really messy. This is an online submission, so I'm guessing it should reduce to something nice, but I can't get to it.
 A: Often the easiest way to do such problems is using potential rather than the electric field.  And always, it is best to use the appropriate coordinates.  In this case, cylindrical coordinates with the rod at $\rho=0$ and extending from $z=-L/2$ to $z=+L/2$ are natural.
So what you do is say that for an element of rod with a tiny length $d\ell$ and charge $\frac{Q}{L}d\ell$ located at $0,z,\theta$ (where $\theta$ is actually moot since $\rho = 0$), the potential at any other point $(r,\zeta, \theta)$ os
 $$\frac{Q}{L\sqrt{r^2 + (z-\zeta)^2}}d\ell$$.
Then the potential due to the whole rod is 
$$ V(r,\zeta, \theta) =\int_{z=-L/2}^{+L/2} \frac{Q}{L\sqrt{r^2 + (z-\zeta)^2}}d\ell$$
Then you do the integral, and when you get $V(r,\zeta, \theta)$ you take its gradient, because the negative of the gradient will be the electric field. 
CAREFUL:  The gradient operator in cylindrical coordinates is not quite just $(\frac{\partial}{\partial \rho},\frac{\partial}{\partial z},\frac{\partial}{\partial \theta})$.  Learn what it is, then apply it to your $V$.  And don't foregt to convert the field back to get $(E_x, E_y, E_z$ if your problem asks for those.
To learn about cylindrical coordinates, wikipedia is your friend
A: First I have to ask: does the question mention anything about the distance d? The reason why I am asking is because if d is large enough, we can say that it is in the far-field and we can easily approximate the field values using electrostatic theory treating the rod as point charge Q. I will provide an edit later if you want to use a far-field approximation. 
