I have the following definition:
Let $f$ be a function. We say that $f$ is injective if $(a, y)\in f$ and $(b,y)\in f$ (i.e., $f(a) = f(b)$) then $a = b$.
I understand the last sentence but I cannot establish the relationship between the definition and injective function.
If $$ a=b \implies f(a)=f(b) $$
Then $f$ is a function.
If $$ f(a)=f(b) \implies a=b $$
then $f$ is injective.
For example $$f=\{ (1,2), (1,3)\}$$ is not a function.
$$f=\{ (1,2), (3,2)\}$$ is a function but it is not injective.
$$f=\{ (1,2), (2,3)\}$$ is a function. It is also injective.