For a nontrivial finite p-group of order with , partition into conjugacy classes. A noncentral class has size , a positive power of larger than one by Lagrange's theorem. The class equation therefore says
The center of a group contains the identity, so , proving its nontriviality. The positive-exponent qualification matters: the one-element group has no nonidentity central element.
If , its center of a group has order or . In the first case, the quotient group has prime order and is cyclic. Whenever a central quotient group is cyclic, writing all elements as with central shows that they commute: . Thus that case would already make Abelian and its center of a group all of , a contradiction. Hence every group of order is Abelian.
If there is an element of order , it is a generator of a group for , giving . Otherwise every nonidentity element has order . Pick and . Their cyclic subgroups have trivial intersection, and they commute; the distinct products exhaust . Hence the classification of groups of order p squared is
Both groups exist and are nonisomorphic, since only the first has an element of order .