[proofplan]
We prove both directions directly from the open-cover definition of a [compact space](/page/Compact%20Space). If $X$ is finite, then any [open cover](/page/Open%20Cover) contains one [open set](/page/Open%20Set) around each point, and these finitely many chosen sets already cover $X$. Conversely, if $X$ has the [discrete topology](/page/Discrete%20Topology), the family of singleton subsets $\{\{x\} : x \in X\}$ is an open cover; compactness reduces it to finitely many singletons, possibly none, forcing $X$ itself to have finitely many points.
[/proofplan]
[step:Extract a finite subcover from any open cover when $X$ is finite]
Assume that $X$ is finite. Let $\mathcal{U}$ be an open cover of $X$, meaning that $\mathcal{U}$ is a collection of open subsets of $X$ such that every point of $X$ belongs to at least one element of $\mathcal{U}$, as in the definition of a [compact space](/page/Compact%20Space).
For each $x \in X$, choose a set $U_x \in \mathcal{U}$ such that $x \in U_x$. This choice is over the finite set $X$. The finite collection
$\{U_x : x \in X\}$ is a subcollection of $\mathcal{U}$ and covers $X$, because each $x \in X$ belongs to its chosen set $U_x$. Hence every open cover of $X$ has a finite subcover, so $X$ is compact.
[guided]
We assume first that $X$ is finite and prove compactness using the open-cover definition. Let $\mathcal{U}$ be an arbitrary open cover of $X$. Thus $\mathcal{U}$ is a collection of open subsets of the [topological space](/page/Topological%20Space) $X$, and the covering condition says that for every point $x \in X$ there exists some set $U \in \mathcal{U}$ with $x \in U$.
Since there are only finitely many points in $X$, we may choose one covering set for each point. More precisely, for each $x \in X$, choose a set $U_x \in \mathcal{U}$ satisfying $x \in U_x$. The collection $\{U_x : x \in X\}$ is finite because it is indexed by the finite set $X$. It is also a subcollection of $\mathcal{U}$.
Now verify that this finite subcollection covers $X$. Let $y \in X$ be arbitrary. By construction, the set $U_y$ was chosen so that $y \in U_y$. Since $U_y$ belongs to the finite collection $\{U_x : x \in X\}$, the point $y$ is covered by that finite collection. Therefore every point of $X$ is covered.
Because the open cover $\mathcal{U}$ was arbitrary, every open cover of $X$ admits a finite subcover. This is precisely compactness of the topological space $X$.
[/guided]
[/step]
[step:Use the singleton open cover to force compact discrete spaces to be finite]
Assume that $X$ is compact and equipped with the discrete topology. Define
$\mathcal{V} := \{\{x\} : x \in X\}$. Since the topology on $X$ is discrete, every subset of $X$ is open, so each singleton $\{x\}$ is open. Also, $\mathcal{V}$ covers $X$, because every point $x \in X$ belongs to the singleton $\{x\}$.
By compactness, there is a finite subcollection $\mathcal{W} \subset \mathcal{V}$ such that $\mathcal{W}$ covers $X$. Define
$A := \{x \in X : \{x\} \in \mathcal{W}\}$. Because $\mathcal{W}$ is finite, the set $A$ is finite. If $\mathcal{W}$ is empty, then its union is empty, and since $\mathcal{W}$ covers $X$, we get $X = \varnothing$, so $X$ is finite. If $\mathcal{W}$ is nonempty, then every point $x \in X$ belongs to some singleton $\{a\} \in \mathcal{W}$ with $a \in A$, hence $x = a$. Thus $X \subset A$. Since every $a \in A$ belongs to $X$ by definition, $A \subset X$. Therefore $X = A$, and $X$ is finite.
[/step]
[step:Combine the two implications]
We have shown that finite discrete spaces are compact and that compact discrete spaces are finite. Therefore a set $X$ equipped with the discrete topology is compact if and only if $X$ is finite.
[/step]