I have the PDE
$$\frac{\partial u}{\partial t} = \frac{\partial^2u}{\partial x^2} - tu, \quad 0<x<1$$
subject to the boundary conditions (BCs) $u(0,t)=0, u_x(1,t)=0$ and initial condition (IC) $u(x,0)=f(x)$.
I have found the general solution using separation of variables
$$u(x,t)=\sum_{n=1}^{\infty} a_n \sin \left[ \left( n + \frac{1}{2} \right) \pi x \right] e^{-t \left[ \left(n+\frac{1}{2} \right) \pi \right]^2+\frac{t}{2}}$$
which then using the IC gives
$$u(x,0) = \sum_{n=1}^{\infty} a_{n} \sin \left[ \left( n + \frac{1}{2} \right) \pi x \right] = f(x)$$
The next question is to state how the BCs gave a periodic extension of $f(x)$ with period $4$ and the piecewise definition of it over $-2<x<2$. This has had me confused for hours as I thought the period is $2$ as $\ell=1$. Does anyone have an idea of what to do next?