I came across the following PDE for $u(x,t)$:
$$u_t = e^{-t}u_{xx} + tu$$
defined on $0\leq x \leq 1$ and $t\geq 0$ with the boundary conditions,
$$u_x(0,t) = u_x(1,t) = 0, \ \text{and} \ u(x,0) = 1 + \cos(3\pi x).$$
Via some guessing and experience with PDEs I found the solution:
$$u(x,t) = e^{t^2 / 2} + \exp{(9 \pi ^2 e^{-t} + t^2/2 - 9\pi^2)}\cos(3\pi x).$$
Are there any techniques better than guessing?
Attempting separation of variables $u = X(x)T(t)$ leads to:
$$XT' = e^{-t}TX'' + tXT,$$
which I could not figure out how to separate (although this approach inspired my solution).
I also tried a few change of variables, $t = \ln \tau$, some others that I forget, that led nowhere.
What am I missing?
While typing this up I noticed that if you multiply both sides of the PDE by $e^t$ you get
$$e^t u_t - te^t u = u_{xx},$$
which is easily separable and leads to:
$$\frac{e^t T' - te^t T}{T} = \frac{X''}{X}.$$