Find an example of a function \(\displaystyle f: A \rightarrow B \) and a subset \(\displaystyle D \subset B \) such that \(\displaystyle f(f^{-1} (D)) \neq D \).

Im totally lost on this one. Any help please

What do you mean by \(\displaystyle f^{-1}\)? Is it that \(\displaystyle f^{-1}(S) = \{s : f(s) \in S\}\)? As clearly this result does not hold if this is your definition of \(\displaystyle f^{-1}\), however this is the `natural' definition...

(The result does not hold as \(\displaystyle f^{-1}(D) = \{a:f(a) \in D\}\) so \(\displaystyle f(f^{-1}(D)) = f(f^{-1}(\{a:f(a) \in D\})) = f(a) \in D\).)

Now, \(\displaystyle f^{-1}(f(D)) \neq D\) does hold sometimes. Take, for example, \(\displaystyle f: \mathbb{Q} \rightarrow \mathbb{Q}\), \(\displaystyle \frac{a}{b} \mapsto ab\) and \(\displaystyle D = \{6\}\).