# Showing that functions of bounded variation are not closed under composition

Find functions $g: [a, b] \to [c, d]$ and $f: [c, d] \to \mathbb{R}$ both of bounded variation, with f continuous, so that $f \circ g$ is not of bounded variation.

This occurs as a request for a counterexample in the midst of proving that the composition is of bounded variation if either f is Lipschitz or g is monotone increasing. I'm close to what might be an answer by taking $f = \sqrt{x}$, $g = x^2 sin^2(1/x)$ (or something like that involving a multiple of sin(1/x); I'd rather find a result that goes into the real numbers although the problem strictly speaking does allow the complex numbers as a range), but showing that a g like this has bounded variation using the partition-based definition of total variation that I have to work with seems to be extremely difficult and has a lot of small technical spots where it would be very easy to make a mistake.

If possible, I would like a simpler example, such as an f and g that have in some sense "obviously" bounded variation but whose composition has unbounded variation. I'm aware of many properties of the Cantor-Lebesgue function but it doesn't seem particularly useful here, or at least I'm having a very hard time coming up with something to compose it with (it would have to be f; since it's monotone increasing it isn't a good candidate for g).

Your example $f(x) = \sqrt x, g(x) = x^2 \sin^2(1/x)$ looks good to me. The function $f\circ g$ will have peaks $1/\sqrt x$ times previous peaks of $g.$ So it's certainly a natural thing to try. Do you know the result that if $h$ is $C^1$ on $[a,b],$ then the total varition of $h$ on $[a,b]$ equals $\int_a^b|h'(x)|\, dx$? That should help in finishing this off.
• Never mind the $C^1$ business. This is easier: Let $a_1>a_2> \cdots \to 0.$ We define $f=0$ at each $a_n$ and of course $f(0)=0.$ On each $(a_{n+1},a_n),$ let $f$ be triangular, with height $1/n^2.$ Then the total variation of $f$ over $[0,a_1]$ is precisely $2\sum_{n=1}^{\infty}1/n^2.$ The total variation of $\sqrt f$ is at least $\sum_{n=1}^{\infty}1/n=\infty.$