# Heat equation using separation of variables

I'm trying to solve a PDE using separation of variables. The heat eq. is given by: $$u_t = k(u_{rr}+ \frac{2}{r} u_r)$$ The boundary conditions are given by: $$\lim_{r \to 0} \frac{\partial u}{\partial r} = 0; \quad \text{for} \quad t>0.$$ and $$u(a,t) = u_{0}; \quad \text{for} \quad t>0.$$ where $$u_0$$ is a constant. The initial condition is given by: $$u(r,0) = 0; \quad \text{for} \quad 0.

Attempt at solution: Let: $$u = R(r)T(t)$$ be the solution to the PDE. From this, we have: $$\frac{\partial u}{\partial t} = R(r)T'(t)$$ $$\frac{\partial u}{\partial r} = R'(r)T(t)$$ $$\frac{\partial^2 u}{\partial r^2} = R''(r)T(t)$$ BY substituting back into the PDE, we have: $$\frac{T'(t)}{T(t)}=k(\frac{R''(r)}{R(r)} + \frac{2}{r}\frac{R'(r)}{R(r)})= -\lambda^2; \quad \text{where} \quad \lambda > 0.$$ Here, $$\lambda$$ is the separation constant. Then, we will get 2 ODEs given by: $$T'(t)+ \lambda T(t)=0$$ $$k(rR''(r)+2R'(r)+\lambda rR(r))= 0$$ The solution to the first ODE is $$T = Ae^{- \lambda t}$$ How do I proceed from here and apply the BCs/ICs?

$$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$$ Lets $$\ds{\varphi\pars{r,t} \equiv \on{u}\pars{r,t} - u_{0}}$$ such that
$$\left\{\begin{array}{rcl} \ds{\varphi_{t}} & \ds{=} & \ds{k\pars{\varphi_{rr} + {2 \over r}\,\varphi_{r}}} \\[2mm] &&\left.\begin{array}{rcl} \ds{\varphi_{r}\pars{0,t}} & \ds{=} & \ds{0} \\[1mm] \ds{\varphi\pars{a,t}} & \ds{=} & \ds{0} \end{array}\right\} \substack{\ds{Boundary} \\[0.5mm] \ds{Conditions}} \\[2mm] \ds{\varphi\pars{r,0}} & \ds{=} & \ds{-u_{0}}\ \pars{~Initial\ Condition~} \end{array}\right.$$
• Set $$\ds{\varphi\pars{r,t} = \on{A}\pars{t}\on{B}\pars{r}}$$. Then, \begin{align} \on{A}_{t}\on{B} & = k\pars{\on{A}\on{B}_{rr} + {2 \over r}\on{A}\on{B}_{r}} \\[2mm] {\on{A}_{t} \over \on{A}} & = k\pars{{\on{B}_{rr} \over \on{B}}+ {2 \over r}{\on{B}_{r} \over \on{B}}} = -q^{2}\,,\quad q \in \mathbb{R} \\[2mm] \on{A} &= -q^{2}\on{A}\,,\quad k\on{B}_{rr} + {2k \over r}\on{B}_{r} + q^{2}\on{B} = 0 \end{align} Lets $$\ds{\on{B} \propto {\expo{\alpha r} \over r}}$$ which yields $$\ds{\alpha = \pm \ic q/\root{k}}$$. In order to satisfy the boundary condition at $$\ds{r = 0}$$, $$\ds{\on{B} \propto {\sin\pars{qr/\root{k}}}/r}$$. At $$\ds{r = a}$$, $$\ds{\sin\pars{qa/\root{k}} = 0}$$ $$\ds{\implies q_{n} = n\,{\pi\root{k} \over a}\,,\quad n = 1,2,3,\ldots}$$ The general solution becomes \begin{align} \varphi\pars{r,t} & = \sum_{n = 1}^{\infty}\on{A}_{n}\pars{0}\exp\pars{-q_{n}^{2}\,t} {\sin\pars{q_{n}r/\root{k}} \over r} \\[5mm] -u_{0} & = \sum_{n = 1}^{\infty}\on{A}_{n}\pars{0} {\sin\pars{q_{n}r/\root{k}} \over r} \\[5mm] &-u_{0}\ \overbrace{\int_{0}^{a}r\sin\pars{{q_{n} \over \root{k}}\,r} \dd r} ^{\ds{-\,{\pars{-1}^{n}a^{2} \over n\pi}}} \\[2mm] & = \sum_{m = 1}^{\infty}\on{A}_{m}\pars{0}\ \underbrace{\int_{0}^{a}\sin\pars{{q_{m} \over \root{k}}\,r} \sin\pars{{q_{m} \over \root{k}}\,r}\,\dd r} _{\ds{{a \over 2}\,\delta_{mn}}} \end{align} $$\ds{\implies \on{A}_{n}\pars{0} = {2\pars{-1}^{n}au_{0} \over n\pi}}$$.
• Finally $$\ds{\pars{~\mbox{with}\ q_{n} = n\,{\pi\root{k} \over a}~}}$$, $$\bbx{\on{u}\pars{r,t} = u_{0} + {2au_{0} \over \pi}\,{1 \over r}\sum_{n = 1}^{\infty} {\pars{-1}^{n} \over n}\exp\pars{-q_{n}^{2}\,t} \sin\pars{{q_{n} \over \root{k}}\,r}}\\$$