Can someone please check my work for this following question? I got really complicated answer so not sure if I'm right.
Question:
My work:
Step 1: Eigenfunction Expansion of $e^{-2t}\cos(5x)$
Eigenfunction: $$ X_n = \cos(2n+1)x, n=0,1,2,...$$
$e^{-2t} \cos(5x) = \sum^\infty _{n=0} S_n(t)\cos(2n+1)x$
$\therefore S_n(t) = e^{-2t}\delta_{n2}$
Step2: Eigenfunction Expansion of PDE
$u = \sum^\infty_{n=0}u_n(t)\cos(2n+1)x$
$u_{xx} = -\sum^\infty_{n=0}u_n(t)(2n+1)^2\cos(2n+1)x$
$u_{tt} = \sum^\infty_{n=0}\mathring{\mathring{u_n(t)}}\cos(2n+1)x$
$\therefore u_{tt} + 2\gamma u_t-u_{xx}-e^{-2t}\cos(5x) = \sum^{\infty}_{n=0}\cos(2n+1)x[\mathring{\mathring{u_n(t)}}+ 2\gamma \mathring{u_nt}+ u_n(t)(2n+1)^2-e^{-2t}\delta_{n2}]$
$\mathring{\mathring{u_n(t)}}+ 2\gamma \mathring{u_nt}+ u_n(t)(2n+1)^2-e^{-2t}\delta_{n2}=0$
$u_n(t) = u_p(t) + u_h(t)$
Let $u_p = Ae^{-2t}, \mathring{u_p} = -2Ae^{-2t}, \mathring{\mathring{u_p}} = 4Ae^{-2t}$
$e^{-2t}[4A-4\gamma A + A(2n+1)^2] = e^{-2t}\delta_{n2}$
$\therefore A_n = \frac{\delta_{n2}}{4-4\gamma+(2n+1)^2}$
$u(t)_h$ characteristic equation with respect to $r$.
$r^2+2\gamma r + (2n+1)^2=0$
$r= \frac{-2\gamma \pm i\sqrt{4(2n+1)-4\gamma^2}}{2}$
$\therefore u(x,t) = \sum^{\infty}_{n=0}\cos(2n+1)x \dot [\frac{\delta_{n2}e^{-2t}}{4-4\gamma+(2n+1)^2} + e^{-\gamma t}(c_1 \cos(\sqrt{(2n+1)^2-\gamma^2))}t+ c_2\sin(\sqrt{(2n+1)^2-\gamma^2)}t)]$
Plugging in IC, we get $c_1 = \frac{-\delta_{n2}}{4-4\gamma(2n+1)^2}$
$c_2 = \frac{\delta_{n1}+\frac{\delta{n2}(2-r)}{4-4\gamma(2n+1)^2}}{\sqrt{(2n+1)^2-\gamma^2}}$
$\therefore u(x,t) = \sum^{\infty}_{n=0}\cos(2n+1)x \dot [\frac{\delta_{n2}e^{-2t}}{4-4\gamma+(2n+1)^2} + e^{-\gamma t}(c_1 \cos(\sqrt{(2n+1)^2-\gamma^2))}t+ c_2\sin(\sqrt{(2n+1)^2-\gamma^2)}t)]$ where $c_1$ and $c_2$ are shown above.

Your solution is correct. You could expand $n$ values and clean up a bit tho.
$$u(x,t) = \frac{\cos(3x)\sin \sqrt{9-\gamma^2}t e^{-\gamma t}}{\sqrt{(9-\gamma^2)}} + \frac{\cos(5x)}{29-4\gamma}[e^{-2t}+e^{-\gamma t}[-\cos\sqrt{25-\gamma^2}t+\frac{\sin\sqrt{25-\gamma^2}t (2-\gamma)}{\sqrt{25-\gamma^2}}]]$$