I wanted to know if my proof is correct or not, and if not, what I need to change. My question given to me is to show that $f:\bigcup\limits_{n=1}^{\infty}\left[n,n+\frac{1}{n^{2}}\right]\rightarrow\mathbb{R}$ is uniformly continuous on $\bigcup\limits_{n=1}^{\infty}\left[n,n+\frac{1}{n^{2}}\right]$, where $f\left(x\right)=x^{2}$. Here is what I have.
If $x,y\in\left[n,n+\frac{1}{n^{2}}\right]$, then $\left\lvert x+y\right\rvert\le\frac{2\left(n^{3}+1\right)}{n^{2}}$. Let $\epsilon>0$ and $\delta=\epsilon\cdot\frac{n^{2}}{2\left(n^{3}+1\right)}$. Then, $$\left\lvert f\left(x\right)-f\left(y\right)\right\rvert=\left\lvert x^{2}-y^{2}\right\rvert=\left\lvert x+y\right\rvert\left\lvert x-y\right\rvert$$ $$\le\frac{2\left(n^{3}+1\right)}{n^{2}}\left\lvert x-y\right\rvert<\frac{2\left(n^{3}+1\right)}{n^{2}}\delta$$ $$=\frac{2\left(n^{3}+1\right)}{n^{2}}\epsilon\cdot\frac{n^{2}}{2\left(n^{3}+1\right)}=\epsilon.$$ Thus, for all $\epsilon>0$, there exists $\delta=\epsilon\cdot\frac{n^{2}}{2\left(n^{3}+1\right)}>0$ such that if $\left\lvert x-y\right\rvert<\delta$, then $\left\lvert f\left(x\right)-f\left(y\right)\right\rvert<\epsilon$, so $f$ is uniformly continuous.
First show that for any $\epsilon > 0$ there exists $N$ depending only on $\epsilon$ and $\delta(\epsilon) > 0$ such that for all $x,y \in [N, \infty)$, if $|x - y| < \delta(\epsilon)$ then $|x^2 - y^2| < \epsilon$.
The appropriate choice to make this work is $N = \max(\lceil \sqrt{2} \rceil, 4/\epsilon)$ and any $\delta(\epsilon) > 0$ such that $\delta(\epsilon) < 1 /N^2.$
Now we need to verify that two conditions are satisfied when $x,y \in [N, \infty)$ and $|x - y| < \delta(\epsilon):$
$$x,y \in [M,M + 1/M^2] \text{ where } M \geqslant N, \\ |x^2 - y^2 | < \epsilon.$$
Suppose that $x \in [M_1,M_1 + 1/M_1^2]$ and $y \in [M_2,M_2 + 1/M_2^2]$ where WLOG $M_2 > M_1 \geqslant N$. In this case,
$$|x-y| \geqslant M_2 - M_1 - 1/M_1^2 > 1 - 1/M_1^2 \geqslant 1 - 1/N^2.$$
However, since $N > \sqrt{2}$, it follows that $1 - 1/N^2 > 1/2 > 1/N^2 > \delta(\epsilon).$ This implies $|x- y| > \delta(\epsilon)$, a contradiction.
Hence, we must have $x, y \in [M,M + 1/M^2]$ with $M \geqslant N$ and
$$|x^2 - y^2| = |x-y||x + y| < \frac{1}{M^2}\left(2M + \frac{2}{M^2} \right) = \frac{2}{M}\left(1 + \frac{1}{M^3}\right)< \frac{4}{N} < \epsilon.$$
You should be able to finish the proof by using the fact that $\displaystyle \bigcup_{n=1}^{N-1}[n,n + 1/n^2]$ is compact, producing a single value of $\delta(\epsilon)$ where $|x^2 - y^2| < \epsilon$ for all $x,y$ in the domain with $|x-y|< \delta(\epsilon)$.