# Deriving the Laplacian in spherical coordinates by concatenation of divergence and gradient.

In earlier exercises, I have derived the formula of divergence in spherical coordinates as $$\textrm{div }\vec{v}= \frac{1}{r^2}\frac{\partial (r^2 v_r)}{\partial r}+\frac{1}{r \sin \vartheta}(\frac{\partial(v_{\vartheta}\sin \vartheta)}{\partial \vartheta}+\frac{\partial v_{\varphi}}{\partial \varphi})$$ with a vector field $$\vec{v}(\vec{r})=v_rê_r+v_{\varphi}ê_{\varphi}+v_{\vartheta}ê_{\varphi}$$ as well as the formula for the gradient as $$\nabla=\frac{\partial}{\partial r}ê_r+\frac{1}{r}\frac{\partial}{\partial \varphi}ê_{\varphi}+\frac{1}{r \sin{\varphi}}\frac{\partial}{\partial \vartheta}ê_{\vartheta}$$.

Now I am asked to concatenate the gradient with the divergence to arrive at the formula for the Laplacian of a scalar-field $$f(r,\varphi,\vartheta)$$, which is defined as the divergence of the gradient, but I am slightly confused. Looking at the solution, I get: $$\Delta = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2 \frac{\partial f}{\partial r})+\frac{1}{r^2 \sin \vartheta}(\frac{\partial}{\partial \vartheta}(\sin \vartheta \frac{\partial f}{\partial \vartheta})+\frac{\partial^2 f}{\partial \varphi^2})$$. I can see that it follows the definition, somehow, but why do we put the factors from the gradient before the partial derivatives of the divergence and the partial derivatives from the gradient after the partial derivatives from the divergence?

For the scalar Laplacian, you take the gradient first, then the divergence. Given a scalar field $$U$$, $$\nabla U=\left(\frac{\partial U}{\partial r},\frac{1}{r\sin\phi}\frac{\partial U}{\partial \theta},\frac{1}{r}\frac{\partial U}{\partial \phi}\right)$$ The formula for the divergence is $$\nabla \boldsymbol{\cdot}\mathbf{F}=\frac{1}{r^2\sin(\phi)}\left(\frac{\partial(r^2\sin(\phi)F_r)}{\partial r}+\frac{\partial(rF_\theta)}{\partial \theta}+\frac{\partial(r\sin(\phi)F_\phi)}{\partial \phi}\right)$$ Plugging in, $$\nabla^2U=\nabla\boldsymbol{\cdot}\nabla U=\frac{1}{r^2\sin(\phi)}\left(\frac{\partial(r^2\sin(\phi)\frac{\partial U}{\partial r})}{\partial r}+\frac{\partial(r\frac{1}{r\sin\phi}\frac{\partial U}{\partial \theta})}{\partial \theta}+\frac{\partial(r\sin(\phi)\frac{1}{r}\frac{\partial U}{\partial \phi})}{\partial \phi}\right)$$ Which we can clean up as $$\nabla^2 U=\frac{1}{r^2\sin\phi}\left(\sin\phi\frac{\partial}{\partial r}\left(r^2\frac{\partial U}{\partial r}\right)+\frac{1}{\sin\phi}\frac{\partial}{\partial \theta}\left(\frac{\partial U}{\partial \theta}\right)+\frac{\partial}{\partial \phi}\left(\sin\phi\frac{\partial U}{\partial \phi}\right)\right)$$ Which finally reduces to $$\nabla^2 U=\frac{1}{r^2}\frac{\partial}{\partial r}\left(r^2\frac{\partial U}{\partial r}\right)+\frac{1}{r^2\sin^2(\phi)}\frac{\partial^2 U}{\partial \theta^2}+\frac{1}{r^2\sin(\phi)}\frac{\partial}{\partial \phi}\left(\sin(\phi)\frac{\partial U}{\partial \phi}\right).$$