# Solving an inhomogeneous wave equation

I'm currently working on an exercise about an inhomogeneous wave equation (PDE) and I can't seem to figure it out completely.

The equation is: $u_{tt}-u_{xx}=\cos{2t}$

With the boundary/initial conditions:

$u(0,t)=u(1,t)=0$

$u(x,0)=0$

$u_t (x,0)=\sum_{n=1}^{\infty} \sin{2 \pi n x}$

Solving the homogeneous problem is fairly straight-forward, I came to a solution of the kind

$u(x,t)=\sum_{n=1}^{\infty} a_n \sin{n \pi x} \sin{n \pi t}$

How can I include the inhomogeneous $\cos(2t)$ now? I have been thinking about this a bit and I think I am basically looking for a special solution $v(x,t)$ that solves the wave equation and also

$v(0,t)=v(1,t)=0,~v(x,0)=0,~v_t (x,0)=0$,

i.e. does not change the boundary conditions. Is this the right way to tackle this problem, and if so, how do I proceed?

-
This question has been solved perfectly. Hope that the asker has been diving enough and accept the answer at an early date. – doraemonpaul Apr 21 '13 at 2:15

Let $u(x,t)=\sum\limits_{n=1}^\infty C(n,t)\sin n\pi x$ so that it automatically satisfies $u(0,t)=u(1,t)=0$ ,

Then $\sum\limits_{n=1}^\infty C_{tt}(n,t)\sin n\pi x+\sum\limits_{n=1}^\infty n^2\pi^2C(n,t)\sin n\pi x=\cos2t$

$\sum\limits_{n=1}^\infty(C_{tt}(n,t)+n^2\pi^2C(n,t))\sin n\pi x=\sum\limits_{n=1}^\infty2\cos2t\int_k^{k+1}\sin n\pi x~dx~\sin n\pi x$ , $\forall k\in\mathbb{Z}$ , $x\in(k,k+1)$

$\sum\limits_{n=1}^\infty(C_{tt}(n,t)+n^2\pi^2C(n,t))\sin n\pi x=\sum\limits_{n=1}^\infty2\cos2t\left[-\dfrac{\cos n\pi x}{n\pi}\right]_k^{k+1}\sin n\pi x$ , $\forall k\in\mathbb{Z}$ , $x\in(k,k+1)$

$\sum\limits_{n=1}^\infty(C_{tt}(n,t)+n^2\pi^2C(n,t))\sin n\pi x=\sum\limits_{n=1}^\infty\dfrac{2((-1)^{nk}-(-1)^{n(k+1)})\cos2t\sin n\pi x}{n\pi}$ , $\forall k\in\mathbb{Z}$ , $x\in(k,k+1)$

$\sum\limits_{n=1}^\infty(C_{tt}(n,t)+n^2\pi^2C(n,t))\sin n\pi x=\sum\limits_{n=1}^\infty\dfrac{2(1-(-1)^n)\text{sgn}(\sin\pi x)\cos2t\sin n\pi x}{n\pi}$

$\therefore C_{tt}(n,t)+n^2\pi^2C(n,t)=\dfrac{2(1-(-1)^n)\text{sgn}(\sin\pi x)\cos2t}{n\pi}$

$C(n,t)=C_1(n)\sin n\pi t+C_2(n)\cos n\pi t+\dfrac{2(1-(-1)^n)\text{sgn}(\sin\pi x)\cos2t}{n\pi(n^2\pi^2-4)}$

$\therefore u(x,t)=\sum\limits_{n=1}^\infty C_1(n)\sin n\pi x\sin n\pi t+\sum\limits_{n=1}^\infty C_2(n)\sin n\pi x\cos n\pi t+\sum\limits_{n=1}^\infty\dfrac{2(1-(-1)^n)\text{sgn}(\sin\pi x)\sin n\pi x\cos2t}{n\pi(n^2\pi^2-4)}$

$u(x,0)=0$ :

$\sum\limits_{n=1}^\infty C_2(n)\sin n\pi x+\sum\limits_{n=1}^\infty\dfrac{2(1-(-1)^n)\text{sgn}(\sin\pi x)\sin n\pi x}{n\pi(n^2\pi^2-4)}=0$

$\sum\limits_{n=1}^\infty C_2(n)\sin n\pi x=\sum\limits_{n=1}^\infty\dfrac{2((-1)^n-1)\text{sgn}(\sin\pi x)\sin n\pi x}{n\pi(n^2\pi^2-4)}$

$C_2(n)=\dfrac{2((-1)^n-1)\text{sgn}(\sin\pi x)}{n\pi(n^2\pi^2-4)}$

$\therefore u(x,t)=\sum\limits_{n=1}^\infty C_1(n)\sin n\pi x\sin n\pi t+\sum\limits_{n=1}^\infty\dfrac{2((-1)^n-1)\text{sgn}(\sin\pi x)\sin n\pi x\cos n\pi t}{n\pi(n^2\pi^2-4)}+\sum\limits_{n=1}^\infty\dfrac{2(1-(-1)^n)\text{sgn}(\sin\pi x)\sin n\pi x\cos2t}{n\pi(n^2\pi^2-4)}=\sum\limits_{n=1}^\infty C_1(n)\sin n\pi x\sin n\pi t-\sum\limits_{n=1}^\infty\dfrac{2~\text{sgn}(\sin\pi x)\sin((2n-1)\pi x)\cos((2n-1)\pi t)}{(2n-1)\pi((2n-1)^2\pi^2-4)}+\sum\limits_{n=1}^\infty\dfrac{2~\text{sgn}(\sin\pi x)\sin((2n-1)\pi x)\cos2t}{(2n-1)\pi((2n-1)^2\pi^2-4)}$

$u_t(x,t)=\sum\limits_{n=1}^\infty n\pi C_1(n)\sin n\pi x\cos n\pi t+\sum\limits_{n=1}^\infty\dfrac{2(2n-1)\pi~\text{sgn}(\sin\pi x)\sin((2n-1)\pi x)\sin((2n-1)\pi t)}{(2n-1)\pi((2n-1)^2\pi^2-4)}-\sum\limits_{n=1}^\infty\dfrac{4~\text{sgn}(\sin\pi x)\sin((2n-1)\pi x)\sin2t}{(2n-1)\pi((2n-1)^2\pi^2-4)}$

$u_t(x,0)=\sum\limits_{n=1}^\infty\sin2n\pi x$ :

$\sum\limits_{n=1}^\infty n\pi C_1(n)\sin n\pi x=\sum\limits_{n=1}^\infty\sin2n\pi x$

$n\pi C_1(n)=\begin{cases}0&\text{when}~n~\text{is an odd integer}\\1&\text{when}~n~\text{is an even integer}\end{cases}$

$C_1(n)=\begin{cases}0&\text{when}~n~\text{is an odd integer}\\\dfrac{1}{n\pi}&\text{when}~n~\text{is an even integer}\end{cases}$

$\therefore u(x,t)=\sum\limits_{n=1}^\infty\dfrac{\sin2n\pi x\sin2n\pi t}{2n\pi}-\sum\limits_{n=1}^\infty\dfrac{2~\text{sgn}(\sin\pi x)\sin((2n-1)\pi x)\cos((2n-1)\pi t)}{(2n-1)\pi((2n-1)^2\pi^2-4)}+\sum\limits_{n=1}^\infty\dfrac{2~\text{sgn}(\sin\pi x)\sin((2n-1)\pi x)\cos2t}{(2n-1)\pi((2n-1)^2\pi^2-4)}$

-