Forced Solution
We now consider an extension of the heat equation problem where there is a forcing term, so that it reads
\begin{align}
\frac{\partial u}{\partial t} = \kappa\frac{\partial^2 u}{\partial x^2} + f(x,t) \tag{1}
\end{align}
where the forcing \( f(x,t) \) may depend on both \(x\) and \(t\). For simplicity, we keep the Dirichlet B.C. \( u(x=0,t) = u(x=L,t) = 0 \). From (19) of this tutorial, we know that the original unforced solution is
\begin{align}
u &= \sum_{n=1}^{\infty} A_n\sin(\frac{n\pi}{L}x)e^{-\frac{n^2\pi^2\kappa}{L^2} t} \tag{2}
\end{align}
The key is to borrow the method of variation of parameters from the ODE counterpart: since the sine spatial component is fixed by the B.C., we perturb the time component, and assume a new solution of
\begin{align}
u &= \sum_{n=1}^{\infty} T_n(t)\sin(\frac{n\pi}{L}x) \tag{3}
\end{align}
where \( T_n(t) \) are functions of \(t\) to be determined. We project (3) onto the Fourier sine basis and obtain the coefficients \( T_n(t) \) while holding \( t \) fixed:
\begin{align}
T_n(t) &= \frac{2}{L}\int_0^L u(\xi,t)\sin(\frac{n\pi}{L}\xi) d\xi \tag{4}
\end{align}
We then do the same on the heat equation (1), L.H.S. gives
\begin{align}
\frac{2}{L}\int_0^L \frac{\partial u(\xi,t)}{\partial t}\sin(\frac{n\pi}{L}\xi) d\xi &= \frac{2}{L}\int_0^L [\sum_{m=1}^{\infty} T_n'(t)\sin(\frac{m\pi}{L}\xi)]\sin(\frac{n\pi}{L}\xi) d\xi \\
&= T_n'(t) \tag{5}
\end{align}
where we just used the orthonormality of the sine basis. Similarly, R.H.S. becomes
\begin{align}
&\quad \frac{2\kappa}{L} \int_0^L u_{xx}(\xi,t)\sin(\frac{n\pi}{L}\xi) d\xi + \frac{2}{L}\int_0^L f(\xi,t)\sin(\frac{n\pi}{L}\xi) d\xi \\
&=\frac{2\kappa}{L} \int_0^L u_{xx}(\xi,t)\sin(\frac{n\pi}{L}\xi) d\xi + B_n(t) \tag{6}
\end{align}
where
\begin{align}
B_n(t) = \frac{2}{L}\int_0^L f(\xi,t)\sin(\frac{n\pi}{L}\xi) d\xi \tag{7}
\end{align}
The integral at the end of (6) can be evaluated using integration by parts:
\begin{align}
&\quad \frac{2\kappa}{L} \int_0^L u_{xx}(\xi,t)\sin(\frac{n\pi}{L}\xi) d\xi \\
&= \frac{2\kappa}{L} [u_{x}(\xi,t)\sin(\frac{n\pi}{L}\xi)]_0^L -\frac{2\kappa n\pi}{L^2}\int_0^L u_x(\xi,t)\cos(\frac{n\pi}{L}\xi) d\xi\\
&= (0) -\frac{2\kappa n\pi}{L^2}[u(\xi,t)\cos(\frac{n\pi}{L}\xi)]_0^L -\frac{2\kappa n^2\pi^2}{L^3}\int_0^L u(\xi,t)\sin(\frac{n\pi}{L}\xi) d\xi\\
&= (0) -\frac{2\kappa n^2\pi^2}{L^3} \frac{L}{2}T_n(t) = -\frac{\kappa n^2\pi^2}{L^2} T_n(t) \tag{8}
\end{align}
at the end we recalled (4). Plugging this back to (6) and also equating to (5) then shows
\begin{align}
T_n'(t) + \frac{\kappa n^2\pi^2}{L^2} T_n(t) = B_n(t) \tag{9}
\end{align}
which is just a first-order ODE. From (4), we can infer the initial condition for \(T_n(0)\):
\begin{align}
T_n(0) &= \frac{2}{L}\int_0^L u(\xi,0)\sin(\frac{n\pi}{L}\xi) d\xi \tag{10}
\end{align}
and let’s denote it by \(b_n\). Then the solution of (9) is
\begin{align}
e^{\frac{\kappa n^2\pi^2}{L^2}t} (T_n'(t) + \frac{\kappa n^2\pi^2}{L^2} T_n(t)) &= B_n(t)e^{\frac{\kappa n^2\pi^2}{L^2}t} \\
\frac{d}{dt}(e^{\frac{\kappa n^2\pi^2}{L^2}t}T_n(t)) &= B_n(t)e^{\frac{\kappa n^2\pi^2}{L^2}t} \\
[e^{\frac{\kappa n^2\pi^2}{L^2}t}T_n(t)]_0^t &= \int_0^t B_n(\tau)e^{\frac{\kappa n^2\pi^2}{L^2}\tau} d\tau \\
T_n(t) &= \int_0^t B_n(\tau)e^{-\frac{\kappa n^2\pi^2}{L^2}(t-\tau)} d\tau + b_ne^{-\frac{\kappa n^2\pi^2}{L^2}t} \tag{11}
\end{align}
and the final solution will be, by (3):
\begin{align}
u &= \sum_{n=1}^{\infty} (\int_0^t B_n(\tau)e^{-\frac{\kappa n^2\pi^2}{L^2}(t-\tau)} d\tau)\sin(\frac{n\pi}{L}x) + \sum_{n=1}^{\infty} b_n\sin(\frac{n\pi}{L}x)e^{-\frac{\kappa n^2\pi^2}{L^2}t} \tag{12}
\end{align}
This is then known as the variation of parameters formula.
Exercise
Solve the heat equation problem (1) with an exponentially decaying forcing \( f(x,t) = e^{-\alpha t} \).
Answer
For (7),
\begin{align}
B_n(t) &= \frac{2}{L}\int_0^L e^{-\alpha t} \sin(\frac{n\pi}{L}\xi) d\xi \\
&=\frac{2(1-(-1)^n)}{n\pi} e^{-\alpha t}
\end{align}
which follows from the Fourier sine series for \(1\). Similarly, (10) is
\begin{align}
b_n &= \frac{2(1-(-1)^n)}{n\pi}
\end{align}
and hence the full solution will be
\begin{align}
u &= \sum_{n=1}^{\infty} (\int_0^t \frac{2(1-(-1)^n)}{n\pi}e^{-\frac{\kappa n^2\pi^2}{L^2}t}e^{(\frac{\kappa n^2\pi^2}{L^2}-\alpha)\tau} d\tau)\sin(\frac{n\pi}{L}x) \\
&\quad + \sum_{n=1}^{\infty} \frac{2(1-(-1)^n)}{n\pi}\sin(\frac{n\pi}{L}x)e^{-\frac{\kappa n^2\pi^2}{L^2}t} \\
&= \sum_{n=1}^{\infty} \frac{2(1-(-1)^n)}{n\pi(\frac{\kappa n^2\pi^2}{L^2}-\alpha)}e^{-\frac{\kappa n^2\pi^2}{L^2}t}(e^{(\frac{\kappa n^2\pi^2}{L^2}-\alpha)t}-1) \sin(\frac{n\pi}{L}x) \\
&\quad + \sum_{n=1}^{\infty} \frac{2(1-(-1)^n)}{n\pi}\sin(\frac{n\pi}{L}x)e^{-\frac{\kappa n^2\pi^2}{L^2}t}
\end{align}








Leave a Reply