Exercise on Sobolev Spaces: Show that this function belong to $W^{1,\infty}$ 
Let $u \in C^0(I)$ be a bounded function on the open interval $I=(a,b)
 \subset \mathbb R$. Suppose that there exists a partition  $a=t_0 \lt
 t_1 \lt \dots \lt t_n=b$ such that:
  
  
*
  
*$f \in C^1((t_i,t_{i+1}))$
  
*$f' \in L^{\infty}((t_i,t_{i+1}))$
for every $i=0,\dots,n-1$. Show that $f\in W^{1,\infty}$

MY ATTEMPT:
It suffices to show that there exists a constant $C\gt 0$ such that $\vert u(x)-u(y)\vert \le C \vert x-y\vert$ for a.e $x,y \in I$. However I have only managed to prove that $u$ satisfies a Lipschitz condition in every subinterval  $(t_i,t_{i+1})$ since:
if $t_i \lt x \lt y \lt t_{i+1}$, then $\vert u(x)-u(y) \vert \le \int_{t_i}^{t_{i+1}} \vert u'(x) \vert \le {\vert \vert u \vert \vert}_{L^{\infty}}((t_i,t_{i+1})) \vert x-y \vert$
I believe that somehow I should take the sum over $i$ in order to pass to the whole $I$ but I don't see how. Moreover I haven't used that $u$ is also bounded and I 'm wondering what I miss here.
Any help or hint is much appreciated.
Thanks in advance!
 A: You have already proved the Lipschitz estimate inside a single interval $(t_i, t_{i+1})$. To complete the proof of Lipschitz condition on $I$ it is enough to show that 
$$
\tag{1} |u(x) - u(t)| \leq C |x - t|, \ \ \text{ for all } x \in [t_i, t_{i+1}] \text{ and } t \in \{t_i, t_{i+1}\}.
$$
Indeed, once we have $(1)$, then the Lipschitz estimate propagates across intervals, as for any $x\in (t_i, t_{i+1})$ and any $y\in (t_{i+1}, t_{i+2})$ we get
$$
|u(x) - u(y)| \leq |u(x) - u(t_{i+1})| + |u(t_{i+1}) - u(y)| \leq C (|x - t_{i+1}| + |t_{i+1} - y|) = C |x - y|,
$$
and similarly, if $x$ and $y$ are not necessarily in neighboring intervals.
To prove $(1)$ for the endpoint $t = t_i$, take $z \in (t_i, t_{i+1}) $ and write
$$
\tag{2} |u(x) - u(t_i)| \leq |u(x) - u(z)|  + |u(z) - u(t_i)| \leq C |x - z| +   |u(z) - u(t_i)|,
$$
where we used the already proved Lipschitz estimate in $(t_i, t_{i+1})$. Notice that 
the constant $C$ in $(2)$ does not depend on $z$ (it can be taken to be $||u'||_{L^\infty(t_i, t_{i+1})}$ as you showed above), hence we may pass to the limit in $(2)$ with respect to $z$ when $z\to t_i$. Taking into account the continuity of $u$ at $t_i$ we get
$$
|u(x) - u(t_i)| \leq C |x - t_i|,
$$
which is what was required to prove.
