Loading [MathJax]/jax/output/CommonHTML/fonts/TeX/fontdata.js
Paul's Online Notes
Paul's Online Notes
Home / Differential Equations / Boundary Value Problems & Fourier Series / Fourier Cosine Series
Hide Mobile Notice  
Mobile Notice
You appear to be on a device with a "narrow" screen width (i.e. you are probably on a mobile phone). Due to the nature of the mathematics on this site it is best viewed in landscape mode. If your device is not in landscape mode many of the equations will run off the side of your device (you should be able to scroll/swipe to see them) and some of the menu items will be cut off due to the narrow screen width.

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 LxL 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 LxL 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 LxL as we showed in a previous section. In that section we also derived the following formula that we’ll need in a bit.

LLcos(nπxL)cos(mπxL)dx={2Lif n=m=0Lif n=m00if nm

We’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.

LLf(x)cos(mπxL)dx=LLn=0Ancos(nπxL)cos(mπxL)dx=n=0AnLLcos(nπxL)cos(mπxL)dx

We 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 LxL. 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:
LLf(x)dx=A0(2L)A0=12LLLf(x)dx m0:
LLf(x)cos(mπxL)dx=Am(L)Am=1LLLf(x)cos(mπxL)dx

Summarizing everything up then, the Fourier cosine series of an even function, f(x) on LxL is given by,

f(x)=n=0Ancos(nπxL)An={12LLLf(x)dxn=01LLLf(x)cos(nπxL)dxn0

Finally, 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={1LL0f(x)dxn=02LL0f(x)cos(nπxL)dxn0

Now let’s take a look at an example.

Example 1 Find the Fourier cosine series for f(x)=x2 on LxL.
Show Solution

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=1LL0f(x)dx=1LL0x2dx=1L(L33)=L23 An=2LL0f(x)cos(nπxL)dx=2LL0x2cos(nπxL)dx=2L(Ln3π3)(2Lnπxcos(nπxL)+(n2π2x22L2)sin(nπxL))|L0=2n3π3(2L2nπcos(nπ)+(n2π2L22L2)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 0xL now instead of LxL 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 LxL. So, given a function f(x) we’ll define the even extension of the function as,

g(x)={f(x)if 0xLf(x)if Lx0

Showing that this is an even function is simple enough.

g(x)=f((x))=f(x)=g(x)for 0<x<L

and we can see that g(x)=f(x) on 0xL and if f(x) is already an even function we get g(x)=f(x) on LxL.

Let’s take a look at some functions and sketch the even extensions for the functions.

Example 2 Problem Statement.
  1. f(x)=Lx on 0xL
  2. f(x)=x3 on 0xL
  3. f(x)={L2if 0xL2xL2if L2xL
Show All Solutions Hide All Solutions
a f(x)=Lx on 0xL Show Solution

Here is the even extension of this function.

g(x)={f(x)if 0xLf(x)if Lx0={Lxif 0xLL+xif Lx0

Here 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).

b f(x)=x3 on 0xL Show Solution

The even extension of this function is,

g(x)={f(x)if 0xLf(x)if Lx0={x3if 0xLx3if Lx0

The 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}$).

c f(x)={L2if 0xL2xL2if L2xL Show Solution

Here is the even extension of this function,

g(x)={f(x)if 0xLf(x)if Lx0={xL2if L2xLL2if 0xL2L2if L2x0xL2if LxL2

The 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.

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 0xL.

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 LxL and so we can write down its Fourier cosine series. This is,

g(x)=n=0Ancos(nπxL)An={1LL0f(x)dxn=02LL0f(x)cos(nπxL)dxn0

and note that we’ll use the second form of the integrals to compute the constants.

Now, because we know that on 0xL we have f(x)=g(x) and so the Fourier cosine series of f(x) on 0xL is also given by,

f(x)=n=0Ancos(nπxL)An={1LL0f(x)dxn=02LL0f(x)cos(nπxL)dxn0

Let’s take a look at a couple of examples.

Example 3 Find the Fourier cosine series forf(x)=Lx on 0xL.
Show Solution

All we need to do is compute the coefficients so here is the work for that,

A0=1LL0f(x)dx=1LL0Lxdx=L2 An=2LL0f(x)cos(nπxL)dx=2LL0(Lx)cos(nπxL)dx=2L(Ln2π2)(nπ(Lx)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.

Example 4 Find the Fourier cosine series forf(x)=x3 on 0xL.
Show Solution

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=1LL0f(x)dx=1LL0x3dx=L34 An=2LL0f(x)cos(nπxL)dx=2LL0x3cos(nπxL)dx=2L(Ln4π4)(nπx(n2π2x26L2)sin(nπxL)+(3Ln2π2x26L3)cos(nπxL))|L0=2L(Ln4π4)(nπL(n2π2L26L2)sin(nπ)+(3L3n2π26L3)cos(nπ)+6L3)=2L(3L4n4π4)(2+(n2π22)(1)n)=6L3n4π4(2+(n2π22)(1)n)n=1,2,3,

The Fourier cosine series for this function is then,

f(x)=L34+n=16L3n4π4(2+(n2π22)(1)n)cos(nπxL)

Finally, let’s take a quick look at a piecewise function.

Example 5 Find the Fourier cosine series forf(x)={L2if 0xL2xL2if L2xL on 0xL.
Show Solution

We’ll need to split up the integrals for each of the coefficients here. Here are the coefficients.

A0=1LL0f(x)dx=1L[L20f(x)dx+LL2f(x)dx]=1L[L20L2dx+LL2xL2dx]=1L[L24+L28]=1L[3L28]=3L8

For the rest of the coefficients here is the integral we’ll need to do.

An=2LL0f(x)cos(nπxL)dx=2L[L20f(x)cos(nπxL)dx+LL2f(x)cos(nπxL)dx]=2L[L20L2cos(nπxL)dx+LL2(xL2)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(xL2)cos(nπxL)dx=Lnπ(Lnπcos(nπxL)+(xL2)sin(nπxL))|LL2=Lnπ(Lnπcos(nπ)+L2sin(nπ)Lnπcos(nπ2))=L2n2π2((1)ncos(nπ2))

Putting these together gives,

An=2L[L22nπsin(nπ2)+L2n2π2((1)ncos(nπ2))]=2Ln2π2[(1)ncos(nπ2)+nπ2sin(nπ2)]

So, after all that work the Fourier cosine series is then,

f(x)=3L8+n=12Ln2π2[(1)ncos(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.