# Converting $\vec{E} = - \nabla \phi$ into spherical coordinates

Let's say I have an electric field $$\vec{E} = (0, 0, E_z)$$, where $$E_z$$ in constant. Then the electric potential is $$\phi = - \vec{E} \cdot \vec{r}$$, where $$\vec{r} = (x, y, z)$$.

Calculating $$\vec{E} = - \nabla {\phi}$$ in cartesian coordinates is ok, we get the $$\vec{E}$$ we started with.

But I have a problem with transforming this whole thing into spherical coordinates. Then the electric field is $$\vec{E} = (E_z \cos{\theta}, -E_z\sin{\theta}, E_z)$$ and $$\nabla \phi = (\frac{\partial \phi}{\partial r}, \frac{1}{r} \frac{\partial \phi}{\partial \theta}, \frac{1}{r \sin{\theta}} \frac{\partial \phi}{\partial \varphi})$$.

I am not really sure whether $$\vec{r}$$ should change to $$(r \sin{\theta}\cos{\theta}, r \sin{\theta}\sin{\varphi}, r\cos{\theta})$$ or $$(r, r\theta, r\sin{(\theta)}\varphi)$$ or something else. Either way, I can't get the original $$\vec{E}$$ from $$\vec{E} = - \nabla {\phi}$$. The result is wrong.

What am I doing wrong? I assume it's the $$\vec{r}$$ transformation but I am not sure.

$$\phi = - \vec{E} \cdot \vec{r}$$,

This equation is only true for a constant electric field. The correct relation between potential and field generally is :

$$- \nabla \phi = \vec{E}$$

The above is a differential equation which you can solve to obtain $$\phi$$.

$$\vec{E} =(E_z\cosθ,−E_z\sinθ,E_z)$$

The conversion for cartesian to polar basis is:

$$\hat{k} = \hat{e_r} \cos \theta - \hat{e_{\theta} } \sin \theta$$

Hence,

$$\vec{E} = E_z \vec{k} = E_z \cdot ( \hat{e_r} \cos \theta - \hat{e_{\theta} } \sin \theta)$$

Now,

$$\nabla \phi = (\frac{\partial \phi}{\partial r}, \frac{1}{r} \frac{\partial \phi}{\partial \theta}, \frac{1}{r \sin{\theta}} \frac{\partial \phi}{\partial \varphi})$$

Hence,

$$-(\frac{\partial \phi}{\partial r}, \frac{1}{r} \frac{\partial \phi}{\partial \theta}, \frac{1}{r \sin{\theta}} \frac{\partial \phi}{\partial \varphi})=(E_z \cos \theta, - E_z \sin \theta,0)$$

Now, all you have to do is find a potential which satisfies the above equation.

• $\phi = -\mathbf E \cdot \mathbf r$ is a valid choice of electrostatic potential if the electric field $\mathbf E$ is constant. Nov 1, 2020 at 15:47