Why union and intersection can be interchanged in this situation? Let $F$ be a closed subset of $\Bbb R$. We define:
$$X_n=\bigcup_{x\in F}\left(x-\frac{1}{n};x+\frac{1}{n}\right)=\bigcup_{x\in F}B\left(x;\frac{1}{n}\right)$$
Show that:
$$F=\bigcap^{\infty}_{n=1}X_n$$
In the solution, I don't understand this statement:
$$F=\bigcap\bigcup B\left(x;\frac{1}{n}\right)=\bigcup\bigcap B\left(x;\frac{1}{n}\right)$$
My questions are:


*

*Why can the union and the intersection be interchanged in this situation?

*In general, what is the condition of an arbitrary set $X_{i,j}$ so that these 2 operations can be interchanged?, that is:
$$\bigcap_{i\in A}\bigcup_{j \in B}X_{i,j}=\bigcup_{j \in B}\bigcap_{i\in A}X_{i,j}$$
(my feeling is that, the property of set $A$ and $B$ is important as well)

*Intuitively, how can a countable union of open sets result in a closed set?

 A: Suppose that $y\in\bigcap_{n\ge 1}\bigcup_{x\in F}B\left(x,\frac1n\right)$; then for each $n\in\Bbb Z^+$ there is an $x_n\in F$ such that $x_n\in B\left(x,\frac1n\right)$. Show that the sequence $\langle x_n:n\in\Bbb Z^+\rangle$ converges to $x$, and use the fact that $F$ is closed to conclude that $x\in F$. This shows that $\bigcap_{n\ge 1}\bigcup_{x\in F}B\left(x,\frac1n\right)\subseteq F$, and the opposite inclusion is easy, so $\bigcap_{n\ge 1}\bigcup_{x\in F}B\left(x,\frac1n\right)=F$.
Now assume that $y\in\bigcup_{x\in F}\bigcap_{n\ge 1}B\left(x,\frac1n\right)$, so that there is an $x_y\in F$ such that $y\in B\left(x_y,\frac1n\right)$ for each $n\in\Bbb Z^+$; this clearly implies that $y=x_y\in F$, so $\bigcup_{x\in F}\bigcap_{n\ge 1}B\left(x,\frac1n\right)\subseteq F$. Once again the opposite inclusion is easy, and we have $\bigcup_{x\in F}\bigcap_{n\ge 1}B\left(x,\frac1n\right)=F$.
Thus,
$$\bigcap_{n\ge 1}\bigcup_{x\in F}B\left(x,\frac1n\right)=F=\bigcup_{x\in F}\bigcap_{n\ge 1}B\left(x,\frac1n\right)\;.$$
It isn’t that the union and intersection are directly equal to each other: it’s that each of them is equal to $F$, and hence they must be equal to each other.
