Q:

If $X$ is a complete, separable, and perfect metric space, then a map $f$ is topologically transitive if and only if it has a dense orbit.

Let $X$ be a complete, separable, and perfect metric space. I'm trying to show that for map $f : X \rightarrow X$, topological transitivity is equivalent to having a dense orbit.
Dense orbit $\implies$ transitivity: Let $U, V \subset X$. Since there exists $x \in X$ such that $\text{Orb}(x) = \{x, f(x), f^2(x), \dots\} = \{x_1, x_2, x_3, \dots\}$ is dense in $X$, then there exist $n,m \in \mathbb{N}$ such that $x_n := f^n(x) \in U$ and $x_m := f^m(x) \in V$. WLOG assume $n>m$. Since $x_n \in f^{n-m}(\{x_m\})$, then $x_n \in U \cap f^{n-m}(V)$, therefore $f$ is transitive.
I don't know how to show the inverse though, how would I prove that transitivity implies dense orbit?

A:

Let $\{U_k\}$ be a countable basis for the topology.  For each $k$ let $V_k$ be the elements of $X$ that visit $U_k$ after some number of applications of $f$.  Then $V_k$ is open and dense.  By the Baire category theorem, $\cap_k V_k$ is nonempty.  An element of this intersection has a dense orbit.

