Proof of the Orthogonality of the Set of Trigonometric Functions
Theorem
The set $\left\{ 1,\ \cos \dfrac{\pi x}{L},\ \cos \dfrac{2\pi x}{L}, \cdots ,\ \sin\dfrac{\pi x}{L},\ \sin\dfrac{2\pi x}{L},\ \cdots \right\}$ of functions $2L$ that are periodic functions is an orthogonal set in the interval $[-L,\ L)$. In other words, for $m,n = 1, 2, 3, \dots$, the following holds.
$$ \begin{align} \dfrac{1}{L} \int _{-L}^{L} \cos\dfrac{m\pi x}{L} \cos\dfrac{n\pi x}{L} dx &= \delta_{mn} \label{eq1} \\ \dfrac{1}{L} \int _{-L}^{L} \sin \dfrac{m\pi x}{L}\sin \dfrac{n\pi x}{L} dx &= \delta_{mn} \label{eq2} \\ \int _{-L}^{L} \cos \dfrac{m\pi x}{L} \sin \dfrac{n\pi x}{L} dx \quad &= 0 \label{eq3} \\ \dfrac{1}{L} \int_{-L}^{L} \cos \dfrac{n\pi x}{L} dx &= 0 \label{eq4} \\ \dfrac{1}{L} \int_{-L}^{L} \sin \dfrac{n\pi x}{L} dx &= 0 \label{eq5} \end{align} $$
Here, $\delta$ is the Kronecker delta.
Corollary
According to $(4), (5)$, the average of one period of cosine and sine is $0$.
Explanation
Due to the Euler’s formula, the set of exponential functions also possesses orthogonality. This fact is significant in Fourier analysis as it enables the representation of periodic functions as series of periodic functions, namely the Fourier series.
Proof
$(1)$
$$ \int_{-L}^{L} \cos \frac{m\pi x}{L} \cos \ \frac{n\pi x}{L} dx \tag{1} $$
- case 1.1 $m \ne n$
$$ \begin{align*} & \int_{-L}^{L} \cos \dfrac{m\pi x}{L} \cos \dfrac{n\pi x}{L} dx \quad (m,n=1, 2,\dots\quad m\ne n) \\ &= \frac{1}{2} \int_{-L}^{L} \left[ \cos \frac{(m+n)\pi x}{L}+\cos \frac{(m-n)\pi x}{L} \right] dx \\ &= \frac{1}{2} \left[ \dfrac{L}{(m+n)\pi}\sin \dfrac{(m+n)\pi x}{L} \right]_{-L}^{L} + \frac{1}{2} \left[ \dfrac{L}{(m-n)\pi }\sin \dfrac{(m-n)\pi x}{L} \right]_{-L}^{L} \\ &= \frac{1}{2} \left[ \dfrac{L}{(m+n)\pi}\sin \big( (m+n)\pi \big) + \dfrac{L}{(m+n)\pi}\sin \big( (m+n)\pi \big) \right] \\ &\quad+ \frac{1}{2} \left[ \dfrac{L}{(m-n)\pi}\sin \big( (m-n)\pi \big) + \dfrac{L}{(m-n)\pi}\sin\big( (m-n)\pi \big) \right] \\ &= 0 \end{align*} $$
The first equality holds due to the product-to-sum identities of trigonometric functions. The last equality holds because $m+n,\ m-n$ is an integer not equal to $0$, so all terms are $0$.
case 1.2 $m = n$
$$ \begin{align*} \int _{-L}^{L} \left( \cos \dfrac{m\pi x}{L} \right)^2 dx &=\dfrac{1}{2} \int_{-L}^{L} \left( 1+ \cos \dfrac{2m\pi x}{L} \right) dx \\ &= \frac{1}{2}\left[ x+\frac{L}{2m\pi}\sin \frac{2m\pi x}{L} \right]_{-L}^{L} \\ &= \frac{1}{2}(2L) \\ &= L \end{align*} \\ \implies \dfrac{1}{L}\int _{-L}^{L} \left( \cos \dfrac{m\pi x}{L} \right)^2dx = 1 $$
The first equality holds due to the half-angle identities of trigonometric functions.
■
$(2)$
$$ \int_{-L}^{L} \sin \dfrac{m\pi x}{L} \sin \dfrac{n\pi x}{L } dx \tag{2} $$
case 2.1 $m \ne n$
$$ \begin{align*} &\int_{-L}^{L} \sin \dfrac{m\pi x}{L} \sin \dfrac{n\pi x}{L} dx \ \quad (m,n= 1,2,\cdots,\quad m\ne n) \\ &= \frac{1}{2} \int_{-L}^{L} \left[ \cos \frac{(m-n)\pi x}{L} -\cos \frac{(m+n)\pi x}{L} \right] dx \\ &= \frac{1}{2} \left[ \dfrac{L}{(m-n)\pi}\sin \dfrac{(m-n)\pi x}{L} \right]_{-L}^{L} - \frac{1}{2} \left[ \dfrac{L}{(m+n)\pi}\sin \dfrac{(m+n)\pi x}{L} \right]_{-L}^{L} \\ &= \frac{1}{2} \left[ \dfrac{L}{(m-n)\pi}\sin \big( (m-n)\pi \big) + \dfrac{L}{(m-n)\pi}\sin \big( (m+n)\pi \big) \right] \\ &\quad- \frac{1}{2} \left[ \dfrac{L}{(m+n)\pi}\sin \big( (m+n)\pi \big) +\dfrac{L}{(m+n)\pi}\sin \big( (m+n)\pi \big) \right] \\ &= 0 \end{align*} $$
The first equality holds due to the product-to-sum identities of trigonometric functions. The last equality holds for the same reason as in case 1.1, since all terms are $0$.
case 2.2 $m = n$
$$ \begin{align*} && \int _{-L}^{L} \left( \sin \dfrac{m\pi x}{L} \right)^2 dx &= \dfrac{1}{2} \int_{-L}^{L} \left( 1- \cos \dfrac{2m\pi x}{L} \right)dx \\ && &=\frac{1}{2}\left[ x-\frac{L}{2m\pi}\sin \frac{2m\pi x}{L} \right]_{-L}^{L} \\ && &= \dfrac{1}{2}(2L) \\ && &= L \end{align*} \\ \implies \dfrac{1}{L}\int _{-L}^{L} \left( \sin \dfrac{m\pi x}{L} \right) ^2 dx=1 $$
The first equality holds due to the half-angle identities of trigonometric functions.
■
$(3)$
$$ \int _{-L}^{L} \cos \dfrac{m\pi x}{L} \sin \dfrac{n\pi x}{L} dx \tag{3} $$
case 3.1 $m \ne n$
$$ \begin{align*} & \int _{-L}^{L} \cos \dfrac{m\pi x}{L} \sin \dfrac{n\pi x}{L} dx \\ &= \dfrac{1}{2} \int_{-L}^{L} \left[ \sin \dfrac{ (m+n) \pi x}{L} - \sin \dfrac{ (m-n) \pi x}{L} \right] dx \\ &= \dfrac{1}{2} \left[ - \dfrac{L}{(m+n)\pi} \cos \dfrac{ (m+n)\pi x}{L} \right] _{-L}^{L} -\dfrac{1}{2}\left[ - \dfrac{L}{(m-n)\pi} \cos \dfrac{ (m-n)\pi x}{L} \right] _{-L}^{L} \\ &= \dfrac{1}{2} \left[ - \dfrac{L}{(m+n)\pi} \cos \big( (m+n)\pi \big) + \dfrac{L}{(m+n)\pi} \cos \big( (m+n)\pi \big) \right] \\ &\quad- \dfrac{1}{2}\left[ - \dfrac{L}{(m-n)\pi} \cos \big( (m-n)\pi\big) + \dfrac{L}{(m-n)\pi} \cos \big((m-n)\pi\big)\right] \\ &= 0 \end{align*} $$
The first equality holds due to the product-to-sum identities of trigonometric functions.
case 3.2 $m = n$
$$ \begin{align*} \int _{-L}^{L} \cos \dfrac{m\pi x}{L} \sin \dfrac{n\pi x}{L} dx &= \int_{-L}^{L} \cos \dfrac{m\pi x}{L} \sin \dfrac{m\pi x}{L} dx \\ &= \dfrac{1}{2} \int _{-L}^{L} 2\cos \dfrac{m\pi x}{L} \sin \dfrac{m\pi x}{L} dx \\ &= \dfrac{1}{2} \int _{-L}^{L} \sin \dfrac{2m\pi x}{L} dx \\ &= \dfrac{1}{2} \left( -\dfrac{L}{2m\pi}\cos 2m\pi + \dfrac{L}{2m\pi} \cos 2m\pi\right) \\ &= 0 \end{align*} $$
■
$(4), (5)$
$$ \begin{align*} \int_{-L}^{L} \cos\dfrac{n \pi x}{L} dx &=\left[ \dfrac{L}{n\pi}\sin \dfrac{n \pi x}{L} \right]_{-L}^{L} \\ &=\dfrac{L}{n\pi}\sin n\pi + \dfrac{L}{n\pi}\sin n\pi \\ &=0 \end{align*} $$
The last equality holds because $n$ is an integer. The sine function also follows for the same reason
$$ \begin{align*} \int_{-L}^{L} \sin\dfrac{n \pi x}{L} dx &=\left[ -\dfrac{L}{n\pi}\cos \dfrac{n \pi x}{L} \right]_{-L}^{L} \\ &=-\dfrac{L}{n\pi}\cos n\pi + \dfrac{L}{n\pi}\cos n\pi \\ &=0 \end{align*} $$
■