Fourier Series of a Constant Function My question is kinda dumb, but here I go: I'm studying Fourier Series on my own for my next semester. I needed to calculate the Fourier Series of the function $f(x) = 5$ defined in $[-4,4]$. 
In this case, using the standard notation, $L = 4$ are the coefficients are
$a_{0} = \dfrac{1}{L} \displaystyle \int_{-L}^{L} f(x) \ dx$; $a_{n} = \dfrac{1}{L} \displaystyle \int_{-L}^{L} f(x) \cdot \cos\bigg(\dfrac{n\pi x}{L}\bigg) \ dx$ and $b_{n} = \dfrac{1}{L} \displaystyle \int_{-L}^{L} f(x) \cdot \sin\bigg(\dfrac{n\pi x}{L}\bigg) \ dx$, correct?
Since the function is constant the sines and cosines must have no contribution to the Fourier series at all, i.e., $a_{n} = b_{n} = 0$, but when I'm doing the calculations I'm getting $a_{n} = \dfrac{10}{\pi n} \sin(\pi n)$. It must be a pretty dumb mistake I'm not seeing, I'm kinda new at this subject.
Thanks for the help :]
 A: This complements the previous answers by providing an additional answer to the title: Fourier series approximation of a constant.
The answers before are all correct for the example presented over the domain $x\in[-4,4]$. Now consider the case of the sine Fourier series for $f(x)=1$ in the interval $x\in(0, \pi)$. You need to create the odd extension of $f(x)$, i.e. $f(x)=-1, \;x\in[-\pi,0)$ (I want $f$ to be piecewise continuous in $x\in(-\pi, \pi)$). In such case,
$$a_{n}\equiv0\text {, whereas}$$
$$b_{n} = \dfrac{2}{\pi}\int_{0}^{\pi}\sin{(nx)}dx = \dfrac{2}{\pi}\left[1 - (-1)^{n} \right]$$
With this, the sine Fourier series approximation to the constant function $f(x)=1$ in $x\in(0, \pi)$ is
$$1 = \dfrac{4}{\pi}\sum_{n=0}^{\infty}\dfrac{\sin[(2n+1)x]}{(2n+1)}$$
This approximation has some issues at the end points $x=\{0, \pi\}$ which results from the discontinuity of the odd extension, converging to $f(0)=f(\pi)=0$. Not a problem when considering the open interval $x\in(0, \pi)$. All in all, this presents a well documented example in which the Fourier series is not the average ($a_{0}=1$). Besides, the sine series of a constant arises in the 1D wave equation with constant forcing, with Dirichlet bc on one end and Neumann bc on the other end.
enter image description here
A: $a_n = $$\frac {1}{L}\int_{-L}^L 5\cos(\frac {n\pi x}{L}) dx\\
\frac {1}{L}(5\sin(\frac {n\pi x}{L})(\frac {L}{n\pi})|_{-L}^L\\
(\frac {5}{n\pi})(\sin( {n\pi})-\sin(-{n\pi})) = 0$
since $\sin( {n\pi}) = 0$
$b_n = $$\frac {1}{L}\int_{-L}^L 5\sin(\frac {n\pi x}{L}) dx\\
\frac {1}{L}(-5\cos(\frac {n\pi x}{L})(\frac {L}{n\pi})|_{-L}^L\\
(\frac {-5}{n\pi})(\cos( {n\pi})-\cos(-{n\pi})) = 0$
since $\cos x$ is an even function.
A: As a footnote to the other answers/comments showing that $a_n$ and $b_n$ are zero for all $n>0$, it is important to see that this means that the "Fourier series" of a constant function is actually just the constant function itself. 
In a normal Fourier series one can shift it up or down with this constant term $a_0$. However, in this case, the constant term is all you need: you just put $f(x)=a_0=5$ and make the coefficient in front of the other terms zero. 
