$f(x)$ is of period $T$, $\int_T^{+\infty} \frac{f(x)}{x} dx$ converges iff $\int_0^T f(x) dx = 0$ $f(x)$ is of period $T$,  prove that $\int_T^{+\infty} \frac{f(x)}{x} dx$ converges iff $\int_0^T f(x) dx = 0$.
I can prove from right to left using Dirichlet's test. 
If I assume $f(x)$ to be positive or negative, I can also prove from left to right since the "partial" integral is unbounded. But how can I prove it in the general case?
 A: Let $\int_0^Tf(x)dx= a$ Then $\int _{kT}^{(k+1)T}f(x) dx =a$ as well. Let $f_+=\max (f,0)$, $f_-= \min (f,0)$ the $T$-periodic positive and negative part of $f$, $a_+=\int _{kT}^{(k+1)T}f_+(x) dx, a_-=\int _{kT}^{(k+1)T}f_-(x) dx$. We have ${a_+\over k+1}\leq \int _{kT}^{(k+1)T }{f_+(x) \over x}dx \leq {a_+\over k}$, ${a_-\over k}\leq \int _{kT}^{(k+1)T }{f_-(x) \over x}dx \leq {a_+\over k+1}$. Thus ${a_+\over k+1}+{a_-\over k}\leq \int _{kT}^{(k+1)T }{f(x) \over x}dx \leq {a_+\over k}+{a_-\over k+1}$. 
Then $a_+ \sum_1^n {1\over k+1}+a_-\sum _1^n 1/k\leq \int_T^nT {f(x)\over x} dx\leq a_- \sum_1^n {1\over k+1}+a_+\sum _1^n 1/k$. One knows that $\sum _1^n 1/k = \ln n+o(\ln n)$ . Therefore
if $a_+ > -a_-$ the left hand side is $  (a_++a_n)\ln n+o(\ln n)$ and goes to $+\infty$. If $a_- < -a+=$ the right hand side goes to $-\infty$. Hence if the integral converges, $a=a_+ + a_-=0$
A: Assume $\int_0^Tf(x){\rm d}x = 0$. Since $f$ is periodic we can split the integral over $[T,\infty)$ into a sum of integrals over intervals on the form $[kT,kT+T]$ and shift the integration variable $y= x-kT$ to get
$$\int_T^\infty\frac{f(x)}{x}{\rm d}x = \sum_{k=0}^\infty\int_T^{2T}\frac{f(y)}{y+kT}{\rm d}y\tag{1}$$
To estimate the summand we can do a little trick: since $\int_T^{2T}f(x){\rm d}x = 0$ we can add $0 = -\int_T^{2T}\frac{f(y)}{kT}{\rm d}y$ to get
$$\int_T^{2T}f(y)\frac{1}{y+kT}{\rm d}y = \int_T^{2T}f(y)\left[\frac{1}{y+kT}-\frac{1}{kT}\right]{\rm d}y = \int_T^{2T}f(y)\left[\frac{-y}{kT(y+kT)}\right]{\rm d}y$$
which gives us the estimate
$$\left|\int_T^{2T}f(y)\frac{1}{y+kT}{\rm d}y\right| \leq \int_T^{2T}\frac{|f(y)y|}{kT(y+kT)}{\rm d}y \leq \int_T^{2T}\frac{|f(y)y|}{(kT)^2}{\rm d}y$$
From this it follows that
$$\sum_{k=0}^\infty \left|\int_T^{2T}\frac{f(y)}{y+kT}{\rm d}y\right| \leq \sum_{k=0}^\infty \frac{C}{k^2} < \infty$$
where $C = \int_T^{2T}\frac{|f(y)y|}{T^2}{\rm d}y$ so the the sum in $(1)$ is absolutely convergent and $\int_T^\infty\frac{f(x)}{x}{\rm d}x$ therefore converges.

For the other direction, assuming $\left|\int_T^\infty \frac{f(x)}{x}{\rm d}x\right|<\infty$, we get that the integral in $(1)$ can be written
$$\int_T^{2T} \frac{f(y)}{y+kT}{\rm d}y = \int_T^{2T}\frac{f(y)}{kT}{\rm d}y - \int_T^{2T}\frac{f(y)y}{kT(kT+y)}{\rm d}y = \frac{C}{k} + \mathcal{O}(1/k^2)$$
where $C = \frac{\int_T^{2T}f(y){\rm d}y}{T}$ and where we used the same estimate as above to estimate the last term. If $C\not =0$ we get
$$\int_T^\infty\frac{f(x)}{x}{\rm d}x = \sum_{k=0}^\infty\frac{C}{k} + \mathcal{O}(1/k^2)$$
which diverges (comparison with the harmonic series). This contradicts $\left|\int_T^\infty \frac{f(x)}{x}{\rm d}x\right|<\infty$ and it follows that $C=0$.
