Show that $f(x):=\sum\limits_{n=0}^{\infty}\frac{1}{n}h(2^{n}x),$ where $h$ is a piecewise function, converges uniformly on $[0,1]$ For $x\in\mathbb{R}$, consider a piecewise function defined by $$h(x):=\left\{
\begin{array}{ll}
x,\ \ \ 0\leq x\leq 1\\
2-x,\ \ 1\leq x\leq 2\\
0,\ \ \text{otherwise}.
\end{array}
\right.$$
Now, consider the series $$f(x):=\sum_{n=0}^{\infty}\dfrac{1}{n}h(2^{n}x).$$ I'd like to show that the series converges uniformly on $[0,1]$.
I have an attempt to use Weierstrass M-test but failed. Here is how I tried:
Note that $$h(2^{n}x)=2^{n}x\mathbb{1}_{[0,2^{-n}]}(x)+(2-2^{n}x)\mathbb{1}_{[2^{-n},2^{-n+1}]}(x).$$
Therefore, for all $x\in [0,1]$ and for each $n$, we have
\begin{align*}
\Big|\dfrac{1}{n}h(2^{n}x)\Big|&\leq \dfrac{2^{n}}{n}|x|\mathbb{1}_{[0,2^{-n}]}(x)+\dfrac{2^{n}+2^{n}|x|}{n}\mathbb{1}_{[2^{-n},2^{-n+1}]}(x)\\
&\leq \dfrac{2^{n}\cdot 2^{-n}}{n}\mathbb{1}_{[0,2^{-n}]}+\dfrac{2+2^{n}\cdot 2^{-n+1}}{2}\mathbb{1}_{[2^{-n},2^{-n+1}]}(x)\\
&=\dfrac{1}{n}\mathbb{1}_{[0,2^{-n}]}(x)+\dfrac{4}{n}\mathbb{1}_{(2^{-n},2^{-n+1})}(x)\\
&\leq \dfrac{5}{n}.
\end{align*}
My idea was to use $\frac{5}{n}$ as $M_{n}$, but the problem is that then $\sum_{n=1}^{\infty}M_{n}$ is divergent since it is a harmonic series.
It seems that the $\frac{1}{n}$ is really irritating. There is any other way to have a $\frac{1}{n^{2}}$? or I am heading to a wrong direction?
Thank you!
 A: (Side remark: Having a $\frac1n$ term and starting the summation at $n=0$ is not a good idea. I assume the summations starts at $n=1$).
For $x \le 0$ and $x \ge 1$ we have $h(2^nx) = 0$ for all $n \ge 1$, so the series is just summing zeros for those $x$.
For $0 < x < 1$ let $n_x$ be the largest nonnegative integer $n$ with $2^nx \le 1$. We get
$$\sum_{n=1}^{n_x}h(2^nx)=\sum_{i=0}^{n_x-1}h(2^{(n_x-i)}x) \le \sum_{i=0}^{\infty}h(2^{(n_x-i)}x) = \sum_{i=0}^{\infty}2^{(n_x-i)}x = \sum_{i=0}^{\infty}\left(\frac12\right)^i2^{n_x}x = 2\times2^{n_x}x \le 2.$$
We start with rearranging the finite sum to go "from end to start", then add more nonnegative values and make it an infite sum. Since all arguments $a$ of $h$ in that sum are in the interval $(0,1)$, we have  $h(a)=a$, which gives a standard infinte geometric series.
Note that by definition of $n_x$ we have that $1 < 2^{n_x+1}x \le 2$, so $h(2^{n_x+1}x) \le 1$ and finally $2^{n_x+2}x > 2$, so $\forall k \ge 2: h(2^{n_x+k}x) = 0$.
Alltogether, that means
$$\forall x \in \mathbb R:\sum_{n=1}^{\infty}h(2^nx) \le 3 \tag{1} \label{eq1}.$$
Now, to prove uniform convergence of $\sum_{n=1}^{\infty}\frac1nh(2^nx)$, we need to show that given any $\epsilon > 0$, we can find an $N \in \mathbb N$ such that
$$\forall x \in \mathbb R:\sum_{n=N}^{\infty}\frac1nh(2^nx) < \epsilon.$$
But using \eqref{eq1}, that's easy, just choose $N > \frac3\epsilon$:
$$\forall x \in \mathbb R:\sum_{n=N}^{\infty}\frac1nh(2^nx) \le \sum_{n=N}^{\infty}\frac1Nh(2^nx) =\frac1N\sum_{n=N}^{\infty}h(2^nx) \le  \frac1N\sum_{n=1}^{\infty}h(2^nx) \le \frac3N <\epsilon.$$
This concludes the proof.
