The sketch of the function:

2468101214161820-2-4123456tf(t)Open image in a new page

Graph of `f(t)`, a rectangular function.

We need to find the Fourier coefficients a0, an and bn before we can determine the series.







Note 1: We could have found this value easily by observing that the graph is totally above the t-axis and finding the area under the curve from t = −4 to t = 4. It is just 2 rectangles, one with height `0` so the area is `0`, and the other rectangle has dimensions `4` by `5`, thus the area is `20`. So the integral part has value `20`; and `1/4` of `20 = 5`.

Note 2: The mean value of our function is given by `(a_0)/2`. Our function has value 5 for half of the time and value 0 for the other half, so the value of `(a_0)/2` must be 2.5. So a0 will have value 5.

These points can help us check our work and help us understand what is going on. However, it is good to see how the integration works for a split function like this.

`a_n=1/Lint_(-L)^L f(t)\ cos {:(n pi t)/L:} dt`

`=1/4int_(-4)^4f(t)\ cos {:(n pi t)/4 :}dt`

`=1/4(int_(-4)^0(0) cos {:(n pi t)/4 :} dt:}` `{: + int_0^4(5) cos {:(n pi t)/4 :}dt)`

`=1/4(0+[5 4/(n pi) sin {:(n pi t)/4 :}]_0^4)`

`=1/4xx5xx4/(n pi)([sin {: (n pi t)/4 :}]_0^4)`

`=5/(n pi)( sin {: (n pi (4) )/4 :} - sin {: (n pi (0) )/4 :} )`

`=5/(n pi)(sin n pi-0)`


Note 3: In the next section, Even and Odd Functions, we'll see that we don't even need to calculate an in this example. We can tell it will have value 0 before we start.

`b_n=1/Lint_(-L)^Lf(t)\ sin {:(n pi t)/L:}dt`

`=1/4int_(-4)^4f(t)\ sin {:(n pi t)/4:}dt`

`=1/4(int_(-4)^0(0)\ sin {:(n pi t)/4 :}dt` `{:+int_0^4(5)\ sin {:(n pi t)/4 :}dt)`

`=1/4(0:}` `{:+[(-5) (4/(n pi)) cos {:(n pi t)/4:}]_0^4)`

`=-(1/4)(5)(4/(n pi))[cos {:(n pi t)/4 :}]_0^4`

`=-5/(n pi)(cos {:(n pi(4))/4:}-1)`

`=-5/(n pi)(cos n pi-1)`

At this point, we can substitute this into our Fourier Series formula:

`f(t)=a_0/2+sum_(n=1)^oo a_n\ cos {:(n pi t)/L :}` `+sum_(n=1)^oo b_n\ sin {:(n pi t)/L:}`

`=5/2+sum_(n=1)^oo(0)\ cos {:(n pi t)/4 :}` `+sum_(n=1)^oo-5/(n pi)(cos n pi-1)\ sin {:(n pi t)/4:}`

`=2.5` `-5/pisum_(n=1)^oo1/n(cos npi-1)\ sin {:(n pi t)/4:}`

Now, we substitute `n = 1, 2, 3,...` into the expression inside the series:

`n` `1/n(cos npi-1)sin{:(n pi t)/4 :}`
`1` `1/1(cos pi-1)\ sin{:(pi t)/4 :}` `=-2\ sin {:(pi t)/4 :}`
`2` `1/2(cos 2pi-1)\ sin{:(2 pi t)/4 :}=0`
`3` `1/3(cos 3pi-1)\ sin{:(3pi t)/4 :}` `=-2/3\ sin {:(3pi t)/4 :}`
`4` `1/4(cos 4pi-1)\ sin{:(4 pi t)/4 :}=0`
`5` `1/5(cos 5pi-1)\ sin{:(5 pi t)/4 :}` `=-2/5\ sin {:(5 pi t)/4 :}`
`6` `1/6(cos 6pi-1)\ sin{:(6 pi t)/4 :}=0`
`7` `1/7(cos 7pi-1)\ sin{:(7pi t)/4 :}` `=-2/7\ sin {:(7 pi t)/4 :}`

Now we can write out the first few terms of the required Fourier Series:

`f(t)=2.5-5/pi(-2\ sin{:(pi t)/4:}` `-2/3 sin {:(3pit)/4:}` `{:-2/5 sin {:(5pit)/4:}-...)`

`=2.5+10/pi(sin {:(pi t)/4:}` `+1/3 sin {:(3 pit)/4:}` `+1/5 sin {:(5pi t)/4:}` `{:+...)`