TITLE: Meaning/Justification for Describing Functions as 'Orthogonal'
QUESTION [18 upvotes]: When introducing Fourier series, my lecturer stated that 2 periodic functions, $f$ and $g$, with period $2L$ are orthogonal iff $$\int^{L}_{-L}{f(x)g(x)}\mathrm dx=0$$ Wikipedia agrees, even defining the above integral to be the inner product of $f$ and $g$, completely analogous with the terminology from linear algebra. My lecturer hinted that there is a reason for the terminology being the way it is, but personally I'm having a bit of a hard time seeing what the above integral has to do with orthogonality as I would understand it. 
On a related note, does this connection (between orthogonal functions and orthogonality more generally, assuming there is one) in some way 'explain' why the sine and cosine functions can be used to construct any continuous functions in a Fourier series, while other sets of functions cannot. Currently it seems the orthogonality plays an almost magical role in deriving the coefficient equations, I'm wondering if there's something deeper there. 
Thanks!

REPLY [4 votes]: An Inner Product Space is a vector space on which an inner product has been defined.  An inner product is a positive definite bilinear form, $\left<x,y\right>$; that is, a  bilinear form where $\left<x,x\right>\ge0$ and $\left<x,x\right>=0$ if and only if $x=0$. Orthogonality is defined using an inner product; that is, $x$ and $y$ are orthogonal when $\left<x,y\right>=0$. The length of a vector is also defined in terms of the inner product: $|x|^2=\left<x,x\right>$. Using a process called Gram-Schmidt Orthonormalization, one can turn any basis for a finite dimensional inner product space into an Orthonormal basis, a basis $\{e_i\}_{i=1}^n$ for which $\left<e_i,e_j\right>=0$ when $i\not=j$ and $\left<e_i,e_i\right>=1$.
In an inner product space, a vector can be written as a linear combination of the basis elements
$$
v=\sum_{i=1}^na_ie_i\tag{1}
$$
If the basis is orthonormal, we can easily compute the coefficients in $(1)$ using the inner product:
$$
\begin{align}
\left<v,e_i\right>
&=\left<\sum_{j=1}^na_je_j\;,\;e_i\right>\\
&=\sum_{j=1}^na_j\left<e_j\;,\;e_i\right>\\
&=a_i\tag{2}
\end{align}
$$
We also have the Pythagorean Theorem for lengths
$$
\begin{align}
|v|^2
&=\left<v,v\right>\\
&=\left<\sum_{i=1}^na_ie_i\;,\;\sum_{j=1}^na_je_j\right>\\
&=\sum_{i=1}^n\sum_{j=1}^na_ia_j\left<e_i,e_j\right>\\
&=\sum_{i=1}^na_i^2\tag{3}
\end{align}
$$
Many inner products can be defined on an inner product space. For functions on $(-L,L]$, the simplest in form is
$$
\left<f,g\right>=\int_{-T}^Tf(x)g(x)\;\mathrm{d}x\tag{4}
$$
With respect to this inner product, the trigonometric functions, $\{\sin(\frac{\pi nx}{L})\}_{n=1}^\infty$ and $\{\cos(\frac{\pi nx}{L})\}_{n=0}^\infty$, or equivalently $\{e^{i\pi nx/L}\}_{n=-\infty}^\infty$, are orthonormal.