# Inner Products vs Discretizations of Functions

Let $f:(0,1)\rightarrow [0,1]$ be a $\mathcal{C}^{\infty}$ function. We say that a function $D_r^f:\{1,...,r\}\rightarrow [0,1]$ is an $r$-discretization of $f$ if $$D_r^f(j) = \frac{1}{|a(j)-b(j)|}\cdot\int_{(a(j),b(j))} f(x)\;dx$$ where $a(j)=\frac{(j-1)}{r}$ and $b(j) = \frac{j}{r}$. In other words, we divide the interval $(0,1)$ in $r$ consecutive sub-intervals and $D^f_r(j)$ is the average of $f$ on the $j$-th sub-interval $(a(j),b(j))$.

For any two $\mathcal{C}^{\infty}$ functions $f,g:(0,1)\rightarrow [0,1]$, we let we consider the following inner product. $$\langle f,g\rangle = \int_{(0,1)} f(x)\cdot g(x)\; dx$$ On the other hand we define the inner product on $r$-discretizations as follows. $$\langle D_r^f,D_r^g\rangle = \sum_{j=1}^r D_r^f(j)\cdot D_r^g(j).$$

Questions:

1. Given an $\varepsilon \in (0,1)$, how large must $r$ be so that $|\langle D_r^f,D_r^g \rangle - \langle f,g\rangle| \leq \varepsilon$?
2. Is it enough to assume that $f,g$ are $\mathcal{C}^{\infty}$ functions in order to be able to prove a bound on $r$ in terms of $\varepsilon$? If not, what are the weakest conditions $f$ and $g$ must satisfy?

Obs: This question was asked at mathoverflow some days ago (with no answers). Now I realize that scicomp may be the most adequate place to ask it.