In my analysis course, when we had to demonstrate that continuous function are Riemann integrable, my professor introduced the concept of uniformly continuous function. On that day he gave this definition:
A function $f:\ I \to \Bbb R $ is uniformly continuous if $\exists \ \omega:\ [0,+\infty[ \ \rightarrow \Bbb R^+$ continuous and increasing with $\omega(0)=0$ such that $\forall \ x,y \in I \quad |f(x)-f(y)|\leq\omega(|x-y|)$$\tag{1}\label{1}$
From this fact he demonstrate that all uniformly continuous function are continuous. There is the proof:
$\forall \ x_0 \in I \ \forall \ \epsilon > 0$ we pick $\delta$ such that $\omega(\delta)\leq\epsilon$ (this is possible due to the continuity of $\omega$). We have that $|f(x)-f(x_0)|\leq\omega(|x-x_0|)\leq\omega(\delta)\leq \epsilon$
After some lesson he returned to the argument in order to proof that continuous function over a compact set are also uniformly continuous. This time the definition he gave was a little different and that confused me:
A function $f:\ E \to G $ ($E,G$ metric spaces) is uniformly continuous if $\exists \ \omega:\ [0,+\infty[ \ \rightarrow \Bbb R^+$ continuous in 0 and increasing with $\omega(0)=0$ such that $\forall \ x,y \in E \quad d_E(f(x),f(y))\leq\omega(d_G(x,y))$$\tag{2}\label{2}$
Of course I think that this definition is a sort of generalization but I cannot understand why this time we need continuity only in 0. Anyway we had never used the fact that it is continuous everywhere but only that is continuous in 0. Since I was confused by these different definitions I have looked up in my book the definition of uniformly continuous function and I have find out (searching also on the web) that the standard definition is this one:
A function $f:\ E \to G $ ($E,G$ metric spaces) is uniformly continuous if $\forall \ \epsilon>0 \ \exists \ \delta>0$ such that $\forall \ x,y \in E \quad d_G(x,y)\leq \delta \ \implies \ d_E(f(x),f(y))\leq \epsilon$$\tag{3}\label{3}$
My question is: Why in the $\ref{2}$ definition we only need that $\omega$ is continuous in 0? Are the $\ref{2}$ and $\ref{3}$ definition the same? If yes how can we prove it? Thank you very much in advance!