Section 8.6 : Fourier Series
Okay, in the previous two sections we’ve looked at Fourier sine and Fourier cosine series. It is now time to look at a Fourier series. With a Fourier series we are going to try to write a series representation for f(x) on −L≤x≤L in the form,
f(x)=∞∑n=0Ancos(nπxL)+∞∑n=1Bnsin(nπxL)So, a Fourier series is, in some way a combination of the Fourier sine and Fourier cosine series. Also, like the Fourier sine/cosine series we’ll not worry about whether or not the series will actually converge to f(x) or not at this point. For now we’ll just assume that it will converge and we’ll discuss the convergence of the Fourier series in a later section.
Determining formulas for the coefficients, An and Bn, will be done in exactly the same manner as we did in the previous two sections. We will take advantage of the fact that {cos(nπxL)}∞n=0 and {sin(nπxL)}∞n=1 are mutually orthogonal on −L≤x≤L as we proved earlier. We’ll also need the following formulas that we derived when we proved the two sets were mutually orthogonal.
∫L−Lcos(nπxL)cos(mπxL)dx={2Lif n=m=0Lif n=m≠00if n≠m∫L−Lsin(nπxL)sin(mπxL)dx={Lif n=m0if n≠m∫L−Lsin(nπxL)cos(mπxL)dx=0So, let’s start off by multiplying both sides of the series above by cos(mπxL) and integrating from –L to L. Doing this gives,
∫L−Lf(x)cos(mπxL)dx=∫L−L∞∑n=0Ancos(nπxL)cos(mπxL)dx+∫L−L∞∑n=1Bnsin(nπxL)cos(mπxL)dxNow, just as we’ve been able to do in the last two sections we can interchange the integral and the summation. Doing this gives,
∫L−Lf(x)cos(mπxL)dx=∞∑n=0An∫L−Lcos(nπxL)cos(mπxL)dx+∞∑n=1Bn∫L−Lsin(nπxL)cos(mπxL)dxWe can now take advantage of the fact that the sines and cosines are mutually orthogonal. The integral in the second series will always be zero and in the first series the integral will be zero if n≠m and so this reduces to,
∫L−Lf(x)cos(mπxL)dx={Am(2L)if n=m=0Am(L)if n=m≠0Solving for Am gives,
A0=12L∫L−Lf(x)dxAm=1L∫L−Lf(x)cos(mπxL)dxm=1,2,3,…Now, do it all over again only this time multiply both sides by sin(mπxL), integrate both sides from –L to L and interchange the integral and summation to get,
∫L−Lf(x)sin(mπxL)dx=∞∑n=0An∫L−Lcos(nπxL)sin(mπxL)dx+∞∑n=1Bn∫L−Lsin(nπxL)sin(mπxL)dxIn this case the integral in the first series will always be zero and the second will be zero if n≠m and so we get,
∫L−Lf(x)sin(mπxL)dx=Bm(L)Finally, solving for Bm gives,
Bm=1L∫L−Lf(x)sin(mπxL)dxm=1,2,3,…In the previous two sections we also took advantage of the fact that the integrand was even to give a second form of the coefficients in terms of an integral from 0 to L. However, in this case we don’t know anything about whether f(x) will be even, odd, or more likely neither even nor odd. Therefore, this is the only form of the coefficients for the Fourier series.
Before we start examples let’s remind ourselves of a couple of formulas that we’ll make heavy use of here in this section, as we’ve done in the previous two sections as well. Provided n in an integer then,
cos(nπ)=(−1)nsin(nπ)=0In all of the work that we’ll be doing here n will be an integer and so we’ll use these without comment in the problems so be prepared for them.
Also, don’t forget that sine is an odd function, i.e. sin(−x)=−sin(x) and that cosine is an even function, i.e. cos(−x)=cos(x). We’ll also be making heavy use of these ideas without comment in many of the integral evaluations so be ready for these as well.
Now let’s take a look at an example.
So, let’s go ahead and just run through formulas for the coefficients.
A0=12L∫L−Lf(x)dx=12L∫L−LL−xdx=L An=1L∫L−Lf(x)cos(nπxL)dx=1L∫L−L(L−x)cos(nπxL)dx=1L(Ln2π2)(nπ(L−x)sin(nπxL)−Lcos(nπxL))|L−L=1L(Ln2π2)(−2nπLsin(−nπ))=0n=1,2,3,… Bn=1L∫L−Lf(x)sin(nπxL)dx=1L∫L−L(L−x)sin(nπxL)dx=1L(−Ln2π2)[Lsin(nπxL)−nπ(x−L)cos(nπxL)]|L−L=1L[L2n2π2(2nπcos(nπ)−2sin(nπ))]=2L(−1)nnπn=1,2,3,…Note that in this case we had A0≠0 and An=0,n=1,2,3,… This will happen on occasion so don’t get excited about this kind of thing when it happens.
The Fourier series is then,
f(x)=∞∑n=0Ancos(nπxL)+∞∑n=1Bnsin(nπxL)=A0+∞∑n=1Ancos(nπxL)+∞∑n=1Bnsin(nπxL)=L+∞∑n=12L(−1)nnπsin(nπxL)As we saw in the previous example sometimes we’ll get A0≠0 and An=0,n=1,2,3,… Whether or not this will happen will depend upon the function f(x) and often won’t happen, but when it does don’t get excited about it.
Let’s take a look at another problem.
Because of the piece-wise nature of the function the work for the coefficients is going to be a little unpleasant but let’s get on with it.
A0=12L∫L−Lf(x)dx=12L[∫0−Lf(x)dx+∫L0f(x)dx]=12L[∫0−LLdx+∫L02xdx]=12L[L2+L2]=L An=1L∫L−Lf(x)cos(nπxL)dx=1L[∫0−Lf(x)cos(nπxL)dx+∫L0f(x)cos(nπxL)dx]=1L[∫0−LLcos(nπxL)dx+∫L02xcos(nπxL)dx]At this point it will probably be easier to do each of these individually.
∫0−LLcos(nπxL)dx=(L2nπsin(nπxL))|0−L=L2nπsin(nπ)=0 ∫L02xcos(nπxL)dx=(2Ln2π2)(Lcos(nπxL)+nπxsin(nπxL))|L0=(2Ln2π2)(Lcos(nπ)+nπLsin(nπ)−Lcos(0))=(2L2n2π2)((−1)n−1)So, if we put all of this together we have,
An=1L∫L−Lf(x)cos(nπxL)dx=1L[0+(2L2n2π2)((−1)n−1)]=2Ln2π2((−1)n−1),n=1,2,3,…So, we’ve gotten the coefficients for the cosines taken care of and now we need to take care of the coefficients for the sines.
Bn=1L∫L−Lf(x)sin(nπxL)dx=1L[∫0−Lf(x)sin(nπxL)dx+∫L0f(x)sin(nπxL)dx]=1L[∫0−LLsin(nπxL)dx+∫L02xsin(nπxL)dx]As with the coefficients for the cosines will probably be easier to do each of these individually.
∫0−LLsin(nπxL)dx=(−L2nπcos(nπxL))|0−L=L2nπ(−1+cos(nπ))=L2nπ((−1)n−1) ∫L02xsin(nπxL)dx=(2Ln2π2)(Lsin(nπxL)−nπxcos(nπxL))|L0=(2Ln2π2)(Lsin(nπ)−nπLcos(nπ))=(2L2n2π2)(−nπ(−1)n)=−2L2nπ(−1)nSo, if we put all of this together we have,
Bn=1L∫L−Lf(x)sin(nπxL)dx=1L[L2nπ((−1)n−1)−2L2nπ(−1)n]=Lnπ[−1−(−1)n]=−Lnπ(1+(−1)n)n=1,2,3,…So, after all that work the Fourier series is,
f(x)=∞∑n=0Ancos(nπxL)+∞∑n=1Bnsin(nπxL)=A0+∞∑n=1Ancos(nπxL)+∞∑n=1Bnsin(nπxL)=L+∞∑n=12Ln2π2((−1)n−1)cos(nπxL)−∞∑n=1Lnπ(1+(−1)n)sin(nπxL)As we saw in the previous example there is often quite a bit of work involved in computing the integrals involved here.
The next couple of examples are here so we can make a nice observation about some Fourier series and their relation to Fourier sine/cosine series
Let’s start with the integrals for An.
A0=12L∫L−Lf(x)dx=12L∫L−Lxdx=0 An=1L∫L−Lf(x)cos(nπxL)dx=1L∫L−Lxcos(nπxL)dx=0In both cases note that we are integrating an odd function (x is odd and cosine is even so the product is odd) over the interval [−L,L] and so we know that both of these integrals will be zero.
Next here is the integral for Bn
Bn=1L∫L−Lf(x)sin(nπxL)dx=1L∫L−Lxsin(nπxL)dx=2L∫L0xsin(nπxL)dxIn this case we’re integrating an even function (x and sine are both odd so the product is even) on the interval [−L,L] and so we can “simplify” the integral as shown above. The reason for doing this here is not actually to simplify the integral however. It is instead done so that we can note that we did this integral back in the Fourier sine series section and so don’t need to redo it in this section. Using the previous result we get,
Bn=(−1)n+12Lnπn=1,2,3,…In this case the Fourier series is,
f(x)=∞∑n=0Ancos(nπxL)+∞∑n=1Bnsin(nπxL)=∞∑n=1(−1)n+12Lnπsin(nπxL)If you go back and take a look at Example 1 in the Fourier sine series section, the same example we used to get the integral out of, you will see that in that example we were finding the Fourier sine series for f(x)=x on −L≤x≤L. The important thing to note here is that the answer that we got in that example is identical to the answer we got here.
If you think about it however, this should not be too surprising. In both cases we were using an odd function on −L≤x≤L and because we know that we had an odd function the coefficients of the cosines in the Fourier series, An, will involve integrating and odd function over a symmetric interval, −L≤x≤L, and so will be zero. So, in these cases the Fourier sine series of an odd function on −L≤x≤L is really just a special case of a Fourier series.
Note however that when we moved over to doing the Fourier sine series of any function on 0≤x≤L we should no longer expect to get the same results. You can see this by comparing Example 1 above with Example 3 in the Fourier sine series section. In both examples we are finding the series for f(x)=x−L and yet got very different answers.
So, why did we get different answers in this case? Recall that when we find the Fourier sine series of a function on 0≤x≤L we are really finding the Fourier sine series of the odd extension of the function on −L≤x≤L and then just restricting the result down to 0≤x≤L. For a Fourier series we are actually using the whole function on −L≤x≤L instead of its odd extension. We should therefore not expect to get the same results since we are really using different functions (at least on part of the interval) in each case.
So, if the Fourier sine series of an odd function is just a special case of a Fourier series it makes some sense that the Fourier cosine series of an even function should also be a special case of a Fourier series. Let’s do a quick example to verify this.
Here are the integrals for the An and in this case because both the function and cosine are even we’ll be integrating an even function and so can “simplify” the integral.
A0=12L∫L−Lf(x)dx=12L∫L−Lx2dx=1L∫L0x2dx An=1L∫L−Lf(x)cos(nπxL)dx=1L∫L−Lx2cos(nπxL)dx=2L∫L0x2cos(nπxL)dxAs with the previous example both of these integrals were done in Example 1 in the Fourier cosine series section and so we’ll not bother redoing them here. The coefficients are,
A0=L23An=4L2(−1)nn2π2,n=1,2,3,…Next here is the integral for the Bn
Bn=1L∫L−Lf(x)sin(nπxL)dx=1L∫L−Lx2sin(nπxL)dx=0In this case the function is even and sine is odd so the product is odd and we’re integrating over −L≤x≤L and so the integral is zero.
The Fourier series is then,
f(x)=∞∑n=0Ancos(nπxL)+∞∑n=1Bnsin(nπxL)=L23+∞∑n=14L2(−1)nn2π2cos(nπxL)As suggested before we started this example the result here is identical to the result from Example 1 in the Fourier cosine series section and so we can see that the Fourier cosine series of an even function is just a special case a Fourier series.