Approximation of square integrable function with continuous periodic function

60 Views Asked by At

Let $f$ be a function from $(a,b)$ to $\mathbb R$, such that $f^2$ has finite improper Riemann integral on $(a,b)$. I know that, if $f$ is bounded, then for all $\varepsilon>0$ it is possible to find a uniformly continuous function $g : (a,b) \to \mathbb R$ such that: $$\lim_{x \to a^{+}} g(x) = \lim_{x \to b^{-}} g(x)$$ And: $$\int_a^b (f(x)-g(x))^2 \mathrm{d}x < \varepsilon$$ My question is: does such a function $g$ also exist if $f$ is not bounded?

The proof I know for the bounded function case first shows that the convergence of the integral of $f^2$ implies the convergence of the integral of $|f|$, then uses the definition of Riemann integral to choose a suitable Riemann partition of $[a,b]$, and finally takes $g$ such that it is piecewise linear and its image in each $[x_{k-1}, x_{k}]$ is included in $[\min_{x \in [x_{k-1}, x_k]} f(x), \max_{x \in [x_{k-1}, x_k]} f(x)]$. With such a $g$, since the boundedness of $f$ allows us to pick a constant $M$, not dependent on $\varepsilon$, such that $|f(x)-g(x)|<2M$, we obtain: $$\int_a^b (f(x)-g(x))^2 \mathbb{d}x \leq 2M \int_a^b |f(x)-g(x)| \mathrm{d}x <2M\varepsilon$$ However, if $f$ is not bounded, one can't so easily estimate the integral of $(f(x)-g(x))^2$ with that of $|f(x)-g(x)|$ (which can be easily made as little as we want in both cases).