Skip to main content
Mathematics LibreTexts

10.5: An Application to Fourier Approximation

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

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

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \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{\longvect}{\overrightarrow}\)

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

    \(\newcommand{\ket}[1]{\left| #1 \right>}\)
    \(\newcommand{\bra}[1]{\left< #1 \right|}\)
    \(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
    \(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
    \(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
    \(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
    \(\newcommand{\expect}[1]{\langle #1 \rangle}\)
    \(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    If \(U\) is an orthogonal basis of a vector space \(V\), the expansion theorem (Theorem 10.2.4) presents a vector \(v \in V\) as a linear combination of the vectors in \(U\). Of course this requires that the set \(U\) is finite since otherwise the linear combination is an infinite sum and makes no sense in \(V\).

    However, given an infinite orthogonal set \(U = \{ \mathbf{f}_1, \mathbf{f}_2, \dots, \mathbf{f}_n, \dots \}\), we can use the expansion theorem for \(\{ \mathbf{f}_1, \mathbf{f}_2, \dots, \mathbf{f}_n\}\) for each \(n\) to get a series of “approximations” \(\mathbf{v}_n\) for a given vector \(\mathbf{v}\). A natural question is whether these \(\mathbf{v}_n\) are getting closer and closer to \(\mathbf{v}\) as \(n\) increases. This turns out to be a very fruitful idea.

    In this section we shall investigate an important orthogonal set in the space \(\mathbf{C}[-\pi, \pi]\) of continuous functions on the interval \([-\pi, \pi]\), using the inner product.

    \[\langle f, g \rangle = \int_{-\pi}^{\pi} f(x)g(x)dx \nonumber \]

    Of course, calculus will be needed. The orthogonal set in question is

    \[\{1, \sin x, \cos x, \sin(2x), \cos(2x), \sin(3x), \cos(3x), \dots \} \nonumber \]

    Standard techniques of integration give

    \[\begin{aligned} \| 1 \|^2 &= \int_{-\pi}^{\pi} 1^2 dx = 2\pi \\ \| \sin\ kx \| ^2 &= \int_{-\pi}^{\pi} \sin^2(kx) dx = \pi \quad \mbox{ for any } k = 1, 2, 3, \dots \\ \| \cos\ kx \| ^2 &= \int_{-\pi}^{\pi} \cos^2(kx) dx = \pi \quad \mbox{ for any } k = 1, 2, 3, \dots\end{aligned} \nonumber \]

    We leave the verifications to the reader, together with the task of showing that these functions are orthogonal:

    \[\langle \sin(kx), \sin(mx) \rangle = 0 = \langle \cos(kx), \cos(mx) \rangle \quad \mbox{ if } k \neq m \nonumber \]

    and

    \[\langle \sin(kx), \cos(mx) \rangle = 0 \quad \mbox{ for all } k \geq 0 \mbox{ and } m \geq 0 \nonumber \]

    (Note that \(1 = \cos(0x)\), so the constant function \(1\) is included.)

    Now define the following subspace of \(\mathbf{C}[-\pi, \pi]\):

    \[F_n = span \;\{1, \sin x, \cos x, \sin(2x), \cos(2x), \dots, \sin(nx), \cos(nx) \} \nonumber \]

    The aim is to use the approximation theorem (Theorem 10.2.8); so, given a function \(f\) in \(\mathbf{C}[-\pi, \pi]\), define the Fourier coefficients of \(f\) by

    \[\begin{aligned} a_0 &= \frac{\langle f(x), 1 \rangle}{\| 1 \| ^2} = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x)dx \\ a_k &= \frac{\langle f(x), \cos(kx) \rangle}{\| \cos(kx) \| ^2} = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x)\cos(kx)dx\quad k = 1, 2, \dots \\ b_k &= \frac{\langle f(x), \sin(kx) \rangle}{\| \sin(kx) \| ^2} = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x)\sin(kx)dx\quad k = 1, 2, \dots\end{aligned} \nonumber \]

    Then the approximation theorem (Theorem 10.2.8) gives Theorem 10.5.1.

    Theorem \(\PageIndex{1}\)

    Let \(f\) be any continuous real-valued function defined on the interval \([-\pi, \pi]\). If \(a_{0}\), \(a_{1}\), \(\dots\), and \(b_{0}\), \(b_{1}\), \(\dots\) are the Fourier coefficients of \(f\), then given \(n \geq 0\),

    \[f_n(x) = a_0 + a_1 \cos x + b_1 \sin x + a_2 \cos(2x) + b_2 \sin(2x) + \dots + a_n \cos(nx) + b_n \sin(nx) \nonumber \]

    is a function in \(F_{n}\) that is closest to \(f\) in the sense that

    \[\| f - f_n \| \leq \| f - g \| \nonumber \]

    holds for all functions \(g\) in \(F_{n}\).

    The function \(f_{n}\) is called the \(n\)th Fourier approximation to the function \(f\).

    Example \(\PageIndex{1}\)

    Find the fifth Fourier approximation to the function \(f(x)\) defined on \([-\pi, \pi]\) as follows:

    \[f(x) = \left\{ \begin{array}{ll} \pi + x & \mbox{if } -\pi \leq x < 0 \\ \pi - x & \mbox{if } 0 \leq x \leq \pi \\ \end{array} \right. \nonumber \]

    Solution

    The graph of \(y = f(x)\) appears in the top diagram. The Fourier coefficients are computed as follows. The details of the integrations (usually by parts) are omitted.

    \[\begin{aligned}
    & a_0=\frac{1}{2 \pi} \int_{-\pi}^\pi f(x) d x=\frac{\pi}{2} \\
    & a_k=\frac{1}{\pi} \int_{-\pi}^\pi f(x) \cos (k x) d x=\frac{2}{\pi k^2}[1-\cos (k \pi)]= \begin{cases}0 & \text { if } k \text { is even } \\
    \frac{4}{\pi k^2} & \text { if } k \text { is odd }\end{cases} \\
    & b_k=\frac{1}{\pi} \int_{-\pi}^\pi f(x) \sin (k x) d x=0 \quad \text { for all } k=1,2, \ldots
    \end{aligned} \nonumber \]

    Hence the fifth Fourier approximation is

    \[f_5(x) = \frac{\pi}{2} + \frac{4}{\pi}\left\{\cos x + \frac{1}{3^2} \cos(3x) + \frac{1}{5^2} \cos(5x) \right\} \nonumber \]

    This is plotted in the middle diagram and is already a reasonable approximation to \(f(x)\). By comparison, \(f_{13}(x)\) is also plotted and the difference is barely noticeable.

    clipboard_ea05311dffa1d47e1bd6fa0bf156f892b.png

    We say that a function \(f\) is an even function if \(f(x) = f(-x)\) holds for all \(x\); \(f\) is called an odd function if \(f(-x) = -f(x)\) holds for all \(x\). Examples of even functions are constant functions, the even powers \(x^{2}\), \(x^{4}\), \(\dots\), and \(\cos(kx)\); these functions are characterized by the fact that the graph of \(y = f(x)\) is symmetric about the \(y\) axis. Examples of odd functions are the odd powers \(x\), \(x^{3}\), \(\dots\), and \(\sin(kx)\) where \(k > 0\), and the graph of \(y = f(x)\) is symmetric about the origin if \(f\) is odd. The usefulness of these functions stems from the fact that

    \[\begin{array}{ll} \int_{-\pi}^{\pi} f(x)dx = 0 & \mbox{if } f \mbox{ is odd} \\ \int_{-\pi}^{\pi} f(x)dx = 2 \int_{0}^{\pi} f(x)dx & \mbox{if } f \mbox{ is even} \end{array} \nonumber \]

    These facts often simplify the computations of the Fourier coefficients. For example:

    1. The Fourier sine coefficients \(b_{k}\) all vanish if \(f\) is even.
    2. The Fourier cosine coefficients \(a_{k}\) all vanish if \(f\) is odd.

    This is because \(f(x) \sin(kx)\) is odd in the first case and \(f(x) \cos(kx)\) is odd in the second case.

    The functions \(1\), \(\cos(kx)\), and \(\sin(kx)\) that occur in the Fourier approximation for \(f(x)\) are all easy to generate as an electrical voltage (when \(x\) is time). By summing these signals (with the amplitudes given by the Fourier coefficients), it is possible to produce an electrical signal with (the approximation to) \(f(x)\) as the voltage. Hence these Fourier approximations play a fundamental role in electronics.

    Finally, the Fourier approximations \(f_{1}, f_{2}, \dots\) of a function \(f\) get better and better as \(n\) increases. The reason is that the subspaces \(F_{n}\) increase:

    \[F_1 \subseteq F_2 \subseteq F_3 \subseteq \cdots \subseteq F_n \subseteq \cdots \nonumber \]

    So, because \(f_n = \text{proj}{F_n}{f}\), we get (see the discussion following Example 10.2.6)

    \[\| f - f_1 \| \geq \| f - f_2 \| \geq \cdots \geq \| f - f_n \| \geq \cdots \nonumber \]

    These numbers \(\| f - f_{n} \|\) approach zero; in fact, we have the following fundamental theorem.

    Theorem \(\PageIndex{2}\)

    Let \(f\) be any continuous function in \(C[-\pi, \pi]\). Then1

    \[f_n(x) \mbox{ approaches } f(x) \mbox{ for all } x \mbox{ such that } -\pi < x < \pi. \nonumber \]

    It shows that \(f\) has a representation as an infinite series, called the Fourier series of \(f\):

    \[f(x) = a_0 + a_1 \cos x + b_1 \sin x + a_2 \cos(2x) + b_2 \sin(2x) + \cdots \nonumber \]

    whenever \(-\pi < x < \pi\). A full discussion of Theorem 10.5.2 is beyond the scope of this book. This subject had great historical impact on the development of mathematics, and has become one of the standard tools in science and engineering.

    Thus the Fourier series for the function \(f\) in Example 10.5.1 is

    \[f(x) = \frac{\pi}{2} + \frac{4}{\pi}\left\{\cos x + \frac{1}{3^2} \cos(3x) + \frac{1}{5^2} \cos(5x) + \frac{1}{7^2} \cos(7x) + \cdots \right\} \nonumber \]

    Since \(f(0) = \pi\) and \(\cos(0) = 1\), taking \(x = 0\) leads to the series

    \[\frac{\pi^2}{8} = 1 + \frac{1}{3^2} + \frac{1}{5^2} + \frac{1}{7^2} + \cdots \nonumber \]

    Example \(\PageIndex{2}\)

    Expand \(f(x) = x\) on the interval \([-\pi, \pi]\) in a Fourier series, and so obtain a series expansion of \(\frac{\pi}{4}\).

    Solution

    Here \(f\) is an odd function so all the Fourier cosine coefficients \(a_{k}\) are zero. As to the sine coefficients:

    \[b_k = \frac{1}{\pi} \int_{-\pi}^{\pi} x \sin(kx)dx = \frac{2}{k}(-1)^{k + 1} \quad \mbox{ for } k \geq 1 \nonumber \]

    where we omit the details of the integration by parts. Hence the Fourier series for \(x\) is

    \[x = 2[\sin x - \frac{1}{2} \sin(2x) + \frac{1}{3} \sin(3x) - \frac{1}{4} \sin(4x) + \dots] \nonumber \]

    for \(-\pi < x < \pi\). In particular, taking \(x = \frac{\pi}{2}\) gives an infinite series for \(\frac{\pi}{4}\).

    \[\frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} - \cdots \nonumber \]

    Many other such formulas can be proved using Theorem 10.5.2.


    1. The name honors the French mathematician J.B.J. Fourier (1768-1830) who used these techniques in 1822 to investigate heat conduction in solids.

    This page titled 10.5: An Application to Fourier Approximation was last modified on Sat, 17 Jan 2026 00:22:30 GMT and is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by W. Keith Nicholson via source content that was edited to the style and standards of the LibreTexts platform.