Finding Lipschitz constant for function that is not differentiable everywhere Suppose I have the function $f(x)=|sin(x)+cos(x)|$. I am looking to find the Lipschitz constant, i.e. smallest value $L$ satisfying $|f(x)-f(y)|\leq L|x-y|$, on the interval $[-2,2]$.
I know that if $f$ is continuous on $[a,b]$ and differentiable on $(a,b)$, then I have $L = sup_{x\in(a,b)}|f'(x)|$ which I can solve analytically or by computer. 
But in this case, although $f$ is continuous on $[a,b]$, $f$ is not differentiable on $(a,b)$ since $f'(-\frac{\pi}{4})$ is not defined. So how can I then find the Lipschitz constant, given that $f$ is not differentiable on $(-2,2)$? Is there some way I can still use the equation $L = sup_{x\in(a,b)}|f'(x)|$? (Note I am not trying to do all of this analytically, but by computer).
 A: You have $f(x)=|g(x)|$. Now by the triangle inequalities,
$$
|f(x_1)-f(x_2)|=\Bigl||g(x_1)|-|g(x_2)|\Bigr|\le|g(x_1)-g(x_2)|,
$$
which means that any Lipschitz constant of $g$ is also a Lipschitz constant for $f$.

(as asked in a comment) If $g$ is continuously differentiable, then its minimal Lipschitz constant over $[a,b]$ is $L=\max_{x\in[a,b]}|g'(x)|$. If $|g'|$ takes the value $L$ at some maximum point $x_*$ then either $g$ has a constant sign over some interval close to $x_*$ or $g(x_*)=0$. In either case, the difference quotient $\frac{\bigl||g(x)|-|g(x_*)|\bigr|}{|x-x_*|}$ has also $L$ as one-sided limit, so that the Lipschitz constant for $f$ can not be smaller than the Lipschitz constant for $g$.
A: For $f'(x) : [a, b] \to \mathbb{R}$ non differentiable in a finite zero-measure subset $\{c_1, c_2, \ldots, c_N\} \in [a ,b]$ (with $a \leq c_1 < c_2 < \ldots < c_N \leq b)$, I would work in this algorithmic way:


*

*Evaluate the function $f'$ on the borders $a$ and $b$;

*Evaluate the function $f'$ on each point $c_i$;

*Use calculus to find stationary points in all subset where $f'$ is differentiable.


The $\sup$ is attained at one of these points. 
