Axioms of a Ring and a Simple Example (that confused me) The professor put an example of a ring on the board today:

Let $G$ be a finite group and define $RG = (a_1g_1+a_2g_2 + ... a_ig_i |a_i \in \mathbb{Z})$.

She then gave an example of multiplaction of "monomials" in this ring:
$2g_i5g_j=10g_k$ where $g_ig_j=g_k$. This example was confusing to me becuase a ring is one set with 2 operations. But here we're using 2 sets ($\mathbb{Z}$ and $G$). So What rules of the ring are allowing me to commute $5$ and $g_i$? 
 A: The elements of $RG$ are linear combinations of elements of $G$ with coefficients in $\mathbb Z$. More compactly, this is called $\mathbb Z$-linear combinations of elements of $G$. The construction as a whole is known as the group ring of $G$. To be clear, usually $R$ is a specific ring, and so the construction you're talking about would typically be called $\mathbb Z[G]$, but it generalizes to an arbitrary ring $R$, which would be called $R[G]$ or $RG$. I'll use $\mathbb Z[G]$ below instead of $RG$ to reflect the fact that we're considering the $R=\mathbb Z$ case, though everything I say below can be immediately generalized to any ring $R$ simply by replacing $\mathbb Z$ with $R$ everywhere.
$5g_i$ is not a combination of an element $5$ of $\mathbb Z[G]$ and an element $g_i$ of $\mathbb Z[G]$, it is merely itself an element. Similarly, $3g_1+2g_7$ is another element. To be pedantic, $5$ and $g_i$ are not elements of $\mathbb Z[G]$, though we could identify them with $5e$ and $1g_i$ where $e$ is the unit of $G$. The multiplication rule on these elements is defined in terms of the original multiplication rule of $G$ as well as rules for manipulating linear combinations in general. Concretely, call the multiplication operation $\cdot$, then the rule is $$\left(\sum_{g\in G} a_g g\right)\cdot\left(\sum_{g\in G} b_g g\right) = \sum_{g\in G}\left(\sum_{g=hk}a_hb_k\right)g$$ where $a_g,b_g\in\mathbb Z$ for each $g\in G$. These sums are formal linear combinations. Indeed, the function $g\mapsto a_g : G \to \mathbb Z$ completely describes the element $\sum_{g\in G} a_g g$, so we could say that the elements of $\mathbb Z[G]$ are these functions. Write $\bar a, \bar b : G\to\mathbb Z$ for two such functions. Then we can describe the multiplication equivalently as $\bar a\cdot\bar b = g\mapsto \sum_{g=hk}\bar a(h)\bar b(k)$. Both of these descriptions are implicitly relying on $G$ being finite, though they can easily be adapted to infinite $G$ with a bit of care.
At any rate, the main thing to get here is that the elements of a ring don't have to be "simple" things, and that we're building a new ring with its own notion of element and multiplication from the original group $G$. The new multiplication is defined in terms of the multiplication on $G$, but is not the same as it. There is no question of "commuting" any elements of $G$.
A: You should be thinking of an element $a_i g_i$ (where $a_i \in \mathbb{Z}$) as the sum of $g_i$ with itself $a_i$ times. So this element is really
$$
2g_i 5g_j = (g_i + g_i)(g_j + g_j + g_j + g_j + g_j)
$$
and using the basic ring axioms, you can see that this expands to $g_{i}g_j$ added to itself $10$ times.
In a more "categorical" sense, and perhaps this won't make sense to you now, but what this says is that for every ring $R$ there is a unique ring morphism $\mathbb{Z} \to R$ which lands in the center of $R$. Namely, I must send $1 \in \mathbb{Z}$ to $1 \in R$, and this uniquely determines the ring morphism. Since this lands in the center of $R$, this tells you why the $5$ and the $g_i$ commute.
