Direct sums and direct products This question has been in my head for a while. And today it appears again when I am reading Arveson's book on $C^*$-algebras. He says 

Countable direct products of Polish spaces are Polish. Countable direct sums of Polish spaces are Polish.

But

What is the difference between a direct sum and a direct product?

It seems to me that these two are the same but Wiki says there are some cases where they are different (without pointing out these cases).
So can somebody clarify the difference between the two and maybe give some examples? Thanks!
 A: Consider the category of groups for simplicity. Let $\left\{G_i\right\}_{i \in I}$ be a collection of groups. Then their direct product is a group that as a set is the 
set-theoretic product $G=\prod_{i \in I} G_i$ and the group operation is given element-wise using the group operation of the $i^{th}$ group. Each element of the direct product is a family of elements $(x_i)_{i \in I}$, where $x_i \in G_i$. The direct sum of the family $\left\{G_i\right\}_{i \in I}$ is defined as the subgroup of $G=\prod_{i \in I} G_i$ that consists of all elements $(x_i)_{i \in I}$ with the property that $x_i \neq 0$ for finitely-many $i \in I$. The two notions are distinct when the index set $I$ is infinite (under the assumption that only finitely many $G_i$ are zero) but coincide when $I$ is finite, i.e. the direct product of a finite number of groups is isomorphic to their direct sum.
A: They are different in most cases.  There are a few kinds of algebraic structures for which they may be the same—most importantly, Abelian groups, and derived structures such as modules—but these are the exception not the rule.  (Even with these, it is only finite direct sums/products that are the same; for an infinite family of Abelian groups, the direct sum and direct product may differ.)
So, what do they look like in some of the cases where they differ?  Just looking at the binary case:
For sets $X$ and $Y$, the direct product is indeed the cartesian product $X \times Y$; the direct sum is the disjoint union $X + Y$ (which may be constructed as $X \times \{0\} \cup Y \times \{1\}$, if you like to be concrete about that sort of thing).
For topological spaces $X$ and $Y$, it’s similar.  The direct product is again the cartesian product $X \times Y$, i.e. the product of the underlying sets, with the product topology; and the direct sum is again just the disjoint union $X + Y$, with the topology where a set $U \subseteq X + Y$ is open exactly if its intersections with (the images of) $X$ and $Y$ in $X + Y$ are both open.
Generally, a direct product of structures is almost always based on taking the direct product of the underlying sets.  Direct sums are more variable: for relational and similar structures (eg topological spaces, posets, measure spaces) they are usually based on a disjoint union; but for algebraic structures, they can vary a lot, and in particular are often more like the direct product.

The deeper story going on here is the category-theoretic definitions of product and coproduct.
The idea of these is: a product $X \times Y$ of two objects is characterised by the property that maps $f : A \to X \times Y$ into it from any other similar object (where “maps” means functions if we’re talking about sets; continuous functions, if we’re talking about topological spaces; homomorphisms, if we’re talking about groups; and so on) correspond bijectively (and naturally) to pairs of maps $f_1 : A \to X$, $f_2 : A \to Y$ into the original objects.
“Direct product” means in all cases (as far as I know) the categorical product.  Exercise (slightly boring): check that the direct products of sets, spaces, and Abelian groups all satisfy the property described above.
A coproduct, usually written $X + Y$, is characterised by the same property, except for maps out of it.  For any other object $Z$, maps $f : X + Y \to Z$ correspond naturally to pairs of maps $f_1 : X \to Z$, $f_2 : Y \to Z$.
The “direct sum” of structures means, for most types of structures, their coproduct.  Exercise (a bit more interesting): check that the direct sums of sets, topological spaces, and Abelian groups all satisfy the defining property of coproducts.
Confusingly, there are a few kinds of structures—notably, rings and (non-Abelian) groups—for which the direct sum is defined as something different from the coproduct, essentially for historical reasons.  So, unlike direct product, direct sum isn’t a single general concept that all the examples we’ve discussed are instances of; it’s something that’s defined specifically for a bunch of different types of structures; but coproduct is a unifying concept that in most cases captures the direct sum.
