What is the geometric meaning of this integral? In my math book, there is an exercise where the task is to compute the following integral and to interpret the result geometrically:
$$\int_0^\pi\cos mx \cos nx \ dx$$
where $m,n \in \mathbb{N}$.
Now, to compute the integral, I separately considered the case $m = n$ and $m \neq n$. For $m \neq n$ we get (using integration by parts and the fact that both $n, m$ are integers)
$$\int_0^\pi\cos mx \cos nx \ dx= \frac{m \cos(n \pi) \sin(m \pi)-n \cos(m \pi) \sin(n \pi)}{m^2-n^2} = 0$$
For, $m = n$, the result is 
$$\int_0^\pi\cos^2 (mx) \ dx= \frac{2 m \pi+ \sin(2 m \pi)}{4 m} = \frac{\pi}{2}$$
Now my book asks me to interpret the result geometrically using terms like "dot product" or "vector space". I am  curious what the answer is but unfortunately my linear algebra skills are quite basic and I didn't find any geometric relation.
 A: Let $E$ be the vector space of continuous functions on $[0,\pi]$ and for $f,g\in E$, define
$$\varphi(f,g)=\int_0^\pi f(x)g(x)\,\mathrm{d}x.$$
Fact: $\varphi$ is a dot product on $E$.
To prove this fact you need to show that:


*

*$\varphi$ is symmetric, i.e., for all $f,g\in E$, $\varphi(f,g)=\varphi(g,f)$. This is obvious.

*$\varphi$ is positive semi-definite, i.e., for all $f\in E$, $\varphi(f,f)\geq0$. This is obvious too.

*$\varphi$ is positive definite, i.e., if $f\in E$ is such that $\varphi(f,f)=0$, then $f=0$. This is easy to prove (you must use continuity of $f$).


So $\varphi$ is a dot product on $E$.
Now, for $n\in\mathbb{N}$, define the function $c_n$ on $[0,\pi]$ by
$$\forall x\in[0,\pi],\ c_n(x)=\cos(nx).$$
Clearly, the functions $c_n$ belong to $E$.
You showed the following:
$$\forall m,n\in\mathbb{N},\ \varphi(c_n,c_m)=\begin{cases}0&\text{if $m\neq n$}\\\pi/2&\text{if $m=n\neq0$}\\\pi&\text{if $m=n=0$.}\end{cases}$$
So your result can be interpreted as:

The family $(c_n)_n$ is an orthogonal family of vectors of $E$ (with respect to the dot product $\varphi$).

A: Define the sequence of functions $f_n(x)=\cos(nx)$.
Let's stick with non-negative integers because $f_n(x)=f_{-n}(x)$.
Also define the sequence of vectors with an infinite number of components:
$v_0=(\alpha,0,0,\ldots)$
$v_1=(0,\alpha,0,\ldots)$
$v_2=(0,0,\alpha,\ldots)$ and so on, where $\alpha=\sqrt\frac{π}{2}$.
Once you simplify your expressions (using the fact that $m$ and $n$ are integers) you should find that
$\int_0^π f_m(x)f_n(x)dx=v_m\cdot v_n$ where the dot product here is defined in the obvious way as an extension of the usual dot product in 3 dimensions.
So you can think of functions built from the sum of functions like $f_n$ exactly like vectors and the integrals of their products can be computed using dot products. For example $\int_0^π \cos(2x)(2\cos(2x)+3\cos(4x))dx$ is just like the dot product $(0, 0, \alpha, 0, \ldots)\cdot(0, 0, 2\alpha, 0, 3\alpha, 0, \ldots)$ and so you can immediately compute the result as $2\alpha^2=π$. In fact, abstractly the $f_n$ are vectors and the integral of their products is a dot product.
A: Suppose you have a space of functions, say for example $\mathcal(\mathbb{R}, \mathbb{R})$. You can define a product by : 
$$\langle f, g \rangle = \int_{\mathbb{R}} f(x)g(x) dx$$
You can easily verify the properties of inner products. The integral you're studying is the scalar product between $x \to \cos (nx)$ and $x \to \cos (mx)$. In advanced courses of analysis, you learn that this kind of functions (with some constants to normalize them) actually form a Hilbert basis of some functional spaces like $L^{2}$. To be simple, Hilbert basis are the generalization of usual basis to the case of infinite-dimensional spaces.
A: Since $n,m\in N$, then the interpretation of this is to said that the set of vectors are orthogonal, since $\int_0^{\pi}\cos{nx}\cos{mx}dx=0$, ($\sin(n\pi)=0$) .
