Hmm. I'd say your expression for should be
Your initial integral there had the wrong limits. Your final expression is correct (you fixed your error in there somewhere.)
You're confusing yourself, I think. Constructing a trigonometric Fourier series is a two-step process (depending on how you count steps):
1. Compute the coefficients and , including That is, compute
2. Write out the representation of the function as
Note: the wiki has a slightly different account. Consult it to see how the factors work.
I've seen you do some good work on computing the coefficients, but I have not seen you do step 2 correctly yet.
I have to be honest that I am confused. The reason for that is everywhere I look the formulas for , and are different.
For instance these two expressions are not the same to me:
I noted also the expressions from wiki and when I apply these I should get the same result but I don't. For example:
Should I apply this result to (1)?
But when I computed the above:
should I apply (2) for this result?
I would appriciate a clarification about this.
For a -periodic integrable function , you have
Here the notation
just means integrate over one period. The endpoints of the interval over which you integrate are unimportant, except that you must have Also, you'll notice that I've used a dummy variable for the integrations so as not to collide with the of
The stuff inside the parentheses are "essentially" the Fourier coefficients. Different authors put the in different places, depending on their preferences. So the key to remember is that those factors are there somehow, and that the cosine integrals get multiplied by the cosine terms, and the same for the sin integrals.
Does this clear things up a bit?
In your case, simply choose a = 0, b = 2pi. You have a 2pi-periodic function. That means you can choose the 2pi-wide interval that you want to use. So pick the easiest one: [0,2pi]. All of the integrals in the big equation I wrote above must be 2pi-wide. That's the important thing: you capture one period in each interval. Nothing else matters. I would just pick the same interval for all three integrals: it's the easiest thing to do.