About an order of a p-group I'm trying to show that if G is a Group, then $|G| = p^2 \Rightarrow G$ is abelian.
The path I'm taking relies on supposing that $|Z(G)| = p$ and forming the quotient group $\overline{G} = G/Z(G)$. 
Then we got $\overline{G}$ as a cyclic group, because it has order p. $\overline{G}=<a.Z(G)>, \ a \in G$.
By that way, on the texts I saw, it's said that I can assume every element in $G$ is in the form of $(a^n)b$, $a \in G$ and $b \in Z(G)$. Why can I assume this?
Thank you
 A: Now for something totally different (using representation theory over $\mathbb{C}$, if you know it)...Let $G$ be a group of order $p^2$. Let $Irr(G)$ be its set of complex irreducible characters. Note that the principal character $1_G \in Irr(G)$. Since $|G|=p^2=\sum_{\chi \in Irr(G)}\chi(1)^2=1 + \sum_{\chi \in Irr(G)-\{1_G\}}\chi(1)^2$, and for all $\chi \in Irr(G)$: $\chi(1) \mid p^2$, it follows that all $\chi$ must be linear, which is equivalent to $G$ being abelian.
A: Since this group is cyclic, there’s an $[a] \in \bar G$ s.t. for every $[x] \in \bar G$ there’s an $n \in \mathbb N$ with $[x] = [a]^n = [a^n]$. But by the definition of quotient group, this is true iff $\exists b \in Z(G)\colon\ x = a^n b$, as desired. As a consequence, if $x = a^n b$ and $y = a^m b'$, using that $b$ commutes with every element of $G$ and $a^n a^m = a^{n+m} = a^m a^n$,
$$\begin{align}
xy &= (a^nb)(a^mb')\\ &= a^n(ba^m)b' \\&= a^n(a^mb)b' \\&= (a^na^m)bb' \\&= (a^ma^n)bb' \\&= a^m(a^nb)b' \\&= a^mb'(a^nb) \\&=(a^mb')(a^nb) \\&= yx. \\\\\
\end{align}$$
$\implies |Z(G)| = |G| \neq p,\  \Rightarrow\!\Leftarrow.$ Since the cetner is not trivial (follows from the Class equation) and $|Z(G)| \in \{1,p,p^2\}$ from Lagrange's theorem, we have that $|Z(G)| = p^2$;
$$\therefore G = Z(G).$$
A: Let us start with a group $G$ with $p^2$ elements.


*

*If the center $Z(G)$ has $p^2$ elements, then $Z(G)=G$, so $G$ abelian.

*If the center $Z(G)$ has $1$ element, then there exist two elements in $G$ that do not commute. Let us denote them by $a,b$. Of course $a,b\ne 1$. Their orders divide $p^2$, and are $\ne 1,p^1$, so both have orders $p$. Then we can list the following different elements of the group: $a^jb^k$, for $0\le j,k< p$. (An equality of the shape $a^jb^k=a^Jb^K$ with $(j,k)\ne (J,K)$ would imply an equality of the shape $a^n = b^N$ with $0\le n,N<p$ and with different values for $n,N$. Take the value among $n,N$ which is not zero, by renotation $n\ne 0$, and since $n$ is prime to $p$, by taking its inverse $m$ modulo $p$ we get $a=a^{mn}=b^{mN}$, contradiction to the fact that $a,b$ do not commute.

*If the center $Z(G)$ has $p$ elements, then we make a choice of a generator $b$ of $Z(G)$, a normal subgroup of $G$, $b$ has order $p$, $b^p=1$, and of a generator $\bar a$ of $G/Z(G)$, and let $a$ be a lift of it to $G$. Since $\bar b$ has order $p$ we have $\bar a^p=\bar 1$, so $a^p=b^k$ for a suitable $k$, $0\le k< p$. By definition of the quotient classes, because of $G/Z(G)=\{\ a^n\ :\ 0\le n< p\ \}$, we obtain parallely 
$$
G=\bigsqcup_n a^n Z(G)\ , 
$$
which answers the question in the last sentence in the OP.
So each element $g$ of $G$ can be uniquely written as
$$
g=a^nb^t\ ,
$$
with powers $n,t$ between $0$ and $(p-1)$. It is easily seen that two such elements commute, since $b$ and its powers commute with $a$ and its powers, so we can always arrange to move the $b$ powers to the right. So $Z(G)$ has more elements, contradiction. 


So $G$ is abelian.
A: It's well known that the center of a $p$-group is nontrivial.  This can be seen by looking at the class equation.
The rest goes through without a hitch.
A: Proposition. Let $G$ be a group of order $p^n$, with $p$ prime and $n \ge 1$. Then $Z(G) \ne \{e\}$.
Proof. By contrapositive, suppose $Z(G)=\{e\}$; so, all the centralizers are proper subgroups of $G$ and have then order of the form $p^\alpha$ with $\alpha < n$. Therefore, the Class Equation reads:
$$p^n=1+\sum_i p^{\beta_i}$$
where $\beta_i \ge 1, \forall i$. But then, $p \mid p^n-\sum_i p^{\beta_i}=1$: contradiction.  $\quad \Box$
Corollary. Let $G$ be a group of order $p^2$, with $p$ prime. Then $G$ is abelian.
Proof. By contrapositive, suppose $G$ non abelian; then, $\exists \tilde a \in C_G(\tilde a) \setminus Z(G)$, so that $Z(G) \lneq C_G(\tilde a) \le G$. By the Proposition, $|Z(G)|=p$ and $|C_G(\tilde a)|=p^2$, whence $C_G(\tilde a)=G$ and $\tilde a \in Z(G)$: contradiction. $\quad \Box$
