TITLE: Specific solution to the $1D$ wave equation
QUESTION [5 upvotes]: So my current solution to the $1D$ wave equation is (with my given boundary and initial conditions):
$$y(x,t) = \sum_{n=1}^\infty C_n\cdot \sin\frac{n \pi x}{2 l}\cdot\cos\frac{n \pi c t}{2 l}$$
However there is one final initial condition that is piecewise, I'm unsure of how to apply this and the solutions expected are of a infinite series (fourier series).
The last initial condition is:
$$y(x,0)= \begin{cases}
     R\cdot\frac{x}{l} & \quad 0\le x\le 1 \\
    R\cdot\left(2 - \frac{x}{l}\right) & \quad l\le x\le 2 l
\end{cases}$$
Any help or advice on solving is much appreciated.

REPLY [3 votes]: Assuming all of our changes are correct, you can get all the $C_n$ by using the formula of the Fourier sine series coefficients:
The solution tells you that $y(x,0)=\sum_{n=1}^\infty C_n\sin\left(\frac{n\pi x}{2l}\right)$, and the condition tells you that this series must equal that piecewise function.
Thus $$C_n=\frac{1}{l}\int_0^{2l}y(x,0)\sin\left(\frac{n\pi x}{2l}\right)dx.$$
Since the function is given piecewise you have to break it up into two integrals:
$$C_n=\frac{1}{l}\int_0^l R\cdot\frac{x}{l}\sin\left(\frac{n\pi x}{2l}\right)dx+\frac{1}{l}\int_l^{2l}R\left(2-\frac{x}{l}\right)\sin\left(\frac{n\pi x}{2l}\right)dx$$
It is kind of tedious to make sure you don't lose any of these constants while integrating, but you should be able to solve it from here (look up $\int x\sin(ax)dx$ in a table to make it go quicker if you want).