Total variation of a step function

What is the formula for the total variation of a step function on [a,b]? I understand how to write a formula for the total variation of a general function of bounded variation. Any ideas?

-
seems like its 2 times the size of the step (step up and step down) – yoyo Apr 3 '11 at 0:46

Without loss of generality we may assume that $f$ is right continuous, however then proof works for more general step functions. This means that there is a partition $P=\{ x_0, x_1, ..., x_n\}$ of $[a,b]$ so that $f$ may be written as $$f=\sum\limits_{k=1}^{n} c_k \chi_{[x_{k-1}, x_k)}$$ where any two consecutive values of $\{c_k\}$ are distinct. It follows that $$V(f, P) =\sum\limits_{k=1}^n |c_k - c_{k-1}|.$$ However, for any other partition $Q$, we can always adjoint $P$, so that $Q^{'} =Q \cup P$ is a partition of $[a,b]$. We may then divide this partition up as $Q^{'} = \bigcup\limits_{k=1}^n Q_k$ where $$Q_k =\{ q \in Q^{'} \ | \ x_{k-1} \leq q < x_k\}$$ Define $q_k^{*} = \max\{Q_k\}.$ We point out that if $q \in Q_k$ then $f(q) = c_k$ and therefore $V(f_{[x_{k-1}, q_k^{*}]} , Q_k)=0$. We then conclude that $$V(f, Q) \leq V(f, Q^{'}) = \sum\limits_{k=1}^n V(f_{[x_{k-1}, q_k^{*}]} , Q_k) +\sum\limits_{k=1}^n |f(x_k)-f(q_k^{*})| = \sum\limits_{k=1}^n |c_k -c_{k-1}|$$ Since this upper bound on $V(f,Q)$ is acheived at $Q=P$, we conclude $$TV(f) = \sum\limits_{k=1}^n |c_k -c_{k-1}|$$
Suppose that $f(x)=A$ on $[a,c]$ and $f(x)=B$ on $(c,b]$ for some $c$ in $[a,b)$. Then you can show that the total variation is $|B-A|$, the "size of the jump", because this will be the result of the sum no matter what partition you choose. (The same would be true if it were $[a,c)$ and $[c,b]$ with $c$ in $(a,b]$.) For the general case, you can refine your partitions to consider just one jump at a time. The total variation is the sum of the total variations on subintervals containing just one jump, which amounts to the sum of the sizes of the jumps.