Limit of integral involving periodic function Can anyone help me with this? I want to know how to solve it.

Let $f:\mathbb R \longrightarrow \mathbb R$ be a continuous function with period $P$.  Also suppose that $$\frac{1}{P}\int_0^Pf(x)dx=N.$$ Show that $$\lim_{x\to 0^+}\frac 1x\int_0^x f\left(\frac{1}{t}\right)dt=N.$$

 A: Note that if $f\in L^1([0,P])$, then
$$
F(x)=\int_0^x(f(t)-N)\;\mathrm{d}t\tag{1}
$$
is a continuous function of period P.
Then, with $M=\max\limits_{[0,P]}|F|$, we have
$$
\begin{align}
\lim_{x\to0^+}\frac 1x\int_0^x f\left(\frac{1}{t}\right)dt
&=\lim_{x\to0^+}\frac1x\int_\frac1x^\infty\frac{f(t)}{t^2}\mathrm{d}t\tag{2a}\\
&=\lim_{x\to\infty}x\int_x^\infty\frac{f(t)}{t^2}\mathrm{d}t\tag{2b}\\
&=N+\lim_{x\to\infty}x\int_x^\infty\frac{f(t)-N}{t^2}\mathrm{d}t\tag{2c}\\
&=N+\lim_{x\to\infty}x\int_x^\infty\frac{1}{t^2}\mathrm{d}F(t)\tag{2d}\\
&=N+\lim_{x\to\infty}x\left(-\frac{F(x)}{x^2}+2\int_x^\infty\frac{F(t)}{t^3}\mathrm{d}t\right)\tag{2e}\\
&=N\tag{2f}
\end{align}
$$
$\hskip{5mm}(\mathrm{2a})$ change of variables $t\mapsto1/t$
$\hskip{5mm}(\mathrm{2b})$ change of variables $x\mapsto1/x$
$\hskip{5mm}(\mathrm{2c})$ $\displaystyle N=x\int_x^\infty\frac{N}{t^2}\mathrm{d}t$
$\hskip{5mm}(\mathrm{2d})$ $\mathrm{d}F(t)=(f(t)-N)\;\mathrm{d}t$ follows from $(1)$ and the Fundamental Theorem of Calculus
$\hskip{5mm}(\mathrm{2e})$ integration by parts
$\hskip{5mm}(\mathrm{2f})$ follows from the simple bound
$\displaystyle\left|-\frac{F(x)}{x^2}+2\int_x^\infty\frac{F(t)}{t^3}\mathrm{d}t\right|\le\frac{2M}{x^2}$
A: Using the function $g(t)=f\left(\frac P{2\pi}t\right)$, we can assume that $f$ is $2\pi$-periodic. If $P_n$ is a sequence of trigonometric polynomial which converges uniformly to $f$, then 
$$\left|\frac 1x\int_0^xf\left(\frac 1t\right)dt-\frac 1{2\pi}\int_0^{2\pi}f(t)dt\right|\leq 2\sup_{s\in\mathbb R}|f(s)-P_n(s)|+\left|\frac 1x\int_0^xP_n\left(\frac 1t\right)dt-\frac 1{2\pi}\int_0^{2\pi}P_n(t)dt\right|,$$
so, by linearity, it's enough to show the result when $f$ is of the form $e^{ipt}$, where $p\in\mathbb Z$. It's clear if $p=0$, so we assume $p\neq 0$. We have $\int_0^{2\pi}f(t)dt=\frac 1p(e^{i2\pi p}-1)=0$ and 
$$\frac 1x\int_0^xf\left(\frac 1t\right)dt=\frac 1x\int_{1/x}^{+\infty}\frac{e^{ips}}{s^2}dx=\int_1^{+\infty}\frac{e^{ip\frac yx}}{y^2}dy,$$
so 
\begin{align*}
\frac 1x\int_0^xf\left(\frac 1t\right)dt&=\left[\frac x{ip}\frac{e^{ip\frac yx}}{y^2}\right]_1^{+\infty}-\frac x{ip}\int_1^{+\infty}\frac{e^{ip\frac yx}}{y^3}(-2)dy\\
&=-\frac x{ip}e^{ip/x}+2\frac x{ip}\int_1^{+\infty}\frac{e^{ip\frac yx}}{y^3}dy,
\end{align*}
and finally
$$\left|\frac 1x\int_0^xf\left(\frac 1t\right)dt\right|\leq \frac x{|p|}\left(1+2\int_1^{+\infty}t^{-3}dt\right)=2\frac x{|p|},$$
which gives the result.
