# Solving non-homogeneous wave equation by separating method

I am studying PDEs by myself. I need your help to know that if I do correct or not.
Some days ago I asked a question on a wave equation with non-homogeneous boundary conditions.(Here) After some discussion, we reached to a non-homogeneouss PDE with homogeneous B.Cs.
I tried to solve the new equation in my free-times, but I couldn't. The new equation is:

\begin{cases} v_{tt}=v_{xx}+(\frac{-2}{\pi}x+2)\sin(t) & 0\leq x\leq\pi\\ v(x,0)=x\\ v_t(x,0)=\frac{2}{\pi}x-2\\ v_x(0,t)=v_x(\pi,t)=0 \end{cases}

I know I should solve the equation for a homogeneous case, and then find the answer... But how to do that?
Let $v(x,t)=F(x,t)+G(x,t)$ where $F(x,t)$ is the solution of homogeneous case. Then we have: $$v_{tt}=F_{tt}+G_{tt}$$ and $$v_{xx}=F_{xx}+G_{xx}$$ So from the PDE: $$F_{tt}+G_{tt}=F_{xx}+G_{xx}+(\frac{-2}{\pi}x+2)\sin(t)$$ Since we look for homogeneous case: $$G_{xx}-G_{tt}=-(\frac{-2}{\pi}x+2)\sin(t)$$ It looks like a loop! Because this new one is as same as our main equation :|
HINT: Go back to your original equation: $$v_{tt}=v_{xx}+(\frac{-2}{\pi}x+2)\sin(t)$$ Define $u = x + t$ and $w = x - t$. Write the derivatives $v_{xx}$ and $v_{tt}$ in terms of derivatives with respect to $u$ and $w$ instead. The resulting equation will be much easier to solve.
It looks like you are misunderstanding "homogeneous case" (I would say "associated homogeneous equation"). Here the associated homogeneous equation is $G_{xx}- G_{tt}= 0$. Separating, write G(x, t)= X(x)T(t) so the equation becomes $X''(x)T(t)- X(x)T''(t)= 0$. Dividing both sides by X(x)T(t) that becomes $X''/X= T''/T$. Since those are to be equal for all x and t, they must be the same constant. $\frac{X''}{X}= \lambda$ so $X''= \lambda X$ and $\frac{T''}{T}= \lambda$ so $X''= \lambda X$ for constants $\lambda$. You have probably done that before and recognize that the solutions can be written as a Fourier series in t. Now write the "non-homogeneous" part, $\left(-\frac{2}{\pi}x+ 2\right)sin(t)$ as a Fourier series in t- that is just Bsin(t) where $A= -\frac{2}{\pi}x+ 2$ and all other coefficients are 0.
According to the above hint: \begin{cases} r=x+t\\ s=x-t \end{cases} \begin{cases} x=\frac{r+s}{2}\\ t=\frac{r-s}{2} \end{cases} so, $$\frac{\partial^2 v}{\partial x^2}=\frac{\partial^2 v}{\partial s^2}.(\frac{\partial s}{\partial x})^2+2\frac{\partial^2 v}{\partial s \partial r}.\frac{\partial s}{\partial x}.\frac{\partial r}{\partial x} +\frac{\partial^2 v}{\partial r^2}.(\frac{\partial r}{\partial x})^2+\frac{\partial v}{\partial s}.\frac{\partial^2 s}{\partial x^2}+\frac{\partial v}{\partial r}.\frac{\partial^2 r}{\partial x^2}$$ $$v_{xx}=v_{ss}+2v_{sr}+v_{rr}$$ and $$\frac{\partial^2 v}{\partial t^2}=\frac{\partial^2 v}{\partial s^2}.(\frac{\partial s}{\partial t})^2+2\frac{\partial^2 v}{\partial s \partial r}.\frac{\partial s}{\partial t}.\frac{\partial r}{\partial t} +\frac{\partial^2 v}{\partial r^2}.(\frac{\partial r}{\partial t})^2+\frac{\partial v}{\partial s}.\frac{\partial^2 s}{\partial t^2}+\frac{\partial v}{\partial r}.\frac{\partial^2 r}{\partial t^2}$$ $$v_{tt}=v_{ss}-2v_{sr}+v_{rr}$$ Now we have: $$v_{ss}-2v_{sr}+v_{rr}=v_{ss}+2v_{sr}+v_{rr}+(\frac{-2}{\pi}(\frac{r+s}{2})+2)\sin(\frac{r-s}{2})$$ $$4v_{sr}=(\frac{r+s}{\pi}-2)\sin(\frac{r-s}{2})$$ Now this is easy to solve :)