# solving heat equation under Neumann boundary conditions

I am having trouble solving following equation \begin{align*} u_t - u_{xx} = 0 & \; ;0<x<L, t>0 \\ u(0, x)=x &\; ; 0<x<L\\ u_x(t, 0) = u_x(t, L) = 0&\; ; t >0 \end{align*}

I got the solution of the form $\displaystyle u(x, t) = \sum_{n=1}^\infty A_n e^{-\frac{-n^2 \pi ^2}{L^2}t} \cos ( \frac{2 n \pi}{L}x)$ but Fourier expansion of $u(0, x) = x$ has no cosine terms. Is the boundary condition properly formulated am I making mistake somethere?

-

If I understand correctly, the solution should be

$$\displaystyle u(x,t) = A_0+\sum_{n=1}^\infty A_n\; exp\left({\lambda_n \;t}\right) \cos ( \frac{ n \pi}{L}x)$$

with $$\lambda_n=-\frac{-n^2 \pi ^2}{L^2}$$

for $$u_t(x,t) - u_{xx}(x,t) = 0 \qquad \; ;0<x<L,\; t>0$$

\begin{align*} u(x,0)=\phi(x) &\qquad \; ; 0<x<L\\ u_x(0,t) =0,\;\; u_x(L,t) = 0&\qquad \; ; t >0 \end{align*}

You need to pick $A_n$ such that $\phi(x)=u(x,0)$

To do this we consider what we learned from Fourier series. In particular we look for $u$ as an infinite sum

$$\displaystyle u(x,t) = A_0+\sum_{n=1}^\infty A_n\; exp\left({\lambda_n \;t}\right) \cos ( \frac{ n \pi}{L}x)$$

and find $\{A_n\}$ while satisfying:

$$\phi(x)=u(x,0)=A_0+\sum_{n=1}^\infty A_n\; \cos ( \frac{ n \pi}{L}x)$$

This requires a $cos$ expansion of $\phi(x)$ in the interval $[0,L]$, then we gain for your case $\phi(x)=x$:

$$A_0=(1/L) \int_0^L \phi(x)dx= (1/L) \int_0^L x dx$$

and

$$A_n=(2/L)\int_0^L \phi(x)\cos ( \frac{ n \pi}{L}x)dx=(2/L)\int_0^L x\cos ( \frac{ n \pi}{L}x)dx$$

-
what should be the final answer? also why did you consider $\cos (n \pi/L)$ shouldn't it be $\cos (2n \pi/L)$. shouldn't the period should be $L$? – Monkey D. Luffy Jul 16 '13 at 14:48
indeed the result should be with $\cos (n \pi/L)$ and not $\cos (2n \pi/L)$. Beyond you need also to consider $A_0$. Resume, your general approach is correct but in details it is bumpy and needs revision. With the above you have the correct solution appraoch for $u$ with $A_0$ and $A_1$. – al-Hwarizmi Jul 16 '13 at 14:59