Skip to main content

Section 3.9 Fourier Series

We will formalize some of the work done in Project 3, specifically the generalization of the dot product to vector spaces in general.

Definition 3.9.1. Inner Product.

An inner product is a bilinear operation (denoted \(\langle . , . \rangle\)) from a vector space \(V \times V\) to \(\mathbb{C}\) that satisifies the following: if \(x,y,z\in V\) and \(k\in \mathbb{C}\) then
  1. \(\displaystyle \langle x , y \rangle = \overline{\langle y,x\rangle}\)
  2. \(\displaystyle \langle x , y+z \rangle = \langle x,y \rangle +\langle x,z\rangle \)
  3. \(\displaystyle \langle k x , y \rangle = k \langle x,y \rangle\)
  4. \(\langle x , x \rangle \geq 0\text{,}\) \(\langle x,x\rangle =0\) iff \(x= \vec{0}\)
A vector space \(V\) with a choice of inner product is called an inner product space.

Example 3.9.2. \(\mathbb{R}^n\) and the dot product.

The dot product (\(\vec{v} \cdot \vec{w} =\sum_i v_i w_i\)) is an inner product for our first example of a vector space, \(\mathbb{R}^n\text{.}\)

Example 3.9.3.

As we developed in Project 3, we can define an inner product of
\begin{equation*} \langle f,g \rangle =\int_a^b f(x) g(x) \enspace dx \end{equation*}
for \(f,g \in C^0([a,b])\text{.}\) because integrals are lienar with respect to the functions being integrated.
There is not just one inner product that we could define on \(C^0([a,b])\text{.}\) We could give a weighting of the the points in our region of integration and define a weighted integral which will still give an inner product. Specifically, we could define
\begin{equation*} \langle f,g \rangle_{w(x)} =\int_a^b f(x) g(x) w(x) \enspace dx \end{equation*}
for \(f,g \in C^0([a,b])\text{.}\) For instance, if \(f(x)=x\) and \(g(x)=^2\text{,}\) then \(f,g\in C^0(\mathbb{R})\) but the unweighted inner product
\begin{equation*} \langle f,g\rangle = \int_{-\infty}^\infty f(x) g(x) \enspace dx \end{equation*}
will not be defined for \(f\) and \(g\text{.}\) The weighted inner product with \(w(x) = e^{-x^2}\) exists for \(f\) and \(g\) because
\begin{equation*} \langle f,g\rangle_{w(x)} = \int_{-\infty}^\infty f(x) g(x) e^{-x^2} \enspace dx \end{equation*}
converges to a finite value.
If we look at a set of of functions, \(S=\{\phi_k(x)\} \subset C^0(\mathbb{R})\text{,}\) we can still consider the span of that set,
\begin{equation*} Span(S)=\{g(x)|g(x)=\sum_{i=1}^n a_i \phi_i(x)\} \end{equation*}
While the span of this set is unlikely to be all of our vector space \(C^0(\mathbb{R})\text{,}\) we can still ask what function from the span is closest to a given function. The inner product (like the dot product) gives us a way to measure how much functions move together, so we can try to find the function from \(Span(S)\) that will maximize it’s inner product with a given \(g \in C^0\text{.}\) If this sounds like a projection vector problem, good news, it is!
Let’s consider our set \(S=\{\phi_k(x)=\sin(\frac{k \pi x}{L})\}\) as a subset of functions/vectors from \(C^\infty(\mathbb{R})\text{.}\) What kind of functions can we write as a linear combination from \(S\text{?}\) For one thing, all of the linear combinations of functions from \(S\) will be periodic and will have zeros at 0 and \(L\text{.}\)
Let’s consider \(h(x)\text{,}\) a function that has zeros at 0 and 1 as shown in the graph below.
Figure 3.9.4. A plot of \(h(x)\)

Question 3.9.5.

How well can we approximate this function with a linear combination from our set \(S\text{?}\)
A very useful fact about our set \(S\) is that each of the functions, \(\phi_k(x)=\sin(\frac{k \pi x}{L})\text{,}\) is orthogonal to any other element of \(S\text{.}\) If \(k\neq j\text{,}\) then \(\langle \phi_k , \phi_j \rangle =0\text{.}\) Here we are using the unweighted inner product. Note here that we will consider \(L=1\) so that our region of interest is the interval from \([0,1]\text{.}\)
What does it mean for our functions to be "orthogonal"? Let’s look at the graph of \(\phi_k(x) \phi_j(x)\) (with \(L=1\)) on the interval from 0 to 1. Change the \(k\) and \(j\) values to see how the function we are integrating changes.
For our set \(S\text{,}\) we should also look at what \(\langle \phi_k, \phi_k \rangle \) would be. Let’s calculate
\begin{equation*} \int_0^1 (\sin(k \pi x))^2 \enspace dx \text{.} \end{equation*}
Let \(h_N\) be the approximation of \(h\) using \(\{\phi_0, \phi_1, \ldots , \phi_N\}\text{.}\) For instance, when \(N=4\text{,}\)
\begin{equation*} h(x) \approx h_N(x) = \sum_{j=0}^4 a_j \phi_j(x) \end{equation*}
So to figure out each of the \(a_j\) coefficents, let’s take the inner product with \(\phi_k\) on both sides of our \(h_N(x)\) linear combination. We get
\begin{equation*} \langle h(x), \phi_k(x)\rangle \approx \langle h_n(x), \phi_k(x)\rangle = \langle \sum_{j=0}^4 a_j \phi_j(x), \phi_k(x)\rangle \end{equation*}
But since each of the \(\phi_k\) functions is orthogonal to all of the other \(\phi_j\) functions (\(k\neq j\)), we will get
\begin{equation*} \langle h(x), \phi_k(x)\rangle \approx \langle h_n(x), \phi_k(x)\rangle = \langle a_k \phi_k(x), \phi_k(x)\rangle \end{equation*}
Thus our coefficents \(a_i\) can be found by
\begin{equation*} a_i=\frac{\langle h(x), \phi_i(x)\rangle}{\langle \phi_i(x), \phi_i(x)\rangle} \end{equation*}
The following sage commands will calculate the coefficents for our approximation of \(h(x)\) using a linear combination of functions from \(S\text{.}\) You can see how we get successively better approximations of \(h(x)\) as we increase the number of terms in the linear combination.
If you noticed, the function we used above for \(h(x)\) was actually a linear combination from \(S\text{.}\) What if we considered the same problem but with a function NOT in \(Span(S)\text{.}\) Consider \(g(x)=|x-1/2|\text{.}\)
Figure 3.9.6. A plot of \(g(x)=|x-1/2|\)
Let’s see what the coefficients will be for our approximation of \(g(x)\) with a linear combination from \(S\text{.}\)
What do you notice about where the approximations are getting better and where the approximations are awful? Why do you think this is the case?
Let’s consider a larger set of functions, \(SC=\{\phi_k(x)=\sin(\frac{k \pi x}{L})\} \cup \{\psi_k(x)=\cos(\frac{k \pi x}{L})\}\text{.}\) Will this set still have the property that each element is orthogonal to all of the others (except itself)?
So we probably shouldn’t use both the sine and cosine functions unless we have a good way to split up our coefficents since \(\langle \phi_k, \psi_j \rangle \neq 0\) for \(k \neq j\text{.}\) For now, let’s consider just the cosine functions \(C=\{\psi_k(x)=\cos(k \pi x)\}\) (with \(L=1\)) for our problem because our target function does not have a zero output at the boundaries of our interval.
Let \(g_N\) be the approximation of \(g\) using \(\{\psi_0, \psi_1, \ldots , \psi_N\}\text{.}\) For instance, when \(N=4\text{,}\)
\begin{equation*} g(x) \approx g_N(x) = \sum_{j=0}^4 b_j \psi_j(x) \end{equation*}
So to figure out each of the \(b_j\) coefficents, let’s take the inner product with \(\psi_k\) on both sides of our \(g_N(x)\) linear combination. We get
\begin{equation*} \langle g(x), \psi_k(x)\rangle \approx \langle g_n(x), \psi_k(x)\rangle = \langle \sum_{j=0}^4 b_j \psi_j(x), \psi_k(x)\rangle \end{equation*}
But since each of the \(\psi_k\) functions is orthogonal to all of the other \(\psi_j\) functions (\(k\neq j\)), we will get
\begin{equation*} \langle g(x), \psi_k(x)\rangle \approx \langle g_n(x), \psi_k(x)\rangle = \langle b_k \psi_k(x), \psi_k(x)\rangle \end{equation*}
Thus our coefficents \(a_i\) can be found by
\begin{equation*} b_i=\frac{\langle g(x), \psi_i(x)\rangle}{\langle \psi_i(x), \psi_i(x)\rangle} \end{equation*}
Let’s see what the coefficients will be for our approximation of \(g(x)\) with a linear combination from \(C\text{.}\)
While our function \(g(x)=|x-1/2|\) is not in the span of our set \(SC\text{,}\) our linear combination approximiation is the closest function to \(g\) (where closest is measured using the inner product!).
We should take a bit of time to list all of the tools we have learned about this semester that are involved in the previous problems: vectors (the bigger idea of vectors as objects that you can work with linear combinations), linear combinations, span, inner products/orthogonality, efficiently solving linear algebraic systems. What others?