Show that the function $f: x \rightarrow x^2$ is uniformly continuous on the set $S = \bigcup \{[n,n + n^{-2}] ~|~n \in \mathbb N\}$ Show that the function $f: x \rightarrow x^2$ is uniformly continuous on the set $S = \bigcup \{[~n~,~n + n^{-2}~] ~|~n \in \mathbb N\}$
Attempt:
Let $S_n = [~n~,~n + n^{-2}~]$.
then diam $S_n = \dfrac {1}{n^2}$ which is clearly dependent on $n$.
If we limit the set $S$ upto $m$ natural numbers, then surely the function is uniformly continuous (since a function which is uniformly continuous over each disjoint subset which are finite in number and at non zero distance from each other, is also uniformly continuous over their union).
But, here the diameter of each $S_n$ is ever changing with each natural number.
Any advice on how to move forward with this problem will be appreciated. Thanks!
 A: Note that $$|f(x)-f(y)|=|x^2 -y^2|= |x-y||x+y|.$$
Thus for $x$ and $y$ in $[k,k+\frac {1}{k^2}]$ we have $$ |f(x)-f(y)|\le \frac {1}{k^2} (2k+ \frac {2}{k^2})$$
Let $\epsilon >0$ be an arbitrary small number.
Pick a natural number $n_0$ such that $$ \frac {1}{n_0^2} (2n_0+ \frac {2} {n_0^2})<\epsilon$$
If $n\ge n_0$ then   $$         \frac {1}{n^2} (2n+ \frac {2} {n^2}) < \frac {1}{n_0^2} (2n_0+ \frac {2} {n_0^2})<\epsilon$$
The first two interval intersect at $x=2$, therefore the union of the first two interval, $[1,2\frac {1}{4}]$requires special attention.
The function $ f(x) =x^2$ is uniformly continuous on $[1,2\frac {1}{4}],$ thus for our given $\epsilon$ there exists a $ \delta _1$ satisfying the condition of uniform continuity on  $[1,2\frac {1}{4}].$
Note that $f(x)=x^2$ is also uniformly continuous on each of closed intervals $$ [k,k+\frac {1}{k^2}]$$ for $k=3,...,n_0-1$.
We can find $$\delta _3,     \delta _4,   \delta _5,....,     \delta _{n_0-1}$$ to satisfy the condition of uniform continuity on $ [k,k+\frac{1}{k^2}]$.
Let $\delta_2 =  \delta_1$ and choose $$\delta  = min( 1/4, \delta _1,     \delta _2,   \delta_3,....,     \delta _{n_0-1})$$.
We have $$ |x-y| < \delta \implies |x^2 -y^2| < \epsilon $$ on the given union.
Thus $f(x) = x^2$ is uniformly continuous on the given union.  
A: Correct me if wrong:
$f(x) = x^2$ , $x \gt 0$, $n \in \mathbb{Z^+}$:
$f$ is uniformly continuos on each compact interval $[n, n+n^{-2}].$
Let $\epsilon \gt 0$ be given, $k \in \mathbb{Z^+}$:
For $x,y \in [k,k+k^{-2}]$ there exist a $\delta_{k}$
such that $|x-y| \lt \delta_{k}$ implies 
$|f(x)-f(y)| \lt \epsilon.$
Now: Let $x,y \in [n,n+n^{-2}] :$
$|f(x)-f(y)| = |x-y||x+y| \le $
$1/n^{2}(2n+2/n^{2})=2(1/n +1/n^4)$.
Let $n_0$ be such that :
$(\star)$ : $|f(x)-f(y)| \le $
$2(2/n_0+1/n_0^2) \lt \epsilon.$
Choose $\delta \le \min(\delta_1, \delta_2,...\delta_{n_0}).$
This $\delta$ qualifies :
For  intervals with $ n \le n_0$ :
$|x-y|\lt \delta$ implies $|f(x)-f(y)|\lt \epsilon.$
Now a bit trickier :
For $n\gt n_0:$
$|x-y| \le 1/n^2$ and using $(\star)$:
$ |x^2-y^2| \lt \epsilon.$
Our $\delta$ is also good for the intervals with $n\gt n_0$:
1)$ \delta \lt $ interval length $ 1/n^2 $, $(\star)$ is valid.
2) $ \delta \ge $ than interval length $1/n^2$ is also 
OK,  since  we restrict $x,y$ to the domain
$[n,n+1/n^2]$ where $(\star) $ is valid.
A: Let $\epsilon>0$ be given. $x^2$ is increasing on this set, so it suffices just compare the endpoints of each interval, from which we see the decaying behavior 
$$(n+n^{-2})^2 - n^2 = 2n^{-1}+ n^{-4}$$
So if you pick $n\gg 1$ so that $2n^{-1}+ n^{-4}<\epsilon$, the function is constant up to $\epsilon$ errors on all intervals $[m,m+m^{-2}]$ for $m>n$. For the remaining intervals
$$ V=\bigcup_{i=1}^n [m,m+m^{-2}]$$
this is a compact set and $x^2$ is continuous, so it is automatically uniformly continuous. 
To turn this into a proof: pick $\delta_1 $ so that for $x,y\in V$, $|x-y| \leq \delta_1 ⟹ |f(x)-f(y)|<\epsilon$. Without loss $\delta_1 < 1/100$. Then for $x,y\not\in V$, if $|x-y|<\delta_1$ this means $x,y$ belong to the same interval $[m,m+m^{-2}]$, and by choice of $n$ above, $|f(x)-f(y)|<\epsilon$. for these points as well, which was to be shown.
A: For each $\epsilon>0$ take $n_0$ as least positive integer where $(n_0+\frac{1}{n_0^2})^2-n_0^2=\frac{2}{n_0}+\frac{1}{n_0^4}<\epsilon$. Also take $\delta=\frac{1}{n_0^2}$. Obviously $\delta$ is a function of $\epsilon$ and for $x_1,x_2\in [n,n+\frac{1}{n^2}]$ where $n\ge n_0$ we have $|f(x_1)-f(x_2)|<\epsilon$ and for $x_1,x_2\in [n,n+\frac{1}{n^2}]$ where $n<n_0$ we have:
$$|x_2-x_1|<\delta=\frac{1}{n_0^2}\to |x_2^2-x_1^2|<|x_2+x_1|\frac{1}{n_0^2}\le \frac{2}{n_0^2}(n_0-1+\frac{1}{(n_0-1)^2})\le\frac{2n_0}{n_0^2}=\epsilon$$which is what we wanted to prove..
