This is probably going to be one of those questions where I can't believe I was so dumb but...What I'm trying to do is calculate the fourier series of some function. This is okay, but I'm having a problem with my integral.

In the fourier series Ao is given by

$\displaystyle Ao = \frac {1}{L} \int_{-L}^{L} f(x)dx $

The fourier series I'm attempting to calculate is for

$\displaystyle f(x) = 1 - |x|$ for $\displaystyle -2 \le x \le 2 $

Let us note that this function is even

$\displaystyle f(-1)=0=f(1)$

So Ao should simplify to

$\displaystyle Ao = \frac {2}{L} \int_{0}^{L} f(x)dx $

We then plug in the values and obtain

$\displaystyle Ao = \int_{0}^{2} (1-|x|)dx $

$\displaystyle Ao = 2 - \frac {x^2}{2} $ evaluated from 0-->2

This of course yields

$\displaystyle Ao = 2 - 2 = 0$

Now, I was fiddling with this. And had I not changed my integral I get a different answer.

$\displaystyle Ao = \frac {1}{L} \int_{-L}^{L} f(x)dx $

$\displaystyle Ao = \frac {1}{2} \int_{-2}^{2} (1-|x|)dx $

$\displaystyle Ao = \frac {1}{2} (4-\frac {x^2}{2} ) $ evaluted from -2-->2

$\displaystyle Ao = \frac {1}{2} (4-[\frac {4}{2} - \frac {4}{2}] $

$\displaystyle Ao = 2 $

I'm sure that I have violated some law in the second evaluation, i don't remember what is is though. Is this because the equation isn't valid on the left side of the XY domain and that the derivative at 0 doesn't exist? I think I vaguely remember something about this from first year.