# Thread: Integral of an Even Function

1. ## Integral of an Even Function

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.

2. Yes it's not continuous at $\displaystyle x=0$ and you can't just integrate it.

When dealing with $\displaystyle |x|$ type things usually you can split them up into...

$\displaystyle \int_{-L}^0 -x dx + \int_0^L x dx$

However since it's gonna be even in your case you can just do...

$\displaystyle 2\int_0^L x dx$

(obviously with 1-x though)

3. Edit

Actually hold on a sec.

The answer should be 2 I think but your method is wrong...
My book has it as equal to 0. Which is what prompted me to think about it some more. I figured it had something to do with not being contious at 0, my simple brain just couldn't rationalize why :P

Let's work it out in full

$\displaystyle \int_{-2}^0 (1+x)dx + \int_{0}^{-2} (1-x)dx$

$\displaystyle 2+ \frac {x^2}{2}$ evaluated from -2-->0 and

$\displaystyle -2 - \frac {x^2}{2}$ evaluated rom 0-->-2

Yeah that equals 0. Thanks mate for helping me think back. I should probably brush up on some definitions :P

5. Originally Posted by AllanCuz
My book has it as equal to 0. Which is what prompted me to think about it some more. I figured it had something to do with not being contious at 0, my simple brain just couldn't rationalize why :P

Let's work it out in full

$\displaystyle \int_{-2}^0 (1+x)dx + \int_{0}^{-2} (1-x)dx$

$\displaystyle 2+ \frac {x^2}{2}$ evaluated from -2-->0 and

$\displaystyle -2 - \frac {x^2}{2}$ evaluated rom 0-->-2

Yeah that equals 0. Thanks mate for helping me think back. I should probably brush up on some definitions :P
Ya I edited that post cos I realized I was being stupid about 3 seconds after I posted it. Plot the graph and you'll see its 0.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}