# Analytical Solution of Heat Equation with Neumann Boundary Conditions

Consider the heat equation:

$$$$\frac{\partial u}{\partial t} = K \frac{\partial^{2} u}{\partial x^2}$$$$

with initial condition:

$$u(x,0) = sin(\pi ^2 - x^2)$$

and Neumann boundary conditions:

$$\frac{\partial u}{\partial x}(\pm \pi, t) = 0$$.

I have attempted using separation of variables, where:

$$$$u(x,t) = X(x)T(t)\\ \Rightarrow \frac{\partial T}{\partial t} = -K\lambda T, \\ \Rightarrow \frac{\partial^2 X}{\partial x^2} = -\lambda X$$$$ and $$X'(-\pi) = X'(\pi) = 0$$.

This leads to the solution of $$T$$:

$$$$T = A exp(-K \lambda t)$$$$

However, I am stuck from this point onward in obtaining the solution for $$X(x)$$.

• I would look for the $X$ solutions first; they should involve sines and cosines. The boundary conditions then imply restrictions on $\lambda$. Then, express your $T$ solution in terms of the allowable $\lambda$s. Dec 31, 2020 at 13:05

As per Mark's hint, you should start with separating and solving for $$X(x)$$

1. Suppose $$u(t,x) = T(t)X(x)$$ and apply separation of variables:

\begin{align*} \frac{1}{K} \frac{T'(t)}{T(t)} = \frac{X''(x)}{X(x)} = -\lambda \leq 0. \end{align*}

1. Solve for $$X(x) = A\cos(\sqrt{\lambda}(x+\pi)) + B\sin(\sqrt{\lambda}(x+\pi))$$ with boundary conditions $$X'(\pm \pi)=0$$ (and $$X(x) \equiv C$$ for $$\lambda =0$$). Argue that a non-trivial eigenfunction in terms of $$\cosh$$ and $$\sinh$$ cannot satisfy the boundary condition.

2. We must have $$B=0$$ as $$X'(-\pi)=0$$. Deduce $$X'(\pi) = -2A\sqrt{\lambda}\sin(\sqrt{\lambda}2\pi) = 0 \implies \lambda = \left (\frac{n}{2} \right )^{2}$$. So you will get eigenfunctions of form $$X_{n}(x) = \cos \left (\frac{n}{2} (x+\pi) \right )$$.

3. Solve for $$T_{n}(t) = e^{-\left (\frac{n}{2}\right)^{2}Kt}$$ and express as a sum

\begin{align*} u(t,x) &= \sum_{n=0}^{\infty} C_{n}T_{n}(t)X_{n}(x) \\ &= \sum_{n=0}^{\infty} C_{n} e^{-n^{2}Kt/4} \cos \left (\frac{n}{2} (x+\pi) \right ). \end{align*}

1. Solve for $$C_{n} = \frac{1}{\pi} \int_{-\pi}^{\pi} u(0,x)\cos \left (\frac{n}{2} (x+\pi) \right )\, dx$$ for $$n \geq 1$$ and $$C_{0} = \frac{1}{2\pi} \int_{-\pi}^{\pi} u(0,x)\, dx$$. These values may not be integrable in terms of elementary functions.