Uniform convergence of the sequence of function. Let $f:\mathbb{R}\rightarrow [0, \infty)$ be a non-negative real-valued continuous function. let
$$ \phi _n(x)= \begin{cases}
    n,& \text{if } f(x)\geq n\\
    0,              & \text{if } f(x)< n\\
\end{cases}$$
$$\phi_{n, k}=\begin{cases}
    \frac{k}{2^n},& \text{if } f(x)\in [\frac{k}{2^n}, \frac{k+1}{2^n})\\
    0,              & \text{if } f(x)\notin [\frac{k}{2^n}, \frac{k+1}{2^n})\\
\end{cases}$$
and $g_n(x)=\phi_n(x)+\sum_{k=0} ^{n2^n -1}\phi_{n,k}(x).$ As $n\rightarrow \infty,$ which of the following are true?
1) $g_n(x) \rightarrow f(x) $ for every $x\in \mathbb{R}$
2) Given any $C>0, g_n(x) \rightarrow f(x)$ uniformly on the set $\{x:f(x)<C  \}$ 
3) $g_n(x) \rightarrow f(x) $ uniformly for every $x\in \mathbb{R}$
4) Given any $C>0, g_n(x) \rightarrow f(x)$ uniformly on the set $\{x:f(x)\geq C  \}$ 
Please help, I can't understand correctly
 A: First of all, let's think for a second about the purpose of each function that you have in your problem. The purpose of defining $\phi_n(x)$ is to suppress the values of $f(x) \geq n$. And the purpose of defining $\phi_{n,k}(x)$ is to estimate the value of $f(x)$ by dividing the range of $f$ into intervals of length $\frac{1}{2^n}$ and then taking the least value of $f$ in that interval.
Fix $x \in \mathbb{R}$. Since $f$ is continuous and non-negative, by the Archimedean property of the real numbers, there exists $m(x) \in \mathbb{N}$ such that $f(x) < 2^{m(x)}$.  Set 
$$k(x)=\min\{n\in\mathbb{N}\cup\{0\}: n \leq m(x)f(x)\}$$
Since $f$ is non-negative, $k(x)$ is well-defined and it exists. Therefore, we have:
$$k(x) \leq m(x)f(x) < k(x)+1 \implies \frac{k(x)}{m(x)} \leq f(x) <\frac{k(x)+1}{m(x)}$$
Now, let's look at $|g_n(x)-f(x)|$ for $n=2^m$:
$$|g_{2^{m}}(x)-f(x)|=\left|\varphi_{2^m}(x)+\sum_{k=0}^{2^{2m}-1}\varphi_{{2^m},k}(x)-f(x) \right|=\left|\varphi_{2^m}(x)+\frac{k(x)}{2^{m(x)}}-f(x) \right|$$ $$=\left| \frac{k(x)}{2^{m(x)}}-f(x)\right| \leq \frac{1}{2^{m(x)}}$$
Note that $\phi_{2^{m(x)}}=0$ because at first, I choose $m(x)$ such that $f(x)<2^{m(x)}$. 
This shows that the sub-sequence $g_{2^m}(x) \to f(x)$. Therefore, you're left with proving that $g_n(x)$ is a Cauchy sequence which is similar to what I did and I leave it to you. Because if a sub-sequence of a Cauchy sequence converges to something, the sequence itself must converge to it as well.
This shows that $\lim_{n \to \infty}g(x) = f(x)$ pointwise. I have no idea about the other parts yet, but it's likely that they are incorrect. 
