Fourier Series - Periodicity I don't know if I'm doing something wrong in this exercise.
$f(t)=\pi-t$, if $0<t<\pi$
$f(t)=0$, if $\pi<t<2\pi$
I have to find the Fourier Series of $f(t)$

I define the Fourier Series like this:
T: period
$$f(t)=\frac{a_0}{2}+\sum_{n=1}^{\infty}[a_n.\cos{\frac{2\pi nt}{T}}+b_n.\sin{\frac{2\pi nt}{T}}]$$
where ($\alpha$ is a real number)
$$a_0=\frac{2}{T}.\int_{\alpha}^{\alpha+T}f(t)dt$$
$$a_n=\frac{2}{T}.\int_{\alpha}^{\alpha+T}f(t).\cos{\frac{2\pi nt}{T}}dt$$
$$b_n=\frac{2}{T}.\int_{\alpha}^{\alpha+T}f(t).\sin{\frac{2\pi nt}{T}}dt$$
Here's the problem: I think that $T=4\pi$, because I extend the function $f(t)$ from $-2\pi$ to $2\pi$, so I have this:
$$a_0=\frac{1}{2\pi}.\int_{-2\pi}^{2\pi}f(t)dt=\frac{1}{\pi}.\int_{0}^{2\pi}f(t)dt$$
$$a_n=\frac{1}{2\pi}.\int_{-2\pi}^{2\pi}f(t).\cos{\frac{nt}{2}}dt=\frac{1}{\pi}.\int_{0}^{2\pi}f(t).\cos{\frac{nt}{2}}dt$$
$$b_n=\frac{1}{2\pi}.\int_{-2\pi}^{2\pi}f(t).\sin{\frac{nt}{2}}dt=\frac{1}{\pi}.\int_{0}^{2\pi}f(t).\sin{\frac{nt}{2}}dt$$
But other people took $T=2\pi$ and they have:
$$a_0=\frac{2}{2\pi}.\int_{0}^{2\pi}f(t)dt=\frac{1}{\pi}.\int_{0}^{2\pi}f(t)dt$$
$$a_n=\frac{2}{2\pi}.\int_{0}^{2\pi}f(t).\cos{nt} dt=\frac{1}{\pi}.\int_{0}^{2\pi}f(t).\cos{nt} \mathrm{d}t$$
$$a_n=\frac{2}{2\pi}.\int_{0}^{2\pi}f(t).\sin{nt} dt=\frac{1}{\pi}.\int_{0}^{2\pi}f(t).\sin{nt} \mathrm{d}t$$
Look that he took the integral between 0 and $2\pi$ and I took it from $-2\pi$ to $2\pi$
Did I do something wrong? Why this he took the period from 0 to $2\pi$? $f(t)$ is not a periodic function?
Thanks!
 A: It does not matter whether we choose to extend $f$ so that the period is $2 \pi$ or $4 \pi$. Your problem is a simplification you made when determining the coefficients.
$$a_n = \frac{2}{4 \pi} \int_{-2 \pi}^{2\pi} f(t) \cos{\frac{n t}{2}} \ dt \neq \frac{1}{\pi} \int_{0}^{2\pi} f(t) \cos{\frac{n t}{2}} \ dt,$$ because when you extend your function $f(t)$ to the interval $[-2 \pi, 2 \pi]$ it is NOT an even function. So, you must compute the integral over the whole interval and not make this incorrect simplification.
What you will find is that when $n$ is odd, you will get $a_n = b_n = 0$ and that when $n$ is even you will get the same answer as you would get by thinking of the function as only having a period of $2 \pi$
A: i get these: $a_0 = \frac{1}{2\pi} \int_0^\pi (\pi - t)\, dt = \frac{\pi}{4}$
and $a_n = \frac{1}{\pi}\int_0^\pi (\pi - t)\cos nt \, dt = \frac{2}{\pi n^2}$ if $n$ is odd and $0$ otherwise. same way i get $b_n = \frac{1}{\pi}\int_0^\pi (\pi - t)\sin nt \, dt= \dfrac{1}{n}.$
so the fourier series looks like $$f \simeq\dfrac{\pi}{4} + \sin t + \dfrac{2}{\pi}\cos t + \cdots $$
A: $f$ is only defined in an interval, so that $f$ can be made periodic by extending it to the entire real line (or just to $[-2\pi,2\pi]$ if you prefer). In the end, the period $T$ of $f$ will be $2\pi$ because that's the length of the original interval ($[0,2\pi]$) in which $f$ was defined.
Your calculations are correct, because $4\pi$ is also a period of $f$, altough it is not the fundamental period (the smallest positive number that can be called "a period" of $f$). So both of the following are correct?
$$f(t)=\frac{a_0}{2}+\sum_{n=1}^{\infty}[a_n.\cos{\frac{2\pi nt}{T}}+b_n.\sin{\frac{2\pi nt}{T}}]$$
$$f(t)=\frac{\tilde a_0}{2}+\sum_{n=1}^{\infty}[\tilde a_n.\cos{\frac{2\pi nt}{\tilde T}}+\tilde b_n.\sin{\frac{2\pi nt}{\tilde T}}]$$
Where $a_n$ and $\tilde a_n$ (etc) are the coefficients from both formulas you posted (one considering $T=2\pi$, and the other $\tilde T=4\pi$).
Yes, they are the same. What's happening is that $\tilde a_n=\tilde b_n=0$ whenever $n$ is odd. You can check that this makes the formulas equal.
EDIT: the calculations are not entirely correct, because, as mentioned in Kevin Discroll's answer, you cannot make the simplifications for reducing the integral over $[-2\pi,2\pi]$ to twice the integral over $[0,2\pi]$ (you could make this simplification if the integrand was just $f(t)$, but you can't for the integrand $f(t)\cos nt/2$; see the comments in his answer). My answer above is only true if you define: $$\tilde a_n = \frac1{2\pi}\int_{-2\pi}^{2\pi}f(t)\cos (nt/2) dt$$ and likewise for $\tilde b_n$.
