Prove that any group $G$ of order $p^2$ is abelian, where $p$ is a prime number 
Possible Duplicate:
Showing non-cyclic group with $p^2$ elements is Abelian 

"Let $p$ be a prime number. Prove that any group $G$ of order $p^2$ is abelian. You may assume the fact that the centre of a $p$-group is non-trivial".
I understand from the question is that the group $G$ is a $p$-group, with $p^2$ number of elements in it (meaning it is finite). Also, the centre, i.e the set of elements where $g_1g_2 = g_2g_1$ for all $g_1, g_2 \in G$, is non-trivial, meaning $\neq e$.
So, the non-trivial bit shows that the center, $Z$, either generates the group, so it's cyclic and therefore abelian by definition. Or, it generates a subgroup of order p, and so $Z$ with some elements missing from group $G$ generate G, but as these groups commute (because they have a centre of $Z$), we can say the group is abelian.
Is this correct? 

This is similar to the answer above, but perhaps more complete. By the class equation, we know that the center (the commutative part) can't be trivial since the identity element is in it, and the order of it must be divisible by $p$. Now, as above, $G/Z(G)$ is cyclic, then this is $G/Z=\langle aZ\rangle$. That tells us $x=a^iz_1$ and $y=a^nz_2$ for any $x,y\in G$. Then $$xy=a^iz_1a^nz_2=a^nz_2a^iz_1=yx$$ since elements in the same cyclic group commute and elements in $Z(G)$ commute. Thus we have that the group is commutative.
