Let $H_1 \leq G_1$ and $H_2 \leq G_2$. Show that in $G_1 \times G_2$, $C(H_1 \times H_2) = C(H_1) \times C(H_2)$
What I have done:
Here, $C(X)$ denotes the centralizer of $X$.
We have that $C(H_1 \times H_2)=\{(g_1,g_2)\in G_1 \times G_2 : (g_1,g_2)(h_1,h_2)=(h_1,h_2)(g_1,g_2), (h_1,h_2)\in (H_1\times H_2)\}$ and $C(H_1) \times C(H_2)=\{(g_1,g_2)\in G_1 \times G_2:g_1h_1=h_1g_1, g_2h_2=h_2g_2 , h_i\in H_i \}$, Which are the same set.Is this enough for my proof or do I need something else? Is this the way?