## Show that the preimage of dense set is dense?

Over a map f that is continuous, and I believe it also has to be onto. I keep trying to come at this at different angles and can't seem to get anywhere.

So more formally...
If f:X→Y, and f is continuous and onto. Let A be a dense set in Y. Then f^1(A) is dense in X.

I'm not entirely sure how to do this. My approach was to let U be any open set in X such that U intersected with any neighborhood of f^1(a) such that a is in A. But I keep getting all mixed up.

Using the fact (from continuity) that every open neighborhood of V(f(x)) for x in X, there exists a U(x) such that f(U(x)) is contained in V(f(x)). Since A is dense in Y, there exists and a in A such that a is in V(f(x)). BUT this doesn't mean that f^1(a) is in U(x), as V(f(x)) could contain elements that are not mapped from f(U(x)).

However, if this map is continuous, does that mean I can get the f^1(a) in U(x), and since x is arbitrary f^1(A) intersect all open sets in X are nonempty, and this f^1(A) is dense? Or am I just way off in all regards?
 PhysOrg.com science news on PhysOrg.com >> 'Whodunnit' of Irish potato famine solved>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change>> Curiosity Mars rover drills second rock target
 Recognitions: Homework Help Science Advisor "obviously" false. just look at a graph of a real valued function. maybe one with some horizontal parts to its graph. i.e. all you have to do is map an interval to a point and you are dead meat. i.e. then the oreimage of the complement of that point is not dense. as usual "obviously" means I think I can see it.
 It is definitely false. Let ##X = \mathbb{R}## be the reals with the discrete topology, let ##Y = \mathbb{R}## be the reals with the Euclidean topology, and let $$f : X\to Y\\ x\mapsto x.$$ Then ##\mathbb{Q}## is dense in ##Y##, but ##\overline{f^{-1}(\mathbb{Q})} = \overline{\mathbb{Q}} = \mathbb{Q}## in X, because every set is closed in the discrete topology, and hence ##f^{-1}(\mathbb{Q})## is not dense in ##(\mathbb{R},\tau_{\textrm{disc}})##.