Sine and Cosine Properties
We saw that polynomials did not work very well with our new sense of closeness. Supposedly, $\sin(nx)$ and $\cos(nx)$ were better. Apparently ``being orthogonal to each other'' was what we needed. Let's find out more.
Recall: We're using the inner product $$ \langle f, g \rangle = \int_{-\pi}^{\pi} f(x)g(x) \ dx. $$
1) The Size of $\sin(nx)$ and $\cos(nx)$
How big are these functions? What should we use to measure them?
$$ || \sin(nx) || = \ ? $$
$$ || \cos(nx) || = \ ? $$
We can compute these together. Here are some tools that to help us simplify our integrals.
Remember these from Trig?
$$ \sin(A)\cos(B) = \frac{1}{2} \left( \sin(A-B) + \sin(A+B) \right) $$ $$ \sin(A)\sin(B) = \frac{1}{2} \left( \cos(A-B) - \cos(A+B) \right) $$ $$ \cos(A)\cos(B) = \frac{1}{2} \left( \cos(A-B) + \cos(A+B) \right) $$
For sine :
So $ || \sin(nx) || = \sqrt{\pi}. $
For cosine :
So $ || \cos(nx) || = \sqrt{\pi}. $
Below we can see the size of our function for just about any $n$. You might notice something significant about the case where $n=0$. Did we address this case in our computations?
Figure 1: Sine and Cosine Norms
Adopting a Better Inner Product
Because of this common factor of $\pi$, it makes a lot more sense to use a scaled-down version of our simpler integral inner product: $$ \langle f, g \rangle = \frac{1}{\pi} \int_{-\pi}^\pi f(x) g(x) \ dx. $$ This is the standard inner product for the periodic functions $\sin(nx)$ and $\cos(nx)$ with period $2\pi$ on the interval $[-\pi, \pi]$.
More generally, we define the standard inner product for periodic functions with period $2L$ on the interval $[a,b]$ of length $2L$ as: $$ \langle f, g \rangle = \frac{1}{L} \int_a^b f(x) g(x) \ dx. $$
With this adjustment to the inner product $\langle -, - \rangle$, all functions of the form $\sin(nx)$ and $\cos(nx)$ have size 1 except for the constant term. Did you find the constant term in the last figure? Hint: It wasn't 0.
We make the constant term $\frac{1}{2}\cos(0x) = \frac{1}{2}$ so that it has size 1 as well.
2) The Perpendicularity of $\sin(mx)$ and $\cos(nx)$
Earlier I made the claim that these functions are perpendicular to each other. In the more general setting of inner products, we usually use term orthogonal.
We'll check that any two distinct functions of the form $\sin(nx)$, $\cos(nx)$ are in fact orthogonal.
$$ \langle \sin(mx), \cos(nx) \rangle = 0 ? $$
$$ \langle \sin(mx), \sin(nx) \rangle = 0 ? $$
$$ \langle \cos(mx), \cos(nx) \rangle = 0 ? $$
These same trig identities will help us again.
$$ \sin(A)\cos(B) = \frac{1}{2} \left( \sin(A-B) + \sin(A+B) \right) $$ $$ \sin(A)\sin(B) = \frac{1}{2} \left( \cos(A-B) - \cos(A+B) \right) $$ $$ \cos(A)\cos(B) = \frac{1}{2} \left( \cos(A-B) + \cos(A+B) \right) $$
For sine and cosine :
Note that the left term cancels for different reasons bases on whether or not $m=n$ or not. If $m=n$ then $(m-n)=0$ and we have $sin(0)=0$ in our integrand. If they are not equal then we get the same behavior in both cases, where we have a multiple of $\cos(kx)$ for some constant $k$ evaluated at $\pi$ and $-\pi$, which cancel.
For two sine terms :
Similarly to the last case, both terms cancel because they have anti-derivatives that agree at $-\pi$ and $\pi$.
For two cosine terms :
Both terms cancel for the same reason as the last computation.
Follow-up question: The terms we just cancelled were all zero. How do you think we could get a size of 1 for $||\sin(nx)||$ and $||\cos(nx)||$?
Figure 2: Inner Products of Sine and Cosine Functions Visualized