Define a topology on $\mathbb{Z}$ which is compact and Hausdorff I am struggling with this question...
'Suppose $f : \mathbb{Z} \rightarrow \mathbb{Z} $ is an arbitrary finite-to-one function such that $f(0) = 0$ and $f(1) = 1$ (ie $0$ and $1$ are fixed points). Define a topology on $\mathbb{Z} $ which is compact and Hausdorff, and with respect to which $f$ is continuous.'
I have been able to define a bijection between $\mathbb{Z} $ and the one point compactification of $\mathbb{Z} $, ie
$$f: \mathbb{Z} \cup \{ \infty \} \rightarrow \mathbb{Z}$$ where
$$f(n) = \begin{cases} n+1, & \text{if } n \in \mathbb{Z}^+ \cup \{0\} \\ 0, & \text{if } n = \infty \\ n, & \text{if } n \in \mathbb{Z}^-\end{cases} $$
My lecturer has told me to think about this bijection as well as that $f(0) = 0$ in the question in order to come up with an answer but I am not sure how to think about this.
 A: For a topological space $(X,\tau)$, the one point compactification of $(X,\tau)$ is the topological space $(X\cup\{\infty\},\tau')$, where $$\tau'=\tau\,\cup\{K\cup\{\infty\}:K\subseteq X, \, X\setminus K \,\,\mbox{is compact in}\,\, (X,\tau)\}.$$
The standard topology  which is given to $\mathbb{Z}$ is the discrete topology $\mathcal{P}(\mathbb{Z})$ (as this is the subspace topology induced on $\mathbb{Z}$ by the Euclidean topology of $\mathbb{R}$). In this topology, the compact subsets of $\mathbb{Z}$ are precisely the finite subsets. Let us therefore define $(\mathbb{Z}\cup\{\infty\},\tau')$ as the one point compactification of $(\mathbb{Z},\mathcal{P}(\mathbb{Z}))$. We then have $$\tau'=\mathcal{P}(\mathbb{Z})\cup\{K\cup\{\infty\}:K\subseteq\mathbb{Z},\, |\mathbb{Z}\setminus K| <\infty\}.$$ It is straightforward to check that $(\mathbb{Z}\cup\{\infty\},\tau')$ is compact and Hausdorff.
You have also provided a bijection $\phi:\mathbb{Z} \cup \{ \infty \} \rightarrow \mathbb{Z}$ (which I have renamed $\phi$ to avoid confusion with the other $f$ in the question). Now we already have a 'nice' topology $\tau'$ on $\mathbb{Z}\cup\{\infty\}$ (that is, one which is compact and Hausdorff), so we would like to use this to obtain a 'nice' topology $\tau$ on $\mathbb{Z}$. 
The commonly used trick here is to define a topology on $\mathbb{Z}$ in such a way as to make $\phi$ a continuous map. Formally, we can take $\tau$ to be the final topology on $\mathbb{Z}$ with respect to $\phi$. Therefore, we define $\tau=\{U\subseteq\mathbb{Z}:\phi^{-1}(U)\in\tau'\}.$ Since $\phi(\infty)=0$, we see that we can explicitly write $$\tau=\mathcal{P}(\mathbb{Z}\setminus\{0\})\cup\{K\cup\{0\}:K\subseteq\mathbb{Z}\setminus\{0\},\, |\mathbb{Z}\setminus K| <\infty\}.$$
The useful property of this topology is that it can be easily checked (which I leave to you) that in fact the bijection $\phi$ is now a homeomorphism between $(\mathbb{Z}\cup\{\infty\},\tau')$ and $(\mathbb{Z},\tau)$. Therefore $(\mathbb{Z},\tau)$ is compact and Hausdorff. It only remains to check the continuity condition. Now we are ready to prove the main result.
Suppose $f:\mathbb{Z}\rightarrow\mathbb{Z}$ is an arbitrary finite-to-one function satisfying $f(0)=0$. We want to show that $f$ is continuous with respect to the topology $\tau$. Let's define a new function $F:\mathbb{Z}\rightarrow\mathbb{Z}\cup\{\infty\}$ by $F=f\circ\phi^{-1}$. Since $\phi$ is continuous and $f=F\circ\phi$, it only remains to show that $F$ is a continuous map.
Suppose $U\in\tau'$, there are two cases. Suppose first that $\infty\notin U$. Then $0\notin\phi(U)$ and so, since $f(0)=0$, we have $F^{-1}(U)=f^{-1}(\phi(U))\subseteq\mathbb{Z}\setminus\{0\}$. Therefore, in this case, $F^{-1}(U)\in\tau$.
Now suppose we have the second case $\infty\in U$, whence $U=(\mathbb{Z}\cup\{\infty\})\setminus V$ for some finite set $V\subset\mathbb{Z}$. Since $\phi$ is bijective, it follows that $\phi(V)$ is a finite subset of $\mathbb{Z}\cup\{\infty\}$. As $f$ is finite-to-one and $f(0)=0$, it follows that $F^{-1}(V)=f^{-1}(\phi(V))$ is a finite subset of $\mathbb{Z}\setminus\{0\}$. Thus, $F^{-1}(U)=\mathbb{Z}\setminus F^{-1}(V)\in\tau$.
Therefore $F$ is continuous and this completes the proof.
A: Let $U\subset \Bbb Z$ be open iff 
(i).  $0\not \in U$, or 
(ii). $0\in U$ and $\Bbb Z\setminus U$ is finite. 
If $U$ is open and $0\not \in U$ then $0\not \in f^{-1}U$ (because $f(0)=0$) so $f^{-1}U$ is open. 
If $U$ is open and $0\in U$ then $\Bbb Z\setminus U$ is finite so $V= f^{-1}(\Bbb Z\setminus U)$ is finite because $f$ is finite-to-one. Then $f^{-1}U =\Bbb Z\setminus V$ contains $0$ (because $f(0)=0$), and $\Bbb Z\setminus f^{-1}U=V$ is finite, so $f^{-1}U$ is open . Therefore $f$ is continuous.
It is easily seen that the map $g(z)=1/z$ for $0\ne z\in \Bbb Z,$ and $g(0)=0,$ is a homeomrphism from $Z$ with the above topology, to the real sub-space $\{0\}\cup \{1/z:0\ne z\in \Bbb Z\}$ (with the usual topology on $\Bbb R$),  which is a compact Hausdorff space.  
