The subset of inverse function

Prove or disprove:

Let $f : X \to Y$ be an onto function and let $A$ and $B$ be subsets of $Y$. If $f^{−1}(A) \subseteq f^{−1}(B)$, then $A \subseteq B$.

Is this statement true? I try to come with counterexample but I cannot; I think it is true but I am not sure.

Could you please confirm that for me ?

• An interesting thing to keep in mind is: let $f:X\to Y$ be a function. Then, $f$ is surjective if and only if $f(f^{-1}(S))=S$ for all $S\subseteq Y$, while $f$ is injective if and only if $f^{-1}(f(T))=T$ for all $T\subseteq X$. – user228113 Mar 10 '17 at 5:18
• @G.Sassatelli Nice information. Thanks! – Error 404 Mar 10 '17 at 5:31

The claim is true. Let $a \in A$. Since $f$ is onto, there exists $x \in X$ such that $f(x)=a$. But that means that $x \in f^{-1}(A)$ and thus $x \in f^{-1}(B)$. Therefore, $a=f(x) \in B,$ as desired.
The claim is not true if $f$ is not onto. To see that, let $X=Y=\mathbb{R}$ and let $A=[-2,2],$ $B=[-1,1],$ and $f(x)=0$ for all $x.$ Then clearly $X=f^{-1}(A)=f^{-1}(B)$ but $A$ is not a subset of $B$.