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$.