Show that a map $f:X\to Y$ is onto iff $f(f^{-1}(C))=C$ for all subsets $C\subseteq Y$.
My workings so far: Because this is an if and only if proof we need to show it both ways. First let's assume $f$ is onto, that is, $\forall y\in Y\ \ \exists x\in X$ such that $f(x)=y$. Now $$f^{-1}(C)=\{ x\in X| f(x)\in C \}$$ Let $f^{-1}(C)=D \subseteq X$ for simplicity. This means $D$ is the subset of $X$ containing all $x$ that get mapped to an element in $C$ under the map $f$. Now $$f(f^{-1}(C))=f(D)=\{ y\in Y | \exists x \in D | f(x)=y \}$$ We can be sure this set is well defined by the fact that $f$ is onto. By the previous definition of $D$ it seems rather trivial that $f(D)=C$. Is this enough to prove the statement in this direction. Maybe using the more elaborate notation $$f(f^{-1}(C))=\{ y\in Y | (\exists x \in \{ x\in X| f(x)\in C \}) | f(x)=y \}$$ Makes it a little bit more obvious (if possibly more confusing).
Now for the other direction we assume that $f(f^{-1}(C))=C$ for all $C\subseteq Y$. Here I really have no idea how to get started. If anyone could point me in the right direction and possible check if argument for the first part is rigorous enough that would be great!