Proving that there is a bijection between $A$ and $B$. If we set $A$ and $B$. Assuming that there exist an injective map from $A$ to $B$ and an injective map from $B$ to $A$. How to prove that there is a bijection between $A$ and $B$.
 A: The result is probably one of the most famous set theoretical results in mathematics and it is known as the Cantor-Bernstein (also Cantor-Schröder-Bernstein) theorem. It has a rich history, and was given several different proofs.
You can find some of its historical highlights, as well one of the proofs on this webpage.
A: As was pointed out in the comments, this is the Cantor-Schröder-Bernstein theorem, of which several proofs are known. The one that I find easiest to grasp is a version of the one due to König.
Let $A_0=A\setminus g[B]$ and $B_0=B\setminus f[A]$. Given $A_n$ and $B_n$ for some $n\in\omega$, let $B_{n+1}=f[A_n]$ and $A_{n+1}=g[B_n]$. Finally, let $A_\omega=A\setminus\bigcup_{n\in\omega}A_n$ and $B_\omega=B\setminus\bigcup_{n\in\omega}B_n$. Clearly $\{A_\xi:\xi\le\omega\}$ and $\{B_\xi:\xi\le\omega\}$ are partitions of $A$ and $B$ respectively. Note also that for each $n\in\omega$, $f\upharpoonright A_n$ is a bijection from $A_n$ to $B_{n+1}$, and $g\upharpoonright B_n$ is a bijection from $B_n$ to $A_{n+1}$. The following paragraph may make this easier to visualize.

Say that an element $b\in B$ can be pulled back if $b\in f[A]$, so that there is a unique $a=f^{-1}(b)\in A$; in this case I’ll say that $b$ can be pulled back to $a$ and call $a$ the pullback of $b$. Similarly, say that $a\in A$ can be pulled back if $a\in g[B]$, so that there is a unique $g^{-1}(a)\in B$. Then $A_0$ is the set of elements of $A$ that can’t be pulled back, and $B_0$ is the set of elements of $B$ that can’t be pulled back. Elements of $A_1$ and $B_1$ can be pulled back once, to $B_0$ and $A_0$, respectively, but their pullbacks cannot be pulled back. Elements of $A_2$ and $B_2$ can be pulled back to $B_1$ and $A_1$, respectively, and their pullbacks can then be pulled back once more. An easy induction establishes that for each $n\in\omega$, elements of $A_n$ and $B_n$ can be pulled back exactly $n$ times. 

If $b\in B_\omega$, then $b\in f[A]$, so $b$ can be pulled back, but its pullback is not in $A_n$ for any $n\in\omega$; thus, $f^{-1}(b)\in A_\omega$. Conversely, if $a\in A_\omega$, then $f(a)\in B\setminus\bigcup_{n\in\omega}B_n=B_\omega$, and it follows that $f\upharpoonright A_\omega$ is a bijection from $A_\omega$ to $B_\omega$. (In fact, $A_\omega$ and $B_\omega$ contain those elements of $A$ and $B$, respectively, that can be pulled back infinitely many times.) We now have the pieces needed to build a bijection $h$ from $A$ to $B$.
The idea is simple. First, on $A_\omega$ we can simply use $f\upharpoonright A_\omega$; that ‘hits’ all of $B_\omega$. If $n\in\omega$ is even, we can use $f\upharpoonright A_n$, hitting $B_{n+1}$. And if $n\in\omega$ is odd, we can use $g^{-1}\upharpoonright A_n$, hitting $B_{n-1}$. In other words, let
$$h:A\to B:a\mapsto\begin{cases}
f(a),&\text{if }a\in A_{2n}\text{ for some }n\in\omega\\
g^{-1}(a),&\text{if }a\in A_{2n+1}\text{ for some }n\in\omega\\
f(a),&\text{if }a\in A_\omega\;.
\end{cases}$$
If you prefer to think of a function as a set of ordered pairs, let $E=A_\omega\cup\bigcup_{n\in\omega}A_{2n}$, and define
$$h=\big(f\upharpoonright E\big)\cup\left(g^{-1}\upharpoonright(A\setminus E)\right)\;.$$
Clearly $h$ is a bijection from $A$ to $B$.
(If I have time, I’ll add a diagram to go with this.)
There is also a very short proof from Tarski’s fixed point theorem, which is itself quite easy to prove. That proof can be found here (as Example $3$). Elegant as it is, however, I don’t find it nearly so intuitively satisfying.
