I'm doing a bit of quantum mechanics and I'm doing a question on the infinite square well.

Anyway, I'm a bit stuck on this integral:

Does anyone know how to integrate this?

I tried reversing the product rule for 3 functions and got this:

But I didn't really get anywhere.

I know that these functions are orthogonal to each other (except for the cosine) and so if they were all sines I can use the Kronecker Delta function to evaluate them faster, but that cosine really messes things up.

Using Wolfram Alpha I got but I want to know how to do this.