Connected topological spaces, product is connected

Show that if $(X_i)_{i \in \mathcal I}$ where $X_i$ is a topological space for every $i \in \mathcal I$, then $X_i$ is connected for every $i$ if and only if $\prod_{i \in \mathcal I} X_i$ is connected.

I could do one implication: If I define the projection map $\Pi_i:\prod_{i \in \mathcal I} X_i \to X_i$, then since $\Pi_i$ is continuous, it follows $X_i$ is connected for every $i \in \mathcal I$.

I need help to prove that if each $X_i$ is connected, then $\prod_{i \in \mathcal I} X_i$ is connected. Thanks in advance.


First prove that any finite product of connected spaces is connected. This can be done by induction on the number of spaces, and for two connected spaces $X$ and $Y$ we see that $X \times Y$ is connected, by observing that $X \times Y = (\cup_{x \in X} (\{x\} \times Y)) \cup X \times \{y_0\}$, where $y_0 \in Y$ is some fixed point. This is connected because every set $\{x\} \times Y$ is homeomorphic to $Y$ (hence connected) and each of them intersects $X \times \{y_0\}$ (in $(x,y_0)$), which is also connected, as it is homeomorphic to $X$. So the union is connected by standard theorems on unions of connected sets. Now finish the induction. So for every finite set $I$, $\prod_{i \in I} X_i$ is connected.

Now if $I$ is infinite, fix points $p_i \in X_i$ for each $i$, and define $$Y = \{ (x_i) \in \prod_i X_i: \{i \in I: x_i \neq p_i \} \text{ is finite }\}$$

Now for each fixed finite subset $F \subset I$, define $Y_F = \{ (x_i) \in \prod_i X_i: \forall i \notin F: x_i = p_i \}$. By the obvious homeomorphism, $Y_F$ is homeomorphic to $\prod_{i \in F} X_i$, which is connected by the first paragraph. So all $Y_F$ are connected, all contain the point $(p_i)_{i \in I}$ of $\prod_{i \in I} X_i$, and their union (over all finite subsets $F$ of $I$) equals $Y$. So again by standard theorems on the union of connected subsets of a space, $Y$ is a connected subspace of $\prod_{i \in I} X_i$.

Finally note that $Y$ is dense in $\prod_{i \in I} X_i$, because every basic open subset $O$ of the product depends on a finite subset of $I$, in the sense that $O = \prod_{i \in I} U_i$ where all $U_i \subset X_i$ are non-empty open and there is some finite subset $F \subset I$ such that $U_i = X_i$ for all $i \notin F$. Pick $q_i \in U_i$ for $i \in F$ and set $q_i = p_i $ for $i \notin F$. The $(q_i)_{i \in I}$ is in $O \cap Y_F \subset O \cap Y$, so every (basic) open subset of $\prod_{i \in I} X_i$ intersects $Y$.

Now use that the closure of a connected set is connected to conclude that $\prod_{i \in I} X_i$ is connected, also for infinite $I$.


Hint: Suppose that $F: \prod X_i \to \{0,1\}$ is continuous. For some choice of $x_j \in X_j$ for all $j \neq i$, we can define a continuous function from $X_i \to \{0,1\}$ by $$ f(y) = F\left(\prod_{j \in I} y_j\right) $$ Where $y_j = x_j$ when $j \neq i$ and $y_i = y$.

Now, if $X_i$ is connected, then $F$ must be constant on every set of the form $f(X_i)$ with $f,F$ as described above.