Is this function Lipschitz? Let $f:X \rightarrow \mathbb R$ be a Lipschitz function  on a metric space $X$ and $K<M$ be some constants.
Is it such a function $g:X\rightarrow \mathbb R$ Lipschitz: 
$$
g(x)=f(x) \textrm{ if } \ K \leq f(x) \leq M,
$$
$$
g(x)=K \textrm { if } \ f(x)<K,
$$
$$
g(x)=M \textrm{ if } \  f(x)>M.
$$
Thanks

We have $g(x)=\min\{\max\{f(x),K\},M\}$. Now, we just have to show that if $|f(x)-f(y)|\leq C|x-y|$, $|\max\{f(x),K\}-\max\{f(y),K\}|\leq C|x-y|$, which can be shown using the formula $2\max\{a,b\}=a+b+|a-b|$ and triangular inequality. 
By the way, the Lipschitz constant is the same.
