I've been having some trouble with calculations involving Fourier series, despite understanding the concept itself because of the multitude of cases: symmetric/asymmetric intervals with different lengths, different conventions in different sources etc. I would like to make a small compendium for myself that would deal with the most general case.
Let's say I have a function $f$ on $A=[a,a+\tau]$, (for some $a, \tau \in \mathbb{R})$ which behaves decently, in that its domain can be divided into finitely many parts on which $f$ is continuous and monotonic. Also, insist that at any point of discontinuity, $f$ takes the value equal to the average of the upper and lower limits of $f$ at that point, and that $f(a) = f(a + \tau)$.
Let $S=\{ \phi_n : [a,a+\tau] \rightarrow \mathbb{C} \quad , \ n \in \mathbb{Z}\}$ be a set of orthogonal functions of equal norm (say $L=||\phi _i||^2$ for any $i \in \mathbb{Z}$), in the sense that for any $n,m \in \mathbb{Z}$ there is:$$\int_{a}^{a+\tau} \phi_n ^* (t) \phi_m (t) dt = L\delta_{nm}$$
Suppose I can write my function $f$ as a combination of functions from $S$:
$$f(t)=\sum_{n \in \mathbb{Z}} F[n] \phi_n (t), \quad t\in A.$$
Where the $F[n]$ are coefficients. Then, for any $m \in \mathbb{Z}$,
$$\phi_m ^*(t) f(t) = \sum_{n \in \mathbb{Z}} F[n] \phi_n (t)\phi_m^*(t)$$ $$\int_{a}^{a+\tau} \phi_m ^*(t) f(t)dt = \int_{a}^{a+\tau} \sum_{n \in \mathbb{Z}} F[n] \phi_n (t)\phi_m^*(t)dt=\sum_{n \in \mathbb{Z}}\int_{a}^{a+\tau} F[n] \phi_n (t)\phi_m^*(t)dt$$ $$=\sum_{n \in \mathbb{Z}} F[n] \int_{a}^{a+\tau} L \delta_{nm} dt=\tau L \cdot F[m]$$
Therefore $$F[m]=\frac{1}{\tau L}\int_{a}^{a+\tau} \phi_m ^*(t) f(t)dt. $$
Now, working backwards, suppose I define a function $S_f : A \rightarrow \mathbb{C}$ by: $$S_f (t) = \sum_{n \in \mathbb{Z}} F[n] \phi_n (t).$$
Where the $F[n]$'s are defined as above. Then the statement is that $S_f (t) = f(t)$ for every $t \in A$.
Example
Let $$\phi_n (t) = \exp \left( \frac{2 \pi n i}{\tau} t \right), \quad n \in \mathbb{Z}.$$ This family of functions is orthogonal on $A$, with $L=1$. Therefore, for any $f$ satisfying the appropriate conditions,
$$f(t) = \frac{1}{\tau} \sum_{n \in \mathbb{Z}} F[n] \exp \left( \frac{2 \pi n i}{\tau} t \right) \ dt$$
Let's calculate the exponential Fourier series for $f(t) = 2t, \ t \in [0,1]$. Here $a=0$, $\tau = 1$, but the endpoints don't have the same value. We can't apply the above methods to $f$, but we can apply them to $g$, which is a new function obtained by modifying the function $f$ by fixing the two values at the endpoints to be $g(0)=g(1)=1=\frac{1}{2}(f(0)+f(1))$ and leaving the rest as it is. Now we can calculate the coefficients for $g$: $$G[n] = \int_{0}^{1} \phi_n ^*(t) f(t)dt = \int_{0}^{1} \exp \left(- 2 \pi n i t \right) (2t)dt = \frac{-i}{n \pi}, \ n \neq 0, \quad G[0]=1.$$
Therefore, for any $t \in [0,1]$, $$g(t)=1+ \sum_{n \in \mathbb{Z \setminus \{ 0 \} }} \frac{-i}{n \pi} \exp(2 \pi n i t)$$
Since $g(t)=f(t)$ on $(0,1)$, we can say that for any $t\in (0,1)$, $$2t=1+\sum_{n \in \mathbb{Z \setminus \{ 0 \}}} \frac{-i}{n \pi} \exp(2 \pi n i t)$$
I would appreciate it if someone could look through this and see if there are any mistakes.