Let f(x) be a function of bounded variation on closed, bounded interval [a, b].

Let g(x) = V(f, [a, x])

where $\displaystyle V(f, [a, x]) = \sum_{k=1}^n |f(x_{i}) - f(x_{i-1}) |$ given some partition $\displaystyle P = \left \{a, x_{1}, x_{2}, ...., x_{n-1}, x \right \}$ of [a, x].

How can I calculate the derivate of g(x)?

I know of differentiation term-by-term but not sure if this would apply here.

Thanks