# Cartesian unit vectors in terms of spherical unit vectors

Here’s a way to express the Cartesian unit vectors $\hat x$, $\hat y$ and $\hat z$ in terms of $\hat r$, $\hat \phi$ and $\hat \theta$ where $\theta$ is the zenithal angle and $\phi$ is the azimuthal angle.

We have that $\begin{cases}x=r\cos\phi\sin\theta \\y=r\sin\phi\sin\theta\\z=r\cos\theta\end{cases}$.

Keeping in mind the definition of the gradient operator: $\nabla = (\frac{1}{h_r}\frac{\partial}{\partial r}\hat r + \frac{1}{h_\theta}\frac{\partial }{\partial \theta}\hat \theta+\frac{1}{h_\phi}\frac{\partial}{\partial \phi} \hat \phi)$ where $h_{e_i}=|\frac{\partial \vec r}{\partial e_i}|$, so that $\nabla =(\frac{\partial}{\partial r}\hat r+ \frac{1}{r}\frac{\partial }{\partial \theta} \hat \theta +\frac{1}{r\sin \theta}\frac{\partial}{\partial \phi}\hat \phi)$.

The Cartesian unit vectors are simply $\hat x = \nabla x =\cos\phi\sin \theta \hat r + \cos\phi\cos\theta\hat\theta-\sin\phi\hat\phi$,

$\hat y = \nabla y =\sin\phi\sin \theta \hat r + \sin\phi\cos\theta\hat\theta+\cos\phi\hat\phi$,

$\hat z = \nabla z =\cos \theta \hat r-\sin \theta \hat \theta$.