check if $f(f^{-1}(D))=D$ I have to check whether $f(f^{-1}(D))=D$. I think this is not true but I'm stuck in my proof.
Can somebody help me?
Thanks in advance.
 A: When you try to prove something and you get stuck, perhaps it is the time to start and try to come up with a counterexample.
Trying to prove this would go something like that:

Suppose that $x\in f(f^{-1}(D))$, then $x=f(y)$ such that $y\in f^{-1}(D)$. Therefore $y=f^{-1}(x')$ such that $x'\in D$. However since $f$ is a function we have that $x=x'$ and so $x\in D$.
In the other direction, suppose that $x\in D$...

And now we get stuck. Why did we get stuck? Well, if only we could have said that $x=f(y)$ for some $y$, then we would be able to say that $y\in f^{-1}(D)$ and so $x\in f(f^{-1}(D))$. But can we say that there is such $y$?
Equivalently we ask, is it always true that $D\subseteq f(X)$? (assuming that $X$ is the domain of $f$ here.)
Of course, the answer is no. Now we can exploit this very fact to construct a counterexample. It would be exactly such $D$ that for some $x\in D$, we have $x\neq f(y)$ for all $y$. That is to say, $x$ is not in the range of $f$.
Good luck!
A: It's a good idea, when stuck on a question, to try working things out for a small example. Let's look at $f\colon\{1\}\to\{1\}$ given by $f(1)=1$. Things look fine here because $f(f^{-1}(\emptyset))=f(\emptyset)=\emptyset$ and $f(f^{-1}(\{1\}))=f(\{1\})=\{1\}$ so that's not going to give us a counter example.
What's the next easiest? How about $f\colon\{1\}\to\{1,2\}$ given by $f(1)=1$. We still have $f(f^{-1}(\{1\}))=\{1\}$, but now we have $f(f^{-1}(\{2\}))=f(\emptyset)=\emptyset$ which means this example does not have the set equality in the question hold. We've found a counter example!
In fact, with a bit of thought, and as Asaf has outlined in his answer, we can see that this equality holds if and only if the function $f$ is a surjective (onto) function. The reason the above countexample didn't satisfy the equality is because $2$ did not have a preimage as $f$ was not surjective.
A: I suggest you to make a drawing of a function $f$ mapping a curve inside a plane (for example). Then let $D$ be an open of the plane intersecting the curve. You will immediately see that $f(f^{-1}(D)) = D$ doesn't hold in this case.

If you think about it you will see that $f(f^{-1}(D))=D \iff f$ is surjective onto $D$.   
A: Think about onto. Are functions always onto?
