We will formalize some of the work done in Project 3, specifically the generalization of the dot product to vector spaces in general.
Definition3.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
\(\displaystyle \langle x , y \rangle = \overline{\langle y,x\rangle}\)
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
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
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.
Figure3.9.4.A plot of \(h(x)\)
Question3.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
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
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{.}\)
Figure3.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{,}\)
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
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?