I have a PDE that I have attempted to solve using the method of 'separation of variables'
$$u_t = (1+2t)u_{xx} \,\,\,\, 0 \leq x < \pi, t \geq 0 $$
With initial and boundary conditions:
$$u(0,t) = 0 $$
$$u(\pi, t) = \pi $$
$$ u(x,0) = 0$$
Using separation of variables, we have
$$u(x,t) = X(x)T(t)$$
$$\frac{T'}{(1+2t)T} = \lambda = \frac{X''}{X}$$
This yields,
$$T = Ae^{\lambda(t + t^2)} $$ $$X = B\sinh(\omega x)$$
Where $\lambda = \omega^2 > 0$, given that $X(\pi) = \pi$, we have
$$B= \frac{\pi}{\sinh(\omega \pi)} $$
So our final solution is
$$u(x,t) = Ae^{\lambda(t + t^2)}\left(\frac{\pi}{\sinh(\omega \pi)}\sinh(\omega x)\right)$$
However, I cannot find a function for A that would satisfy the initial and boundary conditions. Can someone tell me where I have made a mistake. Do I have to do something to deal with the (1 + 2t) coefficient or have I just made a mistake in implementing the method? Any help would be greatly appreciated.
You also have to account for the possibility that $\lambda=0$. Then you have $$ T'=X''=0, $$ so you can have $Bx+C$ as another solution. Setting $x=0$ implies that $C=0$, and $x=\pi$ gives $C=1$, but you have to deal with the initial condition separately. Define $U=u-x$, then $U$ satisfies $$ U_t=(1+2t)U_{xx}, $$ but with different BCs: $$ U(0,t)=0, \quad U(\pi,t) = 0, \quad U(x,0)=-x. $$ But you should recognise this as a problem you can solve using separation of variables and Fourier series: separate variables $U(x,t)=X(x)T(t)$, then $$ T'=\lambda(1+2t)T, \quad X''=\lambda X, $$ so $T$ is as you have it, and the boundary conditions imply that $\lambda<0$, so $X=\sin{nx}$, for $n\in \{1,2,3,\dotsc\}$. Now you have to solve for the initial condition with $$ -x = \sum_{n=1}^{\infty} a_n \sin{nx} $$ for $a_n$ in the usual way. You can then verify that $$ u(x,t) = x+\sum_{n=1}^{\infty} a_n e^{-n(t+t^2)}\sin{nx} $$ solves the original problem.
Remark: the simpler way to do this is to include $\lambda=0$ as another Fourier mode with no period, but this way of splitting into problems that are easier to solve is very useful.