# one dimensional wave equation solution using separation of variables

I am solving this PDE using separation of variables but stuck

$$u_{tt} − α^2 \ u_{xx} = 0, \\ 0 ≤ x ≤ 1, 0 ≤ t < ∞$$

$$u(0, t) = 0$$
$$u(1, t) = sin(t)$$
$$u(x, 0) = 0$$
$$u_{t}(x, 0) = 0$$\

$$X''(x)+k^2X(x)=0$$
$$T''(t)+(kα)^2T(t)$$

$$X(x)=Acos(kx)+Bsin(kx)$$
$$T(x)=Ccos(αkt)+Dsin(αkt)$$

$$u(0,t)=0=A(Ccos(αkt)+Dsin(αkt)$$
$$u(1,t)=sin(t)=(Acos(k)+Bsin(k))(Ccos(αkt)+Dsin(αkt)$$

what is the way forward

• that didn't work. That is why I showed how far I went Jun 7, 2023 at 8:39

The general solution of the wave equation is

$$u(x,t)=f_1(x-\alpha t)+f_2(x+\alpha t)$$

where $$f_1(x-\alpha t)$$ is a wave moving to the right and $$f_2(x+\alpha t)$$ moving to the left with the velocity $$\alpha$$.

My solution approach for this particular problem is

$$u(x,t)=x \sin (t)+\frac{1}{\pi}\sum _{k=1}^{\infty} c_{k} (d_{k} (\cos (\pi k (x-\alpha t))-\cos (\pi k (x+\alpha t)))+(\cos (\pi k x+t)-\cos (\pi k x-t)))$$

already satisfying 3 conditions (2 Dirichlet BC, 1 IC):

$$u(0,t)=0$$ $$u(x,0)=0$$ $$u(1,t)=\sin(t)$$

Now we have a look at the Neumann boundary condition $$u_{t}(x,0)=0$$:

$$u_{t}(x,0)=x+\underbrace{\frac{1}{\pi} \sum_{k=1}^{\infty} 2 c_{k}\cdot (-1+2\pi\alpha\cdot d_{k})\cdot \sin(k \pi x)}_{-x}=0$$

In order to force this equation to $$0$$, we use the Taylor series approximation:

$$-x=\frac{1}{\pi}\sum_{k=1}^{\infty} a_{k} \sin(\pi k x)=\frac{1}{\pi}\sum_{k=1}^{\infty} \frac{2 (-1)^k}{k} \sin(\pi k x)$$

In order to fit the coefficients we have to solve the equation $$2 c_{k}(-1+2\pi\alpha d_{k})=a_{k}$$. With $$d_{k}=\pi k \alpha$$ we get

$$c_{k}=\frac{(-1)^k}{k \left(\pi ^2 \alpha ^2 k^2-1\right)}$$

No we are going to visualize our solution for velocity $$\alpha=1$$: