Isomorphisms for Infinite Direct Products of Groups Here is a question from Section 2.13 of Herstein's "Topics in Algebra" (2nd edition):

If $G_{1}$, $G_{2}$, $G_{3}$ are groups, prove that $(G_{1} \times G_{2}) \times G_{3}$ is isomorphic to $G_{1} \times G_{2} \times G_{3}$. Care to generalize?

The first part of the problem is simple for me; I'm interested in the generalization. For a finite direct product, we can prove that $\prod_{i = 1}^{n} G_{i}$ is isomorphic to the direct product $G_{1} \times \cdots \times  G_{n}$ (with parentheses placed arbitrarily. Suggestions are welcome for formalizing the notation) by induction. But what about the case of $\prod_{i \in I} G_{i}$, where $I$ is an infinite index set, and $G_{i_{1}} \times \cdots$ (also indexed by $I$, and with a (possibly) infinite number of arbitrarily placed parentheses)? Is there still an isomorphism between these two infinite direct products, and, if so, how does one show this? (If this requires some advanced mathematics, an outline to give me a general understanding of the proof will be enough)
I have looked at several, possibly related, questions: Commutativity and Associativity in Infinite Direct Sums and Products of R-Modules, (Direct) Product is Associative, and Is there such a thing as direct product of an infinite number of groups?. The first two questions/answers I don't understand, as I don't know anything about modules or category theory, and I'm not sure if the final question can be applied to this problem.
 A: Lets start with multiple ways of defining the Cartesian product:

*

*$G_1\times G_2$ is defined as the set of all pairs $(g_1,g_2)$, where $g_i\in G_i$. Then $G_1\times\cdots\times G_n$ is defined recursively as $G_1\times(G_2\times\cdots\times G_n)$.

*$G_1\times\cdots\times G_n$ is defined as the set of all $n$-tuples $(g_1,\ldots,g_n)$ where $g_i\in G_i$. The term "$n$-tuple" itself can be defined in multiple ways.

Both constructions are naturally isomorphic (which can be shown by induction). Furthermore, just like you said, it can be shown that
$$(G_1\times G_2)\times G_3\simeq G_1\times (G_2\times G_3)$$
which by induction extends to any number of elements and any bracketing. This property is known as associativity.
Now in order to talk about an infinite variant, we first need an infinite version of Cartesian product. Neither the definition 1. nor 2. extends easily to infinite number of elements. Although it can be done via for example transfinite induction. But I propose a different (but still standard) approach here:


*Let $\{X_i\}_{i\in I}$ be a collection of sets. Then we define the Cartesian product of that collection as: $$\prod_{i\in I}X_i:=\bigg\{f:I\to\bigcup_{i\in I}X_i\ \bigg|\ f(i)\in X_i\bigg\}$$ a.k.a. the set of all choice functions over $\{X_i\}_{i\in I}$. If each $X_i$ is additionally a group, then $\prod_{i\in I}X_i$ is a group as well via pointwise operation: if $f,g$ are choice functions then $fg$ is a choice function given by $fg(i):=f(i)g(i)$ which makes sense since $f(i),g(i)\in X_i$. In that situation we call $\prod_{i\in I}X_i$ the direct product.

If $I$ is a finite set then this definition can be shown to be equivalent to the previous two. Indeed, an $n$-tuple $(x_1,\ldots,x_n)\in X_1\times\cdots\times X_n$ is nothing else than a choice function $x:\{1,\ldots,n\}\to X_1\cup\cdots\cup X_n$.

With this setup lets finally talk about associativity. How would we model an infinite number of brackets? Well, one approach is to see bracketing as nothing else than partitioning of the entire collection into smaller subcollections. With that intuition consider this:
Let $\{X_i\}_{i\in I}$ be a collection of sets (groups). Consider $\mathcal{P}$ to be any partitioning of $I$, i.e. elements of $\mathcal{P}$ are pairwise disjoint subsets of $I$ and $I=\bigcup\mathcal{P}$. Then
$$\prod_{i\in I}X_i\simeq \prod_{P\in\mathcal{P}}\bigg(\prod_{i\in P}X_i\bigg)$$
That is how associativity is expressed at this level. And how do we prove that? Consider
$$F:\prod_{i\in I}X_i\to\prod_{P\in\mathcal{P}}\bigg(\prod_{i\in P}X_i\bigg)$$
So given a choice function $g\in \prod_{i\in I}X_i$ we need to produce a choice function $F(g)\in\prod_{P\in\mathcal{P}}\bigg(\prod_{i\in P}X_i\bigg)$. Thus for any $P\in\mathcal{P}$ we need to define a choice function $F(g)(P)\in \prod_{i\in P}X_i$. And this has a simple definition $F(g)(P)(i):=g(i)$. You can easily check that such function preserves the group structures.
What about the inverse? Well, if $i\in I$, then $i$ belongs to exactly one $P_i\in\mathcal{P}$. Therefore the inverse is given by
$$G:\prod_{P\in\mathcal{P}}\bigg(\prod_{i\in P}X_i\bigg)\to \prod_{i\in I}X_i$$
$$G(f)(i):=f(P_i)(i)$$
A bit abstract, but that's how fomally things look.
Warning: Note that we cannot express an infinite "nesting" of brackets with this approach. We can deal with finite nesting by simply applying our associativity rule finitely many times. However the infinite nesting is a weird concept, how would we define it formally? I'm not sure. Also note that for example the fundamental set theory (Zermelo–Fraenkel) does not allow infinite nesting of sets (see: the Axiom of Regularity). And so in my humble opinion it is not a good idea to go down that road.
Side note: It is worth mentioning that when each $X_i$ is a group then we often deal with $\bigoplus_{i\in I}X_i$ which is defined as $$\{f\in\prod_{i\in I}X_i \ |\ f(i)=e_i\text{ for all but finitely many }i\}$$ where $e_i$ is the neutral element of $X_i$. This is known as the direct sum and it is a proper subset of $\prod_{i\in I}X_i$ when $I$ is infinite (they coincide otherwise). Well, ok, to be 100% correct: that statement actually requires the Axiom of Choice. Anyway you will often see the direct sum in algebra instead of direct product because it has many good properties unlike the direct product. For example the direct sum of free abelian groups is always free abelian, while the direct product of free abelian groups is never free abelian (unless the product is finite), see here. It is also associative similarly to the direct product.
