TITLE: A differentiation almost everywhere problem
QUESTION [5 upvotes]: Let $f: \mathbb R \to \mathbb R$ be a continuous function, and there exists a $k>0$ such that for each $y \in \mathbb R$, there are at most $k$ distinct $x$ with $f(x)=y$. Prove that $f$ is differentiable a.e.
My approach is trying to show $f$ is absolutly continuous, but need a hint to make a start. Thanks.

REPLY [4 votes]: It's enough to show $f$ is locally of bounded variation. 
Let $I$ be a compact interval. Then $f$ achieves a maximum and minimum value on $I.$ Let $m^+,m^-$ be these values, respectively. 
Try to show the variation of $f$ on $I$ is bounded by $k(m^+ - m^-).$