A charge Q is distributed uniformly along a rod of lengths L. The electric field at a distance ‘d’ along its axis from its closer end will be
KQd2+dL
Alright! So the electric field due to a line of charge of length L at a point on its axis, at a distance r from the Centre of the rod is
E=KQr2−L2/4
If you don’t remember this then it’s okay! You don’t have to mug stuff up. I recommend you to watch try the derivation once and then watch the derivation video once again!
here the value of r is d + L2 (as r is the distance from the Centre). Substituting that in the aforementioned equation we get
E=KQd2+dL