# Doubt in a derivation for electric potential at a point

My physcis teacher in school has given me this derivation for electric potential at a point. What bothered me the most was why the small work was negative but the large work positive.Could anyone please explain why this is so and wether this derivation is correct?

The cos 180 doesn’t seem right to me. Shouldn’t it be an external force against the electrostatic force which displaces the test charge through distance $$dx$$ which would thus make the angle cos 0

Also on integrating within those limits, shouldn’t $$dx$$ be negative?

Electric potential at a point is negative of the work done by electrostatic force on a unit charge to bring it to a point, $$r$$ away from a charge $$Q$$, from infinity. From this one can write the equation $$\phi = -\int^{r}_{\infty}{\mathbf{F.dr}}$$ $$\phi = - \int^{r}_{\infty}{\frac{KQ(1)}{r²}(\mathbf{-e_r.e_r})dr}$$ Where $$\mathbf{e_r}$$ is a unit vector along the radial direction. Solving the integral $$\phi = -KQ\bigg( \frac{1}{r} - \frac{1}{\infty} \bigg)$$ Hence we get the final result $$\phi = -\frac{KQ}{r}$$ The only point where people generally get confused is why is potential negative of the work done? The answer is that potential energy is defined as the ability to do work. It can do some amount of work. In this case if I let go of a unit charge at a distance $$r$$ from the fixed charge $$Q$$ then the work done by electrostatic force would of the magnitude of $$\phi$$. That is the reason it is taken to be negative of the work done. In many books the potential is also defined as potential energy per unit charge or $$\phi = \frac{dU}{dq}$$