# Separation of variables for nonhomogeneous equations

I’m trying to learn PDE from An introduction to partial differential equations, Pinchover and Rubinstein. On page 114 section 5.4 it explains the use of separation of variables for nonhomogeneous equations. For example, consider the problem$$u_{tt}-u_{xx}=\cos(2\pi x)\cos(2\pi t), x>0, x<1 ,t>0$$ $$u_x(0,t)=u_x(1,t)=0, t\geqslant 0$$ $$u(x,0)=f(x)= \cos^2(\pi x), x\geqslant 0, x\leq 1$$ $$u_t(x,0)=g(x)=2\cos(2\pi x), x\geqslant 0, x\leq 1.$$ The system of all eigenfunctions and the corresponding eigenvalues of the homogeneous problem are: $$X_n(x)=\cos(n\pi x), \lambda_n=(n\pi)^2, n=0,1,2,...$$ For a fixed $$t$$ the solution $$u$$ can be represented as $$u(x,t)=(\frac{1}{2}) T_0(t) + \sum_{n=1} ^ {\infty} T_n(t)\cos(n\pi x)$$ where $$T_n(t)$$ are the (time dependent) Fourier coefficients of the function $$u(.,t)$$!!!

Can anyone please explain what is going on? How one can solve a nonhomogeneous wave equation using separation of variables method and the idea behind it ? Thanks.

• See here. Feb 21, 2019 at 12:00

Consider the initial boundary problem $$\left\{ \begin{array}{lll} &u_{tt}-c^2u_{xx}=F(x,t),\; a0,\\ &\text{homogeneous boundary conditions on } (a,b),\\ &u(x,0)=f(x),\; a Solving steps:

• Solve eigenvalue problem $$-X_k''=\lambda_k X_k,$$ with homogeneous boundary conditions on $$(a,b)$$.

• Find Fourier series expansions $$F=\sum F_kX_k,$$ $$f=\sum f_kX_k,$$ $$g=\sum g_kX_k.$$

• Solve ODE problems $$T''_k(t)+c^2\lambda_kT_k(t)=F_k,\; T_k(0)=f_k,\;T'_k(0)=g_k.$$

• Then solution of $$(1)$$ is $$u=\sum T_k(t)X_k$$

For example, consider the problem(Pinchover and Rubinstein, An introduction to partial differential equations, p. 114, section 5.4) $$$$\begin{split} &u_{tt}-u_{xx}=\cos2\pi x\cos2\pi t,\; 00,\\ &u_x(0,t)=u_x(1,t)=0,\;t\ge0,\\ &u(x,0)=\cos^2\pi x,\; 0\le x\le 1,\\ &u_t(x,0)=2\cos2\pi x,\; 0\le x\le 1.\\ \end{split}$$$$

• Solutions of eigenvalue problem $$-X_k''=\lambda_k X_k,\;X'_k(0)=X'_k(1)=0$$ is $$X_k(x)=\cos(k\pi x),\quad \lambda_k=(k\pi)^2,\quad k=0,1,2,\dots$$
• $$F=\cos2\pi x\cos2\pi t$$. Then $$F_k=\begin{cases} \cos2\pi t \text{ if } k=2, & \\ 0 \text{ if } k\neq2. \end{cases}$$ $$f=\cos^2\pi x=\frac12+\frac{\cos2\pi x}{2}$$. Then $$f_k=\begin{cases} \frac12 \text{ if } k=0\quad \text{or} \quad k=2, & \\ 0 \text{ in other cases} \end{cases}$$ $$g=2\cos2\pi x$$. Then $$g_k=\begin{cases} 2\text{ if } k=2, & \\ 0 \text{ if } k\neq2. \end{cases}$$
• If $$k=0$$ then $$X_0=1$$, $$\lambda_0=0$$, ODE problem is $$T''_0(t)=0,\; T_k(0)=\frac12,\;T'_k(0)=0.$$

If $$k=2$$ then $$\lambda_2=4\pi^2$$, ODE problem is $$T''_2(t)+4\pi^2T_2(t)=\cos2\pi t,\; T_2(0)=\frac12,\;T'_2(0)=2.$$ We obtain $$T_0(t)=\frac12,$$ $$T_2(t)=\frac{\left( t+4\right) \sin{ 2\pi t }}{4\pi }+\frac{\cos{ 2\pi t }}{2},$$ $$T_k(t)=0 \text{ if } k\neq0,\;2.$$

• Final solution is $$u=T_0(t)X_0+T_2(t)X_2= \frac12+\left(\frac{\left( t+4\right) \sin{ 2\pi t }}{4\pi }+\frac{\cos{ 2\pi t }}{2}\right)\cos 2\pi x$$