Deciding whether $f^{-1} (f(A)) = A$ or $f(f^{-1}(B)) = B$ $X$ and $Y$ are two sets and $f:X\to Y$. If $f(C)=\{f(x):x\in C\}$ for $C\subseteq X$ and $f^{-1}(D)=\{x:f(x)\in D\}$ for $D\subseteq Y$, then the true statement is 
(A) $f(f^{-1}(B))=B$
(B) $f^{-1}(f(A))=A$
(C) $f(f^{-1}(B))=B$ only if $B\subseteq f(X)$
(D) $f^{-1}(f(A))=A$ only if $f(X)=Y$
 A: Let $X = \Bbb R, \ Y = [0, \infty)$ and $f(x) = x^2$. If $A = (-\infty, 0]$, then $f(A) = [0, \infty)$ and $f^{-1} (f(A)) = f^{-1} ([0, \infty)) = \Bbb R \ne A$, therefore $f^{-1} (f(A)) \ne A$, so (B) is false.
Let $X = [0, \infty), \ Y = \Bbb R$ and $f(x) = x$. If $A \subseteq X$, then $f(A) = A \subseteq Y$, so $f^{-1} (f(A)) = f^{-1} (A) = A$. Nevertheless, $f(X) \ne Y$, so (D) is false.
Let $X = \Bbb R, \ Y = \Bbb R$ and $f(x) = x^2$. Let $B = [-1,1]$. Notice that $f^{-1} (B) = f^{-1} ([0,1]) = [-1, 1]$ (because $f^{-1} ([-1,0)) = \emptyset$), so that $f (f^{-1} (B)) = f([-1,1]) = [0,1] \ne B$, therefore (A) is false, too.
Finally, let us investigate (C).
Let $B \subseteq f(X)$. If $y \in B \subseteq f(X)$, then there exist $x \in X$ such that $f(x) = y \in B$, so $x \in f^{-1} (B)$, which implies (just apply $f$) that $f(x) \in f(f^{-1}(B))$, so $y \in f(f^{-1} (B))$. This shows that $B \subseteq f(f^{-1} (B))$. For the opposite inclusion, if $y \in f(f^{-1} (B))$, then there exist $x \in f^{-1} (B)$ with $y = f(x)$; but $x \in f^{-1} (B)$ means that $f(x) \in B$ (this is what "inverse image" means), so then $y = f(x) \in B$. We have thus proved that $f(f^{-1} (B)) \subseteq B$. Since we have inclusions in both directions, we have proved that $B \subseteq f(X) \implies B = f(f^{-1} (B))$.
Assume now that $B = f(f^{-1} (B))$ and let $C = B \cap f(X), \ D = B \setminus f(X)$; notice that $B = C \cup D$, $C \cap D = \emptyset$ and $f^{-1} (D) = \emptyset$. Then $$B = f(f^{-1} (B)) = f(f^{-1} (C \cup D)) = f(f^{-1} (C) \cup f^{-1} (D)) = f(f^{-1} (C)) \cup f(\emptyset) = f(f^{-1} (C)) .$$ Since $D \subseteq B = f(f^{-1} (C)) \subseteq f(X)$, we deduce that $D = \emptyset$, so $B \subseteq f(X)$. We have thus proved that $B = f(f^{-1} (B)) \implies B \subseteq f(X)$.
To conclude, not only is (C) the only true statement, it is true in a much stronger form, with logical equivalence instead of just implication.
A: (A) is not true.
Let $X=A=\{a\}$, and $Y=B=\{a,b\}$. Define $f:X\to Y; \quad f(a)=a.$ Then $f(f^{-1}(B))=\{a\}\neq B.$  

(B) is not true.
Let $X=Y=\{a,b\}$, and $A=B=\{a\}$ . Define $f:X\to Y; \quad f(x)=a, \forall x\in X.$ Then $f^{-1}(f(A))=X\neq A.$   

(D) is not true.
Let $X=\{a,b\}$, $Y=\{a,b,c\}$, and $A=B=\{a\}$. Define $$f:X\to Y; \quad f(x)=x, \forall x\in X.$$
We have $f^{-1}(f(A))=A,$ but $f(X)\neq Y.$

(C) is true:
Let $f(f^{-1}(B))=B.$  We should prove $B\subseteq f(X).$ If not, we have $b\in B\setminus f(X).$ Hence $b\in B\setminus f(f^{-1}(B)),$ Since $f^{-1}(B)\subseteq X.$ (contradiction!)
