# How to convert electric field from spherical coordinates to cartesian?

I have 3 components, $r$, $\theta$ and $\phi$, for an electric field in spherical coordinates (and the $\phi$ component happens to be zero), let's say I just want to convert the $r$ component into cartesian, which looks like:

$$-\frac{0.058125 \cos\theta\sin^2\theta}{r^3}$$

How do I convert this into cartesian?

Edit: Sorry maybe I should have explained that this expression is one component of a vector, which I got using E= −∇V

• See this: en.wikipedia.org/wiki/Gradient – lucas Apr 19 '16 at 6:53
• don't forget about the unit vector - maybe you intend to transform that too. – anon01 Apr 19 '16 at 14:19

You said this is the $r$-component, then you've missed the $\hat{\bf r}$.

Use $$r=\sqrt{x^2+y^2+z^2}$$ $$\cos\theta=z/r=\frac{z}{\sqrt{x^2+y^2+z^2}}$$ $$\hat{\bf r}=\frac{x\hat{\bf x}+y\hat{\bf y}+z\hat{\bf z}}{r}$$

• what if I had a sin(phi) or cos(phi) in the expression? – user43783 Apr 19 '16 at 7:49
• Use $\tan\phi=y/x$. – velut luna Apr 19 '16 at 8:07

Assuming that $\theta$ is the polar angle (angle between $\vec r$ and $\hat z$) and $\phi$ the azimuthal angle then the following relationships can be used.

$x = r \;\sin \theta \;\cos \phi$
$y = r \;\sin \theta\;\sin \phi$
$z= r\; \cos \theta$

• these aren't very helpful as written - you need the inverted relations – anon01 Apr 19 '16 at 14:17