Group of Order $p^2$ Isomorphic to $\mathbb{Z}_{p^2}$ or $\mathbb{Z}_{p}$ $\times$ $\mathbb{Z}_{p}$ I'm a bit lost on this problem: 

Show that a group of order $p^2$ is isomorphic to $\mathbb{Z}_{p^2}$ or $\mathbb{Z}_{p}$ $\times$ $\mathbb{Z}_{p}$. 

The only thing I can think of that may relate to this problem is Lagrange's Theorem, where the order of a subgroup divides the order of a group. But I'm not sure if I can even use that for this problem... Any help would be tremendously helpful. Thank you!
 A: Using Lagrange's Theorem is a great idea. Note that it also tells you about the order of an element of $G$, since the element generates its own subgroup of $G$. It tells you that all orders of elements in $G$ must be one of the positive integer factors of $p^2$ (which you know, since $p$ is prime).
Hint 1: What if $G$ contains an element of order $p^2$?
Hint 2: If $G$ does not contain an element of order $p^2$, what is the order of the non-identity elements of $G$?
Hint 3: Take an element $x \in G$ where $x \neq e$. Then take $y \in G \setminus \langle x \rangle$. Can you draw any conclusions about $\langle x \rangle \times \langle y \rangle$?
A: Consider the set $Z(G) = \{a \in G: \forall h \in G, gh = hg\}$. $Z(G)$ is a subgroup of $G$, and contains more then one element due to the conjugacy class equation (https://en.wikipedia.org/wiki/Conjugacy_class#Conjugacy_class_equation). Consider an element $a \in Z(G)$, $a \neq e$. By Lagrange's Theorem, $o(a)$ is either $p$ or $p^2$ ($o(a)$ is the order of $a$). If $o(a) = p^2$, then clearly $a$ generates $G$, so $G$ is cyclic and hence isomorphic to $\mathbb{Z}_{p^2}$. Now suppose $o(a) = p$. Let $H = \left<a\right>$, and consider some element $b \in G \backslash H$. If $b$ generates $G$ we are done as above, otherwise $o(b) = p$, and $\left<b\right>$ is disjoint from $H$ (apart from the identity element). Then for $0 \leq m,n < p$, the elements $a^nb^m$ are all distinct, but there are $p^2$ such elements, so every member in $G$ is of this form. Also, since $\left<a\right> \subset Z(G)$, we have $a^{n_1}b^{m_1}a^{n_2}b^{m_2} = a^{n_1}a^{n_2}b^{m_1}b^{m_2} = a^{n_1+n_2}b^{m_1+m_2}$. Thus, the map $a^nb^m \mapsto (n,m)$ is an isomorphism from $G$ to $\mathbb{Z}_p \times \mathbb{Z}_p$.
A: (Note $|G|=p^2\implies G$ is abelian, but I'd leave that out as a separate proof.)
Let $a\in G$.  By Lagrange's Theorem $\operatorname{ord}(a) = 1, p$ or $p^2$ . 


*

*$\operatorname{ord}(a) = 1\implies a = e.$

*$\operatorname{ord}(a) = p$.  Let $H = \langle a\rangle$, which is a subgroup of $G$.
$(G:H) = p^2/p = p\implies G/H = \langle Hb\rangle$ for $b\in G$ and $b\not\in H$.   
In other words,\begin{align*}
    G = & \, \{e, \\
    &\,\, a, a^2, \cdots, a^{p-1}, \\ 
    & \,\,b, b^2, \cdots, b^{p-1}, \\
    & \,\,ab, ab^2, \cdots, ab^{p-1}, a^2b,\cdots, a^{p-1}b^{p-1} \}
  \end{align*}
Let $f: G\rightarrow \mathbb{Z}_p\times\mathbb{Z}_p$ such that $f(a^xb^y) = (x, y)$ for $(x, y)\in\mathbb{Z}_p\times\mathbb{Z}_p$.
(a) $f$ is invertible, as $f^{-1}(x,y) = a^xb^y \implies f$ is a bijection.
(b) $f(a^xb^y) = (x,y) = (x,0) + (0,y) = f(a^x) + f(b^y)\implies f$ is a homomorphism.
Hence $\operatorname{ord}(a) = p\implies G\cong\mathbb{Z}_p\times\mathbb{Z}_p$.

*$\operatorname{ord}(a) = p^2\implies G = \{e, a, a^2, \cdots, a^{p^2-1}\}$.
Let $f: G\rightarrow \mathbb{Z}_{p^2}$ such that $f(a^x) = x$ for $x\in \mathbb{Z}_{p^2}$.
(a) $f$ is invertible, as $f^{-1}(x) = a^x \implies f$ is a bijection.
(b) $f(a^xa^y) = f(a^{x+y}) = x+y = f(a^x) + f(a^y)\implies f$ is a homomorphism.
Hence $\operatorname{ord}(a) = p^2\implies G\cong\mathbb{Z}_{p^2}$.
$\Box$
