When is the centralizer of a subgroup equal to the subgroup itself? I am going through a proof of the proposition

Assume $G$ is a group of order $pq$, where $p$ and $q$ are primes with $p\le q$ and $p$ does not divide $q-1$. Then $G$ is abelian.

in Abstract Algbra by Dummit and Foote, and I am stuck at one step. The relevant assumptions are: $Z(G)=1$ (the center of $G$ is the trivial subgroup), $G$ has an element $x$ of order $q$, and $H=\langle x\rangle$. At this point the author concludes that $C_G(H)=H$, ($C_G(H)$ represents the centralizer of $H$ in $G$) but I cannot see why.
I can see $H\subset C_G(H)$. Also $C_G(H)=C_G(x)$. But how to proceed? In particular, I do not know how the condition $Z(G)=1$ is relevant here.
Any help is appreciated. If you believe more information is needed in the context, I can provide it.
 A: Argue using orders:
The centraliser $C_G(H)$ can only have order $1$, $p$, $q$, or $pq$, as it must divide the order of $G$.

*

*As $H\leq C_G(H)$ and $|H|=q$, we have that $C_G(H)$ has order either $q$ or $pq$.

*As $Z(G)=1$, we see that $C_G(H)\lneq G$ (as if $G=C_G(H)$ then the generator $x$ of $H$ would centralise every element of $G$, and so $x\in Z(G)$). So the order cannot be $pq$.

Hence, $|C_H(G)|=q$, and so $C_G(H)=H$.
A: Here are some properties of the centralizer that you won't find easily in a textbook. I admit, it is perhaps somewhat out of bounce given your question, but it provides insight. Especially $(c)$ is a fun property!

Proposition Let $H,K$ subgroups of a group $G$, then the following hold.
$(a)$ If $H \leq K$ then $C_G(K) \leq C_G(H)$.
$(b)$ $H \leq C_G(C_G(H))$.
$(c)$ $C_G(H)=C_G(C_G(C_G(H)))$.
$(d)$ If $H$ is abelian, then $C_G(C_G(H)) \subseteq C_G(H)$.
$(e)$ If $H$ is abelian then $Z(C_G(H))=C_G(C_G(H))$, in particular $C_G(C_G(H))$ is abelian.
Conversely, if $Z(C_G(H))=C_G(C_G(H))$, then $H$ is abelian.

Proof $(a)$ is obvious.
$(b)$ Let $h \in H$, and $x \in C_G(H)$, then $xh=hx$ by definition, hence $h$ centralizes $C_G(H)$.
$(c)$ Replacing $H$ by $C_G(H)$ in (b) we obtain $C_G(C_G(H)) \subseteq C_G(C_G(C_G(H)))$. But applying (a) to (b) yields the reverse inclusion: $C_G(C_G(C_G(H))) \subseteq C_G(C_G(H))$.
$(d)$ If $H$ is abelian, then obviously $H \subseteq C_G(H)$. Hence, by (a) we are done.
$(e)$ Observe that in general $Z(H)=H \cap C_G(H)$. If $H$ happens to be abelian, then, by applying (d) we have $Z(C_G(H))=C_G(H) \cap C_G(C_G(H))=C_G(C_G(H)).$ The converse statement follows from (b).
