\[
u_t = \alpha^2 u_{xx} + f(x,t)
\]
We consider the standard 1-D heat equation with an inhomogeneity \(f(x,t)\). The approach is to expand both \(u\) and \(f\) into Fourier sine series, and then derive ODEs for the time-dependent coefficients.
Fourier Series Expansion
\[
u(x,t) = \sum_{n=1}^\infty T_n(t) X_n(x), \qquad
f(x,t) = \sum_{n=1}^\infty f_n(t) X_n(x),
\]
where \(X_n(x) = \sin(n\pi x)\). Differentiating:
\[
u_t = \sum_{n=1}^\infty T_n'(t) X_n(x), \qquad
u_{xx} = \sum_{n=1}^\infty T_n(t) X_n''(x).
\]
Plugging into the PDE:
\[
\sum_{n=1}^\infty T_n'(t) X_n(x) \;=\;
\sum_{n=1}^\infty T_n(t) X_n''(x) \;+\;
\sum_{n=1}^\infty f_n(t) X_n(x).
\]
Collecting terms:
\[
\sum_{n=1}^\infty \bigl[T_n'(t) - T_n(t)(n\pi)^2 - f_n(t)\bigr]\sin(n\pi x) = 0.
\]
Since \(\{\sin(n\pi x)\}\) is an orthogonal basis, each coefficient must vanish:
\[
T_n'(t) - (n\pi)^2 T_n(t) - f_n(t) = 0.
\]
Computing \(f_n(t)\)
The Fourier sine coefficients are obtained by orthogonality:
\[
f_n(t) = 2\int_0^1 f(x,t)\sin(n\pi x)\,dx.
\]
Initial Condition
If the initial data is \(u(x,0)=\phi(x)\), then expand:
\[
\phi(x) = \sum_{n=1}^\infty T_n(0)\sin(n\pi x).
\]
By orthogonality,
\[
T_n(0) = 2\int_0^1 \phi(x)\sin(n\pi x)\,dx.
\]
Final Solution
For each \(n\), solve the ODE
\[
T_n'(t) + (n\pi)^2 T_n(t) = f_n(t),
\]
using methods such as integrating factors or undetermined coefficients. Then assemble:
\[
u(x,t) = \sum_{n=1}^\infty T_n(t)\sin(n\pi x).
\]