The definition is given here: Show the direct sum is a proper subset of the direct product.
1) I did not understand why For a finite number of factors, the direct sum and direct product of abelian groups (and more generally, of R-modules) are equal? could anyone explain this for me please?
2) But I do not understand why the domain of the function $f$ is $I$ and why its codomain is $\cup A_{i}$ in both definitions? could anyone explain this for me please?
Thanks!!
In both the direct product and the direct sum, think of $f$ as a "sequence". The input values $i \in I$ are the "indices" of the sequence $f$. The $i$th entry of this sequence is $f(i)$ and it is required to be in the group $A_i$. Thus, $f(1) \in A_1$, $f(2) \in A_2$, and so on.
For example consider $I = \{1,2\}$. The two groups $A_1$ and $A_2$ are allowed to be entirely different groups: the first coordinate is an element of the group $A_1$; and the second coordinate is an element of the group $A_2$. An element of $A_1 \times A_2$ or of $A_1 \oplus A_2$ can be thought of as a sequence of length $2$, also known as an ordered pair, whose first coordinate is in $A_1$ and whose second coordinate is in $A_2$. Formally, we might prefer to write the element $f : \{1,2\} \to A_1 \cup A_2$ as an ordered pair $(f(1),f(2))$. Furthermore, we might prefer to write our ordered pairs in the form $(x_1,x_2)$. But this is a mere notational difference: write $f$ instead of $x$; and write the index between parentheses instead of as a subscript.
The difference between the direct product and the direct sum is that, for various reasons, one might want to put further restrictions on the coordinates of $f$. In the direct product $\prod_{i \in I} A_i$, there are no further restrictions on the coordinates of $f$.
But in the direct sum $\oplus_{i \in I} A_i$, there is a further restriction on $f$: all but finitely many coordinates must be the zero element. In other words $f$ must satisfy the following property: there exists a finite subset $J \subset I$ such that if $i \in I-J$ then $f(i)$ is the zero element of $A_i$.
If $I$ were a finite set then the direct sum definition and the direct product definition would result in the exact same set of functions.
However, in the case of an infinite index set such as $I = \mathbb{Z}_+$, we can easily write down an element $f$ which is in the direct product but not in the direct sum: simply assign $f(1)$ to be a nonzero element of $A_1$, and assign $f(2)$ to be a nonzero element of $A_2$, and generally for any index $i \in I$ assign $f(i)$ to be a nonzero element of $A_i$.