# Solving the heat equation using the separation of variables

Solve the initial value problem: $$\begin{cases} u_t = ku_{xx} \ \ &\text{for} \ \ x > 0, t > 0,\\ u(x,0) = e^{-2x} \ \ &\text{for} \ \ x > 0,\\ u(0,t) = 0 \ \ &\text{for} \ \ t > 0\\ \end{cases}$$

Attempted solution - Using the separation of variables $$u(x,t) = X(x)T(t)$$ then $$u_t(x,t) = X(x)T'(t), \ \ u_x(x,t) = X'(x)T(t)$$ $$u_{xx}(x,t) = X^{\prime\prime}(x)T(t)$$ thus $$X(x)T'(t) = k X^{\prime\prime}T(t)$$ Rearranging algebraically we have $$\frac{X^{\prime\prime}}{X(x)} = \frac{T'(t)}{kT(t)} = -\lambda$$ Rearranging again we get $$T' + k\lambda T = 0 \ \ X^{\prime\prime} + \lambda X = 0$$ The general solution to the $T$-equation is of the form $$T(t) = e^{k\lambda t}$$ The general solution to the $X$-equation is of the form $$X(x) = \begin{cases} c_1\cos Bx + c_2 \sin Bx \ \ &\text{if} \ \ \lambda = B^2 > 0\\ c_1e^{\sqrt{\gamma} x} + c_2 e^{-\sqrt{\gamma} x} \ \ &\text{if} \ \ \lambda = -\gamma^2 < 0\\ c_1 + c_2 x \ \ &\text{if} \ \ \lambda = 0\\ \end{cases}$$ Since the given equation is a heat equation $u(x,t)$ should decrease with the increase of time thus we have $$X(x) = c_1 e^{\sqrt{\gamma}x} + c_2 e^{-\sqrt{\gamma}x} \ \ \text{and} \ \ T = c_3 e^{\lambda k t}$$

I am not sure how to apply the initial/boundary conditions to this problem any help would be greatly appreciated.

• There is most likely a typo in your boundary conditions because they are inconsistent. The first condition implies that $u(0,0)=1$, whereas the second implies $u(0,0)=0$. I would guess the second condition should maybe be something like $u_t(0,t)=0$. Commented Jun 4, 2017 at 17:31
• @AlexR. I see your point, I will double check Commented Jun 4, 2017 at 17:36
• @AlexR. I don't see any error in my notes but I will ask around Commented Jun 4, 2017 at 18:01
• Shouldn't be a typo. This will most likely cause the appearance of an infinite series in your solution Commented Jun 6, 2017 at 17:29

The separated equations are, as you wrote, $$T'(t)=-k\lambda T(t),\\ X''(x)+\lambda X(x) = 0, \;\;X(0) = 0.$$ Boundedness in $t$ forces $\lambda > 0$, and gives $X$ solutions $$X_{\lambda}(x) = \sin(\sqrt{\lambda}x),\;\;\; \lambda > 0.$$ A general solution is found by forming an integral "sum" of solutions $$u(x,t)=\int_{0}^{\infty}c(\mu)e^{-k\mu^2 t}\sin(\mu x)d\mu$$ The coefficient function $c(\mu)$ is determined by the initial condition and the inverse Fourier sine transform: $$e^{-2x}= u(x,0) = \int_{0}^{\infty}c(\mu)\sin(\mu x)d\mu \\ \implies \frac{2}{\pi}\int_{0}^{\infty}e^{-2y}\sin(\mu y)dy = c(\mu).$$ The integral can be explicitly carried out, and I'll leave that to you. The solution obtained using this method is $$u(x,t) = \frac{2}{\pi}\int_{0}^{\infty}\left(\int_{0}^{\infty}e^{-2y}\sin(\mu y)dy\right)e^{-k\mu^2 t}\sin(\mu x)d\mu.$$
• $$\int_0^\infty e^{-2y}\sin(\mu y)~dy=\dfrac{\mu}{\mu^2+4}$$ $$\dfrac{2}{\pi}\int_0^\infty\dfrac{\mu e^{-k\mu^2 t}\sin(\mu x)}{\mu^2+4}~d\mu=~......$$ Commented Jun 10, 2017 at 17:03