We have the following problem: $$u_{tt}=c^2u_{xx}$$ $$u(x,0)=u_{t}(x,0)=0$$ $$u(0,t)=h(t),u(l,t)=k(t).$$ From the first two conditions one can deduce that $u(x,t)=0$ for $x>ct$ since the solution to the wave equation is of the form $f(x+ct)+g(x-ct)$ and for $x>ct$ we have that $f+g=0$ and $f'=g'.$ Combining these conditions implies that $f(y)=C$ and $g(y)=-C$ for some constant $C.$
The boundary condition data implies that $f(ct)+g(-ct)=h(t)$ and $f(l+ct)+g(l-ct)=k(t).$ Since $ct>0$ we have that $f(ct)=C$ and therefore for $y<0$ $$g(-ct)=-C+h(t)\implies g(y)=-C+h(-y/c).$$ Since the solution is a sum of $f(x+ct)$ and $g(x-ct)$ the final result will therefore be for $x<ct$ $$h(t-x/c).$$ The answer is however in the form of a series $$u(x,t)= h(t-x/c)-h(t+(x/2l)/c)+h(t-(x+2l)/c)-...+k(t+(x-l)/c)-k(t-(x-l)/c)+..$$ How do I go about deriving this expression?