# Homework Help: Fourier Series ( basics )

1. Jul 10, 2014

### gl0ck

1. The problem statement, all variables and given/known data

Hello guys,

I have to solve one basic problem, but I got the result twice smaller that it should be. So, I am thinking that I must have missed something basic.
The problem is $$f\left(x\right) = 2x-1$$ for $0<x<1$.

I have to find the Fourier coefficients.
I have found $$A_n = \frac{2}{\pi^2}\sum \frac{ (-1)^{n} -1 }{n^2}\cos(n\pi x)$$
but the answer says $$A_n=\frac{4}{\pi^2}\sum \frac{ (-1)^n -1 }{n^2}\cos(n\pi x)$$ and $$B_n = -\frac{2}{\pi} \sum \frac{(-1)^n - 1}{n} \sin(n\pi x)$$

Also I am confused about the thing that I can see on some places formulas for An such that $$A_n = \frac{1}{L} \int_{-L}^L f(x)\cos\left(\frac{n\pi}{L}x\right)dx$$ and on some places it is $$\frac{2}{L}\int_{-L}^L f(x) \cos\left(\frac{n\pi x}{2} x\right)dx$$ in my case I solved with the second formula and get for $L - 1/2$ and formula for $An = 4 \int_0^1 (2x - 1)\cos(2n\pi x)dx$, same for $B_n$ but with sin.

Thanks and hope you could understand my question(s)

Last edited by a moderator: Jul 10, 2014
2. Jul 10, 2014

### LCKurtz

You have given a function of (0,1). That is not a periodic function. Your first decision is what periodic function you are expanding, specifically what is the definition going to be on (-1,0). There are three "natural" choices. You could just use the same formula 2x-1 on -1<x<0, or the even extension of 2x-1, or the odd extension of 2x-1 on (-1,0), and extend them periodically. The first choice would be neither even nor odd and would have both $a_n$ and $b_n$ coefficients. The second and third choices being even or odd would have only $a_n$ or $b_n$ coefficients, respectively. Those last two can use the half range formulas. Surely your text talks about that.

3. Jul 10, 2014

### gl0ck

Not sure I understand what you mean. Are you suggesting to use limits -1<x<0 or -1<x<1 ? If it is that does't it really change the answer much if it is -1<x<0 or 0<x<1.
Or you mean I should understand what is written here : http://www.math24.net/even-and-odd-extensions.html ?
The whole text of the problem says :
Find the Fourier cosine and sine series for the following functions and sketch their corresponding even and odd extensions.

Last edited: Jul 10, 2014
4. Jul 10, 2014

### LCKurtz

Yes, you need to understand that.

The point is that the even and odd extensions are in fact even and odd functions. And because of that the fourier coefficients can be calculated by using the so-called half range formulas. The idea is that the $a_n$ formulas for an even function have even integrands. So instead of doing an integral like $\int_{-a}^a$ you can do $2\int_0^a$. That's the idea behind the half range formulas and you don't have to worry about (-a,0) in the formulas.

5. Jul 11, 2014

### gl0ck

I forgot to thank you, sorry :) This helped me a lot and I solved them all :D