Laplacian of spherical coordinates
Solution 1:
EDIT: The below is only valid if the coordinates are orthogonal and not in the general case, where the metric tensor must be used.
This is because spherical coordinates are curvilinear coordinates, i.e, the unit vectors are not constant.
The Laplacian can be formulated very neatly in terms of the metric tensor, but since I am only a second year undergraduate I know next to nothing about tensors, so I will present the Laplacian in terms that I (and hopefully you) can understand. First, let's set up a general system of curvilinear coordinates in $\mathbb{R}^n$ and then we'll discuss a few things about them, including the Laplacian. Later we'll give this in the special case of spherical coordinates.
Ok, so suppose we have some curvilinear coordinates $(\xi_1,...,\xi_n)$ with scale factors $h_1,...,h_n$. If you're unfamiliar with the concept of scale factors, they are defined as $$h_i=\left\Vert \frac{\partial \mathbf{r}}{\partial \xi_i}\right\Vert$$ Here $\mathbf{r}$ is the position vector. In the standard basis, $\mathbf{r}=\sum_{i=1}^{n}x_i\widehat{\mathbf{e}_i}$, but in curvilinear coordinates it might be any general linear combination of their corresponding unit vectors $\widehat{\mathbf{q}_1},...,\widehat{\mathbf{q}_n}$, like $$\mathbf{r} =\sum ^{n}_{k=1} f_{k}( \xi _{1} ,...,\xi _{n})\widehat{\mathbf{q}_k}$$
The gradient operator in curvilinear coordinates is $$\nabla=\left(\frac{1}{h_1}\frac{\partial}{\partial \xi_1},...,\frac{1}{h_n}\frac{\partial}{\partial \xi_n}\right)$$ I can explain this if you wish, but it's not terribly difficult to derive.
The divergence operator however, is much more difficult. To find the general form for the divergence of a vector field, $\nabla \boldsymbol{\cdot} \mathbf{F}$, in curvinilinear coordinates, we can apply Gauss's divergence theorem and study the integral $$\lim_{\Delta V\to0}\frac{1}{\Delta V} \oint \mathbf{F}\boldsymbol{\cdot}\mathbf{n}\mathrm{d}S$$ Where $\Delta V$ is the volume of a volume element around some point with coordinates $(\xi_1,...,\xi_n)$, $\mathrm{d}S$ is a surface element, and $\mathbf{n}$ is a unit normal vector to this surface. This integral is discussed well in the special case of 3 dimensions here, but I'll cut to the chase and assert that in $n$ dimensions, $$\nabla \boldsymbol{\cdot}\mathbf{F}=\left(\prod_{i=1}^{n}\frac{1}{h_i}\right)\sum_{i=1}^{n}\frac{\partial}{\partial \xi_i}\left(\left(\prod_{j=1 \ ; \ j\neq i}^{n}h_j\right)F_i\right)$$
Here $F_i$ is the $\xi_i$ component of $\mathbf{F}$. Recalling that $\nabla^2\Phi=\nabla \boldsymbol{\cdot}(\nabla \Phi)$, we can combine our expressions for the gradient and divergence to find that $$\nabla^2=\left(\prod_{i=1}^{n}\frac{1}{h_i}\right)\sum_{i=1}^{n}\frac{\partial}{\partial \xi_i}\left(\frac{1}{h_i}\left(\prod_{j=1 \ ; \ j\neq i}^{n}h_j\right)\frac{\partial}{\partial \xi_i}\right)$$ Note that this is consistent with the definition of the Laplacian in the standard basis, since for the standard basis $x_1,...,x_n$ the scale factors $h_1,...,h_n$ are all $=1$. Let's do the case of spherical coordinates. I'll use the $(r,\theta,\phi)$ convention where $x=r\cos(\theta)\sin(\phi)$, etc. We know that our scale factors are $h_r=1$, $h_\theta=r\sin(\phi)$, and $h_\phi=r$. Thus our gradient operator is $$\nabla=\left(\frac{\partial}{\partial r},\frac{1}{r\sin(\phi)}\frac{\partial}{\partial \theta},\frac{1}{r}\frac{\partial}{\partial \phi}\right)$$ The divergence of a vector field $\mathbf{F}(r,\theta,\phi)=F_r\hat{\mathbf{r}}+F_\theta\hat{\boldsymbol{\theta}}+F_\phi\hat{\boldsymbol{\phi}}$ 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)$$
And finally the Laplacian operator is $$\nabla^2=\frac{1}{r^2\sin(\phi)}\left(\frac{\partial}{\partial r}\left(r^2\sin(\phi)\frac{\partial}{\partial r}\right)+\frac{\partial}{\partial \theta}\left(\frac{1}{\sin(\phi)}\frac{\partial}{\partial \theta}\right)+\frac{\partial}{\partial \phi}\left(\sin(\phi)\frac{\partial}{\partial \phi}\right)\right)$$ Thus $$\nabla^2=\frac{1}{r^2}\frac{\partial}{\partial r}\left(r^2\frac{\partial}{\partial r}\right)+\frac{1}{r^2\sin^2(\phi)}\frac{\partial^2}{\partial \theta^2}+\frac{1}{r^2\sin(\phi)}\frac{\partial}{\partial \phi}\left(\sin(\phi)\frac{\partial}{\partial \phi}\right).$$
EDIT #2:
COMPUTING THE SCALE FACTORS IN SPHERICAL COORDINATES.
In the general orthogonal curvilinear coordinate system mentioned above, the unit vectors are $$\widehat{\mathbf{q}_i}=\frac{1}{h_i}\frac{\partial \mathbf{r}}{\partial \xi_i}$$ Let's do the case of spherical coordinates. I'll take it as given that the coordinate conversions between Cartesian and spherical coordinates are $$\mathbf{r}=x\hat{\mathbf{i}}+y\hat{\mathbf{j}}+z\hat{\mathbf{k}}=\begin{bmatrix} x\\ y\\ z \end{bmatrix} =\begin{bmatrix} r\cos \theta \sin \phi \\ r\sin \theta \sin \phi \\ r\cos \phi \end{bmatrix}$$ Therefore, $$\frac{\partial\mathbf{r}}{\partial r}=\begin{bmatrix} \cos \theta \sin \phi \\ \sin \theta \sin \phi \\ \cos \phi \end{bmatrix}$$ And, $$h_r=\sqrt{(\cos\theta\sin\phi)^2+(\sin\theta\sin\phi)^2+(\cos\phi)^2}$$ $$=\sqrt{\sin^2\phi(\cos^2\theta+\sin^2\theta)+\cos^2\phi}$$ $$=\sqrt{\sin^2\phi+\cos^2\phi}=1.$$ Therefore we assert that $$\hat{\mathbf{r}}=\cos\theta\sin\phi\hat{\mathbf{i}}+\sin\theta\sin\phi\hat{\mathbf{j}}+\cos\phi\hat{\mathbf{k}}$$
Now for $\hat{\boldsymbol{\theta}}$. $$\frac{\partial\mathbf{r}}{\partial\theta}=r\frac{\partial}{\partial\theta}(\cos\theta\sin\phi\hat{\mathbf{i}}+\sin\theta\sin\phi\hat{\mathbf{j}}+\cos\phi\hat{\mathbf{k}})$$ $$=r(-\sin\theta\sin\phi\hat{\mathbf{i}}+\cos\theta\sin\phi\hat{\mathbf{j}})$$ And $$h_\theta=r\sqrt{(\sin\theta\sin\phi)^2+(\cos\theta\sin\phi)^2}=r\sin\phi\sqrt{(\sin\theta)^2+(\cos\theta)^2}=r\sin\phi$$ Therefore $$\hat{\boldsymbol{\theta}}=\frac{r(-\sin\theta\sin\phi\hat{\mathbf{i}}+\cos\theta\sin\phi\hat{\mathbf{j}})}{r\sin\phi}=-\sin\theta\hat{\mathbf{i}}+\cos\theta\hat{\mathbf{j}}$$
Finally we turn to $\hat{\boldsymbol{\phi}}$. $$\frac{\partial\mathbf{r}}{\partial\phi}=r\frac{\partial}{\partial\phi}(\cos\theta\sin\phi\hat{\mathbf{i}}+\sin\theta\sin\phi\hat{\mathbf{j}}+\cos\phi\hat{\mathbf{k}})$$ $$=r(\cos\theta\cos\phi\hat{\mathbf{i}}+\sin\theta\cos\phi\hat{\mathbf{j}}-\sin\phi\hat{\mathbf{k}})$$ And $$h_\phi=r\sqrt{(\cos\theta\cos\phi)^2+(\sin\theta\cos\phi)^2+(\sin\phi)^2}$$ $$=r\sqrt{\cos^2\phi(\cos^2\theta+\sin^2\theta)+\sin^2\phi}$$ $$=r\sqrt{\cos^2\phi+\sin^2\phi}=r.$$ Therefore $$\hat{\boldsymbol{\phi}}=\cos\theta\cos\phi\hat{\mathbf{i}}+\sin\theta\cos\phi\hat{\mathbf{j}}-\sin\phi\hat{\mathbf{k}}$$ We can express our unit vector conversions in a matrix: $$\begin{bmatrix} \hat{\mathbf{r}}\\ \hat{\boldsymbol{\theta }}\\ \hat{\boldsymbol{\phi }} \end{bmatrix} =\begin{bmatrix} \cos \theta \sin \phi & \sin \theta \sin \phi & \cos \phi \\ -\sin \theta & \cos \theta & 0\\ \cos \theta \cos \phi & \sin \theta \cos \phi & -\sin \phi \end{bmatrix}\begin{bmatrix} \hat{\mathbf{i}}\\ \hat{\mathbf{j}}\\ \hat{\mathbf{k}} \end{bmatrix}$$ Hope this helped!
Solution 2:
As part of my attempt to learn quantum mechanics, I recently went through the computations to convert the Laplacian to spherical coordinates and was lucky to find a slick method in C.H. Edwards' Advanced Calculus of Several Variables, outlined in Exercise 3.10. It cleverly uses the cylindrical transformation twice and is much simpler than some of the monstrous derivations I've seen online that require computing multiple tedious derivatives. Here's the problem statement:
Given a function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ with continuous second partial derivatives, define $$F(\rho,\theta,\phi)=f(\rho\cos\theta\sin\phi, \rho\sin\theta\sin\phi, \rho\cos\phi)$$ where $\rho,\theta,\phi$ are the usual spherical coordinates. We want to express the 3-dimensional Laplacian $$\nabla^2 f=\frac{\partial^2 f}{\partial x^2}+\frac{\partial^2 f}{\partial y^2}+\frac{\partial^2 f}{\partial z^2}$$ in spherical coordinates, that is, in terms of partial derivatives of $F$.
(a) First define $g(r,\theta, z)=f(r\cos\theta,r\sin\theta, z)$ and conclude from Exercise 3.9 that $$\nabla^2 f=\frac{\partial^2 g}{\partial r^2}+\frac{1}{r^2}\frac{\partial^2 g}{\partial \theta^2}+\frac{1}{r}\frac{\partial g}{\partial r}+\frac{\partial^2 g}{\partial z^2}$$
(b) Now define $F(\rho,\theta,\phi)=g(\rho\sin\phi,\theta,\rho\cos\phi)$. Noting that, except for a change in notation, this is the same transformation as before, deduce that $$\nabla^2 f=\frac{\partial^2 F}{\partial \rho^2}+\frac{2}{\rho}\frac{\partial F}{\partial\rho}+\frac{1}{\rho^2}\frac{\partial^2 F}{\partial \phi^2}+\frac{\cos\phi}{\rho^2\sin\phi}\frac{\partial F}{\partial\phi}+\frac{1}{\rho^2\sin^2\phi}\frac{\partial^2 F}{\partial \theta^2}$$
And my solution:
(a)
This is where most of the hard work is done. Let $T:\mathbb{R}^3\rightarrow\mathbb{R}^3$ be the ``cylindrical coordinate mapping'' defined by $T(r,\theta, z)=(r\cos\theta,r\sin\theta, z)$, so that $g=f\circ T$. The chain rule gives $$\frac{\partial g}{\partial r}=\frac{\partial f}{\partial x}\cos\theta+\frac{\partial f}{\partial y}\sin\theta \quad\qquad \frac{\partial g}{\partial \theta}=-\frac{\partial f}{\partial x}r\sin\theta+\frac{\partial f}{\partial y}r\cos\theta \quad\qquad \frac{\partial g}{\partial z}=\frac{\partial f}{\partial z}$$ Next we find $\partial ^2g/\partial r^2$, $\partial ^2g/\partial \theta^2$, and $\partial ^2g/\partial z^2$. For the first one we get
$$\frac{\partial}{\partial r}\left(\frac{\partial g}{\partial r}\right)=\frac{\partial}{\partial r}\left(\frac{\partial f}{\partial x}\right)\cos\theta+\frac{\partial}{\partial r}\left(\frac{\partial f}{\partial y}\right)\sin\theta\tag{*}\label{intermediate}$$
Now, to deal with those partials of $f$, remember that they're being evaluated at $T(r,\theta,z)$, so they're more precisely written as $\partial f/\partial x\circ T$, and so forth, and we want to take derivatives of these. But we've essentially already done that when we found derivatives of $f\circ T$. The only difference is that now $\partial f/\partial x$ or $\partial f/\partial y$ play the role that $f$ did before. At any rate, the chain rule again gives
$$\frac{\partial}{\partial r}\left(\frac{\partial f}{\partial x}\right)=\frac{\partial^2f}{\partial x^2}\cos\theta+\frac{\partial^2f}{\partial x\partial y}\sin\theta\qquad\qquad \frac{\partial}{\partial r}\left(\frac{\partial f}{\partial y}\right)=\frac{\partial^2f}{\partial x\partial y}\cos\theta+\frac{\partial^2f}{\partial y^2}\sin\theta$$
Plugging these into eq.\eqref{intermediate} yields $$\frac{\partial^2 g}{\partial r^2}=\frac{\partial^2f}{\partial x^2}\cos^2\theta+\frac{\partial^2f}{\partial y^2}\sin^2\theta+2\frac{\partial^2f}{\partial x\partial y}\cos\theta\sin\theta \tag{1}\label{eq: rsq}$$ Finding $\partial ^2g/\partial \theta^2$ is a bit more involved because we need the product rule, but the process is the same:
$$\frac{\partial}{\partial \theta}\left(\frac{\partial g}{\partial\theta}\right)=-\frac{\partial}{\partial\theta}\left(\frac{\partial f}{\partial x}\right)r\sin\theta-\frac{\partial f}{\partial x}r\cos\theta+\frac{\partial}{\partial\theta}\left(\frac{\partial f}{\partial y}\right)r\cos\theta-\frac{\partial f}{\partial y}r\sin\theta$$
And once again by the chain rule $$\frac{\partial}{\partial\theta}\left(\frac{\partial f}{\partial x}\right)=-\frac{\partial ^2f}{\partial x^2}r\sin\theta+\frac{\partial^2f}{\partial x\partial y}r\cos\theta\qquad\qquad \frac{\partial}{\partial\theta}\left(\frac{\partial f}{\partial y}\right)=-\frac{\partial^2f}{\partial x\partial y}r\sin\theta+\frac{\partial ^2f}{\partial y^2}r\cos\theta$$ Plugging in gives $$\frac{\partial ^2g}{\partial \theta^2}=\frac{\partial ^2f}{\partial x^2}r^2\sin^2\theta+\frac{\partial ^2f}{\partial y^2}r^2\cos^2\theta-2\frac{\partial ^2f}{\partial x\partial y}r^2\cos\theta\sin\theta-\frac{\partial f}{\partial x}r\cos\theta-\frac{\partial f}{\partial y}r\sin\theta\tag{2}\label{eq: thetasq}$$ Lastly, the easiest of all: $$\partial ^2g/\partial z^2=\partial ^2f/\partial z^2$$
The presence of $\cos^2\theta$ and $\sin^2\theta$ in eq.\eqref{eq: rsq} and eq.\eqref{eq: thetasq} strongly suggests that we combine them in a fairly obvious way, and the terms left hanging around after this are easily accounted for. The result is indeed that $$\frac{\partial ^2g}{\partial r^2}+\frac{1}{r^2}\frac{\partial ^2g}{\partial \theta^2}+\frac{1}{r}\frac{\partial g}{\partial r}+\frac{\partial ^2g}{\partial z^2}=\frac{\partial ^2f}{\partial x^2}+\frac{\partial ^2f}{\partial y^2}+\frac{\partial ^2f}{\partial z^2}$$ and we're done.
(b)
This is basically repeating part (a) with a trivially modified second cylindrical transformation that gives us the desired relationship between $F$ and $f$: $$F(\rho,\theta,\phi)=g(\rho\sin\phi,\theta,\rho\cos\phi)=f(\rho\sin\phi\cos\theta,\rho\sin\phi\sin\theta,\rho\cos\phi)$$ Define $$T_1(\rho,\theta,\phi)=(\rho\sin\phi,\theta,\rho\cos\phi)$$ so $F=g\circ T_1$.
The chain rule gives $$\frac{\partial F}{\partial \rho}=\frac{\partial g}{\partial r}\sin\phi+\frac{\partial g}{\partial z}\cos\phi \quad\qquad \frac{\partial F}{\partial\theta}=\frac{\partial g}{\partial\theta} \quad\qquad \frac{\partial F}{\partial\phi}=\frac{\partial g}{\partial r}\rho\cos\phi-\frac{\partial g}{\partial z}\rho\sin\phi$$
Before proceeding, notice that the two outer equations can be solved for $\partial g/\partial r$ in terms of partials of $F$, a fact we'll use later. From here the process is exactly the same as part (a), and we easily see that $$\frac{\partial ^2F}{\partial \rho^2}+\frac{1}{\rho^2}\frac{\partial ^2F}{\partial \phi^2}+\frac{1}{\rho}\frac{\partial F}{\partial \rho}+\frac{\partial ^2F}{\partial \theta^2}=\frac{\partial ^2g}{\partial r^2}+\frac{\partial ^2g}{\partial \theta^2}+\frac{\partial ^2g}{\partial z^2}\tag{3}\label{Fg}$$
But this isn't what we want. We need to relate the partials of $F$ to those of $f$, and $g$ is just the intermediate step. The first step is easy: $\frac{\partial^2 g}{\partial z^2}=\frac{\partial^2 f}{\partial z^2}$. Next, we would like $\frac{1}{r^2}\frac{\partial^2 g}{\partial \theta^2}$ instead of just $\frac{\partial^2 g}{\partial \theta^2}$ on the right side of eq.\eqref{Fg}. But since $\frac{\partial^2 F}{\partial \theta^2}=\frac{\partial^2 g}{\partial \theta^2}$, we can retain the equality by changing to $\frac{1}{r^2}\frac{\partial^2 g}{\partial \theta^2}$ on the right, provided we change to $\frac{1}{\rho^2\sin^2\phi}\frac{\partial^2 F}{\partial\theta^2}$ on the left (since $r=\rho\sin\phi$). Now if we could just get $\frac{1}{r}\frac{\partial g}{\partial r}$ on the right side, we'd be able to use the result from part (a) to express the partials of $F$ in terms of those of $f$. So we just add one there, and of course balance out the equation by adding $\frac{1}{\rho\sin\phi}\frac{\partial g}{\partial r}$ on the left side. So close! We want the left side to be all in terms of $F$, and we've just added the annoying $\partial g/\partial r$ there. By what we said above though, we can replace this with an expression involving only the function $F$. Omitting the routine details, and combining everything we've said so far, we do finally end up with $$\nabla^2 f=\frac{\partial^2 F}{\partial \rho^2}+\frac{2}{\rho}\frac{\partial F}{\partial\rho}+\frac{1}{\rho^2}\frac{\partial^2 F}{\partial \phi^2}+\frac{\cos\phi}{\rho^2\sin\phi}\frac{\partial F}{\partial\phi}+\frac{1}{\rho^2\sin^2\phi}\frac{\partial^2 F}{\partial \theta^2}$$ as claimed.