Paul's Online Notes
Paul's Online Notes
Home / Differential Equations / Boundary Value Problems & Fourier Series / Fourier Sine Series
Show Mobile Notice Show All Notes Hide All Notes
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 views in landscape mode. If your device is not in landscape mode many of the equations will run off the side of your device (should be able to scroll to see them) and some of the menu items will be cut off due to the narrow screen width.

Section 8.4 : Fourier Sine Series

In this section we are going to start taking a look at Fourier series. We should point out that this is a subject that can span a whole class and what we’ll be doing in this section (as well as the next couple of sections) is intended to be nothing more than a very brief look at the subject. The point here is to do just enough to allow us to do some basic solutions to partial differential equations in the next chapter. There are many topics in the study of Fourier series that we’ll not even touch upon here.

So, with that out of the way let’s get started, although we’re not going to start off with Fourier series. Let’s instead think back to our Calculus class where we looked at Taylor Series. With Taylor Series we wrote a series representation of a function, \(f\left( x \right)\), as a series whose terms were powers of \(x - a\) for some \(x = a\). With some conditions we were able to show that,

\[f\left( x \right) = \sum\limits_{n = 0}^\infty {\frac{{{f^{\left( n \right)}}\left( a \right)}}{{n!}}{{\left( {x - a} \right)}^n}} \]

and that the series will converge to \(f\left( x \right)\) on \(\left| {x - a} \right| < R\) for some \(R\) that will be dependent upon the function itself.

There is nothing wrong with this, but it does require that derivatives of all orders exist at \(x = a\). Or in other words \({f^{\left( n \right)}}\left( a \right)\) exists for \(n = 0,1,2,3, \ldots \) Also for some functions the value of \(R\) may end up being quite small.

These two issues (along with a couple of others) mean that this is not always the best way of writing a series representation for a function. In many cases it works fine and there will be no reason to need a different kind of series. There are times however where another type of series is either preferable or required.

We’re going to build up an alternative series representation for a function over the course of the next couple of sections. The ultimate goal for the rest of this chapter will be to write down a series representation for a function in terms of sines and cosines.

We’ll start things off by assuming that the function, \(f\left( x \right)\), we want to write a series representation for is an odd function (i.e. \(f\left( { - x} \right) = - f\left( x \right)\)). Because \(f\left( x \right)\) is odd it makes some sense that we should be able to write a series representation for this in terms of sines only (since they are also odd functions).

What we’ll try to do here is write \(f\left( x \right)\) as the following series representation, called a Fourier sine series, on \( - L \le x \le L\).

\[\sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \]

There are a couple of issues to note here. First, at this point, we are going to assume that the series representation will converge to \(f\left( x \right)\) on \( - L \le x \le L\). We will be looking into whether or not it will actually converge in a later section. However, assuming that the series does converge to \(f\left( x \right)\) it is interesting to note that, unlike Taylor Series, this representation will always converge on the same interval and that the interval does not depend upon the function.

Second, the series representation will not involve powers of sine (again contrasting this with Taylor Series) but instead will involve sines with different arguments.

Finally, the argument of the sines, \(\frac{{n\pi x}}{L}\), may seem like an odd choice that was arbitrarily chosen and in some ways it was. For Fourier sine series the argument doesn’t have to necessarily be this but there are several reasons for the choice here. First, this is the argument that will naturally arise in the next chapter when we use Fourier series (in general and not necessarily Fourier sine series) to help us solve some basic partial differential equations.

The next reason for using this argument is the fact that the set of functions that we chose to work with, \(\left\{ {\sin \left( {\frac{{n\pi x}}{L}} \right)} \right\}_{n\,\, = \,\,1}^\infty \)in this case, need to be orthogonal on the given interval, \( - L \le x \le L\) in this case, and note that in the last section we showed that in fact they are. In other words, the choice of functions we’re going to be working with and the interval we’re working on will be tied together in some way. We can use a different argument but will need to also choose an interval on which we can prove that the sines (with the different argument) are orthogonal.

So, let’s start off by assuming that given an odd function, \(f\left( x \right)\), we can in fact find a Fourier sine series, of the form given above, to represent the function on \( - L \le x \le L\). This means we will have,

\[f\left( x \right) = \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \]

As noted above we’ll discuss whether or not this even can be done and if the series representation does in fact converge to the function in later section. At this point we’re simply going to assume that it can be done. The question now is how to determine the coefficients, \({B_n}\), in the series.

Let’s start with the series above and multiply both sides by \(\sin \left( {\frac{{m\pi x}}{L}} \right)\) where \(m\) is a fixed integer in the range \(\left\{ {1,2,3, \ldots } \right\}\). In other words, we multiply both sides by any of the sines in the set of sines that we’re working with here. Doing this gives,

\[f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right) = \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)} \]

Now, let’s integrate both sides of this from \(x = - L\) to \(x = L\).

\[\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = \int_{{\, - L}}^{{\,L}}{{\sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)} \,dx}}\]

At this point we’ve got a small issue to deal with. We know from Calculus that an integral of a finite series (more commonly called a finite sum….) is nothing more than the (finite) sum of the integrals of the pieces. In other words, for finite series we can interchange an integral and a series. For infinite series however, we cannot always do this. For some integrals of infinite series we cannot interchange an integral and a series. Luckily enough for us we actually can interchange the integral and the series in this case. Doing this and factoring the constant, \({B_n}\), out of the integral gives,

\[\begin{align*}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} &= \sum\limits_{n = 1}^\infty {\int_{{\, - L}}^{{\,L}}{{{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}}} \\ & = \sum\limits_{n = 1}^\infty {{B_n}\int_{{\, - L}}^{{\,L}}{{\sin \left( {\frac{{n\,\pi x}}{L}} \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}}} \end{align*}\]

Now, recall from the last section we proved that \(\left\{ {\sin \left( {\frac{{n\pi x}}{L}} \right)} \right\}_{n\,\, = \,\,1}^\infty \) is orthogonal on \( - L \le x \le L\)and that,

\[\int_{{ - L}}^{L}{{\sin \left( {\frac{{n\pi x}}{L}} \right)\sin \left( {\frac{{m\pi x}}{L}} \right)\,dx}} = \left\{ {\begin{array}{*{20}{l}}L&{{\mbox{if }}n = m}\\0&{{\mbox{if }}n \ne m}\end{array}} \right.\]

So, what does this mean for us. As we work through the various values of \(n\) in the series and compute the value of the integrals all but one of the integrals will be zero. The only non-zero integral will come when we have \(n = m\), in which case the integral has the value of \(L\). Therefore, the only non-zero term in the series will come when we have \(n = m\) and our equation becomes,

\[\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = {B_{\,m}}L\]

Finally, all we need to do is divide by \(L\) and we now have an equation for each of the coefficients.

\[{B_{\,m}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}}\hspace{0.25in}m = 1,2,3, \ldots \]

Next, note that because we’re integrating two odd functions the integrand of this integral is even and so we also know that,

\[{B_{\,m}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}}\hspace{0.25in}m = 1,2,3, \ldots \]

Summarizing all this work up the Fourier sine series of an odd function \(f\left( x \right)\) on \( - L \le x \le L\) is given by,

\[\begin{align*}f\left( x \right) & = \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} & {B_{\,n}} & = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\,\,\,\,\,\,\,n = 1,2,3, \ldots \\ & & & = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\,\,\,\,\,\,\,n = 1,2,3, \ldots \end{align*}\]

Let’s take a quick look at an example.

Example 1 Find the Fourier sine series for \(f\left( x \right) = x\) on \( - L \le x \le L\).
Show Solution

First note that the function we’re working with is in fact an odd function and so this is something we can do. There really isn’t much to do here other than to compute the coefficients for \(f\left( x \right) = x\).

Here is that work and note that we’re going to leave the integration by parts details to you to verify. Don’t forget that \(n\), \(L\), and \(\pi \) are constants!

\[\begin{align*}{B_{\,n}} & = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{x\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{2}{L}\left. {\left( {\frac{L}{{{n^2}{\pi ^2}}}} \right)\left( {L\sin \left( {\frac{{n\,\pi x}}{L}} \right) - n\pi x\cos \left( {\frac{{n\,\pi x}}{L}} \right)} \right)} \right|_0^L\\ & = \frac{2}{{{n^2}{\pi ^2}}}\left( {L\sin \left( {n\,\pi } \right) - n\pi L\cos \left( {n\,\pi } \right)} \right)\end{align*}\]

These integrals can, on occasion, be somewhat messy especially when we use a general \(L\) for the endpoints of the interval instead of a specific number.

Now, taking advantage of the fact that \(n\) is an integer we know that \(\sin \left( {n\pi } \right) = 0\) and that \(\cos \left( {n\pi } \right) = {\left( { - 1} \right)^n}\). We therefore have,

\[{B_{\,n}} = \frac{2}{{{n^2}{\pi ^2}}}\left( { - n\pi L{{\left( { - 1} \right)}^n}} \right) = \frac{{{{\left( { - 1} \right)}^{n + 1}}2L}}{{n\pi }}\hspace{0.25in}\hspace{0.25in}n = 1,2,3 \ldots \]

The Fourier sine series is then,

\[x = \sum\limits_{n = 1}^\infty {\frac{{{{\left( { - 1} \right)}^{n + 1}}2L}}{{n\pi }}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} = \frac{{2L}}{\pi }\sum\limits_{n = 1}^\infty {\frac{{{{\left( { - 1} \right)}^{n + 1}}}}{n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \]

At this point we should probably point out that we’ll be doing most, if not all, of our work here on a general interval (\( - L \le x \le L\) or \(0 \le x \le L\)) instead of intervals with specific numbers for the endpoints. There are a couple of reasons for this. First, it gives a much more general formula that will work for any interval of that form which is always nice. Secondly, when we run into this kind of work in the next chapter it will also be on general intervals so we may as well get used to them now.

Now, finding the Fourier sine series of an odd function is fine and good but what if, for some reason, we wanted to find the Fourier sine series for a function that is not odd? To see how to do this we’re going to have to make a change. The above work was done on the interval \( - L \le x \le L\). In the case of a function that is not odd we’ll be working on the interval \(0 \le x \le L\). The reason for this will be made apparent in a bit.

So, we are now going to do is to try to find a series representation for \(f\left( x \right)\) on the interval \(0 \le x \le L\) that is in the form,

\[\sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \]

or in other words,

\[f\left( x \right) = \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \]

As we did with the Fourier sine series on \( - L \le x \le L\) we are going to assume that the series will in fact converge to \(f\left( x \right)\) and we’ll hold off discussing the convergence of the series for a later section.

There are two methods of generating formulas for the coefficients, \({B_n}\), although we’ll see in a bit that they are really the same, just looked at from different perspectives.

The first method is to just ignore the fact that \(f\left( x \right)\) is not odd and proceed in the same manner that we did above only this time we’ll take advantage of the fact that we proved in the previous section that \(\left\{ {\sin \left( {\frac{{n\pi x}}{L}} \right)} \right\}_{n\,\, = \,\,1}^\infty \) also forms an orthogonal set on \(0 \le x \le L\) and that,

\[\int_{0}^{L}{{\sin \left( {\frac{{n\pi x}}{L}} \right)\sin \left( {\frac{{m\pi x}}{L}} \right)\,dx}} = \left\{ {\begin{array}{*{20}{l}}{\frac{L}{2}}&{{\mbox{if }}n = m}\\0&{{\mbox{if }}n \ne m}\end{array}} \right.\]

So, if we do this then all we need to do is multiply both sides of our series by \(\sin \left( {\frac{{m\pi x}}{L}} \right)\), integrate from 0 to \(L\) and interchange the integral and series to get,

\[\int_{0}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = \sum\limits_{n = 1}^\infty {{B_n}\int_{0}^{{\,L}}{{\sin \left( {\frac{{n\,\pi x}}{L}} \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}}} \]

Now, plugging in for the integral we arrive at,

\[\int_{0}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = {B_m}\left( {\frac{L}{2}} \right)\]

Upon solving for the coefficient we arrive at,

\[{B_m} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}}\,\,\,\,\,\,\,m = 1,2,3, \ldots \]

Note that this is identical to the second form of the coefficients that we arrived at above by assuming \(f\left( x \right)\) was odd and working on the interval \( - L \le x \le L\). The fact that we arrived at essentially the same coefficients is not actually all the surprising as we’ll see once we’ve looked the second method of generating the coefficients.

Before we look at the second method of generating the coefficients we need to take a brief look at another concept. Given a function, \(f\left( x \right)\), we define the odd extension of \(f\left( x \right)\) to be the new function,

\[g\left( x \right) = \left\{ {\begin{array}{*{20}{l}}{f\left( x \right)}&{\,\,\,\,{\mbox{if }}0 \le x \le L}\\{ - f\left( { - x} \right)}&{\,\,\,\,{\mbox{if }} - L \le x \le 0}\end{array}} \right.\]

It’s pretty easy to see that this is an odd function.

\[g\left( { - x} \right) = - f\left( { - \left( { - x} \right)} \right) = - f\left( x \right) = - g\left( x \right)\hspace{0.25in}\hspace{0.25in}{\mbox{for }}0 < x < L\]

and we can also know that on \(0 \le x \le L\) we have that \(g\left( x \right) = f\left( x \right)\). Also note that if \(f\left( x \right)\) is already an odd function then we in fact get \(g\left( x \right) = f\left( x \right)\) on \( - L \le x \le L\).

Let’s take a quick look at a couple of odd extensions before we proceed any further.

Example 2 Sketch the odd extension of each of the given functions.
  1. \(f\left( x \right) = L - x\) on \(0 \le x \le L\)
  2. \(f\left( x \right) = 1 + {x^2}\) on \(0 \le x \le L\)
  3. \(f\left( x \right) = \left\{ {\begin{array}{*{20}{l}}{\frac{L}{2}}&{\,\,\,\,{\mbox{if }}0 \le x \le \frac{L}{2}}\\{x - \frac{L}{2}}&{\,\,\,\,{\mbox{if }}\frac{L}{2} \le x \le L}\end{array}} \right.\)
Show All Solutions Hide All Solutions
Show Discussion

Not much to do with these other than to define the odd extension and then sketch it.


a \(f\left( x \right) = L - x\) on \(0 \le x \le L\) Show Solution

Here is the odd extension of this function.

\[\begin{align*}g\left( x \right) & = \left\{ {\begin{array}{*{20}{l}}{f\left( x \right)}&{\,\,\,\,{\mbox{if }}0 \le x \le L}\\{ - f\left( { - x} \right)}&{\,\,\,\,{\mbox{if }} - L \le x \le 0}\end{array}} \right.\\ & = \left\{ {\begin{array}{*{20}{l}}{L - x}&{\,\,\,\,{\mbox{if }}0 \le x \le L}\\{ - L - x}&{\,\,\,\,{\mbox{if }} - L \le x \le 0}\end{array}} \right.\end{align*}\]

Below is the graph of both the function and its odd 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 odd 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 tick marks at y=-L and y=L. 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\left( x \right) = 1 + {x^2}\) on \(0 \le x \le L\) Show Solution

First note that this is clearly an even function. That does not however mean that we can’t define the odd extension for it. The odd extension for this function is,

\[\begin{align*}g\left( x \right) & = \left\{ {\begin{array}{*{20}{l}}{f\left( x \right)}&{\,\,\,\,{\mbox{if }}0 \le x \le L}\\{ - f\left( { - x} \right)}&{\,\,\,\,{\mbox{if }} - L \le x \le 0}\end{array}} \right.\\ & = \left\{ {\begin{array}{*{20}{l}}{1 + {x^2}}&{\,\,\,\,{\mbox{if }}0 \le x \le L}\\{ - 1 - {x^2}}&{\,\,\,\,{\mbox{if }} - L \le x \le 0}\end{array}} \right.\end{align*}\]

The sketch of the original function and its odd extension are ,

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 no scale.  In the left graph there is the graph of the portion of $y=1+x^{2}$ that lies in the 1st quadrant between 0<x<L.  In the right graph there is the graph of the portion of $y=1+x^{2}$ that lies in the 1st quadrant between 0<x<L.  This graph is shown with a solid line.  Also in the graph is the portion of $y=-1-x^{2}$ that lies in the 3rd quadrant between -L<x<0.

c \(\displaystyle f\left( x \right) = \left\{ {\begin{array}{*{20}{l}}{\frac{L}{2}}&{\,\,\,\,{\mbox{if }}0 \le x \le \frac{L}{2}}\\{x - \frac{L}{2}}&{\,\,\,\,{\mbox{if }}\frac{L}{2} \le x \le L}\end{array}} \right.\) Show Solution

Let’s first write down the odd extension for this function.

\[g\left( x \right) = \left\{ {\begin{array}{*{20}{l}}{f\left( x \right)}&{\,\,\,\,{\mbox{if }}0 \le x \le L}\\{ - f\left( { - x} \right)}&{\,\,\,\,{\mbox{if }} - L \le x \le 0}\end{array}} \right. = \left\{ {\begin{array}{*{20}{l}}{x - \frac{L}{2}}&{\,\,\,\,{\mbox{if }}\frac{L}{2} \le x \le L}\\{\frac{L}{2}}&{\,\,\,\,{\mbox{if }}0 \le x \le \frac{L}{2}}\\{ - \frac{L}{2}}&{\,\,\,\,{\mbox{if }} - \frac{L}{2} \le x \le 0}\\{x + \frac{L}{2}}&{\,\,\,\,{\mbox{if }} - L \le x \le - \frac{L}{2}}\end{array}} \right.\]

The sketch of the original function and its odd extension are,

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 tick marks at y=-L/2 and y=L/2.  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 3rd 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.

With the definition of the odd extension (and a couple of examples) out of the way we can now take a look at the second method for getting formulas for the coefficients of the Fourier sine series for a function \(f\left( x \right)\) on \(0 \le x \le L\). First, given such a function define its odd extension as above. At this point, because \(g\left( x \right)\) is an odd function, we know that on \( - L \le x \le L\) the Fourier sine series for \(g\left( x \right)\) (and NOT \(f\left( x \right)\) yet) is,

\[g\left( x \right) = \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \,\hspace{0.25in}\hspace{0.25in}{B_{\,n}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{g\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\,\,\,\,\,\,\,n = 1,2,3, \ldots \]

However, because we know that \(g\left( x \right) = f\left( x \right)\) on \(0 \le x \le L\) we can also see that as long as we are on \(0 \le x \le L\) we have,

\[f\left( x \right) = \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \,\hspace{0.25in}\hspace{0.25in}{B_{\,n}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\,\,\,\,\,\,\,n = 1,2,3, \ldots \]

So, exactly the same formula for the coefficients regardless of how we arrived at the formula and the second method justifies why they are the same here as they were when we derived them for the Fourier sine series for an odd function.

Now, let’s find the Fourier sine series for each of the functions that we looked at in Example 2.

Note that again we are working on general intervals here instead of specific numbers for the right endpoint to get a more general formula for any interval of this form and because again this is the kind of work we’ll be doing in the next chapter.

Also, we’ll again be leaving the actually integration details up to you to verify. In most cases it will involve some fairly simple integration by parts complicated by all the constants (\(n\), \(L\), \(\pi \), etc.) that show up in the integral.

Example 3 Find the Fourier sine series for \(f\left( x \right) = L - x\) on \(0 \le x \le L\).
Show Solution

There really isn’t much to do here other than computing the coefficients so here they are,

\[\begin{align*}{B_{\,n}} & = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{\left( {L - x} \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\\ & = \frac{2}{L}\left. {\left( { - \frac{L}{{{n^2}{\pi ^2}}}} \right)\left[ {L\sin \left( {\frac{{n\,\pi x}}{L}} \right) - n\pi \left( {x - L} \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)} \right]} \right|_0^L\\ & = \frac{2}{L}\left[ {\frac{{{L^2}}}{{{n^2}{\pi ^2}}}\left( {n\pi - \sin \left( {n\pi } \right)} \right)} \right] = \frac{{2L}}{{n\pi }}\end{align*}\]

In the simplification process don’t forget that \(n\) is an integer.

So, with the coefficients we get the following Fourier sine series for this function.

\[f\left( x \right) = \sum\limits_{n = 1}^\infty {\frac{{2L}}{{n\pi }}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \,\]

In the next example it is interesting to note that while we started out this section looking only at odd functions we’re now going to be finding the Fourier sine series of an even function on \(0 \le x \le L\). Recall however that we’re really finding the Fourier sine series of the odd extension of this function and so we’re okay.

Example 4 Find the Fourier sine series for \(f\left( x \right) = 1 + {x^2}\) on \(0 \le x \le L\).
Show Solution

In this case the coefficients are liable to be somewhat messy given the fact that the integrals will involve integration by parts twice. Here is the work for the coefficients.

\[\begin{align*}{B_{\,n}} & = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{\left( {1 + {x^2}} \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\\ & = \frac{2}{L}\left( {\frac{L}{{{n^3}{\pi ^3}}}} \right)\left[ {\left( {2{L^2} - {n^2}{\pi ^2}\left( {1 + {x^2}} \right)} \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right) + 2Ln\pi x\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \right]_0^L\\ & = \frac{2}{L}\left( {\frac{L}{{{n^3}{\pi ^3}}}} \right)\left[ {\left( {2{L^2} - {n^2}{\pi ^2}\left( {1 + {L^2}} \right)} \right)\cos \left( {n\pi } \right) + 2{L^2}n\pi \sin \left( {n\pi } \right) - \left( {2{L^2} - {n^2}{\pi ^2}} \right)} \right]\\ & = \frac{2}{{{n^3}{\pi ^3}}}\left[ {\left( {2{L^2} - {n^2}{\pi ^2}\left( {1 + {L^2}} \right)} \right){{\left( { - 1} \right)}^n} - 2{L^2} + {n^2}{\pi ^2}} \right]\end{align*}\]

As noted above the coefficients are not the most pleasant ones, but there they are. The Fourier sine series for this function is then,

\[f\left( x \right) = \sum\limits_{n = 1}^\infty {\frac{2}{{{n^3}{\pi ^3}}}\left[ {\left( {2{L^2} - {n^2}{\pi ^2}\left( {1 + {L^2}} \right)} \right){{\left( { - 1} \right)}^n} - 2{L^2} + {n^2}{\pi ^2}} \right]\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \,\]

In the last example of this section we’ll be finding the Fourier sine series of a piecewise function and can definitely complicate the integrals a little but they do show up on occasion and so we need to be able to deal with them.

Example 5 Find the Fourier sine series for \(f\left( x \right) = \left\{ {\begin{array}{*{20}{l}}{\frac{L}{2}}&{\,\,\,\,{\mbox{if }}0 \le x \le \frac{L}{2}}\\{x - \frac{L}{2}}&{\,\,\,\,{\mbox{if }}\frac{L}{2} \le x \le L}\end{array}} \right.\) on \(0 \le x \le L\).
Show Solution

Here is the integral for the coefficients.

\[\begin{align*}{B_{\,n}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} &= \frac{2}{L}\left[ {\int_{{\,0}}^{{\,\frac{L}{2}}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} + \int_{{\,\frac{L}{2}}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}} \right]\\ & = \frac{2}{L}\left[ {\int_{{\,0}}^{{\,\frac{L}{2}}}{{\frac{L}{2}\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} + \int_{{\,\frac{L}{2}}}^{{\,L}}{{\left( {x - \frac{L}{2}} \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}} \right]\end{align*}\]

Note that we need to split the integral up because of the piecewise nature of the original function. Let’s do the two integrals separately

\[\int_{{\,0}}^{{\,\frac{L}{2}}}{{\frac{L}{2}\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = - \left. {\left( {\frac{L}{2}} \right)\left( {\frac{L}{{n\pi }}} \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)} \right|_0^{\frac{L}{2}} = \frac{{{L^2}}}{{2n\pi }}\left( {1 - \cos \left( {\frac{{n\,\pi }}{2}} \right)} \right)\] \[\begin{align*}\int_{{\,\frac{L}{2}}}^{{\,L}}{{\left( {x - \frac{L}{2}} \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} & = \left. {\frac{L}{{{n^2}{\pi ^2}}}\left[ {L\sin \left( {\frac{{n\,\pi x}}{L}} \right) - n\pi \left( {x - \frac{L}{2}} \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)} \right]} \right|_{\frac{L}{2}}^L\\ & = \frac{L}{{{n^2}{\pi ^2}}}\left[ {L\sin \left( {n\pi } \right) - \frac{{n\pi L}}{2}\cos \left( {n\pi } \right) - L\sin \left( {\frac{{n\,\pi }}{2}} \right)} \right]\\ & = - \frac{{{L^2}}}{{{n^2}{\pi ^2}}}\left[ {\frac{{n\pi {{\left( { - 1} \right)}^n}}}{2} + \sin \left( {\frac{{n\,\pi }}{2}} \right)} \right]\end{align*}\]

Putting all of this together gives,

\[\begin{align*}{B_{\,n}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} & = \frac{2}{L}\left( {\frac{{{L^2}}}{{2n\pi }}} \right)\left[ {1 + {{\left( { - 1} \right)}^{n + 1}} - \cos \left( {\frac{{n\,\pi }}{2}} \right) + \frac{2}{{n\pi }}\sin \left( {\frac{{n\,\pi }}{2}} \right)} \right]\\ & = \frac{L}{{n\pi }}\left[ {1 + {{\left( { - 1} \right)}^{n + 1}} - \cos \left( {\frac{{n\,\pi }}{2}} \right) - \frac{2}{{n\pi }}\sin \left( {\frac{{n\,\pi }}{2}} \right)} \right]\end{align*}\]

So, the Fourier sine series for this function is,

\[f\left( x \right) = \sum\limits_{n = 1}^\infty {\frac{L}{{n\pi }}\left[ {1 + {{\left( { - 1} \right)}^{n + 1}} - \cos \left( {\frac{{n\,\pi }}{2}} \right) - \frac{2}{{n\pi }}\sin \left( {\frac{{n\,\pi }}{2}} \right)} \right]\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \,\]

As the previous two examples has shown the coefficients for these can be quite messy but that will often be the case and so we shouldn’t let that get us too excited.