# A finite vibrating string initial value problem, solve using separation of variables [Solved]

We have $u_{xx} = u_{tt}$ on $0<x<L, t\geq 0$

with boundary conditions $u(0, t) = 0$ and $u(L, t)=0$

The string is released from rest with initial displacement $u(x,0) = \left\{\begin{matrix} \ 1 &\text{ for } 0 <x\leq \frac{L}{2}\\ 0 &\text{for} \frac{L}{2}<x<L \end{matrix}\right.$

What are the steps to solve this by separation of variables?

Recovering an old question by providing my answer. Hopefully this will be of instructional value.

Find u(x,t) using separation of variables. Assume $u(x,t)=X(x)T(t)$ and $\lambda$ is the separation constant.

Step 1) $\frac{X''}{X}=\frac{T''}{T}=-\lambda$ $\rightarrow T''+\lambda T = 0,t\geq0$ Notice that $X$ satisfies the boundary conditions $X(0)=X(L)=0$ and $T$ satisfies the initial condition $T'(0)=0$, (this is from $u(x,t)$).

Step 2) $\lambda >0$ must be true to have a non-trivial soplution for X. Assum $\lambda >0$, then $X(x)=Acos\sqrt{\lambda x} + Bsin\sqrt{\lambda x}$. Now the boundary conditions are $Acos(0)+Bsin(0)=Acos\sqrt{\lambda L} + B sin \sqrt{\lambda L}=0$

Step 3) For $A=0$ and nontrivial solution, $sin\sqrt{\lambda L}=0$ is a requirement. Now we can find the eigenvalues which are $\lambda_n$=($\frac{n\pi}{L})^2$, $n= 1, 2, ...$ with associated eigenfunction $X_n(x)=B_n sin \frac{n\pi x}{L}$.

Step 4) With these values of $\lambda,$ the general solution of the equation for $T$ is $T_n(t)=C_n cos\frac{n\pi t}{L} + D_Nsin\frac{n\pi t}{L},$ $n= 1, 2, ...$

To satisfy the initial condition $T'(0)=0$, we take $D_n=0$ so $T_n(t)=C_n cos\frac{n\pi t}{L},$ $n=1, 2, ...$

We now have a collection of functions call it $u_n(x,t)=X_n(x)T_n(t)=B_n sin\frac{n\pi x}{L}cos\frac{n\pi t}{L}$

Step 5) Take a linear combination of $u_n(x,t)$ we have $u(x,t)=\sum\limits_{n=1}^\infty B_n sin\frac{n\pi x}{L} cos\frac{n\pi t }{L}$ Find $B_n$ such that $u(x,0)=\sum\limits_{n=1}^\infty B_n sin\frac{n\pi x}{L}=f(x)$, where $f(x)= \begin{cases} 1, & \mbox{for } 0<x\leq L \\ 0, & \mbox{for } L/2<x\leq L \end{cases}$

The $B_n$ are the coefficients of the sine series $f(x).$ We extend $f(x)$ to an odd function with period $2L$

$g(x) = \begin{cases} f(x), & \mbox{for } 0<x\leq L \\ 0, & \mbox{for } x=0 \\-f(x), &\mbox{for }L\leq x <0\\ g(x-2L), &\mbox{everywhere}\end{cases}$

Now we can take an integral $B_n=\frac{1}{L}\int_{-L}^{L}sin\frac{n\pi x}{L} dx =-\frac{1}{L}\int_{-L/2}^{0}sin\frac{n\pi x}{L}dx+\frac{1}{L}\int_{0}^{L/2}sin\frac{n\pi x}{L}dx=$ $\frac{2(1-cos(\frac{\pi n}{2}))}{\pi n}$

The solution is $u(x,t)=\sum\limits_{n=1}^\infty \frac{2(1-cos(\frac{\pi n}{2}))}{\pi n}sin\frac{n\pi x}{L}cos\frac{n\pi t}{L}$