Integral convergence question Let $ f: [a,\infty ) \to \mathbb R $ be $ f\in C([a,\infty)) $, with a cycle $ T > 0 $,
and let $ g: [a,\infty ) \to \mathbb R $ be a monotonic function, and $$ \lim_{x\to \infty} g(x) = 0$$
Assume that $$ \int_a^{a+T} f(x)\,dx = 0 $$
Prove that: $$ \int_a^\infty f(x)g(x)\,dx $$
converges.
Help?
 A: Hint: if $a_{n}$ and $b_{n}$ are sequences such that
$$
 \lim_{n\to\infty}a_{n} = 0 \\
$$
and there exists a $M$ such that for all $N$
$$
 | \sum_{n=1}^{N} b_{n} | \leq M,
$$
i.e. the partial sum is bounded, then
$$
 \sum a_{n} b_{n}
$$
converges.
A: Assume without loss of generality that $g(x)\ge 0$.
First, let $a=\int_0^T \lvert f(x)\rvert\,dx$, then 
\begin{align}
\int_s^{s+T}f(x)\,g(x)\,dx&=\int_s^{s+T}f(x)\,\big(g(x)-g(s+T)\big)\,dx+\int_s^{s+T}f(x)\,g(s+T)\,dx \\
&=\int_s^{s+T}f(x)\,\big(g(x)-g(s+T)\big)\,dx+g(s+T)\int_s^{s+T}f(x)\,dx
\\
&=\int_s^{s+T}f(x)\,\big(g(x)-g(s+T)\big)\,dx,
\end{align}
and hence
$$
\Big|\int_s^{s+T}f(x)\,g(x)\,dx\,\Big|\le \big(g(s)-g(s+T)\big)\int_s^{s+T}\lvert f(x)\rvert\,\,dx=a\big(g(s)-g(s+T)\big).
$$
We need to show that for any $\varepsilon>0$, there exists an $M>0$, such that, for every $N>M$,
$$
\Big|\int_M^N f(x)\,g(x)\,dx\,\Big|<\varepsilon.
$$
As $\lim_{x\to\infty}g(x)=0$, let $M>0$, such that $$ag(M)<\varepsilon.$$ Let now $N>M$, and assume that
$$
M<M+s<\cdots<M+ks\le N<M+(k+1)s.
$$
Then
\begin{align}
\int_M^N f(x)\,g(x)\,dx&=\sum_{j=1}^k \int_{M+(j-1)s}^{M+js}f(x)\,g(x)\,dx+\int_{M+ks}^{N}f(x)\,g(x)\,dx \\
&=\sum_{j=1}^k \int_{M+(j-1)s}^{M+js}f(x)\,\big(g(x)-g(M+js)\big)\,dx+\int_{M+ks}^{N}f(x)\,g(x)\,dx,
\end{align}
and hence
\begin{align}
\Big|\int_M^N f(x)\,g(x)\,dx\,\Big|&\le 
\sum_{j=1}^k \int_{M+(j-1)s}^{M+js} \lvert f(x)\rvert\,\big(g(x)-g(M+js)\big)\,dx+\int_{M+ks}^{N}\lvert f(x)\rvert\,g(x)\,dx \\ &\le 
\sum_{j=1}^k a\big(g(M+(j-1)s)-g(M+js)\big)+ag(M+ks)=ag(M)<\varepsilon.
\end{align}
