Could you please explain the step in this theorem and proof that I do not follow:
If $G$ is a finite group, let $C_{G}(x)$ be the centralizer of $x$ in $G$, that is
$C_{G}(x)=\{g \in G: xg=gx\}$
If $x^{G}=\{g^{-1}xg: g \in G\}$ is the conjugacy class of $x$ in $G$.
A theorem says that the size of the conjugacy class $x^{G}$ is given by
$|x^{G}|=|G|/|C_{G}(x)|$
The proof goes like this, but cannot follow a step of it.
For $g,h \in G$ we have
$g^{-1}xg=h^{-1}xh \iff hg^{-1}x=xhg^{-1} \iff hg^{-1} \in C_{G}(x) $
Now (I don't follow this part)
$hg^{-1} \in C_{G}(x) \iff C_{G}(x)g=C_{G}(x)h$
I see that $hg^{-1}g=h$ but $hg^{-1}h\neq h$ and don't get why $C_{G}(x)g=C_{G}(x)h?$
So we can define an injective function $f$ from $x^{G}$ to the set of right cosets of $C_{G}(x)$ in $G$ by
$f:g^{-1}xg \to C_{G}(x)g$ for $(g \in G).$
Because $f$ is also surjective we have
$|x^{G}|=|G|/|C_{G}(x)|$
You need that $C_G(x)$ is a subgroup of $G$. Then, more generally, if $H$ is a subgroup of $G$: $$\forall h,g\in G: hg^{-1}\in H \iff Hhg^{-1}=H \iff Hh=Hg$$