Real Analysis – Proving Sequence of Step Functions Converges Pointwise to Function $f$

continuityconvergence-divergencereal-analysis

Question: Suppose $f: [0,1] \rightarrow \mathbb{R}$ is continuous on $(0,1)$. Prove there is a sequence of step functions $\left\{f_{n}\right\}$ which converges pointwise to $f$ on $[0,1]$.

I saw the same question was asked here but I was still confused regarding the solution to the question.

I had attempted a solution but I now realize this solution is wrong:

Proof:
Since $f$ is continuous on $(0,1)$, then for every $x \in (0,1)$ and for every $\epsilon>0$, there exists a $\delta(x)$ such that $|f(x)-f(y)|<\epsilon$ whenever $y \in (0,1)$ and $|y-x|<\delta(x)$. In particular, let $\epsilon_{n} = 1/2^{n}$ and let $\delta_{n}(x)$ be the corresponding $\delta$ which is guaranteed by the continuity of $f$. Fix a value of $n$ and choose a partition $x_{0}=0 < x_{1} < x_{2} < \ldots < x_{m} = 1$ such that $x_{i}-x_{i-1} < \delta_{n}(x)$. Let $f_{n}(x):= f(x_{i-1})$ for all $x \in (x_{i-1}, x_{i})$. Clearly $f_{n}(x)$ is a step function and hence $\left\{f_{n}\right\}$ is a sequence of step functions. Observe that $f_{n}(x)=f_{n}(x_{i-1})=f(x_{i-1})$. Finally, by the continuity of $f$ and by the fact that $x_{i}-x_{i-1} < \delta_{n}(x)$, we may conclude that
\begin{align*}
|f(x)-f_{n}(x)| \leq |f(x)-f(x_{i-1})| < \epsilon_{n}
\end{align*}
and so the sequence converges pointwise to $f$.

End of proof.

I was hoping someone can shed some light on the correct solution to this problem. Any hints would be appreciated. Thanks!

Best Answer

Since $f$ is continuous on $(0,1)$, for all $n\in \mathbb N$, consdier $I_n = [2^{-(n+1)}, 1-2^{-(n+1)}]$. Then $f$ is continuous on $I_n$. Let $s_n$ be a step function on $I_n$ so that $|f(x) - s_n(x)|<2^{-n}$ for all $x\in I_n$. That can be found as $I_n$ is a closed and bounded interval and so $f$ is uniformly continuous on $I_n$.

Now define a step function $f_n$ on $[0,1]$, where

$$f_n(x) = \begin{cases} s_n(x) &\text{if } x\in I_n \\ f(0) & \text{if }x \in [0,2^{-(n+1)}), \\ f(1) & \text{if } x\in (1-2^{-(n+1)},1]. \end{cases}$$

Claim: $f_n$ converges to $f$ pointwisely on $[0,1]$.

Fix $x\in [0,1]$. We need to show that $f_n(x) \to f(x)$ as $n\to \infty$. By definition of $f_n$, this is obvious for $x=,0,1$. If $x\in (0,1)$, then there is $N_x\in \mathbb N$ so that $x\in I_n$ for all $n\ge N_x$. Thus

$$|f_n(x) - f(x)| = |s_n(x) - f(x)| \le 2^{-n},\ \ \ \forall n\ge N_x.$$

This implies $f_n(x) \to f(x)$ as $n\to \infty$. Thus the claim is shown.