TITLE: When do union and intersection commute?
QUESTION [12 upvotes]: Suppose we're given a family of sets $A_{mn}$. When does
$$
\bigcap_{m\in\mathbb{N}}\bigcup_{n\in\mathbb{N}}A_{mn}=\bigcup_{n\in\mathbb{N}}\bigcap_{m\in\mathbb{N}}A_{mn}?
$$
For instance, if $A_{mn}=(\frac{m}{n},\infty)$ then the left side is $(0,\infty)$ and the right side is $\varnothing$.

REPLY [3 votes]: I know it is an old topic, but I was computing $\left(\bigcup_{i=1}^m A_i\right)\setminus\left(\bigcup_{j=1}^n B_j\right)$ and found something similar to this question. One can calculate $\left(\bigcup_{i=1}^m A_i\right)\setminus\left(\bigcup_{j=1}^n B_j\right)=\bigcap_{j=1}^n\left(\left(\bigcup_{i=1}^m A_i\right)\setminus B_j\right)=\bigcap_{j=1}^n \bigcup_{i=1}^m (A_i\setminus B_j)$. But one can also calculate $\left(\bigcup_{i=1}^m A_i\right)\setminus\left(\bigcup_{j=1}^n B_j\right)=\bigcup_{i=1}^m\left(A_i\setminus \bigcup_{j=1}^n B_j\right)=\bigcup_{i=1}^m\bigcap_{j=1}^n(A_i\setminus B_j)$. Then we conclude that $\bigcap_{j=1}^n \bigcup_{i=1}^m (A_i\setminus B_j)=\bigcup_{i=1}^m\bigcap_{j=1}^n(A_i\setminus B_j)$.