Prove the periodic function $f :\mathbb R \to \mathbb R$ s.t. $f(x)=|x|$ on $[-1,1]$ with period $2$ is Lipschitz continuous.
Here is my proof. I'm stuck in the last part.
Note that $f(x)=|x-2k| \ (2k-1 \leqq x< 2k+1)$ with $k$ moving on all integers.
Let $x,y \in \mathbb R. (x>y)$
If $x-y \geqq 1, $ then $|f(x)-f(y)|\leqq 1 \leqq |x-y|$ since $0\leqq f(x)\leq 1, 0\leqq f(y)\leqq 1$.
Consider the case of $0<x-y<1.$
There exist $n,m \in \mathbb Z$ s.t. $2n-1 \leqq x < 2n+1, 2m-1\leqq y < 2m+1$.
Then, $2n-2m-2< x-y < 2n-2m+2$ holds. Since $0<x-y<1$, $0<2n-2m+2$ and $2n-2m-2 <1$ have to hold. Thus I get $n-m=0, 1$.
If $n-m=0,$ then $|f(x)-f(y)|=||x-2n|-|y-2n||\leqq |(x-2n)-(y-2n)|=|x-y|.$
I'm stuck in the case of $n-m=1.$
In this case, $f(x)=|x-2(m+1)|, f(y)=|y-2m|$.
How can I show $|f(x)-f(y)|\leqq |x-y|$ $\ ($ or $|f(x)-f(y)|\leqq L|x-y|$ with some $L>0$ $)$ ?
$||x-2(m+1)|-|y-2m||\leqq |x-2(m+1)|+|y-2m|$ and $||x-2(m+1)|-|y-2m||\leqq |(x-2(m+1))-(y-2m)|$ don't work well.
Thanks for your help.
Consider $n-m=1$. Since $0 < x-y \leq 1$ and $y < 2m+1 = 2n-1$, it follows that $x = x-y + y < 2n$. Similarly, with $x \geq 2n-1 = 2m+1$ it can be shown that $y = y - x + x \geq 2m$. Therefore $f(x) = |x-2n| = 2n - x$ and $f(y)=|y-2m|=y - 2m$ and hence $|f(x)-f(y)| \leq |x - (2m +1)| + |y - (2m +1)| = |x-y|$. The final equality follows from $y \leq 2m+1 \leq x$.
Alternatively, you could consider the fact that $f$ can be represented both as $$ f(x) = |x-2k|, \quad 2k - 1 \leq x < 2k + 1, $$ or as $$ f(x) = 1 - |x-2k + 1|, \quad 2k \leq x < 2k + 2, $$ which are clearly piecewise Lipschitz functions. Then you would note that if $|x-y| \leq 1$, there must exist an integer $p$ such that $p \leq x, y < p + 2$.