Lipschitz at every point in $[a,b]$ but not Lipschitz on $[a,b]$?

The question is:

Find a function on $[a,b]$ which is Lipschitz at every point of $[a,b]$, but not Lipschitz on $[a,b]$.

I am having a hard time picturing this, and thus, having a hard time finding such a function... I have not learned a lot about this other than the definition (not even derivatives yet!), so if someone can help me picture this that'd be awesome!


I assume that by “Lipschitz at every point” you mean:

For every $x \in [a,b]$ there is $\varepsilon_x \gt 0$ and a constant $C_x$ (that may both depend on $x$) such that for all $y \in [a,b]$ with $|y-x| \lt \varepsilon_x$ we have $|f(y) - f(x)| \lt C_x |y-x|$.

(I don't know if this is a standard notion, it's a definition I made up myself on the fly, because that's the only interpretation of “Lipschitz at every point” I could think of that 1. deserves the name, and 2. doesn't imply Lipschitz on a compact interval.)


For inspiration, the following picture may help: it is the graph of $x\sin{\frac{1}{x}}$. However, showing rigorously that it is Lipschitz at every point is a bit cumbersome without derivatives:

xsin(1/x)

The picture should indicate what to do: make the function “oscillate” wildly so that the constants $C_x$ can't be chosen to be bounded above when $x$ ranges over $[a,b]$. This would almost be achieved by the function $\sin{\frac1x}$, but that function fails to be continuous (and hence Lipschitz) at $0$. That's why I added a factor $x$ to get $x\sin{\frac1x}$ and and thus squeeze the graph of $\sin{\frac1x}$ into the region $\{|y|\leq |x|\}$, thus ensuring that the function is Lipschitz at $0$.


For an example based on this idea that can be tackled without taking derivatives, I suggest the following construction on $[0,1]$:

Put $f(0) = 0$.

Divide the interval $[0,1]$ into the intervals $I_n = \left[\frac{1}{n+1},\frac{1}{n}\right]$, $n=1,2,3,\ldots$.

If $n$ is odd define $f_n$ on $I_n$ to be the straight line segment that connects $\left(\frac{1}{n+1},-\frac1{n+1}\right)$ to $\left(\frac1n,\frac1n\right)$ and if $n$ is even define $f_n$ to be the straight line segment that connects $\left(\frac{1}{n+1},\frac1{n+1}\right)$ to $\left(\frac1n,-\frac1n\right)$.

The idea is: The length of the interval $I_n$ is $\frac{1}{n} - \frac{1}{n+1} = \frac{1}{n(n+1)}$, while $|f(\frac{1}{n}) - f(\frac{1}{n+1})| = \frac{1}{n}+\frac{1}{n+1} = \frac{2n+1}{n(n+1)}$, so the function's slope on $I_n$ is $2n+1$.

This will give you a function of the desired type which looks something like this:

straight line version

I'll leave it to you to figure out the detailed formulas and to prove that it is Lipschitz at every point, but not Lipschitz on the entire interval $[0,1]$.

As soon as you have that, simply take $g(x) = f\left(\frac{x-a}{b-a}\right)$ on $[a,b]$.