Fourier's Serier

Where are you stuck finding $a_n$? I think you need to integrate by parts twice for the first and one time for the second.