I have a question that says to solve the heat equation by substituting in
$$\phi(x,t) = \frac{a_0(t)}{2} + \sum_{n=1}^{\infty} a_n(t)\cos(\frac{n\pi}{L} x)$$
I presume I must take the partial derivatives of this to be able to solve the heat equation. I should then have a ordinary differential equation for $a_n$.
how would I solve/find this?
If a series is wel-behaving then its okay to interchange the differentiation operator and the summation. So, substitute, differentiate, use the Fourier trick to get DE for a specific $a_n$, solve.