Let $f(x)$ be defined as: $$ f(x) = \begin{cases} -x, & x \in [0,\pi] \\ \sin{x} & x \in [ \pi , 2 \pi ] \end{cases} $$
I need to find the total variation of the function $V_{0}^{x} (f)$ for $ x \in [0, \pi]$ without using integrals.
Now $f$ is monotone on $\left[0, \pi\right] , \left[\pi, \frac{3 \pi}{2}\right]$ and $\left[\frac{3 \pi}{2}, 2\pi \right]$ and for monotone functions on closed interval $[a,b]$ we have $V_{a}^{b} (f) = f(b) - f(a)$ but the problem is that the right and left limit in $x= \pi$ are different so we can't use this method to evaluate it directly. I also tried evaluating it through arbitrary partitions but wasn't successful.
As a solution I should get the following:
$V_{0}^{x} (f) = \begin{cases} x, & x \in [0,\pi] \\ 2 \pi - \sin{x} & x \in [ \pi , \frac{3 \pi}{2} ] \\ 2 \pi + 2 + \sin{x} , & x \in [ \frac{3 \pi}{2}, 2 \pi] \end{cases} $
I suppose the issue is that no matter which method I use I can't match the solution above.
First, to avoid two-valued functions, $x=\pi$ should belong to exactly one interval in the definition of $f$, say $f(x):=-x$ on $[0,\pi)$ and $f(x):= \sin x$ on $[\pi,2\pi]$.
Obviously, the interesting part of the story here is $V_0^x(f)$ at a point $x$ in the middle interval $[\pi,3/2\pi]$. For functions monotone on $[a,b]$ we can use $V_a^b(f)=|f(b)-f(a)|$. Now, take any partition of $[0,x]$ and add $\pi$ to it if it is not already there. Because of monotonicity of $f$ on $[0,\pi)$ and on $[\pi,x]$, it suffices to consider only the partitions of the form $\{0<p<\pi\leq x\}$. The variation of $f$ given by this partition is $$ |f(p )-f(0)|+|f(\pi)-f(p )|+|f(x)-f(\pi)| = 2p - \sin x. $$ Taking the supremum of this expression for $p\in (0,\pi)$ gives immediately $$ V_0^x(f) = 2\pi - \sin x. $$
To get the formula on the third interval is now easy because we have no discontinuity at $x=3/2 \pi$.