TITLE: $A\subset f^{-1}(f(A))$ with equality if and only $f$ is injective.
QUESTION [5 upvotes]: I've got a little mistakes with that:
$A\subset f^{-1}(f(A))$ with equality if and only $f$ is injective.
For example, if we take $f(x)=x^2$ and $A=[-1,1]$, we have
$$f(A)=f([-1,1])=\{f(x)\mid x\in[-1,1]\}=[0,1]$$
and
$$f^{-1}(f(A))=f^{-1}([0,1])=\{x\mid f(x)\in[0,1]\}=[-1,1].$$
What's wrong here ?

REPLY [5 votes]: I think you got mixed up. The statement is

$f\colon X → Y$ is injective if and only if for every subset $A ⊂ X$, $A = f^{-1}(f(A))$.

Not “for some  subset”. The condition is, of course, always true for $A = X$.

REPLY [5 votes]: The correct statement is with equality for all $A$ if and only $f$ is injective.
In your example if you pick $A=[0,1]$ then $f^{-1} (f(A)) \neq A$.
If $f$ is not injective, equality still holds for some $A$'s, but not for all.
Added If you actually mean that your proof is a proof of the statement, then here is what it is wrong with it.
You proved that this statement is true for the one function you chose and the one set you chose. But this doesn't prove that the statement is true for another function and another set. You need to prove it for ALL functions, not just one you chose.