I'm studying a book named 'Computational Techniques for fluid dynamics' by Fletcher , and it solves a heat conduction problem with mixed boundary conditions.
$$\frac{\partial T}{\partial t}-\alpha \frac{\partial^2 T}{\partial^2 x}=0~, \qquad \begin{aligned} &\text{B.C.}\quad \left\{ \begin{aligned} \frac{\partial T}{\partial x}(0,t) &= -2 \\ T(1,t) &=1 \end{aligned} \right.\\ &\text{I.C.} \quad T(x,0) =3-2x-2x^2+2x^3 \end{aligned}$$
And it formulates the form of solution as
$$T=3-2x+b_0+\sum_{j=1}^J{a_j \sin(2\pi j x )+b_j \cos(2\pi j x)}$$
I cannot understand how it comes out. I can see how 3-2x comes from the steady state solution, but what about Fourier series? They doesn't even satisfy boundary conditions individually! However, the method works, I mean, if I plug in that form in the heat equation and let the computer solves for all coefficients a and b, I can see the numerical solution fits exactly on the exact solution.
So my question is, how non-eigenfunction can works as a component of separation of variables, and if it works, why the book had to separate steady state solution at all? Why it just didn't assume $$T=b_0+\sum_{j=1}^J{a_j \sin(2\pi j x )+b_j \cos(2\pi j x)}$$ and let computer do all the job? (I tried that, but it failed, and I cannot see what's the difference)