# Solve heat equation using separation of variables

I am trying to solve the following exercise:

$u_t=4u_{xx}, 0,x<x<\pi, t>0$

$u(x,0)=g(x), 0\le x\le\pi$

$-u_x(0,t)=u_x(\pi,t)=0, t>0$,

considering that $u(x,t) \to U$ as $t \to \pm \infty$.

I tried so solve it using separation of variables (suppose $u(x,t)=X(x)T(t)$) and using the Neumann boundary conditions and the initial condition in order to find the constants. I came up with the following:

$u(x,t)= \sum_{k=1}^ \infty a_k \cos (kx) e^{-4k^2t}$

$a_0 = \frac{1}{\pi} \int_0^\pi g(x)dx$

$a_k = \frac{2}{\pi} \int_o^\pi f(x) \cos(kx)dx$.

Is this correct? What does it mean that $u(x,t) \to U$ as $t \to \pm \infty$?

EDIT:

From my solution $u(x,t)$ I use the initial condition and get:

$g(x) = \sum_{k=1}^\infty a_k \cos(kx)$.

From this I should use Fourier series to find $a_k$ right?

• as far as I can see, $u(x,t)\to U$ means $u(x,t)$ as a function of $x$ tends to a constant function $U$ as $t\to \infty$. Natural interpretation would be that heat diffuses over the domain indefinitely so heat distribution converges to uniform distribution, as you would expect with diffusion
– PLE
Commented Oct 26, 2016 at 16:06
• Thank you @PLE but do I have to do something \textit{particular} in order to take into account this information? Thank you. Commented Oct 26, 2016 at 16:08
• Something is wrong here: first your $a_k$ should be integrals involving $g(x)$ not $f(x)$. Also, your $u(x,t)$ seems to be wrong - given your solution, as $t\to \infty$ $u\to 0$ for every $x$, so $U=0$ BUT because your boundary conditions imply zero flux the heat cannot escape through boundary (ie it is insulated) so total amount of heat must be conserved, which would eqaul $U\pi$. To this end I think you are missing a term involving $a_0$ in your expression of $u(x,t)$. Once you find that, you know $u(x,t)\to \text{some term involving$a_0$}=U$, so you can in fact find $a_0$ in terms of $U$.
– PLE
Commented Oct 26, 2016 at 16:23
• Thank you @PLE yes it is a typo, it is $g(x)$. For the other problem I will try to go through the problem again. Thank you. Commented Oct 26, 2016 at 16:27