Proof:
Given theorem is Schroeder-Bernstein Theorem
We call an element b of B lonely if there is no element a∈A such that f(a)=b. We say that an element b1 of B is a descendent of an element b0 of B if there is a natural number n (possibly zero) such that b1=(f∘g)n(b0). We define the function h:A→B as follows: Note that f(a) cannot be lonely itself. If f(a) is the descendent of a lonely point, then f(a)=f∘g(b) for some b; since g is injective, the element g−1(a) is well defined. Thus our function h is well defined. We claim that it is a bijection from A to B. We first prove that h is surjective. Indeed, if b∈B is the descendent of a lonely point, then h(g(b))=b; and if b is not the descendent of a lonely point, then b is not lonely, so there is some a∈A such that f(a)=b; by our definition, then, h(a)=b. Thus h is surjective. Next, we prove that h is injective. We first note that for any a∈A, the point h(a) is a descendent of a lonely point if and only if f(a) is a descendent of a lonely point. Now suppose that we have two elements a1,a2∈A such that h(a1)=h(a2). We consider two cases. If f(a1) is the descendent of a lonely point, then so is f(a2). Then g−1(a1)=h(a1)=h(a2)=g−1(a2). Since g is a well defined function, it follows that a1=a2. On the other hand, if f(a1) is not a descendent of a lonely point, then neither is f(a2). It follows that f(a1)=h(a1)=h(a2)=f(a2). Since f is injective, a1=a2. Thus h is injective. Since h is surjective and injective, it is bijective, as desired.