# Solving PDE using separation of variables (Heat diffusion)

I am trying to solve a standard PDE, but I got stuck on how to choose the separation constant such that I do not end up with a trivial, uninteresting solution. The system is presented below and my solution thus far.

$$\left\{\begin{array}{ll}u_{t}(x,t)-\alpha u_{xx}(x,t)=C,\quad 00\\u_{x}(0,t)=0,\quad u(L,t)=0,\quad t>0\\u(x,0)=0,\quad 0

I begin by defining $$w(x)$$ so that it satisfies the following equation $$\alpha w''(x)+C=0$$ (this will turn the problem into a homogenous system by setting $$u(x,t)=v(x,t)+w(x)$$, where $$v(x,t)$$ is another function I define). The solution to the ODE above is $$w(x)=\frac{C}{2\alpha}(L^2-x^2)$$, using the boundary conditions above. Now, the new homogeneous system becomes:

$$\left\{\begin{array}{ll}v_{t}(x,t)-\alpha v_{xx}(x,t)=0,\quad 00\\v_{x}(0,t)=0,\quad v(L,t)=0,\quad t>0\\v(x,0)=\frac{C}{2\alpha}(x^2-L^2),\quad 0

I use separation of variables: $$v(x,t)=X(x)T(t)$$. The first equation becomes $$XT'=\alpha X''T\implies \alpha \frac{X''}{X}=\frac{T'}{T}=-\lambda$$, where $$\lambda$$ is a separation constant. This results in the system

$$\left\{\begin{array}{ll}\alpha X''+\lambda X=0\\T'+\lambda T=0\\\end{array}\right.$$

We know that for $$\lambda \leq 0$$ only trivial solutions are obtained, so we set $$0<\lambda$$. The ODEs yield the following solutions:

$$\left\{\begin{array}{ll}X(x)=A \cos(\sqrt{\lambda /\alpha }x)+B\sin(\sqrt{\lambda / \alpha}x)\\T(t)=De^{-\lambda t}\\\end{array}\right.$$

Now, when I apply the BCs I get $$A=0$$ and if $$B\neq 0$$ then $$\lambda =\frac{\alpha}{L^2}(\pi /2 +\pi n)$$, where $$n$$ is a non-negative integer.

Is that correct? Do I just multiply $$X$$ and $$T$$ and sum up all these solutions for different $$n$$ using linearity and that is my (general) solution? It looks odd to me.

Best regards //

• you still have to figure out the formula of the coefficients $a_n$ in $v = \sum_{n\geq 1} a_n \sin(\sqrt{\frac{\alpha}{L^2}(\pi /2 +\pi n) / \alpha}x)e^{-{\frac{\alpha t}{L^2}(\pi /2 +\pi n)}}$ for that use the BC's and/or IC's – rapidracim Jan 30 at 20:47

The eigenvalues look "odd" because you have mixed boundary conditions (Neumann on one side, Dirichlet on the other).

Note that the B.C. $$X'(0) = 0$$ forces $$\color{red}{B=0}$$, so the eigenfunctions have the form

$$X_n(x) = \cos\left(\frac{(2n+1)\pi}{2L}x\right)$$

where $$n = 0,1,2,\dots$$ and $$\lambda_n = \dfrac{\alpha\pi^2}{4L^2}(2n+1)^2$$

The rest is business as usual. Write the general solution as a series and use the I.C. $$u(x,0)$$ to find the constants.

Edit: The solution is

$$v(x,t) = \sum_{n=0}^\infty c_n e^{-\frac{\alpha \pi^2}{4L^2}(2n+1)^2t}\cos\left(\frac{(2n+1)\pi}{2L}x\right)$$

where

$$c_n = \frac{\int_0^L f(x)\cos\left(\frac{(2n+1)\pi}{2L}x\right) dx}{\int_0^L \cos^2\left(\frac{(2n+1)\pi}{2L}x\right)dx }$$

and $$f(x) = v(x,0)$$

Edit 2: This result was derived from the orthogonality of the eigenfunctions. For $$n\ne m$$ you always have

$$\int_0^L X_n(x)X_m(x)\ dx = 0$$

To find $$c_n$$ such that

$$\sum_{n=0}^\infty c_n X_n(x) = f(x)$$

Multiply both sides by $$X_m(x)$$ and integrate throughout

$$\sum_{n=0}^\infty c_n\int_0^L X_n(x)X_m(x)\ dx = \int_0^L f(x)X_m(x)\ dx$$

Every term on the LHS will go to $$0$$ except for when $$n=m$$, therefore

$$c_m \int_0^L [X_m(x)]^2\ dx = \int_0^L f(x) X_m(x)\ dx$$

• Thanks, I didn't realize I had mixed boundary conditions. But when using the I.C. v(x,0) I obtain a series of cosines equal to a power of x and a constant. Is it possible to choose the coefficients such that these are equal? Or have I made a mistake somewhere. – SimpleProgrammer Jan 31 at 9:04
• You have to find the corresponding Fourier series of the initial function. – Dylan Jan 31 at 10:02
• I've been trying to get the same coefficients as you, but using Fourier series expansion for the initial function on the interval 0<x<L becomes something hideous. Are you using "Fourier's trick" or how did you obtain c_n in such a compact way? (Maybe this ought to be an entirely new question...) – SimpleProgrammer Jan 31 at 11:47
• It's a result of orthogonality, i.e. $\int_0^L X_nX_m dx =0$ for $n\ne m$ – Dylan Jan 31 at 11:58
• Yes, I did mean $v$. Thanks – Dylan Jan 31 at 16:29