# When is a locally Lipschitz function globally Lipschitz?

If $f:\mathbb{R}\rightarrow \mathbb{R}$ is locally Lipschitz, that is to say, on any compact set of $\mathbb{R}$, $f$ is Lipschitz on it. I am thinking about if in addition, $f$ is also bounded, can we conclude that $f$ is globally Lipschitz on $\mathbb{R}$?

Since I cannot imagine an example of bounded and locally Lipschitz function is globally Lipschitz, I tend to believe the answer is yes. Can anyone help with a counterexample or proof?

The answer is no. As a counterexample, consider $f:\Bbb R \to \Bbb R$ given by $$f(x) = \cos(x^2)$$ Notably, any $C^1$ function with an unbounded derivative will fail to be globally Lipschitz.