Prove: If $f:A\to B, C\subseteq A, D\subseteq B$, then $f(C) \subseteq D \iff C \subseteq f^{-1}(D)$ 
Prove: If $f:A\to B, C\subseteq A, D\subseteq B$, then $f(C) \subseteq D \iff C \subseteq f^{-1}(D)$

My attempt:
Suppose $f(C) \subseteq D$. If $x\in C$, then $f(x)\in f(C)$ and certainly $f(x) \in D$ since $f(C)\subseteq D$. But whenever $f(x)\in D$, we have that $x\in f^{-1}(D)$. So $C\subseteq f^{-1}(D)$. Conversely, suppose $C\subseteq f^{-1}(D)$. Given that $C \subseteq f^{-1}(D)$, if $x\in f^{-1}(D)$, then certainly $f(x)\in d$. Hence $C\subseteq f^{-1}(D)$.
Is there any flaw with my proof? Also, when is the equality part of this proof satisfied and why?
 A: You are right in the first part. In the conversely part you seem to have assumed $C \subseteq f^{-1} (D)$ and proved the same thing. You need to show now that $f(C) \subseteq D$. For that you should start with $y \in f(C)$. So there exists an $x \in C$ such that $ y = f(x)$. Since $C \subseteq f^{-1} (D)$ we have that $x \in f^{-1}(D)$ so that $y=f(x) \in D$. Then you are done.
For the second question - 
We will try to see what conditions on $f$ make $f(C) = D \Longleftrightarrow C = f^{-1}(D)$ true.
First suppose $C=f^{-1}(D)$
Let $y\in f(C)$. Then $y=f(x)$  for some  $ x \in C = f^{-1}(D)$. So $y=f(x) \in f(f^{-1}(D) \subseteq D$. Next let $y\in D$. Then $f^{-1}(y) \subseteq f^{-1}(D) = C$. To proceed any further we have to choose an $x$ in $f^{-1}(y)$ which can only happen if $f$ is surjective when the codomain is restricted to $D$. (A better way to say this is that when every point in $D$ has a preimage).  So we will impose this condition on $f$. But this gives us $y\in f(C)$ which proves $f(C) = D$
Conversely suppose $f(C)=D$
Let $x \in C$. Then$f(x)\in D$ so $x \in f^{-1}(D)$. Next let $x\in f^{-1}(D)$. So $f(x) \in D =f(C)$. So there exists a $c\in C$ such that $f(x)=f(c)$. If $f$ were injective then $x=c$ and we are done proving $C=f^{-1}(D)$. Notice that just having $f|_C$ isn't enough as you don't have apriori that $x\in C$
Thus for the equality you need $f$ to be injective and every element of $D$ must have a preimage under $f$.
