TITLE: Can you help with the Method Of Eigenfunction Expansion of a Non-Homogeneous PDE problem?
QUESTION [0 upvotes]: Here is the Problem: 
Solve $\frac{\partial T(x,t)}{\partial t} = \frac{\partial^{2} T(x,t)}{\partial x^{2}} +2xe^{-t} $ with the following boundary conditions $T(0,t)=10, and \frac{\partial T}{\partial x} (1,t)= 0 $ and initial condition $T(x,0)=10$ 
The attempt: 
We need to make the PDE homogeneous and the Boundary Conditions homogeneous by using the eigenfunction expansion method. Assume $T(x,t) = v(x,t) - r(x,t)$ which $r(x,t)$ is found by the equilibrium temperature solution. What I have is $r(x,t) = T_e(x) = -\frac{1}{3}x^{3} e^{-t}+xe^{-t} +10$, which the PDE, BC's and IC becomes 
$\frac{\partial v}{\partial t} = \frac{\partial^{2} v}{\partial x^{2}} - \frac{1}{3} x^{3} e^{-t} + xe^{-t}$ 
$v(0,t) = 0$ 
$\frac{\partial v}{\partial x} (1,t) = 0$ 
$v(x,0) = 1/3 x^{3} e^{-t} -xe^{-t} $
The Eigenvalues and eigenfunctions for the homogeneous PDE are 
$\lambda_n= \big(\frac{(2n-1)\pi  }{2}\big)^{2} $ 
$\phi_n(x) = \sin(\frac{(2n-1) \pi x}{2})$ 
From the Generalized Principle of Superposition, this would mean that 
$v(x,t) = \sum_{n=1}^{\infty} h_n(t) \phi_n(x)$  which $h_n(t) = C_n e^{-\lambda_n t}$ 
Now I did solve for $h_n(0)$ but it is too hard to type it on this software. 
So I do plug in the sub into the PDE and the way to find $q_n(t)$ is by getting an ODE from this. How do I do that in this scenario? Does this look okay so far? 
Thank you very much. I really appreciate your thoughts and inputs.

REPLY [3 votes]: The problem statement is
\begin{cases}
\begin{align}
u_t(x,t) &= u_{xx}(x,t) + 2x e^{-t} \\
u(0,t) &= 10 \\
u_x(1,t) &= 0 \\
u(x,0) &= 10.
\end{align}
\end{cases}
As it stands, separation of variables may not be used on this system since the boundary conditions are not homogeneous. However, both can be made homogeneous by the simple change
$$
w(x,t) = u(x,t) - 10.
$$
The system for $w$ is then
\begin{cases}
\begin{align}
w_t(x,t) &= w_{xx}(x,t) + 2x e^{-t} \\
w(0,t) &= 0 \\
w_x(1,t) &= 0 \\
w(x,0) &= 0.
\end{align}
\end{cases}
The condition that $w(x,0) = 0$ is not necessary, only homogeneous boundary conditions is necessary for this approach.
To find the solution, we need to find the eigenfunctions associated with the homogeneous heat equation
$$
v_t - v_{xx} = 0,
$$
with the same conditions as $w$. Separating the variables and equating to a common constant $-\lambda$, we get the system of ODEs
\begin{cases}
X'' + \lambda X = 0, &\text{with}& X(0) = 0, & X'(1) = 0 \\
T' + \lambda T = 0
\end{cases}
We know the operator on $X$ is symmetric with the given conditions, so the eigenvalues $\lambda$ are real, and any solutions $X$ identically zero are of no use. With this in mind, $\lambda = 0$ is automatically eliminated from consideration.
(i) $\lambda < 0$
\begin{align}
X(x) &= c_1 e^{\sqrt{-\lambda} x} + c_2 e^{-\sqrt{ -\lambda} x} \\
&= \tilde{c}_1 \sinh \sqrt{-\lambda} x. \\
X'(x) &= \tilde{c}_1 \sqrt{-\lambda} \cosh \sqrt{-\lambda} x,
\end{align}
and $X'(1) = 0$ iff $\tilde{c}_1 = 0$ since $\lambda < 0$ and $\cosh y > 0$ for all $y$.
(ii) $\lambda > 0$
\begin{align}
X(x) &= c_1 \cos \sqrt{\lambda} x + c_2 \sin \sqrt{\lambda} x \\
&= c_2 \sin \sqrt{\lambda}x. \\
X'(x) &= c_2 \sqrt{\lambda} \cos \sqrt{\lambda} x \\
X'(1) &= c_2 \sqrt{\lambda} \cos \sqrt{\lambda} \\
\implies X_n(x) &= c_n \sin \left(n\pi - \frac{\pi}{2} \right)x, \ \ \  n \in \mathbb{N^+}.
\end{align}
$X_n(x)$ are the eigenfunctions, and furthermore, $\phi_n(x)$ are the normalized eigenfunctions such that $\left<\phi_n(x), \phi_n(x)\right> = 1.$
$$
\phi_n(x) = \sqrt{2} \sin \left(n\pi - \frac{\pi}{2} \right)x.
$$
Now returning to the problem for $w$, let
\begin{align}
w(x,t) &= \sum_{n = 1}^\infty w_n(t) \phi_n(x) & w_n(t) &= \int_0^1 w(x,t)\phi_n(x) \, dx \\
2x e^{-t} &= \sum_{n = 1}^\infty g_n(t) \phi_n(x) &
g_n(t) &= \int_0^1 2x e^{-t} \phi_n(x) \, dx.
\end{align}
Now multiplying the nonhomogeneous heat equation for $w$ by $\phi_n(x)$ and integrating over the domain of $x$,
\begin{align}
\int_0^1 w_t(x,t) \phi_n(x) \, dx &= \int_0^1 w_{xx}(x,t) \phi_n(x) \, dx + \int_0^1 2x e^{-t} \phi_n(x) \, dx \\
\frac{d}{dt} \int_0^1 w(x,t) \phi_n(x) \, dx &= \int_0^1 w(x,t) \phi_n{''}(x) \, dx + g_n(t),
\end{align}
where here the Lagrange-Green identity was used. We now have a well-known ordinary differential equation (5) for $w_n(t)$.
\begin{align}
w_n{'}(t) &= -\lambda_n w_n(t) + g_n(t) \\
\implies w_n(t) &= w_n(0) e^{-\lambda_n t} + e^{-\lambda_n t} \int_0^t g_n(s) e^{\lambda_n s} ds \\
&= e^{-\lambda_n t} \int_0^t g_n(s) e^{\lambda_n s} ds,
\end{align}
since $w(x,0) = 0$ and $\phi_n(x) \not\equiv 0.$
$$
w_n(t) = \frac{32 \sqrt{2}}{\pi^2} \frac{e^{-\frac{\pi^2}{4}(2n-1)^2 t} - e^{-t}}{(-1)^{-n}(2n-1)^2(\pi^2(2n-1)^2 - 4)}.
$$
The solution $u$ is now known.
$$
u(x,t) = 10 + \frac{64}{\pi^2}\sum_{n = 1}^\infty \frac{\big(e^{-\frac{\pi^2}{4}(2n-1)^2 t} - e^{-t}\big)\sin \left(n\pi - \frac{\pi}{2} \right)x}{(-1)^{-n}(2n-1)^2(\pi^2(2n-1)^2 - 4)}.
$$
{"set_name": "stack_exchange", "score": 0, "question_id": 1059676}