First, we sketch the curve:

12345-11-1tf(t)Open image in a new page

Graph of `f(t)`.

This function is an even function, so `b_n= 0`. We only need to find a0 and an.

`a_0 = 1/Lint_(-L)^Lf(t)dt`


`=int_(-1)^(-0.5)0\ dt` `+int_(-0.5)^0.5cos 3pi t\ dt` `+int_0.5^1 0\ dt`

`=[(sin 3pi t)/(3 pi)]_(-0.5)^0.5`


Now for an. We will use Scientific Notebook to perform the integration:

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

`=int_(-1)^1f(t)\ cos n pi t\ dt`

`=0` `+int_(-0.5)^(0.5)cos 3 pi t\ cos n pi t\ dt` `+0`

`=6 (cos {:(n pi)/2 :})/(pi(-9+n^2))`

(We used Scientific Notebook for the final answer.)

Recall that `cos((nπ)/2) = 0` for n odd and `+1` or `-1` for n even. (See the Helpful Revision page.)

So we expect 0 for every odd term.

However, we cannot have `n = 3` in this expression, since the denominator would be `0`. In this situation, we need to integrate for `n = 3` to see if there is a value. In fact, we will use SNB to find the values up to `n = 5`, to see what is happening:

When `n=1`,

`int_(-1//2)^(1//2)cos 3 pi t\ cos pi t\ dt=0`

When `n=2`,

`int_(-1//2)^(1//2)cos 3 pi t\ cos 2pi t\ dt=6/(5pi)`

When `n=3`,

`int_(-1//2)^(1//2)cos 3 pi t\ cos 3pi t\ dt=1/2`

(We see there is in fact a value for the integral when `n=3`.)

When `n=4`,

`int_(-1//2)^(1//2)cos 3 pi t\ cos 4pi t\ dt=6/(7pi)`

When `n=5`,

`int_(-1//2)^(1//2)cos 3 pi t\ cos 5pi t\ dt=0`

So we will start our series by writing out the terms for `n = 2` and `n = 3`, then use summation notation from `n = 4`:

`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:}`

`=a_0/2+6/(5pi) cos 2 pi t+1/2 cos 3pit` `+sum_(n=4)^oo a_n cos {:(npit)/L:}`

`=-1/(3pi)+(6\ cos 2pit)/(5pi)` `+(cos 3pit)/2` `+sum_(n=4)^oo 6 (cos{:(npi)/2:})/(pi(-9+n^2)) cos npit`

As usual, we graph the first few terms and see that our series is correct:

12345-11-1tf(t)Open image in a new page

Graph of `f(t)`, the Fourier series approximation of our given periodic function.

Solution without Scientific Notebook:

The integration for an could have been performed as follows. We re-express the function using a trick based on what we learned in Sum and Difference of Two Angles.

In general, `cos(A+B)` `=cosAcosB-sinAsinB`.

If we let

`A=3pit` and `B=npit`,

then the cos expression becomes:

`cos(3pit+npit)` `=cos3pit cos npit - sin3pit sin npit` ... (1)

Taking the negative case:

`cos(3pit-npit)` `=cos3pit cos npit + sin3pit sin npit` ... (2)

Adding equations (1) and (2) gives:

`cos(3pit+npit)+cos(3pit-npit)` `=2cos3pit cos npit`

Reversing sides, dividing both sides by `2`, and factoring, we have:

`cos 3pi t cos n pi t` `=1/2[cos(3+n)pit+cos(3-n)pit]`

So our integral becomes

`int_(-1//2)^(1//2)cos 3pit\ cos npi t\ dt`

`=1/2int_(-1//2)^(1//2)[cos(3+n)pit` `{:+cos(3-n)pit]dt`

`=1/2[(sin(3+n)pit)/((3+n)pi)` `{:+(sin(3-n)pit)/((3-n)pi)]_(-1//2)^(1//2)`

It is then necessary to substitute `t = 1/2` and `t = -1/2`, and subtract as usual, then simplify the expression in `n`.

After integrating, we could have expressed an as follows:

`a_n=6((-1)^(n//2))/(pi(-9+n^2))`, `\ \ n` even (`0` if `n` odd, `n!=3`), or as:

` =6((-1)^n)/(pi(-9+4n^2)),\ \ \n=1,2,3,...`

Then we could have substituted this expression into the series. However, we would still need to consider separately the case when `n = 3`.

Easy to understand math videos: