Question: Is there any function $f:\mathbb{R}\to\mathbb{R}$ that is continuous precisely on the rational points of $\mathbb{R}$?
Solution: Let $f:\mathbb{R}\to \mathbb{R}$ be any arbitrary function. Give a positive integer $n$, let $U_n$ be the union of the elements of the following collection:
$$\big\{U:U \; \text {is open in} \;\mathbb{R}\;\&\; \text {diam}(f(U))<\frac{1}{n}\big \}$$
Then $U_n$ is open in $\mathbb{R}$ and let us consider the set $X=\cap_{n} U_n$. Then $X$ is the set of points at which the function $f$ is continuous......
I can't able to understand the last line of the solution. That is, how $X$ becomes the set of points of continuity of $f$? Please help me to understand this.