Section 8.5 : Fourier Cosine Series
In this section we’re going to take a look at Fourier cosine series. We’ll start off much as we did in the previous section where we looked at Fourier sine series. Let’s start by assuming that the function, f(x), we’ll be working with initially is an even function (i.e. f(−x)=f(x)) and that we want to write a series representation for this function on −L≤x≤L in terms of cosines (which are also even). In other words, we are going to look for the following,
f(x)=∞∑n=0Ancos(nπxL)This series is called a Fourier cosine series and note that in this case (unlike with Fourier sine series) we’re able to start the series representation at n=0 since that term will not be zero as it was with sines. Also, as with Fourier Sine series, the argument of nπxL in the cosines is being used only because it is the argument that we’ll be running into in the next chapter. The only real requirement here is that the given set of functions we’re using be orthogonal on the interval we’re working on.
Note as well that we’re assuming that the series will in fact converge to f(x) on −L≤x≤L at this point. In a later section we’ll be looking into the convergence of this series in more detail.
So, to determine a formula for the coefficients, An, we’ll use the fact that {cos(nπxL)}∞n=0 do form an orthogonal set on the interval −L≤x≤L as we showed in a previous section. In that section we also derived the following formula that we’ll need in a bit.
∫L−Lcos(nπxL)cos(mπxL)dx={2Lif n=m=0Lif n=m≠00if n≠mWe’ll get a formula for the coefficients in almost exactly the same fashion that we did in the previous section. We’ll start with the representation above and multiply both sides by cos(mπxL) where m is a fixed integer in the range {0,1,2,3,…}. Doing this gives,
f(x)cos(mπxL)=∞∑n=0Ancos(nπxL)cos(mπxL)Next, we integrate both sides from x=−L to x=L and as we were able to do with the Fourier Sine series we can again interchange the integral and the series.
∫L−Lf(x)cos(mπxL)dx=∫L−L∞∑n=0Ancos(nπxL)cos(mπxL)dx=∞∑n=0An∫L−Lcos(nπxL)cos(mπxL)dxWe now know that the all of the integrals on the right side will be zero except when n=m because the set of cosines form an orthogonal set on the interval −L≤x≤L. However, we need to be careful about the value of m (or n depending on the letter you want to use). So, after evaluating all of the integrals we arrive at the following set of formulas for the coefficients.
m=0:∫L−Lf(x)dx=A0(2L)⇒A0=12L∫L−Lf(x)dx m≠0:
∫L−Lf(x)cos(mπxL)dx=Am(L)⇒Am=1L∫L−Lf(x)cos(mπxL)dx
Summarizing everything up then, the Fourier cosine series of an even function, f(x) on −L≤x≤L is given by,
f(x)=∞∑n=0Ancos(nπxL)An={12L∫L−Lf(x)dxn=01L∫L−Lf(x)cos(nπxL)dxn≠0Finally, before we work an example, let’s notice that because both f(x) and the cosines are even the integrand in both of the integrals above is even and so we can write the formulas for the An’s as follows,
An={1L∫L0f(x)dxn=02L∫L0f(x)cos(nπxL)dxn≠0Now let’s take a look at an example.
We clearly have an even function here and so all we really need to do is compute the coefficients and they are liable to be a little messy because we’ll need to do integration by parts twice. We’ll leave most of the actual integration details to you to verify.
A0=1L∫L0f(x)dx=1L∫L0x2dx=1L(L33)=L23 An=2L∫L0f(x)cos(nπxL)dx=2L∫L0x2cos(nπxL)dx=2L(Ln3π3)(2Lnπxcos(nπxL)+(n2π2x2−2L2)sin(nπxL))|L0=2n3π3(2L2nπcos(nπ)+(n2π2L2−2L2)sin(nπ))=4L2(−1)nn2π2n=1,2,3,…The coefficients are then,
A0=L23An=4L2(−1)nn2π2,n=1,2,3,…The Fourier cosine series is then,
x2=∞∑n=0Ancos(nπxL)=A0+∞∑n=1Ancos(nπxL)=L23+∞∑n=14L2(−1)nn2π2cos(nπxL)Note that we’ll often strip out the n=0 from the series as we’ve done here because it will almost always be different from the other coefficients and it allows us to actually plug the coefficients into the series.
Now, just as we did in the previous section let’s ask what we need to do in order to find the Fourier cosine series of a function that is not even. As with Fourier sine series when we make this change we’ll need to move onto the interval 0≤x≤L now instead of −L≤x≤L and again we’ll assume that the series will converge to f(x) at this point and leave the discussion of the convergence of this series to a later section.
We could go through the work to find the coefficients here twice as we did with Fourier sine series, however there’s no real reason to. So, while we could redo all the work above to get formulas for the coefficients let’s instead go straight to the second method of finding the coefficients.
In this case, before we actually proceed with this we’ll need to define the even extension of a function, f(x) on −L≤x≤L. So, given a function f(x) we’ll define the even extension of the function as,
g(x)={f(x)if 0≤x≤Lf(−x)if −L≤x≤0Showing that this is an even function is simple enough.
g(−x)=f(−(−x))=f(x)=g(x)for 0<x<Land we can see that g(x)=f(x) on 0≤x≤L and if f(x) is already an even function we get g(x)=f(x) on −L≤x≤L.
Let’s take a look at some functions and sketch the even extensions for the functions.
- f(x)=L−x on 0≤x≤L
- f(x)=x3 on 0≤x≤L
- f(x)={L2if 0≤x≤L2x−L2if L2≤x≤L
Here is the even extension of this function.
g(x)={f(x)if 0≤x≤Lf(−x)if −L≤x≤0={L−xif 0≤x≤LL+xif −L≤x≤0Here is the graph of both the original function and its even extension. Note that we’ve put the “extension” in with a dashed line to make it clear the portion of the function that is being added to allow us to get the even extension
![There are two graph in this image. For each the horizontal axis has tick marks at x=-L and x=L and the vertical axis has a tick mark at y=L. Only the 1st and 2nd quadrants are shown. In the left graph there is a line in the 1st quadrant connecting the points (L,0) and (0,L). In the right graph there is a solid line in the 1st quadrant connecting the points (L,0) and (0,L) as well as a dashed line connecting the points (-L,0) and (0, L).](FourierCosineSeries_Files/image001.png)
b f(x)=x3 on 0≤x≤L Show Solution
The even extension of this function is,
g(x)={f(x)if 0≤x≤Lf(−x)if −L≤x≤0={x3if 0≤x≤L−x3if −L≤x≤0The sketch of the function and the even extension is,
![There are two graph in this image. For each the horizontal axis has tick marks at x=-L and x=L and the vertical axis has a tick mark at $y=L^{3}$. Only the 1st and 2nd quadrants are shown. In the left graph there is the portion of $y=x^{3}$ in the 1st quadrant connecting the points (0,0) and (L,$L^{3}$). In the left graph there is the portion of $y=x^{3}$ (represented as a solid line) in the 1st quadrant connecting the points (0,0) and (L,$L^{3}$). There is also the portion of $y=-x^{3}$ (represented as a dashed line) in the 2nd quadrant connecting the points (0,0) and (-L,$L^{3}$).](FourierCosineSeries_Files/image002.png)
c f(x)={L2if 0≤x≤L2x−L2if L2≤x≤L Show Solution
Here is the even extension of this function,
g(x)={f(x)if 0≤x≤Lf(−x)if −L≤x≤0={x−L2if L2≤x≤LL2if 0≤x≤L2L2if −L2≤x≤0−x−L2if −L≤x≤−L2The sketch of the function and the even extension is,
![There are two graph in this image. For each the horizontal axis has tick marks at x=-L, x=-L/2, x=L/2 and x=L and the vertical axis has a tick mark at y=L/2. Only the 1st and 2nd quadrants are shown. In the left graph there is a horizontal line in the 1st quadrant connecting the points (0, L/2) and (L/2, L/2) as well as a line connecting the points (L/2,0) and (L, L/2). In the right graph there is a horizontal line in the 1st quadrant connecting the points (0, L/2) and (L/2, L/2) as well as a line connecting the points (L/2,0) and (L, L/2). Each of these are represented with solid lines. There is also a horizontal line in the 2nd quadrant connecting the points (0, L/2) and (-L/2, L/2) as well as a line connecting the points (-L/2,0) and (-L, L/2). Each of these are represented with dashed lines.](FourierCosineSeries_Files/image003.png)
Okay, let’s now think about how we can use the even extension of a function to find the Fourier cosine series of any function f(x) on 0≤x≤L.
So, given a function f(x) we’ll let g(x) be the even extension as defined above. Now, g(x) is an even function on −L≤x≤L and so we can write down its Fourier cosine series. This is,
g(x)=∞∑n=0Ancos(nπxL)An={1L∫L0f(x)dxn=02L∫L0f(x)cos(nπxL)dxn≠0and note that we’ll use the second form of the integrals to compute the constants.
Now, because we know that on 0≤x≤L we have f(x)=g(x) and so the Fourier cosine series of f(x) on 0≤x≤L is also given by,
f(x)=∞∑n=0Ancos(nπxL)An={1L∫L0f(x)dxn=02L∫L0f(x)cos(nπxL)dxn≠0Let’s take a look at a couple of examples.
All we need to do is compute the coefficients so here is the work for that,
A0=1L∫L0f(x)dx=1L∫L0L−xdx=L2 An=2L∫L0f(x)cos(nπxL)dx=2L∫L0(L−x)cos(nπxL)dx=2L(Ln2π2)(nπ(L−x)sin(nπxL)−Lcos(nπxL))|L0=2L(Ln2π2)(−Lcos(nπ)+L)=2Ln2π2(1+(−1)n+1)n=1,2,3,…The Fourier cosine series is then,
f(x)=L2+∞∑n=12Ln2π2(1+(−1)n+1)cos(nπxL)Note that as we did with the first example in this section we stripped out the A0 term before we plugged in the coefficients.
Next, let’s find the Fourier cosine series of an odd function. Note that this is doable because we are really finding the Fourier cosine series of the even extension of the function.
The integral for A0 is simple enough but the integral for the rest will be fairly messy as it will require three integration by parts. We’ll leave most of the details of the actual integration to you to verify. Here’s the work,
A0=1L∫L0f(x)dx=1L∫L0x3dx=L34 An=2L∫L0f(x)cos(nπxL)dx=2L∫L0x3cos(nπxL)dx=2L(Ln4π4)(nπx(n2π2x2−6L2)sin(nπxL)+(3Ln2π2x2−6L3)cos(nπxL))|L0=2L(Ln4π4)(nπL(n2π2L2−6L2)sin(nπ)+(3L3n2π2−6L3)cos(nπ)+6L3)=2L(3L4n4π4)(2+(n2π2−2)(−1)n)=6L3n4π4(2+(n2π2−2)(−1)n)n=1,2,3,…The Fourier cosine series for this function is then,
f(x)=L34+∞∑n=16L3n4π4(2+(n2π2−2)(−1)n)cos(nπxL)Finally, let’s take a quick look at a piecewise function.
We’ll need to split up the integrals for each of the coefficients here. Here are the coefficients.
A0=1L∫L0f(x)dx=1L[∫L20f(x)dx+∫LL2f(x)dx]=1L[∫L20L2dx+∫LL2x−L2dx]=1L[L24+L28]=1L[3L28]=3L8For the rest of the coefficients here is the integral we’ll need to do.
An=2L∫L0f(x)cos(nπxL)dx=2L[∫L20f(x)cos(nπxL)dx+∫LL2f(x)cos(nπxL)dx]=2L[∫L20L2cos(nπxL)dx+∫LL2(x−L2)cos(nπxL)dx]To make life a little easier let’s do each of these separately.
∫L20L2cos(nπxL)dx=L2(Lnπ)sin(nπxL)|L20=L2(Lnπ)sin(nπ2)=L22nπsin(nπ2) ∫LL2(x−L2)cos(nπxL)dx=Lnπ(Lnπcos(nπxL)+(x−L2)sin(nπxL))|LL2=Lnπ(Lnπcos(nπ)+L2sin(nπ)−Lnπcos(nπ2))=L2n2π2((−1)n−cos(nπ2))Putting these together gives,
An=2L[L22nπsin(nπ2)+L2n2π2((−1)n−cos(nπ2))]=2Ln2π2[(−1)n−cos(nπ2)+nπ2sin(nπ2)]So, after all that work the Fourier cosine series is then,
f(x)=3L8+∞∑n=12Ln2π2[(−1)n−cos(nπ2)+nπ2sin(nπ2)]cos(nπxL)Note that much as we saw with the Fourier sine series many of the coefficients will be quite messy to deal with.