Proceeding as follows, use the method of separation of variables to solve
$\dfrac{\partial{u}}{\partial{t}} = \dfrac{\partial^2{u}}{\partial{x}^2} + 2\dfrac{\partial{u}}{\partial{x}}$ subject to $u(0,t) = 0$ and $u(\pi,t) = 0$ for $t > 0$ and to $u(x,0) = 1$ for $0 < x < \pi$.
(a) Try $u(x,t) = X(x)T(t)$ to get a pair of ordinary differential equations.
(b) Solve the differential equation for $X(x)$ by trying $X(x) = e^{mx}$. In particular, show that $m = -1 \pm \sqrt{1 - \lambda}$.
(c) Only the case $\lambda > 1$ is relevant. Solve the boundary value problem for $X(x)$ to determine the eigenfunctions.
(d) Solve the differential equation for $T(t)$.
(e) Write down the general solution to the partial differential equation.
(f) Find the solution of the problem by fitting the initial condition.
I have completed the problem up to and including (f). My work agrees with the solutions for all components except for (f).
The general solution the the partial differential equation (from (e)) is
$u(x, t) = \sum_{n = 1}^\infty b_n e^{-x} e^{-(1 + n^2)t}\sin(nx)$.
The solutions have the following for (f):
The initial condition $u(x,0) = 1$ is satisfied if $\sum_{n = 1}^\infty b_n e^{-x} \sin(nx) = 1$
$\implies \sum_{n = 1}^\infty b_n \sin(nx) = e^x$
$\implies b_n = \dfrac{4n}{\pi(1 + n^2)}$, $n$ odd
The solution to the problem is $u(x, t) = \dfrac{4e^{-x}}{\pi} \sum_{odd \ n = 1}^\infty \dfrac{ne^{-(1 + n^2)t} \sin(nx)}{1 + n^2}$
However, my solution for (f) is as follows:
Using the formula for the coefficients of a Fourier series, we have
$$b_n = \frac{2}{\pi} \int_0^\pi e^x \sin(nx) \ dx.$$
Which, after using integration by parts, should be $b_n = \dfrac{2}{\pi} \left( \dfrac{n - e^\pi n \cos(n\pi)}{1 + n^2} \right)$.
As you can see, there is a discrepancy between my solution for $b_n$ and that of the instructor. I have also checked my integration by parts calculation using an online calculator, so I don't think it's incorrect. I would greatly appreciate it if people could please take the time to clarify this.
Indeed, you are correct. Some trial and error reveals that the coefficients given in the answer are actually those of the Fourier series of $$ \frac{2\sinh{(\pi-x)}}{\sinh{\pi}}. $$