This problem has been asked here before. For example, this question Prove that the restriction $f|_K$ of $f$ to $K$ is globally Lipschitz where $K$ is a compact set only treated the continuity of $f$ on $K$ while this question $f \in C^1$ defined on a compact set $K$ is Lipschitz? already assumed $f$ to be $C^1$ function. Although, the latter was close to answering my question but used terms difficult for me to understand. So, in both cases, they have not answered my question. So, here it is
If $f:O\subset \Bbb{R}^n\to\Bbb{R}^m$ is locally Lipschitz, then prove that for any compact set $K$ in $O,$ $f \mid_K$ is Lipschitz such that $\exists \;c\in [x,y]$ such that \begin{align}\Vert f(x)-f(y) \Vert\leq c\Vert x-y \Vert,\;\;\forall\;x,y\in K\end{align}
My efforts
Let $K$ be compact in $O$. Let $x,y\in K$, then by MVT, $\exists \;r\in [x,y]$ such that \begin{align}\Vert f(x)-f(y) \Vert\leq \sup\limits_{r\in [x,y]}\Vert f'(r) \Vert\Vert x-y \Vert\end{align} \begin{align}\qquad\qquad\qquad\leq \sup\limits_{r\in K}\Vert f'(r) \Vert\Vert x-y \Vert\end{align} Since $f$ is locally Lipschitz, then it is continuous and since $K$ is compact, then the maximum is reached. So, let \begin{align}c= \sup\limits_{r\in K}\Vert f'(r) \Vert\end{align} Thus, \begin{align}\Vert f(x)-f(y) \Vert\leq c\Vert x-y \Vert,\;\;\forall\;x,y\in K\end{align}
Please, can anyone help me check if my proof is correct? If no, alternative proofs will be highly regarded! Thanks!