The center of a direct product of groups and Abelian groups Claim. The center of $(G_1\times G_2,\star)$ is $Z(G_1)\times Z(G_2)$, where $Z(G_i)$ is the center of $G_i$, for $i=1,2$.
I'm trying to figure out a proof for this and got myself a little bit confused. My thought process was to show that if the two groups $G_1$ and $G_2$ are Abelian groups that the direct product of these two Abelian groups is also Abelian, then the claim would follow by the result of them being Abelian. 
If that is the correct way to approach this proof, what does this then say about the center of the direct product if they happened to not be Abelian groups? Is that possible? Does it mean there only exists a center if it's Abelian?
Sorry if my question is kind of stupid. Just trying to understand the problem and how to proceed.
 A: The center of a group $G$ is the set $Z(G)=\{g\mid gh=hg\;\forall h\in G\}$. 
In your case $Z(G\times H)=\{(g,h)\mid (g,h)(g',h')=(g',h')(g,h)\;\forall (g',h')\in G\times H\}$.
We can prove $Z(G)\times Z(H)=Z(G\times H)$ looking at the inclusions:
$\subset)$ We must prove that $(g,h), g\in G, h \in H$ commutes with every other element in $G\times H$ if $g\in Z(G), h\in Z(H)$. Let $(g',h')\in G\times H$. As $g\in Z(G)$ and $h\in Z(H)$ we have $gg'=g'g$ and $hh'=h'h$ so $(g,h)(g',h')=(gg',hh')=(g'g,h'h)=(g',h')(g,h)$. Therefore $(g,h)\in Z(G\times H)$.
$\supset)$ Let $(g,h)\in Z(G\times H)$, then $(g,h)(g',h')=(g',h')(g,h)$ for all $(g',h')\in G\times H$ by definition of the center. But then, $gg'=g'g$ and $hh'=h'h$ for all $g'\in G, h'\in H$. Therefore $g\in Z(G)$ and $h\in Z(H)$.
In summary, $Z(G\times H)=Z(G)\times Z(H)$ because of the definition of the product in the group $G\times H$.
As a corollary of this, you have that $G$ and $H$ are abelian if and only if $G\times H$ is abelian.
