Heat equation separation of variables with different boundary conditions I need to solve the following heat equation using separation of variables
$
\left\{\begin{matrix}
u_{t}=c^{2}u_{xx} \; \; ,0<x<L,  t>0 \\ 
u(0,t)= 0 \\ 
u_{x}(L,t)=0 \\
u(x,0)=f(x) 
\end{matrix}\right.
$
So far I've got:
$
X''-kX=0 \\
T'-c^{2}kT=0
$
But I'm not sure how to apply the boundaries to this problem and arrive at a general solution.
Any help is much appreciated.
 A: Write $k=-\lambda^2$.  Then you can write
$$X(x) = A \cos{\lambda x} + B \sin{\lambda x}$$
$$X(0) = 0 \implies A \cos{0} + B \sin{0} = A = 0$$
$$X'(L) = 0 \implies B \lambda \cos{\lambda L} = 0 \implies \lambda L = (n+1/2) \pi$$
where $n \in \mathbb{Z}$.  So set $\lambda_n = (n+1/2) \pi/L$ is an eigenvalue of the operator, with corresponding eigenfunction
$$X_n(x) = \sin{\left [ \left (n+\frac{1}{2}\right) \frac{\pi x}{L} \right ]}$$
ignoring the scale factor $B$.
For the $T$ equation, we have
$$T_n(t) = B_n e^{-\lambda_n^2 c^2 t}$$
Using the initial condition and the eigenvalues, we then have the following expansion for the general solution:
$$u(x,t) = \sum_{n=0}^{\infty} B_n \sin{\left [ \left (n+\frac{1}{2}\right) \frac{\pi x}{L} \right ]} e^{-\frac{(n+1/2)^2 \pi^2 c^2 t}{L^2} }$$
$$u(x,0) = \sum_{n=0}^{\infty} B_n \sin{\left [ \left (n+\frac{1}{2}\right) \frac{\pi x}{L} \right ]} = f(x)$$
The $B_n$ are then Fourier coefficients:
$$\begin{align}B_n &= \frac{\displaystyle \int_0^{L} dx \: f(x) \sin{\left [ \left (n+\frac{1}{2}\right) \frac{\pi x}{L} \right ]}}{\displaystyle \int_0^{L} dx \: \sin^2{\left [ \left (n+\frac{1}{2}\right) \frac{\pi x}{L} \right ]}}\\ &= \frac{2}{L} \int_0^{L} dx \: f(x) \sin{\left [ \left (n+\frac{1}{2}\right) \frac{\pi x}{L} \right ]}\end{align}$$
