(edited)Which $f$ can satisfy $f(A)=f(B) \to A=B$? As I wrote in title,
What is the necessary and sufficient relation between function $f$ and set $A,B$  which can satisfy
$f(A)=f(B) \to A = B\\ where f(A) =\{f(x)\|x\in A\}, f:X\to X$
and is it possible for above $f$ to make $f(A)$ and $f(B)$ intersect while A and B aren't?
edited) I know what injectivity is but what i am asking is the condition that even 
$f(x_1) = f(x_2) \land x_1 \neq x_2$ happened,  it is okay if $x_1,x_2 $ are in both $A$ and $B$

In general, it is possible that $f(A) = f(B)$, even if $A \neq B$. Let for instance $f \equiv 1$ be constant $1$, and $A$ be the positive integers and $B$ be the negative integers. Then, $f(A) = \{1\} = f(B)$, but $A \cap B = \emptyset$. 
A necessary and sufficient condition is $f$ being injective.
$f$ is injective, if $f(x) = f(y)$ implies $x = y$.
It is necessary, as if this is not true for some $x$, one would have $f(\{x\}) = f(\{y\})$, but not $\{x\} = \{y\}$. It is sufficient, since if $f$ is injective the above relation holds for any point set. This can be easily extended to any set.
