Hi I have been stuck on the following problem for quite some time now I don't find the trick to solve it. Any help would be much appreciated.
Let $f:A\to B$ and $g:B\to A$ be arbitrary functions. Show that there are subsets $A_1,A_2\subseteq A$ and $B_1,B_2\subseteq B$ such that $A_1\cup A_2=A$, $A_1\cap A_2=\varnothing$, $B_1\cup B_2=B$, $B_1\cap B_2=\varnothing$, and $$f(A_1)=B_1,\qquad g(B_2)=A_2\;.$$ Use this to give an alternative proof of the Cantor-Schröder-Bernstein theorem.