# Can we define inverse function for the injections?

My calculus book denotes like following:

If $f: X \rightarrow Y$ is injective $\Rightarrow$ $f^{-1}$ is defined as following : $f^{-1}(b) = a \iff f(a) =b$ where domain of $f^{-1}$ is $Y$ and codomain is $X$

But What I know is inverse exists only in case f is bijective. Isn't it? and one more question, if inverse exists only in case of f is bijective, above definition assumes that $f(Y\setminus f(x)) = \emptyset$ ?

If $f: X \rightarrow Y$ is injective, then you can define $f_0:X \rightarrow f(X)$ by $f_0(x)=f(x)$.
$f_0$ is bijective, hence $f_0^{-1}:f(X) \to Y$ exists.
You well noticed that injectivity of $f:X\to Y$ does indeed not guarantee the existence of a function $g:Y\to X$ s.t. the functions $f\circ g$ and $g\circ f$ are identities, and personally I would say that $f$ has not necessarily an inverse.
However, the opposite graph $\{\langle y,x\rangle\mid f(x)=y\}$ of $f$ can be written as $\{\langle y,x\rangle\mid x=g(y)\}$ where $g$ is a function having $X$ as codomain and the range of $f$ as domain.