integral involving a periodic function Let $f:[0,1] \longrightarrow \mathbb R$ be a continuous function, and let $g:\mathbb R \longrightarrow \mathbb R$ be a continuous and periodic function with period $1$. Prove that 
$\displaystyle\lim_{n\to \infty}\int_0^1f(x)g(nx)dx=\left(\int_0^1f(x)dx\right)\left(\int_0^1g(x)dx\right)$.
any Ideas?
 A: Let $$\displaystyle A_n(f,g) = \int_0^1 f(x)g(nx)\ dx - \left(\int_0^1 f(x)\ ds\right) \left(\int_0^1 g(x)\ dx\right).$$  Note that $\displaystyle |A_n(f,g)| \le 2 \|f\|_2 \|g\|_2$ so it suffices to prove $\displaystyle \lim_{n \to \infty} A_n(f,g) = 0$ when $f$ and $g$ are in a dense subspace of $L^2(0,1)$, in particular for trigonometric polynomials. Further, it suffices to prove it for $f$ and $g$ in a set that spans the trigonometric polynomials.
 But for $f(x) = e_j(x) = \exp(2 \pi i jx)$ and $g(x) = e_k(x) = \exp(2 \pi ikx)$ where $j$ and $k$ are integers, $$\displaystyle \int_0^1 e_j(x) e_k(nx)\ dx = 1 \text{  if  } j + nk = 0,  \text{  otherwise  } 0,$$ while $$\displaystyle \int_0^1 e_j(x)\ dx \int_0^1 e_k(x)\ dx = 1 \text{  if  } j = k = 0, \text{  otherwise  } 0.$$ Thus $A_n(e_j,e_0) = 0$ for all $j$ and $n$, while if $k\ne 0$, for each $j$ there are at most  two $n$ for which $A_n(e_j,e_k) \ne 0$.  In each case $\displaystyle \lim_{n \to \infty} A_n(e_j,e_k) = 0$.    
A: Usually this problem is seen with $g$ being some trigonometric function with the specical condition $\displaystyle \int^1_0 g(x) dx = 0 \ ;$ in this case the result is easy to discover. Intuitively, for large enough $n$ the oscillations become extremely rapid and since piece-wise constant functions uniformly approximate continuous functions arbitrarily well, the areas cancel out. So it is natural to prove this special case first:

Suppose $\displaystyle \int^1_0 g(x) dx =0. $ Let $G(x) =\displaystyle
 \int^x_0 g(t) dt.$ Since $g$ is $1$-periodic and $\displaystyle 
 \int^1_0 g(x) dx=0,$ we have that $G$ is bounded on $ \mathbb{R}.$ 
If $f \in C^1( [0,1],\mathbb{R} )$ then integration by parts gives $$
 \int^1_0 f(x) g(nx) dx = \frac{ f(1)G(n) - f(0)G(0) }{n} - \frac{1}{n}
 \int^1_0 f'(x) G(nx) dx \to 0$$ as required. As note that if
  $\displaystyle \int^1_0 g(x) dx \neq 0 $ then the limit is not $0$
  for arbitrary $f\in C[0,1].$
If $f$ is continuous but not nessicarily $C^1$ then by the
  Stone-Weierstrass
  Theorem
  we can find a  continuously differentiable $h: [0,1] \to \mathbb{R}$
  such that $\displaystyle \int^1_0 |f(x)-h(x)| dx$ is arbitrarily
  small.  Then since $$ \biggr| \int^1_0 \left( f(x) - h(x) \right)
 g(nx) dx \biggr| \leq  \sup_{x\in [0,1]} |g(x)| \int^1_0 | f(x)-h(x)|
 dx$$ is also arbitrarily small, we have $$\lim_{n\to\infty} \int^1_0
 f(x) g(nx) dx = \lim_{n\to \infty} \int^1_0 h(x)g(nx) dx =0.$$

How can one discover the general result? In the language of linear algebra, what we have shown is that $\displaystyle \int^1_0 f(x) g(nx) dx \to 0$ if and only if $g\in \ker L$, where $L:C[0,1]\to C[0,1]$ is the linear operator defined by $L(g) =\displaystyle \int^1_0 g(x) dx.$ So naturally, we want to see what this kernel looks like. We can see that $L^2=L$ so then we find that $ \ker L = \{ g- Lg : g\in C[0,1] \}.$ So the special case is true if we use $g-Lg,$ and rewriting that gives precisely the general result. We could compress this into a more mysterious conclusion:

Now, for arbitrary $ \displaystyle \int^1_0 g(x) dx$, the function $
 \hat{g}(x)=g(x) -\displaystyle \int^1_0 g(x) dx $ is a continuous
  $1$-periodic function with $\displaystyle \int^1_0 \hat{g}(x) dx=0$
  and applying the previously developed result to it gives the full
  result.

A: Note that for positive integer $n$, we have
$$\tag{1}\int_0^1f(x)g(nx)dx=\sum_{i=0}^{n-1}\int_{\frac{i}{n}}^{\frac{i+1}{n}}f(x)g(nx)dx.$$
We change the variable by letting $y=nx$, then $dx=dy/n$. For $i=0,1,..., n-1$, we have 
$$\tag{2}\int_{\frac{i}{n}}^{\frac{i+1}{n}}f(x)g(nx)dx=\frac{1}{n}\int_{i}^{i+1}f(\frac{y}{n})g(y)dy=\frac{1}{n}f(\zeta_i)\int_{i}^{i+1}g(y)dy$$
where $\zeta_i\displaystyle\in[\frac{i}{n},\frac{i+1}{n}]$. Here we have used the mean-value theorem in the last equality. By assumption that $g$ has period $1$, by $(2)$ we have
$$\int_{\frac{i}{n}}^{\frac{i+1}{n}}f(x)g(nx)dx=\frac{1}{n}f(\zeta_i)\int_{0}^{1}g(y)dy.$$
Put this back to $(1)$, we have
$$\int_0^1f(x)g(nx)dx=\left(\int_{0}^{1}g(y)dy\right)\sum_{i=0}^{n-1}\frac{1}{n}f(\zeta_i)$$
where $\zeta_i\displaystyle\in[\frac{i}{n},\frac{i+1}{n}]$. Note that by Riemann sum, we have
$$\lim_{n\rightarrow \infty}\sum_{i=0}^{n-1}\frac{1}{n}f(\zeta_i)=\int_0^1f(x)dx.$$
This proves the assertion. 
