Uniform Continuous and Continuous Proof.

Prove that if $f$ is continuous on the interval $[0, \infty)$ and if $f$ is uniformly continuous on $[M, \infty)$ for some fixed $M>0$ then $f$ must also be uniformly continuous on $[0,\infty)$. Give counterexamples showing that both of the hypotheses in this statement are needed to obtain this conclusion.

Definition: A function $f: D \longrightarrow \mathbb{R}$ is uniformly continuous on $D$ if for every $\epsilon > 0$ there exists some $\delta > 0$ such that $|f(x) - f(y)| < \epsilon$ whenever $|x-y|<\delta$.

My attempt: Let $\epsilon > 0$ be given. We must show that there exists an $h > 0$ such that () for any $x$ and $y$ in $[0, \infty)$ with $| x-y | < h$ we will have $| f(x)-f(y) | < \epsilon$. Since $f$ is uniformly continuous on $[M, \infty)$ we know that there exists an $h_1 > 0$ such that for any $x$ and $y$ in $[M,\infty)$ with $|x-y| < h_1$ we have $|f(x)-f(y)| < e/2$. Also, since $f$ is continuous on $[0,M]$ and $[0,M]$ is compact (closed and bounded), $f$ must be uniformly continuous there as well. (Whats this theorem called again?) So there must exist an $h_2 > 0$ such that for any $x$ and $y$ in $[0,M]$ with $|x-y| < h_2$ we have $|f(x)-f(y)| < e/2$. Now choose $h = min(h_1,h_2)$ will satisfy (): for if $x$ and $y$ are both in $[0,M]$ or are both in $[M, \infty)$, then $|f(x)-f(y)| < \frac{\epsilon}{2} < \epsilon$ as needed. On the other hand, if $x$ and $y$ straddle $M$, then both $|x-M| < h$ and $|M-y| < h$. So by the triangle inequality$| f(x)-f(y) | \leq | f(x)-f(M) | + | f(M)-f(y) | < \frac{\epsilon}{2} + \frac{\epsilon}{2} = \epsilon$.

Now to the counterexamples. (1) You need to have ordinary continuity in order to hope to have uniform continuity; if $f$ is not continuous then it certainly cannot be uniformly continuous. For example, let $f(x)$ be zero everywhere except at $1$ and $f(1)=1$. If we take $\epsilon =1$ (or any value $< 1$) then no $h$ can satisfy (*) above because no matter how close $x$ and $y$ are, as long as one of them is $1$, we have $|f(x)-f(y)|=1$ which isn't $< \epsilon$.

-
What have you tried? –  Stefan Nov 12 '12 at 22:55
Hint: what do you know about $f$ on the interval $[0,M]$? –  icurays1 Nov 12 '12 at 23:19
Your previous question and answers may help, both in terms of definitions, and for exploring counterexamples... –  amWhy Nov 12 '12 at 23:23
Your definition of uniform continuity is incorrect, it should be: A function $f$ is uniformly continuos on $D$ iff for every $\varepsilon > 0$ there exists $\delta > 0$, such that $\left| {f(x) - f(y)} \right| < \varepsilon$ whenever $\left| {x - y} \right| < \delta$ for all $y\in D$ and all $x\in D$. Here $\delta$ must be chosen independently of $x$ (for entire domain). For usual continuity, $\delta$ is allowed to depend on $\varepsilon$ and $x$. –  glebovg Nov 12 '12 at 23:27
I gave an attempt at solving it, how does it look? –  Joakim Nov 13 '12 at 17:10

Hint: Continuity on a compact set implies uniform continuity. Also, if $f:(A \cup B) \to C$ is uniformly continuous on both $A$ and $B$, then $f$ is uniformly continous on $A \cup B$ also. The latter hold because (after choosing an $\epsilon$) you can simply pick the minimum of the two $\delta$ values for $A$ and $B$.
For a counterexample, simply pick a function with unbounded derivative on $[0,\infty)$. If the derivative is unbounded, you can find for every combination of $\delta > 0$ and $\epsilon > 0$ some $x$ such that $|f(x) - f(x+\delta)| > \epsilon$, which contradicts uniform continuity.