What is the $L$ in the Fourier series term? I am a bit confused about this:
I want to calculate the Fourier series $S^f$ of $f(x)$, where $f$ is periodic with period $k\in \mathbb{R}$.
I know that the equations for my terms are:
$$a_n=\frac{\color{red}{2}}{L} \int_{-L}^L f(x)\cos {\frac{n\pi x}{L}} dx$$
$$b_n=\frac{\color{red}{2}}{L} \int_{-L}^L f(x)\sin {\frac{n\pi x}{L}} dx$$
How do I know what is $L$?
Example:$$
f(x)=\left\{\begin{matrix}
L+x, & -L\leq x <0\\ 
L-x, & 0 \leq x<L
\end{matrix}\right.$$
Assume that the given function is periodically extended outside the original interval.
I am getting confused between $L=2 \pi$ and $L=\pi$ in this example.
Another one:
$$f(x)=\left\{\begin{matrix}
0, & -1\leq x <0\\ 
x^2/4, & 0 \leq x<1
\end{matrix}\right.$$
 A: For the formula for Fourier coefficients, the function is originally defined on $[-L,L]$, and then the function is extended to a periodic function on ${\mathbb R}$. 
So in your first example the $L$ in the formula for Fourier coefficients is the same as the $L$ in the definition of the function, while in the second case the $L$ in the formula for Fourier coefficients is equal to $1$.
A: In math terms $[-L,L]$ is the interval where the function is defined on, which is going to be extended on $\mathbb{R}$. 
Physically speaking, for example, in heat conduction, $L$ is considered to be the length of a bar with transversal section of area S. See figure. 
$\hskip1.2in$
Imagine the bar is placed over the x-axis. Then the temperature of a point x in the x-axis is represented by $u(x,t)$ at the time $t$. Notice that the temperature independs of the y and z coordinates. As shown in the next figure. 
$\hskip0.5in$
In other words we take the region $R$ determined by $0<x<L$ and $t>0$, and $\overline{R}$ to be $\lbrace 0 \leq x \leq L, t\geq 0 \rbrace $, where the function is determined. 
To understand more the intuition of it, see here
In future approaches, as in disc, spheres, among others, I believe this the example above  might help you see things through. 
