Let $G$ be a group. Suppose $G=H_1 \times H_2.$
Set
$Z(G)=\{ c \in G | \forall a \in G ; ca=ac \}$
$Z(H_1)=\{ c \in H_1 | \forall a \in H_1 ; ca=ac \}$
$Z(H_2)=\{ c \in H_2 | \forall a \in H_2 ; ca=ac \}$
I want to prove $Z(G)=Z(H_1)Z(H_2)$.
First, I have to prove $Z(G)\subset Z(H_1)Z(H_2)$.
Let $a \in Z(G)$.
Since $Z(G) \subset G=H_1 \times H_2$, there exist $h_1 \in H_1, h_2 \in H_2$ s.t. $a=h_1 h_2$.
If I could prove $h_1 \in Z(H_1)$ and $h_2 \in Z(H_2)$, then I can say $a\in Z(H_1)Z(H_2)$.
How can I prove $h_1 \in Z(H_1)$ and $h_2 \in Z(H_2)$?
I have to prove $h_1s=sh_1$ for all $s\in H_1$ and $h_2t=th_2$ for all $t\in H_2$, but I'm stacked. Maybe I have to use $G=H_1 \times H_2.$
You need to be more precise. These are Cartesian products, so that take $a\in Z(G)$ we have $a = (h_1, h_2)$. By definition that for any element $g =(h_1', h_2') \in G$ we have that $(h_1h_1', h_2h_2') = ag = ga = (h_1'h_1, h_2'h_2)$. Since $h_1', h_2'$ arbitrary, we have that $a \in Z(H_1)\times Z(H_2)$.