TITLE: Compact Sets of $(X,d)$ with discrete metric
QUESTION [7 upvotes]: Let $X \neq \emptyset$. Define the discrete metric on $X$ with:
  $
    d(x,y)=\left\{\begin{array}{ll} 1, & x \neq y \\
         0, & x=y\end{array}\right.$
(a) Ascertain the compact sets in $(X,d)$.
(b) Ascertain the continuous functions $f: X \to \mathbb{R}$.

I'm really confused about this tasks because I don't know what I have to do exactly. My ideas:
(a) First all sets in (X,d) are open and closed, because in a ball $B(x,r)$ there is only the element $x$ and all singletons are open. So $\bigcap F_{open}, F \subset X$ is open too. The complement of these $F$ are closed. So all sets are open closed. How I ascertain the compact sets in $(X,d)$? This means one can find unlasting open covers for $X$, but how far I can find the compact sets with these information?
(b) Unfortunately I haven't any idea..
Thanks for helping!

REPLY [4 votes]: Let $C$ be a compact set. As every set is open, for each $c \in C$ the set $\{c\}$ is open and $\bigcup_{c\in C}\{c\}$ is an open cover of $C$. 
Now, it must have a finite subcover, which tells you that $C$ is finite. The converse is not hard to show. 
For b. use the characterizations of continuous functions via the inverse image of open sets, that is $f^{-1}(U)$ is open for open $U$. When all sets are open in $X$ this is however no restrictions whatsoever, whence all functions are continuous.

REPLY [3 votes]: Hint on (a):
Note that any set $Y\subseteq X$ has the covering $\{\{y\}\mid y\in Y\}$ which is an open cover here (all sets are open, as you remark) and has no subcover. What are the consequences for infinite sets?
Hint on (b):
A function $f:X\to\mathbb R$ is not continuous if some open set $U\subseteq\mathbb R$ exists such that $f^{-1}(U)\subseteq X$ is not open. Now remember that all subsets of $X$ are open.