Let $f:X\rightarrow Y$ a function. Prove that $f$ is injective if and only if, for every pair of subsets $A$ and $B$ in $X$, we have $f(A\backslash B)=f(A)\backslash f(B)$.
The first part ($\Rightarrow$) I found easy to do. But the second part ($\Leftarrow$), all the ideas I had got me nowhere. For example, one of the ideas I had is making $f(x_1)=f(x_2)$ and try to prove that $x_1=x_2$. But I don't know how to start it. Should I separate in cases, like $f(x_1)$ and $f(x_2)$ belongs to $f(A)$ but not $f(B)$, and then the other cases...? I tried that but I got confused. The other way I tried is supposing and absurd that $f(x_1)=f(x_2)$ but $x_1\neq x_2$. And again I got stuck.
I am only asking here for a tip. Thanks.