Why does the definition of topological space require that the empty set be open? I'm taking my first course in general topology, and so obviously I came across the definition of topological space $(T, \tau)$:

*

*$\tau \in \mathcal P \mathcal P (T)$

*$\emptyset, T \in \tau$

*$(A_i)_{i \in I} \in \tau \implies \bigcup_{i \in I} A_i \in \tau$

*$A_1, \dots, A_n \in \tau \implies \bigcap_{i=1}^n A_i \in \tau$
This is very abstract, so I tried to find a few examples, and these examples I found caught my eye:

*

*$T = \mathbb R^n$, $\tau = \{ \text{every set whose complement is compact} \}$

*$T = [0,1]$ $\tau = \{ \text{every set whose complement is a finite set}  \}$
Now these satisfy every part of the definition, except that one has to add the empty set to $\tau$ explicitly as well. This gives the natural question: why is this needed?
 A: First of all, in your examples $\emptyset$ is not a set with a compact complement, as $\Bbb R^n$ is not compact, and it does not have a finite complement $[0,1]$ in the second case.. So they should be explicily added to $\tau$ as one of the axioms states it should be in there.
Also, in many cases, like topologies from metric spaces or ordered spaces, there will be many cases where the topology contains disjoint sets and we want open sets to be closed under finite intersections, so for that reason alone we have to add $\emptyset$ to $\tau$ or accept that a topology reduces to a weakened sort of filter on $X$ (another type of families of subsets, also interesting, but not topology; your second example as stated (without the empty set) is indeed a filter BTW and the first a so-called filter-base ). Also formally, in the arbitrary union axiom we could take $I=\emptyset$ and then we're also "forced" to add $\emptyset$ to $\tau$ in order to fulfill it.
In short, we have the empty set in $\tau$ for practical and internal logic/consistency reasons. We consider mostly non-empty open sets in practice (as these are the neighbourhoods used in continuity/convergence etc.), but we do need it in there.
This question has many more reasons in its answers.
A: Technically we could define topology without the empty set. But then everywhere an empty set appears we would have to deal with it in a special way. For example a continuous function $f:X\to Y$ is a function such that preimage of any open set is open. Without the "$\emptyset\in\tau$" assumption we would have to modify this definition: preimage of every open set is open if nonempty. And this special "if nonempty" now has to appear everywhere.
This is an unnecessary noise. Makes proofs and definitions longer, less readable and for no good reason.
Also note that similar reasoning applies to "$T\in\tau$". Since we often deal with closed sets which by definition are complements of open sets. We now have to deal with two special cases: "if nonempty" and "if not entire $T$". Which can be avoided by two simple axioms.
A: Taking a categorical perspective we should ask why are we even defining topological spaces. In a category we are primarily interested in the morphisms and the objects are merely there to serve as domains and codomains. So, the reason we define topological spaces is in order to define continuous functions between them. A function $f\colon X\to Y$ is continuous if it pulls back every open set in $Y$ to an open set in $Y$. Namely once topologies have been chosen, for $f$ to be continuous it must be the case that $f^{-1}(U)$, the inverse image of $U\subseteq Y$, is open in $X$. At first site this may seem like an odd definition but it just justified in many ways, chiefly, at the elementary level, by the desire to mimic the usual $\varepsilon - \delta $ notion of continuity which also goes in reverse. In any case, one certainly wants all constant functions to be continuous. If we did not demand the empty set to always be open, then constant functions would typically fail to be continuous since you can find, typically, plenty of open sets in the codomain whose inver image is empty.
A: There is an important way to view topology in which

an open set is  a property that can be recognized with a finite amount of information.

In the usual topology on $\Bbb R$, membership in the open set $(2,4)$ is such a property. Given any element $x\in(2,4)$, we can recognize this fact by examining only a finite number of digits of $x$.  In contrast. membership in the non-open set $[2,4]$ is not one of these properties, because if we happen to be given  $x=4$, we cannot recognize it.  No matter how many digits of $4.000\ldots$ we examine, we can never be sure that there won't be some nonzero digit later that will prove that $x$ is not in the closed set $[2,4]$.  (A similar problem occurs with $x=2$, if it is presented to us in the form $1.999\ldots$.)
Viewed in this way, the familiar union and intersection properties appear naturally:

*

*Suppose $G_1$ and $G_2$ are open sets.  Given $x\in G_1$, we can recognize this fact using only finite information from $x$, and similarly for $x\in G_2$. Can we also recognize that $x\in G_1\cap G_2$ using only a finite amount of information about $x$?  Clearly we can: just check both properties, using a finite amount of information for each.


*Suppose membership in each member of some family  $G_i$ can be recognized with only a finite amount of information.  Can membership in $\bigcup G_i$ be recognized?  Yes, because if $x\in\bigcup G_i$ then it is in $G_k$ for some particular $k$, this fact can be recognized with finite information, and that amount, plus the information about $k$ itself, suffices for the $x\in\bigcup G_i$ question.


*Suppose membership in each member of some family  $G_i$ can be recognized with only a finite amount of information.  Can membership in $\bigcap G_i$ be recognized?  Not necessarily.  Even if the amount of information required for each individual  $G_i$ is finite, the total amount of information required to place $x$ in all of the $G_i$ might be infinite.
The other example you invoked (the cofinite topology) can also be understood in this way.
Regardless of what the elements of the topology are or what sorts of questions we can answer about them, there are always two trivial properties that are recognizable. There are the property that is always true and the property that is always false.  These properties correspond to the entire space and to the empty  set.
A: You could do it without requiring $\emptyset \in \tau$. But if you do not want to exclude more or less all interesting spaces (like the reals with its standard topology), then the standard intersection axiom $(I)$ must be replaced by
$(I')$ $\phantom{x}$ If $A_1, \dots, A_n \in \tau$, then $\bigcap_{i=1}^n A_i \in \tau$ or $\bigcap_{i=1}^n A_i = \emptyset$.
Anyway, the system $\tau' = \tau \cup \{ \emptyset\}$ is again a topology in your modified sense, and it satisfies the intersection axiom in its original form. This is a much more elegant formulation which eliminates the special status of $\emptyset$ in the intersection axiom. Moreover, as the other answers have shown, the absence of $\emptyset$ as an open set would require to add another unnecessary special case to the definition of a continuous function.
Also note that if we work with $\emptyset \in \tau$, then the union axiom is satisfied also for the empty index set. This is just a very formal reason, but again it allows to avoid to consider an unnecessary special case.
Similarly you could omit the requirement $X \in \tau$. In that case you should replace the standard union axiom $(U)$ by the weaker version
$(U')$ $\phantom{x}$ If $(A_i)_{i \in I} \in \tau$, then $\bigcup_{i \in I} A_i \in \tau$ or $\bigcup_{i \in I} A_i = X$.
Once more there is no benefit in doing so. The system $\tau' = \tau \cup \{ X \}$ is again a topology in the modified sense, and it satisfies the union axiom in its original form without a special treatment of $X$. And the absence of $X$ as an open set would require to add another unnecessary special case to the definition of a continuous function. In fact, $f^{-1}(V) = X$ is possible for a continuous function $f : X \to Y$ and open $V \subsetneqq Y$. Finally, if we work with $X \in \tau$, then the intersection axiom is satisfied also for the empty index set.
Let us call a system $\tau \subset \mathcal P (X)$ a quasi-topology if it satisfies $(I')$ and $(U')$. We do require neither $\emptyset \in \tau$  nor $X\in \tau$. The following facts show that it does not make much difference to work with topologies or with quasi-topologies.

*

*Each topology is a quasi-topology.


*For each topology $\tau$, the "reduced set" $r(\tau)  = \tau \setminus \{ \emptyset, X\}$ is a  quasi-topology contained in $\tau$. Other quasi-topologies contained in $\tau$ are $r_U(\tau) = \tau \setminus \{ \emptyset\}$ (which satisfies $(U)$) and $r_I(\tau) = \tau \setminus \{ X \}$ (which satisfies $(I)$).


*For each quasi-topology $\tau'$, the "extended  set" $e(\tau')  = \tau' \cup \{ \emptyset, X\}$ is a  topology.


*One has $e(r(\tau)) = \tau$ and $r(e(\tau')) \subset \tau'$. It is possible that $r(e(\tau')) \ne \tau'$.
A: The fact that $\emptyset \in \tau$ for any topology $\tau$ does not actually need to be demanded explicitly, it is a consequence of demanding that a topology is closed under arbitrary union. "Arbitrary union" includes taking the union of no open sets whatsoever, and that will be the empty set.
Similarly, if we are careful about the intersection property and demand that the open sets are closed under finite intersection, then we see that $X \in \tau$ follows, because $X$ is the result of taking the intersection of zero subsets of $X$.
A: One of the most useful properties of the closed sets is that they contain all of their limit points since space itself also satisfies this condition it is natural to want the entire space to be closed as well as open, the only this can be true is if the empty set is closed, moreover as pointed out earlier without considering the empty set open it is impossible to have finite intersection property for open sets.
