You need to know the orthogonal properties of sine and cosine.
(If L>0 we have):
.
.
.
Here .
indeed! and the first two are 0 if
you know i didn't know about these rules until after my differential equations class was over! i always had to do it the hard way (the product to sum formulas)