I'm trying to find the electric field from the potential and vise-versa but I'm having trouble
I know the electric field of a ring with radius a and charge Q to be $$E=\frac{Qx}{4\pi \varepsilon_{0}(x^{2}+a^{2})^{3/2} }$$
and the potential to be $$V=\frac{Q}{4\pi\varepsilon_{0}\sqrt{x^{2}+a^{2}}}$$
How can I reach the equation for potential from the electric field given that $$V=\int E\cdot dl=\int E\cos \phi dl$$
$$\cos \phi =\frac{x}{\sqrt{x^{2}+a^{2}}}$$
It seems that just solving the integral would yield the answer but somehow it is giving me completely different answer
Edit
This is the work done by me, although I am not entirely sure if this is the way to do it-
$$V=\int \frac{Qx}{4\pi \varepsilon_{0}(x^{2}+a^{2})^{3/2} }\cdot dx$$ $$=\frac{Q}{4\pi \varepsilon_{0}}\int \frac{x}{(x^{2}+a^{2})^{3/2}}dx$$ $$=-\frac{Q}{4\pi\varepsilon_{0}\sqrt{x^{2}+a^{2}}}$$
I have no idea what to do with the negative sign.