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.
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?)