Derivation (separation of variables on a 3D annulus)

In spherical polars $(r,\theta,\varphi)$, the Laplace equation is $$ \begin{align*} \frac{1}{r^2} \pdd{r}\left(r^2 \pdfd{\phi}{r}\right) + \frac{1}{r^2\sin\theta}\pdd{\theta}\left(\sin\theta \pdfd{\phi}{\theta}\right) + \frac{1}{r^2\sin^2\theta} \pdfd[2]{\phi}{\varphi} = 0. \end{align*} $$ Assuming $\phi$ does not depend on $\varphi$, we have $\pdfd[2]{\phi}{\varphi} = 0$. Substituting $\phi = R(r) \Theta(\theta)$ and multiplying by $r^2/\phi$, $$ \begin{align*} \frac{(r^2 R')'}{R} + \frac{(\sin\theta\cdot\Theta')'}{\sin\theta\cdot\Theta} = 0 \end{align*} $$ so since $r$ and $\theta$ are independent, $$ \begin{align*} \begin{cases} (r^2R')' = \lambda R, \\ (\sin\theta\cdot\Theta)' = -\lambda\sin\theta\cdot\Theta. \end{cases} \end{align*} $$

For the equation for $\Theta$, we perform a change of variable $x=\cos\theta$ and $\Theta(\theta) = \tilde\Theta(x)$. Then $$ \begin{align*} \dd{\theta} = \dfd{x}{\theta} \dd{x}= -\sin\theta \dd{x} \end{align*} $$ so $$ \begin{align*} -\sin\theta \dd{x}\left(-\sin^2\theta\cdot \tilde\Theta'\right) &= -\lambda \sin\theta \cdot\tilde\Theta \\ -\dd{x}\left((1-x^2)\tilde \Theta'\right) &= \lambda\tilde \Theta, \qquad -1<x<1. \end{align*} $$ This is the Legendre equation! The solutions are the Legendre polynomials $$ \begin{align*} \tilde\Theta(x) = P_n(x), \qquad \lambda = \lambda_n := n(n+1) \end{align*} $$ so $$ \begin{align*} \Theta_n(\theta) = P_n(\cos\theta). \end{align*} $$

Now the equation for $R$ becomes $$ \begin{align*} (r^2 R')' = n(n+1) R \end{align*} $$ which is equidimensional. We guess $R\propto r^\beta$ and get $$ \begin{align*} \beta(\beta+1) = n(n+1) \implies \beta=-(n+1), \, n \end{align*} $$ so $$ \begin{align*} R_n(r) = \alpha_n r^n + \frac{\beta_n}{r^{n+1}}. \end{align*} $$

Each $R_n(r) \Theta_n(\theta)$ solves $\Delta\phi = 0$, so by superposition, so does $$ \begin{align*} \phi(r,\theta) = \sum_{n=0}^{\infty} \left(\alpha_n r^n + \frac{\beta_n}{r^{n+1}}\right) P_n(\cos\theta). \end{align*} $$