# If $p$ is prime and $|G|<\infty$ such that every element has order a power of $p$ then $G$ is a $p$-group?

can anyone help me with following exercise from Rotmann's Advanced Modern Algebra book:

Exercise: Prove that if $p$ is prime and $G$ is a finite group such that every element has order a power of $p$ then $G$ is a $p$-group.

Hint: Use Cauchy's theorem.

Recall a finite group $G$ is a $p$-group if its order $|G|=p^n$ for some $p$ prime and some integer $n\geq 0$.

Thanks

Atempt: I've just written a sketch.

Suppose $|G|=p_1^{\alpha_1}\cdots p_n^{\alpha_n}$ where $p_1, \ldots, p_s$ are distinct primes and $\alpha_j\in\mathbb Z^+$. We know (by Lagrange and hypothesis) $$pp^{n-1}=p^n\mid |G|,$$ so that $$p\mid p_1^{\alpha_1}\cdots p_s^{\alpha_s}.$$ In particular $p\mid p_i^{\alpha_i}$ for (at least) one $i\in\{1, \ldots, s\}$. For simplifying suppose $i=1$. Then $p\mid p_1$ hence $p=p_1$ for both $p$ and $p_1$ are primes. Therefore, $$|G|=p^{\alpha_1}p_2^{\alpha_2}\cdots p_n^{\alpha_n}.$$ The terms $p_2^{\alpha_2}, \ldots, p_n^{\alpha_n}$ can't occur above otherwise by Cauchy's theorem $p_j\mid |G|$ for all $j=2, \ldots, s$ so that we could find $a_j\in G$ such that $o(a_j)=p_j\neq p$, a contradiction. Therefore, $|G|=p^{\alpha_1}$ and $G$ is a $p$-group.

Obs: I didn't like my last argument but I don't know how to write better for now.

Hint: Suppose $G$ is not a $p$-group - say $q \mid |G|$ for some prime $q \ne p$. What happens when you apply Cauchy's theorem to $q$?