Construction for pairwise disjoint sets I’ve been reading about measure theory and found that if I have a collection on measurable sets (suppose for the sake of simplicity that they’re intervals here) $\{I_k\}_{k=1}^N$ that there is a way to construct a new countable collection $E_1, E_2 , \dots$ such that $E_i$’s are pairwise disjoint. And that $\bigcup_{i=1}^N I_i = \bigcup_{i=1}^N E_i $.
Now how this works is that first you set $E_1 = I_1$. Then for $i>1$ you define $E_i =I_i \setminus \left(\bigcup_{j=1}^{i-1} I_j \right)$ and this would create a collection for which $\bigcup_{i=1}^N I_i = \bigcup_{i=1}^N E_i  $.
Now I couldn’t find any proof on why this works so I would like to have some insight on what is happening here?
 A: I'm assuming you meant $N$ to be a natural number, so that we have finitely many intervals $\{I_1,I_2,\dots,I_N\}$, but it also works if we use an infinite set $\{I_1,I_2,\dots\}$. Also, the sets $I_i$ don't need to be intervals, since this is not a necessary assumption in the proof.
We will first show that $\bigcup E_k=\bigcup I_k$ by proving $\bigcup E_k\subseteq \bigcup I_k$ and $\bigcup I_k\subseteq\bigcup E_k$. (Whenever I leave out the sub- and superscripts, such as in the previous sentence, I mean to take the full range of indices, e.g. $\bigcup E_k$ stands for $\bigcup_{i=1}^{N}E_k$ in case we consider finitely many indices, or $\bigcup_{i=1}^\infty E_k$ in case we consider infinitely many)
[edit: I've included a part at the bottom showing that the sets $E_k$ are disjoint]

Let's do the easy direction first. If $x\in \bigcup E_k$, then $x\in E_i$ for some $i$. By how $E_i$ is defined, then $x\in I_i$ as well, and therefore $x\in \bigcup I_k$. Hence $\bigcup E_k\subseteq \bigcup I_k$.

Now let's do the other direction. Suppose that $x\in \bigcup I_k$, then once again there is some $i$ such that $x\in I_i$, but naturally it may be possible that there are multiple $i$ for which this holds, since the sets $I_k$ do not have to be disjoint.
Let $X\subseteq\Bbb N$ be the set of natural numbers such that $x\in I_k$ if and only if $k\in X$. Since every subset of the natural numbers is well-ordered, $X$ contains a least element, let's call it $i\in X$. Then $x\in I_i$, but for any $j<i$ we see that $x\notin I_j$ (otherwise $j$ would be in $X$, contradicting the minimality of $i$).
So, since $x\notin I_j$ for any $j<i$, also $x\notin \bigcup_{j=1}^{i-1} I_j
$. Hence $x\in I_i\setminus \bigcup_{j=1}^{i-1} I_j=E_i$. This shows that $\bigcup I_k\subseteq \bigcup E_k$.

What is left, is to show that the $E_k$ are disjoint from each other. Suppose $i\neq j$ are natural numbers, then $i<j$ or $j<i$. Let's assume the first, that $i<j$.
If $E_i\cap E_j\neq \varnothing$, then there is some $x$ such that both $x\in E_i=I_i\setminus \bigcup_{k=1}^{i-1} I_k$ and $x\in E_j=I_j\setminus \bigcup_{k=1}^{j-1}I_k$.
So $x\in I_i$ in particular. But since $i<j$, also $x\in \bigcup_{k=1}^{j-1}I_k=I_1\cup I_2\cup\cdots \cup I_i\cup\cdots I_{j-1}$. Which means that $x\notin E_j$, since $E_j$ is just $I_j$ without the elements from $\bigcup_{k=1}^{j-1}I_k$.
