$x^2$ with removable discontinuities has bounded variation Define
$$f(x) = \begin{cases}0 & \text{ if } x=1/n \text{ for some } n\in\mathbb{N}
\\x^2 & \text{ else}\end{cases}$$
on $[0, 1].$ I want to show that this has bounded variation. It is straightforward to show that $x^2$ has bounded variation on $[0,1]$, but the discontinuities at $1/n$ cause problems. I was thinking of splitting up the variation over the interval $[0,1]$ into the variation over each subinterval $[1/n, 1/(n+1)]$ as follows:
$$V_{[0,1]}(f) = \sum_{n=1}^\infty V_{[1/n, 1/(n+1)]}(f) = 2\sum_{n=1}^\infty \frac{1}{n^2} <\infty.$$
However, I'm stuck in proving the first equality. In fact, I'm not even completely sure that it is true. Any help would be appreciated.
 A: According to wiki:

The total variation of a real-valued (or more generally complex-valued) function $f$, defined on an interval $[0, 1] \subset \mathbb {R}$ is the quantity
$$ V_{[0,1]} (f) = \sup_P \sum_{i=0}^{n_P - 1} |f(x_{i+1}) - f(x_i)|,$$
where the supremum runs over the set of all partitions $P$ of the given interval.

Every partition of $[0,1]$ is a subset of the union of some partitions of your intervals, namely if $P = \{0 = x_0, x_1, \dots, x_n = 1\}$ then $x_1 \ge \tfrac{1}{m}$ for some $m$, and you can add points $\tfrac{1}{m}, \tfrac{1}{m-1}, \dots, \tfrac{1}{2}$ to $P$, and then take $x_i$ into the corresponding interval, showing that $$V(P) \le \sum_{n = 1}^{m_P} V_{[1/n,1/(n+1)]}(f).$$
Taking $\sup_P$ on the left corresponds to taking $\sup_{m_P}$ on the right, which is the same as changing the finite sum to the series because the total variation is nonnegative. Therefore, you get $$V_{[0,1]}f(V) \le \sum_{n = 1}^\infty V_{[1/n,1/(n+1)]}(f).$$
The reversed inequality follows from considering a sequence of partitions $(P_n)$ with $m_P \to \infty$, one possible example being $$P_n = \left\{ 0, \tfrac{1}{n}, (\tfrac{1}{n}+\tfrac{1}{n-1})/2, \tfrac{1}{n-1}, (\tfrac{1}{n-1}+\tfrac{1}{n-2})/2, \dots, 1 \right\}.$$
It appears to me that a similar approach can be used to prove the general statement $$V_{[a,b)} = \sum_{i = 1}^\infty V_{[a_i, b_i)}(f), \quad \bigsqcup_{i = 1}^\infty [a_i, b_i) = [a, b),$$ but I don't know whether this result has a name and whether or not it holds in other measure spaces.
A: The total variation of a differentiable function $f(x)$ on the interval $[a.b]$ is
$$V_b^a(f)=\int_a^b \left| f'(x)\right|  \, dx$$
The function $f(x)=x^2$ on intervals $\left(\frac{1}{n+1},\frac{1}{n}\right)$ has variation
$$\int_{\frac{1}{n+1}}^{\frac{1}{n}} 2 x \, dx=\frac{1}{n^2}-\frac{1}{(n+1)^2}$$
The sum of these variations is
$$ \sum _{n=1}^{\infty }\left( \frac{1}{n^2}-\frac{1}{(n+1)^2}\right)=1$$
Look here for further details.
This result fits with intuition, actually. The function goes from $0$ to $1$ and the total variation is $1$
