Why $f$ is of bounded variation Asume that $(x_n)$ is a sequence of positive numbers such  that $\sum_{n=1}^\infty x_n <\infty$.  We define a functon $f:[0,1]\rightarrow \mathbb R$ in the following way:
$f(x)=x_n $ if $x=\frac{1}{n}$, $n \in \mathbb N$;
$f(x)=0$ for $x\in [0,1]\setminus \{\frac{1}{k}: k\in \mathbb N \}$.
How to prove that $f$ is of bounded variation?

Given any finite partition
$$P:\qquad 0=x_0<x_1<x_2<\ldots< x_{N-1}<x_N=1\ ,$$ put $n_1:=\lfloor{1\over x_1}\rfloor$ and 
insert all points ${1\over n}$ $\>(2\leq n\leq n_1)$ to obtain a slightly finer partition $$P':\qquad 0=y_0<y_1<y_2<\ldots< y_{M-1}<y_M=1\ .$$ One then has
$$\sum_{k=1}^N|f(x_k)-f(x_{k-1})|\leq \sum_{k=1}^M|f(y_k)-f(y_{k-1})|\leq 2\sum_{n=1}^{n_1}x_n\leq 2\sum_{n=1}^\infty x_n=:C\ .$$
Since this is true for any finite partition $P$ of $[0,1]$ the function $f$ is of bounded variation on $[0,1]$.
