Finding a series solution using separation of variables A vibrating string of length 1 in a resistant medium with fixed ends, linear initial displacement, and zero initial velocity is modeled by the following problem
$$\left\{
\begin{array}{l l}
u_{tt} - c^2u_{xx} + ru_t = 0 & \quad \mbox{$0<x<1, t>0$} \\
\quad  u(x,0) =  \begin{cases} x & \textrm{ if $0\le x\le 1/2$} \\ 1-x & \textrm{ if $1/2\le x\le 1,$} \end{cases}  
\\
\quad u_t(x,0) = 0,
\\ 
u(0,t) = u(1,t) = 0,
\\
\end{array} 
\right. $$
where $r$ is a constant, and $0<r<2\pi c$. Use separation of variable to find a series solution.
I have left the condition for $u(x,0)$ blank because I'm not sure how to code into the problem another brace for the two initial conditions that it has which are $x$ if $0 \leq x \leq 1/2$ and $1-x$ if $1/2 \leq x \leq 1$.
 A: Since you are looking at a string between $x=0$ and $x=1$, it is convenient to write it as a Fourier series in $x$.
The endpoints are attached, so we only get sine terms — if you want, you can also include cosine terms and later figure out why their coefficients vanish.
The coefficients depend on $t$.
So, we write
$$
u(x,t)
=
\sum_{k=1}^\infty a_k(t)\sin(k\pi x).
$$
In each term the time- and space-dependency are separate; this is your separation of variables.
The PDE becomes
$$
\sum_{k=1}^\infty [a_k''(t)+(ck\pi)^2a_k(t)+ra_k'(t)]\sin(k\pi x)=0.
$$
Since this vanishes for all $x$ and $t$, we get for each $k$ the ODE
$$
a_k''(t)+(ck\pi)^2a_k(t)+ra_k'(t)=0.
$$
This can be solved with elementary methods, once you know $a_k(0)$ and $a_k'(0)$.
These come from your initial conditions for $u$ at $t=0$.
Using the series representation, we have
$$
u(x,0)
=
\sum_{k=1}^\infty a_k(0)\sin(k\pi x)
$$
and
$$
\partial_tu(x,0)
=
\sum_{k=1}^\infty a_k'(0)\sin(k\pi x),
$$
so the initial conditions for the ODEs are the Fourier coefficients of the initial coefficients for $u$.
You have $\partial_tu(x,0)=0$, so $a_k'(0)=0$.
To find $a_k(0)$, you need to compute the Fourier series of your function $u(x,0)$.
The Fourier series of that function can be found in tables, including the one in Wikipedia.
