# $Y\subseteq X$ and $\exists f:X\to Y$ injection, then $X$ and $Y$ are in bijective correspondence

$$Y\subseteq X$$ and $$\exists f:X\to Y$$ injection, then $$X$$ and $$Y$$ are in bijective correspondence

if $$Y=X$$, we're done, since Identity map servers our purpose

assume $$Y\neq X \rightarrow X\setminus Y \neq 0$$

define $$A= f^{n}(X\setminus Y)$$

define $$g:X\to Y$$

$$x \mapsto f(x)$$ if $$x\in A$$ and

$$x \mapsto x$$ if $$x\notin A$$

It is well defined.

if $$g(x)=g(y)$$

then if both $$x,y \in A\rightarrow f(x)=f(y) \rightarrow x=y$$

else if both $$x,y \notin A \rightarrow x=y$$

if $$x\in A$$ and $$y\notin A$$

then $$g(x)=g(y)\rightarrow f(x)=y$$

as $$x\in A \rightarrow \exists m\in N\cup\{0\}$$ and $$\exists z\in X\setminus Y$$ such that $$x=f^m (z)\rightarrow y=f(x)=f^{m+1}(z) \in A$$ contradiction

so $$g$$ is injective

How can I show that this map is surjective?

I assume you mean $$A = \bigcup_{n=0}^\infty f^n(X\setminus Y).$$ To see $$g$$ is surjective, let $$y\in Y.$$ If $$y\notin A,$$ then $$y=g(y).$$ If $$y\in A,$$ then since $$y\notin X\setminus Y,$$ $$y=f(x)$$ for some $$x\in A,$$ so $$y=g(x).$$
As $$Y\subset X$$, you can consider the injective embedding $$Y \rightarrow X$$. As there is alzó An injective function $$X \rightarrow Y$$, it follows by Cantor-Bernstein theorem that $$|Y|=|X|$$, i.e., there is a bijection between these two sets.