The problem:
Solve: $$u_t - u_{xx} = 0$$ $$u_x (0,t) = u_x (3,t) = 0$$ $$u(x,0) = 3 + \cos(2\pi x)$$
The provided answer: $$ 3 + e^{-4(\pi ^2)t}\cos(2\pi x)$$
What I have done:
-----Define $ u=XT$ ----- $$XT' - X''T =0$$ -----Rearrange ----- $${X'' \over X} = {T' \over T} = \lambda $$ -----Split into two equations----- $${X'' \over X} = \lambda $$ $${T' \over T} = \lambda $$ ----- Solve X first ----- $$X'' - \lambda x = 0$$ -----Consider $\lambda = 0$ , $\lambda = m^2 > 0$ , and $\lambda = -m^2 < 0$ -----
-----$\lambda = 0$ case----- $$X'' - \lambda x = 0$$ $$X'' = 0$$ $$X = c_1x+c_2$$ $$X' = c_1$$
Using initial condition, $$0 = X'(0) = c_1$$ $$c_1 = 0$$
$c_2$ is arbitrary.
-----$\lambda = m^2 > 0$ case----- $$X = c_1\cosh(mx) + c_2\sinh(mx)$$ $$X' = c_1m\sinh(mx) + c_2\cosh(mx)$$
Using initial condition, $$ 0 = X'(0) = c_1m\sinh(0) + c_2\cosh(0)$$ $$ 0 =c_2$$
Using other initial condition, $$ 0 = X'(3) = c_1m\sinh(3m)$$ As $\sinh(3m)$ never equals $0$ for $m>0$, $$c_2 = 0$$
Both $c_1$ and $c_2$ equal zero, this means there are no eigenvalues and no eigenfunctions. Thus, let's move onto the next case.
-----$\lambda = -m^2 < 0$ case----- $$X = c_1\cos(mx) + c_2\sin(mx)$$ $$X' = -c_1m\sin(mx) + c_2m\cos(mx)$$
Using initial condition,
$$0 = X'(0) = -c_1m\sin(0) + c_2m\cos(0)$$
$$0 = -c_1m(0) + c_2m(1)$$ $$ 0 = c_2$$
Using other initial condition,
$$0 = X'(3) = -c_1m\sin(3m)$$
We don't want $c_1$ to also be 0, therefore let $\sin(3m) = 0$
$sin(\theta) = 0$ only when $\theta = n\pi$ for $n = 0,1,2,...$
Therefore, $$3m = n\pi$$ $$m = {1 \over 3} n\pi$$
From above, $\lambda = - m^2$, therefore,
$$\lambda = - {1 \over 9} n^2 \pi ^2$$
and
$$X = \cos({1 \over 3} n\pi x)$$
-----Back to T-----
Reminder, that $T' = \lambda T$
$$T' + ({1 \over 9} n^2 \pi ^2)T = 0$$
Therefore,
$$T = e^{- {1 \over 9} n^2 \pi ^2 t}$$
This is where I am stuck. I don't know how to take this information and get the answer.
The general solution is $$ u(x,t)=\sum_{n=0}^{\infty}C_ne^{-n^2\pi^2 t/9}\cos\left(\frac{n\pi x}{3}\right) $$ The constants $C_n$ must be chosen so that $$ 3+\cos(2\pi x) = u(x,0) = \sum_{n=0}^{\infty}C_n\cos\left(\frac{n\pi x}{3}\right) $$ You can see from this that $C_0=3$ and $1=C_6$ and all other $C_n$ are $0$. So, $$ u(x,t)=3+e^{-36\pi^2 t/9}\cos(2\pi x). $$