I came up with an alternative definition of an injective function and would like to know if it's correct and how to prove it if it is, or why it's not correct if it isn't.
f:A→B is injective if ∀y∈f(A) ∃! x∈A: f(x)=y
Is this an equivalent definition to the standard "if a≠b in A ⇒ f(a)≠f(b) in B" ?
Suppose definition 1 holds and $y=f(a)=f(b) \in B$ for some $a,b\in A$, then we have $a=b$ by definition 1, which is the countrapositive of definition 2.
Suppose definition 2 holds and $y=f(a)\in f(A)$ then we have $x\in A$ s.t. $f(x)=y$ since $f(a)$ is in the image, the uniqueness is guaranteed by definition 2.