Skip to main content
Mathematics LibreTexts

5.2: Fourier Trigonometric Series

  • Page ID
    106227
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    As we have seen in the last section, we are interested in finding representations of functions in terms of sines and cosines. Given a function \(f(x)\) we seek a representation in the form

    \[f(x) \sim \dfrac{a_{0}}{2}+\sum_{n=1}^{\infty}\left[a_{n} \cos n x+b_{n} \sin n x\right]. \label{5.1} \]

    Notice that we have opted to drop reference to the frequency form of the phase. This will lead to a simpler discussion for now and one can always make the transformation \(n x=2 \pi f_{n} t\) when applying these ideas to applications.
    The series representation in Equation (5.1) is called a Fourier trigonometric series. We will simply refer to this as a Fourier series for now. The set of constants \(a_{0}, a_{n}, b_{n}, n=1,2, \ldots\) are called the Fourier coefficients. The constant term is chosen in this form to make later computations simpler, though some other authors choose to write the constant term as \(a_{0}\). Our goal is to find the Fourier series representation given \(f(x)\). Having found the Fourier series representation, we will be interested in determining when the Fourier series converges and to what function it converges.

    From our discussion in the last section, we see that the infinite series is periodic. The largest period of the terms comes from the \(n=1\) terms. The periods of \(\cos x\) and \(\sin x\) are \(T=2 \pi\). Thus, the Fourier series has period \(2 \pi\). This means that the series should be able to represent functions that are periodic of period \(2 \pi\).

    While this appears restrictive, we could also consider functions that are defined over one period. In Figure 5.4 we show a function defined on \([0,2 \pi]\). In the same figure, we show its periodic extension. These are just copies of the original function shifted by the period and glued together. The extension can now be represented by a Fourier series and restricting the Fourier series to \([0,2 \pi]\) will give a representation of the original function. Therefore, we will first consider Fourier series representations of functions defined on this interval. Note that we could just as easily considered functions defined on \([-\pi, \pi]\) or any interval of length \(2 \pi\).

    Theorem 5.2: Fourier Coefficients

    The Fourier series representation of \(f(x)\) defined on \([0,2 \pi]\) when it exists, is given by (5.1) with Fourier coefficients

    \[\begin{aligned}
    a_{n} &=\dfrac{1}{\pi} \int_{0}^{2 \pi} f(x) \cos n x d x, \quad n=0,1,2, \ldots \\
    b_{n} &=\dfrac{1}{\pi} \int_{0}^{2 \pi} f(x) \sin n x d x, \quad n=1,2, \ldots
    \end{aligned} \label{5.2} \]

    Screen Shot 2022-07-05 at 1.23.58 AM.png
    Figure 5.4. Plot of the functions \(f(t)\) defined on \([0, 2\pi]\) and its periodic extension.

    These expressions for the Fourier coefficients are obtained by considering special integrations of the Fourier series. We will look at the derivations of the \(a_{n}\)'s. First we obtain \(a_{0}\).

    We begin by integrating the Fourier series term by term in Equation (5.1).

    \[\int_{0}^{2 \pi} f(x) d x=\int_{0}^{2 \pi} \dfrac{a_{0}}{2} d x+\int_{0}^{2 \pi} \sum_{n=1}^{\infty}\left[a_{n} \cos n x+b_{n} \sin n x\right] d x \label{5.3} \]

    We assume that we can integrate the infinite sum term by term. Then we need to compute

    \[\begin{array}{r}
    \int_{0}^{2 \pi} \dfrac{a_{0}}{2} d x=\dfrac{a_{0}}{2}(2 \pi)=\pi a_{0} \\
    \int_{0}^{2 \pi} \cos n x d x=\left[\dfrac{\sin n x}{n}\right]_{0}^{2 \pi}=0 \\
    \int_{0}^{2 \pi} \sin n x d x=\left[\dfrac{-\cos n x}{n}\right]_{0}^{2 \pi}=0
    \end{array} \label{5.4} \]

    From these results we see that only one term in the integrated sum does not vanish leaving

    \[\int_{0}^{2 \pi} f(x) d x=\pi a_{0} \nonumber \]

    This confirms the value for \(a_{0}\).
    Next, we need to find \(a_{n}\). We will multiply the Fourier series (5.1) by \(\cos m x\) for some positive integer \(m\). This is like multiplying by \(\cos 2 x, \cos 5 x\), etc. We are multiplying by all possible \(\cos mx\) functions for different integers \(m\) all at the same time. We will see that this will allow us to solve for the \(a_n\)’s.

    We find the integrated sum of the series times \(\cos mx\) is given by

    \[\begin{aligned}
    \int_{0}^{2 \pi} f(x) \cos m x d x &=\int_{0}^{2 \pi} \dfrac{a_{0}}{2} \cos m x d x \\
    &+\int_{0}^{2 \pi} \sum_{n=1}^{\infty}\left[a_{n} \cos n x+b_{n} \sin n x\right] \cos m x d x
    \end{aligned} \label{5.5} \]

    Integrating term by term, the right side becomes

    \[\dfrac{a_{0}}{2} \int_{0}^{2 \pi} \cos m x d x+\sum_{n=1}^{\infty}\left[a_{n} \int_{0}^{2 \pi} \cos n x \cos m x d x+b_{n} \int_{0}^{2 \pi} \sin n x \cos m x d x\right] \text {. } \label{5.6} \]

    We have already established that \(\int_{0}^{2 \pi} \cos m x d x=0\), which implies that the first term vanishes.

    Next we need to compute integrals of products of sines and cosines. This requires that we make use of some trigonometric identities. While you have seen such integrals before in your calculus class, we will review how to carry out such integrals. For future reference, we list several useful identities, some of which we will prove along the way.

    Useful Trigonometric Identities

    \[\sin (x \pm y) =\sin x \cos y \pm \sin y \cos x \label{5.7} \]

    \[\cos (x \pm y) =\cos x \cos y \mp \sin x \sin y \label{5.8} \]

    \[\sin ^{2} x =\dfrac{1}{2}(1-\cos 2 x) \label{5.9} \]

    \[\cos ^{2} x =\dfrac{1}{2}(1+\cos 2 x) \label{5.10} \]

    \[\sin x \sin y =\dfrac{1}{2}(\cos (x-y)-\cos (x+y)) \label{5.11} \]

    \[\cos x \cos y =\dfrac{1}{2}(\cos (x+y)+\cos (x-y)) \label{5.12} \]

    \[\sin x \cos y =\dfrac{1}{2}(\sin (x+y)+\sin (x-y)) \label{5.13} \]

    We first want to evaluate \(\int_{0}^{2 \pi} \cos n x \cos m x d x\). We do this by using the product identity. We had done this in the last chapter, but will repeat the derivation for the reader's benefit. Recall the addition formulae for cosines:

    \[\cos (A+B)=\cos A \cos B-\sin A \sin B \nonumber \]

    \[\cos (A-B)=\cos A \cos B+\sin A \sin B \nonumber \]

    Adding these equations gives

    \[2 \cos A \cos B=\cos (A+B)+\cos (A-B). \nonumber \]

    We can use this identity with \(A=m x\) and \(B=n x\) to complete the integration.
    We have

    \[\begin{aligned}
    \int_{0}^{2 \pi} \cos n x \cos m x d x &=\dfrac{1}{2} \int_{0}^{2 \pi}[\cos (m+n) x+\cos (m-n) x] d x \\
    &=\dfrac{1}{2}\left[\dfrac{\sin (m+n) x}{m+n}+\dfrac{\sin (m-n) x}{m-n}\right]_{0}^{2 \pi} \\
    &=0 .
    \end{aligned} \label{5.14} \]

    There is one caveat when doing such integrals. What if one of the denominators \(m \pm n\) vanishes? For our problem \(m+n \neq 0\), since both \(m\) and \(n\) are positive integers. However, it is possible for \(m=n\). This means that the vanishing of the integral can only happen when \(m \neq n\). So, what can we do about the \(m=n\) case? One way is to start from scratch with our integration. (Another way is to compute the limit as \(n\) approaches \(m\) in our result and use L'Hopital's Rule. Try it!)

    So, for \(n=m\) we have to compute \(\int_{0}^{2 \pi} \cos ^{2} m x d x\). This can also be handled using a trigonometric identity. Recall that

    \[\cos ^{2} \theta=\dfrac{1}{2}(1+\cos 2 \theta \text {. }) \nonumber \]

    Inserting this into the integral, we find

    \[\begin{aligned}
    \int_{0}^{2 \pi} \cos ^{2} m x d x &=\dfrac{1}{2} \int_{0}^{2 \pi}\left(1+\cos ^{2} 2 m x\right) d x \\
    &=\dfrac{1}{2}\left[x+\dfrac{1}{2 m} \sin 2 m x\right]_{0}^{2 \pi} \\
    &=\dfrac{1}{2}(2 \pi)=\pi
    \end{aligned} \label{5.15} \]

    To summarize, we have shown that

    \[\int_{0}^{2 \pi} \cos n x \cos m x d x=\left\{\begin{array}{l}
    0, m \neq n \\
    \pi, m=n
    \end{array}\right. \label{5.16} \]

    This holds true for \(m, n=0,1, \ldots\). [Why did we include \(m, n=0\)?] When we have such a set of functions, they are said to be an orthogonal set over the integration interval.

    Definition 5.3. 

    A set of (real) functions \(\left\{\phi_{n}(x)\right\}\) is said to be orthogonal on \([a, b]\) if \(\int_{a}^{b} \phi_{n}(x) \phi_{m}(x) d x=0\) when \(n \neq m\). Furthermore, if we also have that \(\int_{a}^{b} \phi_{n}^{2}(x) d x=1\), these functions are called orthonormal.

    The set of functions \(\{\cos n x\}_{n=0}^{\infty}\) are orthogonal on \([0,2 \pi]\). Actually, they are orthogonal on any interval of length \(2 \pi\). We can make them orthonormal by dividing each function by \(\sqrt{\pi}\) as indicated by Equation (5.15).

    The notion of orthogonality is actually a generalization of the orthogonality of vectors in finite dimensional vector spaces. The integral \(\int_{a}^{b} f(x) f(x) d x\) is the generalization of the dot product, and is called the scalar product of \(f(x)\) and \(g(x)\), which are thought of as vectors in an infinite dimensional vector space spanned by a set of orthogonal functions. But that is another topic for later.

    Returning to the evaluation of the integrals in equation (5.6), we still have to evaluate \(\int_{0}^{2 \pi} \sin n x \cos m x d x\). This can also be evaluated using trigonometric identities. In this case, we need an identity involving products of sines and cosines. Such products occur in the addition formulae for sine functions:

    \begin{aligned}
    &\sin (A+B)=\sin A \cos B+\sin B \cos A \\
    &\sin (A-B)=\sin A \cos B-\sin B \cos A
    \end{aligned}

    Adding these equations, we find that

    \[\sin (A+B)+\sin (A-B)=2 \sin A \cos B. \nonumber \]

    Setting \(A=n x\) and \(B=m x\), we find that

    \[\begin{aligned}
    \int_{0}^{2 \pi} \sin n x \cos m x d x &=\dfrac{1}{2} \int_{0}^{2 \pi}[\sin (n+m) x+\sin (n-m) x] d x \\
    &=\dfrac{1}{2}\left[\dfrac{-\cos (n+m) x}{n+m}+\dfrac{-\cos (n-m) x}{n-m}\right]_{0}^{2 \pi} \\
    &=(-1+1)+(-1+1)=0 .
    \end{aligned} \label{5.17} \]

    For these integrals we also should be careful about setting \(n=m\). In this special case, we have the integrals

    \[\int_{0}^{2 \pi} \sin m x \cos m x d x=\dfrac{1}{2} \int_{0}^{2 \pi} \sin 2 m x d x=\dfrac{1}{2}\left[\dfrac{-\cos 2 m x}{2 m}\right]_{0}^{2 \pi}=0. \nonumber \]

    Finally, we can finish our evaluation of (5.6). We have determined that all but one integral vanishes. In that case, \(n=m\). This leaves us with

    \[\int_{0}^{2 \pi} f(x) \cos m x d x=a_{m} \pi \nonumber \]

    Solving for \(a_{m}\) gives

    \[a_{m}=\dfrac{1}{\pi} \int_{0}^{2 \pi} f(x) \cos m x d x \nonumber \]

    Since this is true for all \(m=1,2, \ldots\), we have proven this part of the theorem. The only part left is finding the \(b_{n}\)'s This will be left as an exercise for the reader.

    We now consider examples of finding Fourier coefficients for given functions. In all of these cases we define \(f(x)\) on \([0,2 \pi]\).

    Example 5.4. \(f(x) = 3 \cos 2x, x \in [0,2 \pi]\).

    We first compute the integrals for the Fourier coefficients.

    \[\begin{aligned}
    &a_{0}=\dfrac{1}{\pi} \int_{0}^{2 \pi} 3 \cos 2 x d x=0 \\
    &a_{n}=\dfrac{1}{\pi} \int_{0}^{2 \pi} 3 \cos 2 x \cos n x d x=0, \quad n \neq 2 \\
    &a_{2}=\dfrac{1}{\pi} \int_{0}^{2 \pi} 3 \cos ^{2} 2 x d x=3 \\
    &b_{n}=\dfrac{1}{\pi} \int_{0}^{2 \pi} 3 \cos 2 x \sin n x d x=0, \forall n
    \end{aligned} \label{5.18} \]

    Therefore, we have that the only nonvanishing coefficient is \(a_{2}=3\). So there is one term and \(f(x)=3 \cos 2 x\). Well, we should have know this before doing all of these integrals. So, if we have a function expressed simply in terms of sums of simple sines and cosines, then it should be easy to write down the Fourier coefficients without much work.

    Example 5.5. \(f(x) = \sin^{2}x, x \in [0,2 \pi]\).

    We could determine the Fourier coefficients by integrating as in the last example. However, it is easier to use trigonometric identities. We know that

    \[\sin ^{2} x=\dfrac{1}{2}(1-\cos 2 x)=\dfrac{1}{2}-\dfrac{1}{2} \cos 2 x. \nonumber \]

    There are no sine terms, so \(b_{n}=0, n=1,2, \ldots\) There is a constant term, implying \(a_{0} / 2=1 / 2\). So, \(a_{0}=1\). There is a \(\cos 2 x\) term, corresponding to \(n=2\), so \(a_{2}=-\dfrac{1}{2}\). That leaves \(a_{n}=0\) for \(n \neq 0,2\).

    Example 5.6. \(f(x)=\left\{\begin{array}{c}
    1, \quad 0<x<\pi \\
    -1, \pi<x<2 \pi
    \end{array}\right.\).

    This example will take a little more work. We cannot bypass evaluating any integrals at this time. This function is discontinuous, so we will have to compute each integral by breaking up the integration into two integrals, one over \([0, \pi]\) and the other over \([\pi, 2 \pi]\).

    \[\begin{aligned}
    a_{0}&=\dfrac{1}{\pi} \int_{0}^{2 \pi} f(x) d x \\
    &=\dfrac{1}{\pi} \int_{0}^{\pi} d x+\dfrac{1}{\pi} \int_{\pi}^{2 \pi}(-1) d x \\
    &=\dfrac{1}{\pi}(\pi)+\dfrac{1}{\pi}(-2 \pi+\pi)=0
    \end{aligned} \label{5.19} \]

    \[\begin{aligned}
    a_{n} &=\dfrac{1}{\pi} \int_{0}^{2 \pi} f(x) \cos n x d x \\
    &=\dfrac{1}{\pi}\left[\int_{0}^{\pi} \cos n x d x-\int_{\pi}^{2 \pi} \cos n x d x\right] \\
    &=\dfrac{1}{\pi}\left[\left(\dfrac{1}{n} \sin n x\right)_{0}^{\pi}-\left(\dfrac{1}{n} \sin n x\right)_{\pi}^{2 \pi}\right] \\
    &=0 .
    \end{aligned} \label{5.20} \]

    \[\begin{aligned}
    b_{n} &=\dfrac{1}{\pi} \int_{0}^{2 \pi} f(x) \sin n x d x \\
    &=\dfrac{1}{\pi}\left[\int_{0}^{\pi} \sin n x d x-\int_{\pi}^{2 \pi} \sin n x d x\right] \\
    &=\dfrac{1}{\pi}\left[\left(-\dfrac{1}{n} \cos n x\right)_{0}^{\pi}+\left(\dfrac{1}{n} \cos n x\right)_{\pi}^{2 \pi}\right] \\
    &=\dfrac{1}{\pi}\left[-\dfrac{1}{n} \cos n \pi+\dfrac{1}{n}+\dfrac{1}{n}-\dfrac{1}{n} \cos n \pi\right] \\
    &=\dfrac{2}{n \pi}(1-\cos n \pi)
    \end{aligned} \label{5.21} \]

    We have found the Fourier coefficients for this function. Before inserting them into the Fourier series (5.1), we note that \(\cos n \pi=(-1)^{n}\). Therefore,

    \[1-\cos n \pi=\left\{\begin{array}{l}
    0, n \text { even } \\
    2, n \text { odd }
    \end{array}\right. \label{5.22} \]

    So, half of the \(b_{n}\)'s are zero. While we could write the Fourier series representation as

    \[f(x) \sim \dfrac{4}{\pi} \sum_{n=1, \text { odd }}^{\infty} \dfrac{1}{n} \sin n x \nonumber \]

    we could let \(n=2 k-1\) and write

    \(f(x)=\dfrac{4}{\pi} \sum_{k=1}^{\infty} \dfrac{\sin (2 k-1) x}{2 k-1}\),

    But does this series converge? Does it converge to \(f(x)\)? We will discuss this question later in the chapter.


    This page titled 5.2: Fourier Trigonometric Series is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Russell Herman via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.