Perhaps a more advanced way to prove Cantor–Bernstein I was told the following, and am having a lot of trouble understanding how this can be true.
Apparently if we have any two arbitrary functions $f:X \to Y$ and $g: Y \to X$ then there exist subsets $X_1$ and $X_2$ of $X$ and $Y_1, Y_2$ of $Y$ such that $X_1 \cup X_2=X$ , $X_1 \cap X_2= \emptyset$, $Y_1 \cup Y_2= Y, Y_1 \cap Y_2 = \emptyset$ and moreover $f(X_1)=Y_1$ and $g(Y_2)=X_2$.
Finally, this can be used to actually prove the Cantor–Bernstein theorem.
Here are my questions, how do we know that such subsets even exist? What would they have to be? Would it be related to fixed points? And even if it is true, how are we able to prove the theorem just from it?
Thanks all for time and help
 A: I. Lemma (Knaster–Tarski Fixed Point Theorem). If a function $\varphi:\mathcal P(A)\to\mathcal P(A)$ satisfies the condition
$$X\subseteq Y\implies\varphi(X)\subseteq\varphi(Y)$$
for all $X,Y\subseteq A,$ then $\varphi(S)=S$ for some $S\subseteq A.$
Proof. Let $\mathcal F=\{X:X\subseteq\varphi(X)\}$ and let $S=\bigcup\mathcal F.$ First note that, if $X\in\mathcal F,$ then $X\subseteq S$ and $X\subseteq\varphi(X)\subseteq\varphi(S).$ Since every member of $\mathcal F$ is a subset of $\varphi(S),$ it follows that $S=\bigcup\mathcal F\subseteq\varphi(S),$ that is, $S\in\mathcal F.$ From $S\in\mathcal F$ it follows that $\varphi(S)\in\mathcal F,$ whence $\varphi(S)\subseteq S,$ and so $\varphi(S)=S.$
II. Theorem (Banach Mapping Theorem). For any two functions $f:X\to Y$ and $g:Y\to X$ there exist subsets $X_1,X_2$ of $X$ and $Y_1,Y_2$ of $Y$ such that $X_1\cup X_2=X,\ $$X_1\cap X_2=\emptyset,\ Y_1\cup Y_2=Y,\ Y_1\cap Y_2 = \emptyset$ and moreover $f(X_1)=Y_1$ and $g(Y_2)=X_2$.
Proof. Define a function $\varphi:\mathcal P(X)\to\mathcal P(X)$ by setting
$$\varphi(S)=X\setminus g(Y\setminus f(S)),$$
and observe that $S\subseteq T\implies\varphi(S)\subseteq\varphi(T).$ Hence, by the lemma, there is a set $X_1\subseteq X$ such that $X_1=\varphi(X_1)=X\setminus g(Y\setminus f(X_1)),\ $ i.e., $$X\setminus X_1=g(Y\setminus f(X_1)).$$
Let
$$Y_1=f(X_1),$$
$$Y_2=Y\setminus Y_1=Y\setminus f(X_1),$$
$$X_2=g(Y_2)=g(Y\setminus f(X_1))=X\setminus X_1,$$
and everything is fine.
III. Corollary. (Cantor—Bernstein Theorem). If there are injections $f:X\to Y$ and $g:Y\to X,$ then there is a bijection $h:X\to Y.$
Proof. With $X_1,X_2,Y_1,Y_2$ as above, let $h=(f\upharpoonright X_1)\cup(g\upharpoonright Y_2)^{-1}.$
A: Let $f:X\to Y$ and $g:Y\to X$ be injections. For $p\in X,$ consider the sequence $$(p,g^{-1}(p), f^{-1}g^{-1}(p), g^{-1}f^{-1}g^{-1}(p),...)$$  which may terminate after finitely many terms (when an inverse fails to exist), or may continue without end. 
Let $O$ be the set of $p\in X$ for which the sequence has an odd number of terms. Let $E$ be the set of $p\in X$ for which the sequence has an even number of terms. Let $I$ be the set of $p\in X$ for which the sequence has no end.
Now let $h(p)=f(p)$ if $p\in O,$ and $h(p)=g^{-1}(p)$ if $p\in E \cup I.$
(1A).Clearly if $\{p_1,p_2\}\subset O$ or if $\{p_1,p_2\}\subset E$ then $h(p_1)=h(p_2)\implies p_1=p_2.$ 
(1B).Suppose $p_1\in O$ while $p_2\in E\cup I.$ Then $$h(p_1)=h(p_2)\implies f(p_1)=g^{-1}(p_2)\implies p_1=f^{-1}g^{-1}(p_2).$$ But if $p_2 \in E\cup I$ and if $ f^{-1}g^{-1}(p_2)$ exists then $f^{-1}g^{-1}(p_2)\in E\cup I,$ so $p_1\in E\cup I, $ a contradiction to $p_1\in O.$ 
(1C).Therefore $h:X\to Y$ is an injection.
(2A).  For $q\in Y,$ if $g(q)\in E\cup I$ then $h(g(q))=g^{-1}g(q)=q.$ 
(2B).If $g(q)=x\in O,$ then $g^{-1}(x)$ exists and the sequence $(x,g^{-1}(x), ...)$ has an odd number of terms. So $f^{-1}g^{-1}(x)$ exists, and it also belongs to $O.$ So $h(f^{-1}g^{-1}(x))=f(f^{-1}g^{-1}(x))=g^{-1}(x)=g^{-1}(g(q))=q.$
(2C). Therfore $h:X\to Y$ is a surjection.
I think that drawing a heuristic picture, with $X$ and $Y$ as parallel lines, may help you to grasp this.
