If $|G|=pq$ where $p,q$ are primes that are not necessarily distinct, prove the order of $Z(G)=1$ or $pq$. 
Question :
If $|G|=pq$ where $p$ and $q$ are primes that are not necessarily distinct. Prove that the order of $Z (G) =1$ or $pq$.

Showing the order is $pq$ is trivial.
I unsure how to start with showing the order is $1$. Hints are appreciated.
Thanks in advance.
 A: By Lagrange theorem, $|Z(G)|=1,p,q$ or $pq$.
If $|Z(G)|=p$ or $|Z(G)|=q$ the quotient group $G/Z(G)$ has prime order (respectively $q$ or $p$). So $G/Z(G)$ is cyclic, and so $G$ is abelian (proof here). But if $G$ is abelian, then $Z(G)=G$, so $|Z(G)|=pq$. So there is a contradiction.
Finally : 
$|Z(G)| = pq$ or $1$.
A: Use the fact that $Z(G)$, i.e. the center of $G$, is a subgroup of $G$, so by Lagrange Theorem $\big| Z(G) \big|  \bigg|  \big| G \big|$, hence $\big| Z(G) \big|  = \{1,p,q,pq\}$. If $\big|  Z(G) \big|  = p$ or $q$, then the order of $G/Z(G)$ is a prime number, hence the quotent group is cyclic, implying that $G$ is abelian. A contradiction. Therefore $\big| Z(G) \big| = \big| G \big| = pq $ or $1$.
A: Suppose not, and let $x$ be an element in the center, without loss of generality assume it is of order $p$, by cauchy's theorem there is an element $y$ of order $q$. So $x$ and $y$ commute and generate $G$. $G$ is therefore abelian.
Note that this can be generalized as follows:  Let $G$ be a non-abelian group such that for every $x\in G\setminus\{e\}$ there is $y$ with $\langle x,y\rangle=G$, then the center of $G$ is trivial.
