With boundary value and initial value problems, respectively,
The solution to this heat equation is,
In this case which is the easy part.
The harder part is,
Use the fact that the sines are orthogonal series of functions. This means that,
Therefore the first integral vanishes for every . It does not vanish when in that case the integral is . So . Similarly and .