Hello,
I have an example were they determine the Cn coefficient for a Fourier series:

My problem is i don't follow what happens in the following moment:

neither am i sure how the two e^-inwt comes to be cos(nwt) in the last part.
The only solution I can come up with is to reverse the limits what is obvious and then say: t=-a --> -1*t=-1*-a and then change a for -a in the limit and t for -t. However this doesn't work in other similar problems so I don't think think this is right.
I have an example were they determine the Cn coefficient for a Fourier series:

My problem is i don't follow what happens in the following moment:

neither am i sure how the two e^-inwt comes to be cos(nwt) in the last part.
The only solution I can come up with is to reverse the limits what is obvious and then say: t=-a --> -1*t=-1*-a and then change a for -a in the limit and t for -t. However this doesn't work in other similar problems so I don't think think this is right.