This is regarding setting up an integral to calculate the electric field on a point charge that is at a distance "a" from a uniformly charged rod of length "L". I have attached a picture of my work, which includes a diagram of the problem, and wanted to know if my thought process is correct.
The Attempt at a Solution
Finding a general expression for the electric field produced by an infinitely small "piece" of charge and then adding them all up. The charged rod is parallel to the y-axis and it's center is at the origin.
We know that the linear charge density is
For an infinitely small piece of charge, we say λ=(dQ/dL), so dQ=λ*dL
The formula for the Electric field on a point charge is E=q/((4∏ε)*r^2)
To find an expression for the Electric field produced by the small piece of charge, we can replace q with dQ
(substitue λ*dL for dQ)
dE=λ*dL / ((4∏ε)*r^2)
The part that I am unsure about is finding an expression for the "r". Would it be reasonable to say that "r = (a+y)", where y is the variable that I am integrating, and my limits of integration would be [(-L/2),(L/2)]? The reason I am saying (a+y) is because if I plug "-L/2" in for y, then (a-(L/2)) is the distance from the point charge "a" to the end of the rod that is above the origin. If I plug in "L/2" for y, then (a+(L/2)) takes care of the distance from the point charge "a" to the end of the rod below the origin. If I plug in 0 for y, then I simply get "a" which makes sense, since that is the distance from the origin to the point charge.
I hope my post was formatted correctly, please let me know if It is not, and I will be sure to make changes in the future