Fourier series method I have the following Boundary value problem  
$U_t-U_{xx}=0$ from  zero to one; $t>0$ 
$ U(x,0)=x$ from zero to one  
$U(0,t)=U(1,t)=0$  
I need to solve it using the Fourier series method, But I don't know for which $f(x)$ I need to find the solution. Is $f(x)=0$ or $f(x)=x$?
 A: For the pde $u_{t} = u_{xx}$ with the conditions $u(0,t) = u(1,t) = 0$, $u(x,0) = x$ the following is the solution. 
Let $u(x,t) = F(x) G(t)$ to obtain
\begin{align}
\frac{G'}{G} = - \lambda^{2} = \frac{F''}{F}
\end{align}
and leads to the two equations $G' + \lambda^{2} G = 0$ and $F'' + \lambda^{2} F = 0$. The solutions are 
\begin{align}
G(t) &= e^{- \lambda^{2} t} \\
F(x) &= A \cos(\lambda x) + B \sin(\lambda x).
\end{align}
For the conditions $u(0,t), u(1,t)$ leads to $F(0) = 0, F(1) = 0$ and the solution $F(x) = B \sin(n \pi x)$ for which the general solution becomes
\begin{align}
u(x,t) &= \sum_{n=1}^{\infty} B_{n} \, e^{- n^{2} \pi^{2} t} \, \sin(n \pi x).
\end{align}
The coefficients are found by use of the Fourier sine series are are seen, in this case, by
\begin{align}
B_{n} &= 2 \int_{0}^{1} x \, sin(n \pi x) \, dx \\
&= \frac{2}{n \pi} \left( 1 - (-1)^{n} \right).
\end{align}
This leads to the general solution
\begin{align}
u(x,t) &= \frac{2}{\pi} \, \sum_{n=1}^{\infty} \frac{1 - (-1)^{n}}{n} \, e^{- n^{2} \pi^{2} t} \, \sin(n \pi x) \\
&= \frac{4}{\pi} \sum_{n=1}^{\infty} \frac{1}{2n+1} \, e^{-(2n+1)^{2} \pi^{2} t} \, \sin((2n+1) \pi x)
\end{align}
