# Commutativity and Associativity in Infinite Direct Sums and Products of R-Modules

I'm working through Mac Lane's Homology, and one of the exercises asks me to show the direct sum of projective R-Modules is again projective.

In the case of finite direct sums, one can run an argument as follows:

Say each $$P_i$$ is projective. Then we have $$Q_i$$ such that $$P_i \oplus Q_i$$ free for each $$i$$. Then

$$\left ( \bigoplus_{i=0}^n P_i \right ) \oplus \left ( \bigoplus_{i=0}^n Q_i \right ) \cong \bigoplus_{i=0}^n (P_i \oplus Q_i)$$ is a direct sum of free modules, therefore free, and the claim follows.

However, for infinite direct sums, I feel like this proof should break because of some subtlety about commutativity and associativity of infinite direct sums which I'm currently unaware of.

I've found a different proof of the claim which avoids this issue, but I'm curious if there is a way to make this argument work.

tl;dr Infinite products/sums are commutative and associative as well. Therefore your proof can be easily generalized.

Long answer: Ok, so infinite products/direct sums are more problematic then finite as you will see soon. First of all: what is an infinite product? The definition goes as follows:

Definition. For a given collection $$\{A_i\}_{i\in I}$$ of sets the (generalized) product is the set $$\prod_{i\in I}A_i=\bigg\{f:I\to\bigsqcup_{i\in I}A_i\ \bigg|\ \forall_{i\in I}\ f(i)\in A_i\bigg\}$$ so it is the set of all choice functions.

If each $$A_i$$ is a module then this generalized product has a structure of a module as well via pointwise addition and ring action. Under the Axiom of Choice of course (which guarantees that $$\prod A_i$$ is nonempty). Then the direct sum $$\bigoplus_{i\in I}A_i$$ is a special subset of $$\prod A_i$$ consisting of all choice functions which are constant $$0$$ almost everywhere.

This is important because only by looking at the definition you can have your first "oh" moment: the definition does not depend on any particular order. In other words $$A\times B$$ is literally equal to $$B\times A$$ under this definition. And the ordering of such product boils down to ordering of the underlying set of indices, which is not mandatory. It is then a theorem that the classical Cartesian product is isomorphic to this generalized product in the case of finitely many components. Which also shows that the order in the classical Cartesian product is indeed irrelevant in this particular case. This solves your "commutativity" issue.

The other thing you need in this setup is the following variant of the associativity:

Lemma 1. Let $$\{A_i\}_{i\in I}$$ be a collection of modules. Assume that $$I=J\cup K$$ is a partitioning, i.e. $$J\cap K=\emptyset$$ and both are nonempty. Then $$\prod_{i\in I}A_i\simeq\bigg(\prod_{j\in J}A_j\bigg)\times\bigg(\prod_{k\in K}A_k\bigg)$$

Proof. I will use the classical "pair" definition for the outer Cartesian product "$$\times$$" (just because nesting choice functions is a pain in the ***). With that define $$\Psi:\prod_{i\in I}A_i\to\bigg(\prod_{j\in J}A_j\bigg)\times\bigg(\prod_{k\in K}A_k\bigg)$$ $$\Psi(f)=\left(f_{|J},\ f_{|K}\right)$$ where $$f_{|J}$$ denotes the classical function restriction. I leave as an exercise that $$\Psi$$ is an isomorphism. $$\Box$$

And the last component is:

Lemma 2. If $$I=J\cup K$$ is a partitioning and $$f:J\to K$$ is a bijection then $$\prod_{i\in I} A_i\simeq \prod_{j\in J}\big( A_j\times A_{f(j)} \big)$$

which you prove similarly.

Finally I leave as an exercise that both lemmas hold for the direct sum as well. All those facts together give you your generalized version of the direct sum of projective modules.

Note that you need to use "direct sums" instead of "products" because in general the (infinite) product of free modules need not be free, even over such nice rings like $$\mathbb{Z}$$. While the direct sum of free modules is always free.