Why is $f(x) = x^2$ uniformly continuous on [0,1] but not $\mathbb{R}$

There is a lot of agreement that $x^2$ is not uniformly continuous. But is $x^2$ uniformly continuous on $[0,1]$?

For example:

Let $f(x) = x^2$, then $|f(x) - f(x_0)| < |(x-x_0)(x+x_0)| < 2|x-x_0|$

Let $|x - x_0| < \delta$, then $|f(x) - f(x_0)| < 2\delta$

Therefore if $\delta = \epsilon/2$ then $|f(x) - f(x_0)| < \epsilon$ is satisfied and since $\delta$ does not depend on $x$ therefore $f(x) = x^2$ is uniformly continuous

Wouldn't the same proof be applied for $\mathbb{R}$ as well as all subsets of $\mathbb{R}$?

• Your proof is fine. Every continuous function on a compact set is uniformly continuous. – lhf Jul 25 '15 at 1:01
• @ihf Sorry I am confused as to why are other posters claiming that the function is not uniformly continuous? – Shamisen Expert Jul 25 '15 at 1:04
• Other posters are claiming it is not uniformly continuous on other domains, such at $\mathbb R$. – GEdgar Jul 25 '15 at 1:05
• Shouldn't the first < sign on the first line be =? Because $|f(x)−f(x_0)|$ is actually equal to $|(x−x_0)(x+x_0)|$ if $f(x)=x^2$. – Al.G. Feb 21 at 12:18

The comments and other answer address the uniform continuity on compact sets. @hermes points out the crux of your proof, that $|x + x_0| < 2$, cannot be extended to all of $\mathbb{R}$. Turns out there is no fix for that.
Let $\varepsilon = 1$. We need to show that for all $\delta > 0$, there exist $x,y$ such that $|x - y| < \delta$ but $|f(x) - f(y)| > 1$. The key is the dependence of $x$ and $y$ on $\delta$. To this end, let $\delta > 0$ be given, and choose $y = x + \frac{\delta}{2}$. Then $|x-y| = \frac{\delta}{2} < \delta$, but $$|f(x) - f(y)| = |x^2 - y^2| = \left|x^2 - \left(x^2 + x\delta + \frac{\delta^2}{4}\right)\right| = \left|x\delta + \frac{\delta^2}{4}\right|,$$ and for sufficiently large (or small) $x \in \mathbb{R}$, we can make the last quantity larger than 1. Hence we do not have uniform continuity on $\mathbb{R}$.
$$x^2$$ is uniformly continuous on $$[0,1]$$ because continuous functions are always uniformly continuous on a compact set.
In your proof, you need $$|x+x_0|<2$$ to prove uniform continuity, which is true on $$[0,1]$$ but not on $$\mathbb{R}$$. So the proof cannot be extended to $$\mathbb{R}$$.