Proof
We prove that the centralizer of a set X is a subgroup. The other cases are left to the reader.
X.
Hence
and we find that gh also centralizes X.
and we conclude that g-1 also centralizes X.
Hence the centralizer of X is a subgroup of G.