If $G/Z(G)$ is cyclic, then $G$ is abelian Continuing my work through Dummit & Foote's "Abstract Algebra", 3.1.36 asks the following (which is exactly the same as exercise 5 in this related MSE answer):

Prove that if $G/Z(G)$ is cyclic, then $G$ is abelian. [If $G/Z(G)$ is cyclic with generator $xZ(G)$, show that every element of $G$ can be written in the form $x^az$ for some $a \in \mathbb{Z}$ and some element $z \in Z(G)$]
  

The hint is actually the hardest part for me, as the quotient groups are somewhat abstract. But once I have the hint, I can write:

$g, h \in G$ implies that $g = x^{a_1}z_1$ and $h = x^{a_2}z_2$, so
\begin{align*}gh &= (x^{a_1}z_1)(x^{a_2}z_2)\\\
 &= x^{a_1}x^{a_2}z_1z_2\\\
& = x^{a_1 + a_2}z_2z_1\\\
&= \ldots = (x^{a_2}z_2)(x^{a_1}z_1) = hg.
\end{align*}
Therefore, $G$ is abelian. 
1) Is this right so far? 
2) How can I prove the "hint"?
 A: We have that $G/Z(G)$ is cyclic, and so there is an element $x\in G$ such that $G/Z(G)=\langle xZ(G)\rangle$, where $xZ(G)$ is the coset with representative $x$. Now let $g\in G$.
We know that $gZ(G)=(xZ(G))^m$ for some $m$, and by definition $(xZ(G))^m=x^mZ(G)$.
Now, in general, if $H\leq G$, we have by definition too that $aH=bH$ if and only if $b^{-1}a\in H$.
In our case, we have that $gZ(G)=x^mZ(G)$, and this happens if and only if $(x^m)^{-1}g\in Z(G)$.
Then, there's a $z\in Z(G)$ such that $(x^{m})^{-1}g=z$, and so $g=x^mz$.
The hint is then proved, and the rest is identical to the work you did.
A: The following is another way to show the hint:
We know that the left cosets of $Z(G)$ partition the group $G$. So for all $g\in G$ there exists $n\in N, \ z\in Z(G)$ such that $x^nz=g$, where $xZ(G)$ generates $G/Z(G)$. 
A: Here is another proof of the following statement:
Let $G$ be a group, $N\leq G$ a subgroup of $G$.  If $N\leq Z(G)$ and $G/N$ is cyclic then $G=Z(G)$.

Let $gN$ be a generator of $G/N$.  Since $N\leq Z(G)$ clearly $N\subseteq C_{G}(g)$.  By definition, $g\in C_{G}(g)$ as well.  Hence $C_{G}(g)/N = G/N$.  From the correspondance theorem it follows that $C_{G}(g) = G$, and hence $g\in Z(G)$.  So again $Z(G)/N = G/N$ and therefore by the correspondance theorem again $Z(G) = G$.
