I apologize for the outage on the site yesterday and today. Lamar University is in Beaumont Texas and Hurricane Laura came through here and caused a brief power outage at Lamar. Things should be up and running at this point and (hopefully) will stay that way, at least until the next hurricane comes through here which seems to happen about once every 10-15 years. Note that I wouldn't be too suprised if there are brief outages over the next couple of days as they work to get everything back up and running properly. I apologize for the inconvienence.

Paul

August 27, 2020

*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-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\left( x \right)\) on \( - L \le x \le L\) in the form,

\[f\left( x \right) = \sum\limits_{n = 0}^\infty {{A_n}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} + \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \]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\left( x \right)\) 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, \({A_n}\) and \({B_n}\), will be done in exactly the same manner as we did in the previous two sections. We will take advantage of the fact that \(\left\{ {\cos \left( {\frac{{n\pi x}}{L}} \right)} \right\}_{n\,\, = \,\,0}^\infty \) and \(\left\{ {\sin \left( {\frac{{n\pi x}}{L}} \right)} \right\}_{n\,\, = \,\,1}^\infty \) are mutually orthogonal on \( - L \le x \le L\) as we proved earlier. We’ll also need the following formulas that we derived when we proved the two sets were mutually orthogonal.

\[\begin{align*}& \int_{{ - L}}^{L}{{\cos \left( {\frac{{n\pi x}}{L}} \right)\cos \left( {\frac{{m\pi x}}{L}} \right)\,dx}} = \left\{ {\begin{array}{*{20}{l}}{2L}&{{\mbox{if }}n = m = 0}\\L&{{\mbox{if }}n = m \ne 0}\\0&{{\mbox{if }}n \ne m}\end{array}} \right.\\ & \\ & \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.\\ & \\ & \int_{{ - L}}^{L}{{\sin \left( {\frac{{n\pi x}}{L}} \right)\cos \left( {\frac{{m\pi x}}{L}} \right)\,dx}} = 0\end{align*}\]So, let’s start off by multiplying both sides of the series above by \(\cos \left( {\frac{{m\pi x}}{L}} \right)\) and integrating from –\(L\) to \(L\). Doing this gives,

\[\int_{{\, - L}}^{L}{{f\left( x \right)\cos \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = \int_{{ - L}}^{L}{{\sum\limits_{n = 0}^\infty {{A_n}\cos \left( {\frac{{n\,\pi x}}{L}} \right)\cos \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)\cos \left( {\frac{{m\,\pi x}}{L}} \right)} }}\,dx\]Now, just as we’ve been able to do in the last two sections we can interchange the integral and the summation. Doing this gives,

\[\int_{{\, - L}}^{L}{{f\left( x \right)\cos \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = \sum\limits_{n = 0}^\infty {{A_n}\int_{{ - L}}^{L}{{\cos \left( {\frac{{n\,\pi x}}{L}} \right)\cos \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)\cos \left( {\frac{{m\,\pi x}}{L}} \right)}}\,dx} \]We 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 \ne m\) and so this reduces to,

\[\int_{{\, - L}}^{L}{{f\left( x \right)\cos \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = \left\{ {\begin{array}{*{20}{c}}{{A_m}\left( {2L} \right)}&{{\mbox{if }}n = m = 0}\\{{A_m}\left( L \right)}&{{\mbox{if }}n = m \ne 0}\end{array}} \right.\]Solving for \({A_m}\) gives,

\[\begin{align*}& {A_0} = \frac{1}{{2L}}\int_{{\, - L}}^{L}{{f\left( x \right)\,dx}}\\ & {A_m} = \frac{1}{L}\int_{{\, - L}}^{L}{{f\left( x \right)\cos \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}}\hspace{0.25in}\hspace{0.25in}m = 1,2,3, \ldots \end{align*}\]Now, do it all over again only this time multiply both sides by \(\sin \left( {\frac{{m\pi x}}{L}} \right)\), integrate both sides from –\(L\) to \(L\) and interchange the integral and summation to get,

\[\int_{{\, - L}}^{L}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = \sum\limits_{n = 0}^\infty {{A_n}\int_{{ - L}}^{L}{{\cos \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} \]In this case the integral in the first series will always be zero and the second will be zero if \(n \ne m\) and so we get,

\[\int_{{\, - L}}^{L}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}} = {B_m}\left( L \right)\]Finally, solving for \({B_m}\) gives,

\[{B_m} = \frac{1}{L}\int_{{\, - L}}^{L}{{f\left( x \right)\sin \left( {\frac{{m\,\pi x}}{L}} \right)\,dx}}\hspace{0.25in}\hspace{0.25in}m = 1,2,3, \ldots \]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\left( x \right)\) 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 \left( {n\pi } \right) = {\left( { - 1} \right)^n}\hspace{0.25in}\hspace{0.25in}\sin \left( {n\pi } \right) = 0\]In 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 \left( { - x} \right) = - \sin \left( x \right)\) and that cosine is an even function, *i.e.* \(\cos \left( { - x} \right) = \cos \left( x \right)\). 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.

\[{A_0} = \frac{1}{{2L}}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\,dx}} = \frac{1}{{2L}}\int_{{\, - L}}^{{\,L}}{{L - x\,dx}} = L\] \[\begin{align*}{A_n} &= \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{\left( {L - x} \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\\ & = \frac{1}{L}\left. {\left( {\frac{L}{{{n^2}{\pi ^2}}}} \right)\left( {n\pi \left( {L - x} \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right) - L\cos \left( {\frac{{n\,\pi x}}{L}} \right)} \right)} \right|_{ - L}^L\\ & = \frac{1}{L}\left( {\frac{L}{{{n^2}{\pi ^2}}}} \right)\left( { - 2n\pi L\sin \left( { - n\,\pi } \right)} \right) = 0\hspace{0.25in}\hspace{0.25in}\hspace{0.25in}\hspace{0.25in}n = 1,2,3, \ldots \end{align*}\] \[\begin{align*}{B_{\,n}} &= \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{\left( {L - x} \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\\ & = \frac{1}{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|_{ - L}^L\\ & = \frac{1}{L}\left[ {\frac{{{L^2}}}{{{n^2}{\pi ^2}}}\left( {2n\pi \cos \left( {n\pi } \right) - 2\sin \left( {n\pi } \right)} \right)} \right] = \frac{{2L{{\left( { - 1} \right)}^n}}}{{n\pi }}\hspace{0.25in}\hspace{0.25in}n = 1,2,3, \ldots \end{align*}\]Note that in this case we had \({A_0} \ne 0\) and \({A_n} = 0,\,\,n = 1,2,3, \ldots \) This will happen on occasion so don’t get excited about this kind of thing when it happens.

The Fourier series is then,

\[\begin{align*}f\left( x \right) &= \sum\limits_{n = 0}^\infty {{A_n}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} + \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \\ & = {A_0} + \sum\limits_{n = 1}^\infty {{A_n}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} + \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} = L + \sum\limits_{n = 1}^\infty {\frac{{2L{{\left( { - 1} \right)}^n}}}{{n\pi }}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \end{align*}\]As we saw in the previous example sometimes we’ll get \({A_0} \ne 0\) and \({A_n} = 0,\,\,n = 1,2,3, \ldots \) Whether or not this will happen will depend upon the function \(f\left( x \right)\) 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.

\[\begin{align*}{A_0} & = \frac{1}{{2L}}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\,dx}} = \frac{1}{{2L}}\left[ {\int_{{\, - L}}^{{\,0}}{{f\left( x \right)\,dx}} + \int_{{\,0}}^{{\,L}}{{f\left( x \right)\,dx}}} \right]\\ & = \frac{1}{{2L}}\left[ {\int_{{\, - L}}^{{\,0}}{{L\,dx}} + \int_{{\,0}}^{{\,L}}{{2x\,dx}}} \right] = \frac{1}{{2L}}\left[ {{L^2} + {L^2}} \right] = L\end{align*}\] \[\begin{align*}{A_n} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} & = \frac{1}{L}\left[ {\int_{{\, - L}}^{{\,0}}{{f\left( x \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} + \int_{{\,0}}^{{\,L}}{{f\left( x \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}} \right]\\ & = \frac{1}{L}\left[ {\int_{{\, - L}}^{{\,0}}{{L\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} + \int_{{\,0}}^{{\,L}}{{2x\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}} \right]\end{align*}\]At this point it will probably be easier to do each of these individually.

\[\int_{{\, - L}}^{{\,0}}{{L\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \left. {\left( {\frac{{{L^2}}}{{n\pi }}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \right)} \right|_{ - L}^0 = \frac{{{L^2}}}{{n\pi }}\sin \left( {n\pi } \right) = 0\] \[\begin{align*}\int_{{\,0}}^{{\,L}}{{2x\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} & = \left. {\left( {\frac{{2L}}{{{n^2}{\pi ^2}}}} \right)\left( {L\cos \left( {\frac{{n\,\pi x}}{L}} \right)\, + n\pi x\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,} \right)} \right|_0^L\\ & = \left( {\frac{{2L}}{{{n^2}{\pi ^2}}}} \right)\left( {L\cos \left( {n\pi } \right)\, + n\pi L\sin \left( {n\pi } \right) - L\cos \left( 0 \right)} \right)\\ & = \left( {\frac{{2{L^2}}}{{{n^2}{\pi ^2}}}} \right)\left( {{{\left( { - 1} \right)}^n} - 1} \right)\end{align*}\]So, if we put all of this together we have,

\[\begin{align*}{A_n} & = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{1}{L}\left[ {0 + \left( {\frac{{2{L^2}}}{{{n^2}{\pi ^2}}}} \right)\left( {{{\left( { - 1} \right)}^n} - 1} \right)} \right]\\ & = \frac{{2L}}{{{n^2}{\pi ^2}}}\left( {{{\left( { - 1} \right)}^n} - 1} \right)\,\,\,,\hspace{0.25in}\hspace{0.25in}n = 1,2,3, \ldots \end{align*}\]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.

\[\begin{align*}{B_{\,n}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} & = \frac{1}{L}\left[ {\int_{{\, - L}}^{{\,0}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} + \int_{{\,0}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}} \right]\\ & = \frac{1}{L}\left[ {\int_{{\, - L}}^{{\,0}}{{L\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} + \int_{{\,0}}^{{\,L}}{{2x\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}} \right]\end{align*}\]As with the coefficients for the cosines will probably be easier to do each of these individually.

\[\int_{{\, - L}}^{{\,0}}{{L\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \left. {\left( { - \frac{{{L^2}}}{{n\pi }}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} \right)} \right|_{ - L}^0 = \frac{{{L^2}}}{{n\pi }}\left( { - 1 + \cos \left( {n\pi } \right)} \right) = \frac{{{L^2}}}{{n\pi }}\left( {{{\left( { - 1} \right)}^n} - 1} \right)\] \[\begin{align*}\int_{{\,0}}^{{\,L}}{{2x\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} & = \left. {\left( {\frac{{2L}}{{{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\\ & = \left( {\frac{{2L}}{{{n^2}{\pi ^2}}}} \right)\left( {L\sin \left( {n\pi } \right) - n\pi L\cos \left( {n\pi } \right)} \right)\\ & = \left( {\frac{{2{L^2}}}{{{n^2}{\pi ^2}}}} \right)\left( { - n\pi {{\left( { - 1} \right)}^n}} \right) = - \frac{{2{L^2}}}{{n\pi }}{\left( { - 1} \right)^n}\end{align*}\]So, if we put all of this together we have,

\[\begin{align*}{B_{\,n}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} & = \frac{1}{L}\left[ {\frac{{{L^2}}}{{n\pi }}\left( {{{\left( { - 1} \right)}^n} - 1} \right) - \frac{{2{L^2}}}{{n\pi }}{{\left( { - 1} \right)}^n}} \right]\\ & = \frac{L}{{n\pi }}\left[ { - 1 - {{\left( { - 1} \right)}^n}} \right] = - \frac{L}{{n\pi }}\left( {1 + {{\left( { - 1} \right)}^n}} \right)\hspace{0.25in}\hspace{0.25in}n = 1,2,3, \ldots \end{align*}\]So, after all that work the Fourier series is,

\[\begin{align*}f\left( x \right) & = \sum\limits_{n = 0}^\infty {{A_n}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} + \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \\ & = {A_0} + \sum\limits_{n = 1}^\infty {{A_n}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} + \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \\ & = L + \sum\limits_{n = 1}^\infty {\frac{{2L}}{{{n^2}{\pi ^2}}}\left( {{{\left( { - 1} \right)}^n} - 1} \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)} - \sum\limits_{n = 1}^\infty {\frac{L}{{n\pi }}\left( {1 + {{\left( { - 1} \right)}^n}} \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \end{align*}\]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 \({A_n}\).

\[{A_0} = \frac{1}{{2L}}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\,dx}} = \frac{1}{{2L}}\int_{{\, - L}}^{{\,L}}{{x\,dx}} = 0\] \[{A_n} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{x\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = 0\]In 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 \(\left[ { - L,L} \right]\) and so we know that both of these integrals will be zero.

Next here is the integral for \({B_n}\)

\[{B_{\,n}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{x\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{x\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\]In this case we’re integrating an even function (\(x\) and sine are both odd so the product is even) on the interval \(\left[ { - L,L} \right]\) 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,

\[{B_n} = \frac{{{{\left( { - 1} \right)}^{n + 1}}2L}}{{n\pi }}\hspace{0.25in}\hspace{0.25in}n = 1,2,3, \ldots \]In this case the Fourier series is,

\[f\left( x \right) = \sum\limits_{n = 0}^\infty {{A_n}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} + \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} = \sum\limits_{n = 1}^\infty {\frac{{{{\left( { - 1} \right)}^{n + 1}}2L}}{{n\pi }}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} \]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\left( x \right) = x\) on \( - L \le x \le 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 \le x \le L\) and because we know that we had an odd function the coefficients of the cosines in the Fourier series, \({A_n}\), will involve integrating and odd function over a symmetric interval, \( - L \le x \le L\), and so will be zero. So, in these cases the Fourier sine series of an odd function on \( - L \le x \le 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 \le x \le 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\left( x \right) = 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 \le x \le L\) we are really finding the Fourier sine series of the odd extension of the function on \( - L \le x \le L\) and then just restricting the result down to \(0 \le x \le L\). For a Fourier series we are actually using the whole function on \( - L \le x \le 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 \({A_n}\) 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.

\[{A_0} = \frac{1}{{2L}}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\,dx}} = \frac{1}{{2L}}\int_{{\, - L}}^{{\,L}}{{{x^2}\,dx}} = \frac{1}{L}\int_{{\,0}}^{{\,L}}{{{x^2}\,dx}}\] \[{A_n} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{{x^2}\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{2}{L}\int_{{\,0}}^{{\,L}}{{{x^2}\cos \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}}\]As 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,

\[{A_0} = \frac{{{L^2}}}{3}\hspace{0.25in}\hspace{0.25in}{A_n} = \frac{{4{L^2}{{\left( { - 1} \right)}^n}}}{{{n^2}{\pi ^2}}},\,\,\,\,\,n = 1,2,3, \ldots \]Next here is the integral for the \({B_n}\)

\[{B_{\,n}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{f\left( x \right)\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = \frac{1}{L}\int_{{\, - L}}^{{\,L}}{{{x^2}\sin \left( {\frac{{n\,\pi x}}{L}} \right)\,dx}} = 0\]In this case the function is even and sine is odd so the product is odd and we’re integrating over \( - L \le x \le L\) and so the integral is zero.

The Fourier series is then,

\[f\left( x \right) = \sum\limits_{n = 0}^\infty {{A_n}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} + \sum\limits_{n = 1}^\infty {{B_n}\sin \left( {\frac{{n\,\pi x}}{L}} \right)} = \frac{{{L^2}}}{3} + \sum\limits_{n = 1}^\infty {\frac{{4{L^2}{{\left( { - 1} \right)}^n}}}{{{n^2}{\pi ^2}}}\cos \left( {\frac{{n\,\pi x}}{L}} \right)} \]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.