**Positive electric charge Q is distributed uniformly along a line (you could imagine it as a very thin rod) with length 2a, lying along the y-axis between y = -a and y = +a. A point p lies at x along x-axis. Find the electric potential at point P.**

Linear charge density:

$$\lambda = \frac{Q}{2a}$$

Small element of charge:

$$dQ = \lambda \, dy$$

dV in terms of linear charge density:

$$\begin{aligned} dV &= \frac{dQ}{4 \pi \epsilon_{0} r} \\ &= \frac{\lambda \, dy}{4 \pi \epsilon_{0} \sqrt{x^{2} + y^{2}}} \end{aligned}$$

Integrate from -a to a by using the integral in integration table, specifically $\int \frac{dx}{\sqrt{a^{2} +x^{2}}} = \text{ln} \, \left(x + \sqrt{a^{2} + x^{2}} \right)$,

$$\begin{aligned} V &= \frac{\lambda}{4 \pi \epsilon_{0}} \int\limits_{-a}^{a} \frac{dy}{\sqrt{x^{2}+y^{2}}} \\ &= \frac{\lambda}{4 \pi \epsilon_{0}} \text{ln} \left( \frac{\sqrt{a^{2}+x^{2}}+a}{\sqrt{a^{2} + x^{2}} – a} \right) \end{aligned}$$

We can check the expression for V with the expression for electric field derived in Electric Field Of A Line Of Charge.

$$\begin{aligned} E &= \, – \frac{\partial V}{\partial x} \\ &= \frac{Q}{4 \pi \epsilon_{0} \sqrt{x^{2} + a^{2}}} \end{aligned}$$

Next: Electric Potential Of An Infinite Line Charge

Isn’t electric potential equal to negative integral of Edr? Not positive?