The temperature $u(x,t)$ of a copper wire of length $\pi$ obeys the one-dimensional heat equation $$ u_t = 3u_{xx} $$ in the domain $0 < x < \pi$ for all $t > 0$, with the initial condition $$ u(x,0) = 1 − \cos(2x), quad \text{ for } 0 < x < \pi. $$ (a) Suppose the temperature $u(x,t)$ also satisfies the boundary conditions $$ u_x(0,t)=u_x(\pi, t) = 0, \quad \text{for } t \ge 0. $$ By substitution or otherwise, show that $$ u(x, t) = e^{At} + Be^{-3t}\cos(x) + Ce^{Dt}\cos(2x) $$ is a solution to the heat equation satisfying the initial and boundary conditions for appropriate values of the constants $A, B, C$ and $D$.
So far I have identified that I have to use Neumann boundary conditions and have $$ \begin{split} A_0 &= \frac{2}{\pi} \int_0^L f(x)dx = \frac{2}{\pi} \int_0^\pi (1-\cos(2x))dx = 2\\ A_n &= \frac{2}{\pi} \int_0^L f(x)\cos(\frac{nx\pi}{L})dx \\ &= \frac{2}{\pi} \int_0^\pi (1-\cos(2x))\cos(nx)dx \\ &= \frac{2}{\pi} \times \frac{4\sin(n\pi)}{n^3-4n} \\ &= 0 \end{split} $$ as n must be an integer and for all integers of n, so $\sin(n\pi)=0$.
I know I have gone wrong somewhere and am not sure if it is my whole approach or if I have messed up somewhere can anyone please help.
feel free to edit tags if I have this in the wrong place and sorry this is so poorly written
One way, likely the simplest one, is to substitute directly into the PDE and note that if $$ u(x, t) = e^{At} + Be^{-3t}\cos(x) + Ce^{Dt}\cos(2x) $$ then $$ u_t = Ae^{At} -3Be^{-3t}\cos x + DCe^{Dt}\cos(2x) $$ and $$ u_{xx} = -Be^{-3t}\cos x-4Ce^{Dt}\cos(2x) $$ so you can solve for $A,B,C,D$ which make $u_t=3u_{xx}$ hold.
UPDATE
So $u_t=3u_{xx}$ implies we have $$ \require{cancel} Ae^{At} -\cancel{3Be^{-3t}\cos x} + DCe^{Dt}\cos(2x) = - \cancel{3Be^{-3t}\cos x} - 12Ce^{Dt}\cos(2x) $$ and we must have $A=0,D=-12$ with any values for $B,C$.