# Needs some hints regarding Fourier series

Determine the fourier series for the function defined by:

$f(x) = 2x$ for $0 < x < 2\pi$, and $f(x+2\pi) = f(x)$

The Fourier series coefficients are defined as follows:

$$A_0 = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(x) dx$$ and, for $n \geq 1$, $$A_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x) \cos(nx) dx$$ $$B_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x) \sin(nx) dx$$

I have three questions.

Is $A_0 = 0$ ? Is $A_n = 0$? Is $B_n =$ (something nonzero)?

Here is my reasoning: https://gyazo.com/e91c055d76da4837082c79be73f494bc

This has been my approach so far. I can't seem to get the right answer so I have to root out what I am doing wrong with some help. I am attempting to do fourier series for the first time ever.

Here is the graph I have drawn:

https://gyazo.com/70bc06f7eedb101e0f46a1619328fbc2

I am also looking for some kind webpage or program where I can plot in the information I have to get a correct answer.

• What formulas do you have for $A_n$ and $B_n$? Note that your three questions can be answered without evaluating the integrals. See if you can understand why $A_0$ will be zero if and only if the average value of $f$ over $[0,2\pi]$ is zero. Also, observe that the integrals are the same whether you integrate from $0$ to $2\pi$ or from $-\pi$ to $\pi$. What conditions on $f$ would suffice to make these integrals zero? (Hint: consider odd and even functions.)
– user169852
Dec 11, 2015 at 20:45
• @Bungo Hi Bungo. Thank you for your answer. I am updating the OP with my formulas. I also know about the things, odd or even. I also know that you can integrate the same plus part of the integral and times by 2 instead of going from negative to positive. Dec 11, 2015 at 20:48
• I edited your post to add the formulas for the coefficients. If you click "edit", you will be able to see how I did it, in case you want to try MathJax typesetting in future questions (which is encouraged!)
– user169852
Dec 11, 2015 at 21:12

I'm reproducing your original link to the formulas you are using for completeness: https://gyazo.com/81653210303c42b1b5dcdae717690842

Here is a typeset version in case the link goes stale in the future: $$a_0 = \frac{1}{2L}\int_{-L}^{L} f(x) dx$$ and, for $n \geq 1$, $$a_n = \frac{1}{L}\int_{-L}^{L} f(x) \cos\left(\frac{n\pi x}{L}\right) dx$$ $$b_n = \frac{1}{L}\int_{-L}^{L} f(x) \sin\left(\frac{n\pi x}{L}\right) dx$$ These formulas are in a slightly nonstandard form. At first glance, you might expect that $L$ is the period of the function $f$. But in fact, when computing Fourier series coefficients, we always integrate over one period. These integrals are taken over $[-L,L]$, which has length $2L$, so in fact this means that $L$ is half of the period. Your function has period $2\pi$, so we need to take $L = \pi$.

Rewriting your formulas with $L = \pi$ gives us $$a_0 = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(x) dx$$ and, for $n \geq 1$, $$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x) \cos(nx) dx$$ $$b_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x) \sin(nx) dx$$ Notice that the formula for $a_0$ is simply the average value of $f$ over the interval $[-\pi, \pi]$. You should be able to see at a glance that the average of your function is nonzero: indeed, it is strictly positive because the function is always nonnegative, and each "triangle" has positive area.

Now, look at the defining integrals for $a_n$ and $b_n$. See if you can convince yourself that if we replace $f(x)$ with $g(x) = f(x) - a_0$, the values of $a_n$ and $b_n$ do not change. This is because $\int_{-\pi}^{\pi} a_0 \cos(nx) dx = \int_{-\pi}^{\pi}a_0 \sin(nx) dx = 0$ since $a_0$ is just a constant.

Observe that $g(x) = f(x) - a_0$ is odd: you can see this by shifting the graph downward by $a_0$. That means that one of the integrals will be zero (which one?)

• Nicely done sir! Dec 11, 2015 at 21:08
• But where does -pi to pi come from? I thought L was 2pi. How can I just rewrite it like that? I thought I was going to integrate one period. So from -2pi to 2pi I guess. I realize now that's 2 periods .. but it still says L in the formulas, so I am a little bit confused. I have a rule that says if a function is odd it's, 0, so is my graph drawn wrong? Dec 11, 2015 at 21:18
• Your function has period $2\pi$. If you integrate from $-2\pi$ to $2\pi$ you will be integrating over two periods, not one. Note that your function $f$ is not odd. An odd function satisfies $f(-x) = -f(x)$ for all $x$. If we plug in $x=\pi$ for example, your function gives us $f(\pi) = 2\pi$ and $f(-\pi) = 2\pi$ (not $-2\pi$), so $f$ is not odd. However, if we shift your function downward by $2\pi$ we get a new function $g(x) = f(x) - 2\pi$ which is odd.
– user169852
Dec 11, 2015 at 21:21
• Can I integrate from 0 to 2pi instead then? It seems easier. But, wouldn't I get different answers if pick different points on the x-line, because the triangles wouldn't be always the same? or is the area the same because in one period no matter where I pick the area is always the same? Dec 11, 2015 at 21:28
• @Bungo. I thank you for your help. I have an exam in 3 days, and I learned Fourier series in one day. I managed to do the fourier series on older exam papers very easily. Dec 12, 2015 at 18:58