If $f$ is continuous on $\mathbb{R}$, then it is continuous on a closed interval $[a,b]\subset \mathbb{R}$.

continuityreal-analysisuniform-continuity

I am writing a proof for a problem, and one of the ways to proceed would be using the following claim:

If $f$ is continuous on $\mathbb{R}$, then it is continuous on a closed interval $[a,b]\subset \mathbb{R}$.

I think it is true since the definition of continuity states that if $f$ is continuous on a set $S$, then $\forall x_0 \in S$ and $\epsilon>0$ there is some $\delta>0$, such that $x \in S$ and $|x-x_0|<\delta$ imply $|f(x)-f(x_0)|<\epsilon$; so the points coming out of the subset of $S$, must be from $S$, and thus the existence of $\delta$ for the whole set implies an existence of $\delta$ for any of its subsets.

However, if $f$ is continuous on any closed interval $[a,b]\subset \mathbb{R}$., then it must be uniformly continuous on any such interval, which in turn would imply it is uniformly continuous on $\mathbb{R}$. But this would mean that the continuity of a function implies its uniform continuity, which is clearly not true. So there must be a flaw in my argument, which I cannot see. (I am expecting it to be something like "a function being uniformly continuous on any $[a,b]$ closed interval does not imply it is continuous on $\mathbb{R}$," which I don't understand why would be the case, since you can take the $\delta$ of the uniform continuity to be the minimum of all deltas across the intervals, no?)

EDIT: There seems to be confusion regarding my question, so let me narrow it down.

Is this true: If for all $a,b \in \mathbb{R}$, the function $f$ is uniformly continuous on $ [a,b]\subset \mathbb{R}$, then $f$ is uniformly continuous on $\mathbb{R}$.

Best Answer

which I don't understand why would be the case, since you can take the $\delta$ of the uniform continuity to be the minimum of all deltas across the intervals, no?

The minimum might be $0$, which is not allowed. For example:

Let $f(x)=x^2$. Then on $[-b,b]$ we have that $|f(x)-f(y)|=|x^2-y^2|=|x-y||x+y|\leq 2b |x-y|$.

So given an $\varepsilon>0$, you can let $\delta<\varepsilon/(2b)$. Thus $f$ is uniformly continuous on $[-b,b]$.

The infimum over $b$ of this is exactly $0$, which is not allowed.