This is an exercise from Devlin, Joy of sets.
Exercise The ordered pair operation $(a,b)$ defines a binary function on sets. The inverse functions to the function are defined as follows $$ \textrm{if } w=(a,b), \textrm{ then } (w)_0=a\ \textrm{ and}\ \ (w)_1=b$$ Prove that if $w$ is an ordered pair, then:
(a) $(w)_0=\bigcup\bigcap w$;
(b) \begin{equation*} (w)_1 =\left\{ \begin{array}{rl} \bigcup \left[\bigcup w-\bigcap w\right] & \text{if } \bigcup w\neq\bigcap w,\\ \bigcup\bigcup w & \text{if } \bigcup w=\bigcap w \end{array} \right. \end{equation*}
Note 1 if $w$ is a set of sets, then $\bigcup w=\{a|(\exists y\in w) (a\in y)\}$
Note2 the author considers an ordered pair as a set, namely $(a,b)=\{\{a\},\{a,b\}\}$
Note3 please don't ask me what I did or where precisely I got lost, since what I should do and why a mathematician should always try to turn trivialities into complicated stuff is a part of this question.
EDIT What I can't understand is the presence of union symbol both in (a) and (b). I mean, if $x$ is a set, then $\bigcup x=x$. So, in our case, $\bigcap w$ is a set, so that $\bigcup\bigcap w=\bigcap w$, so why $\bigcup$ is needed? Similarly for part (b), $\bigcup\bigcup w=\bigcup w$, so why a double union is needed?