Classification of Groups of Order $p^2$ The book I am reading contains contains the following claim:

Every group of order $p^2$, where $p$ is a prime, is isomorphic to $\mathbf{Z}_{p^2}$ or $\mathbf{Z}_p \oplus \mathbf{Z}_p$.

I tried to do the proof myself and ended up with the following. Is the following sketch correct? --


*

*We can show all groups of order $p^2$ are abelian by examining the center of the group. https://proofwiki.org/wiki/Group_of_Order_Prime_Squared_is_Abelian

*We are left to show, that such an abelian group of order $p^2$ is of the two forms given above. Examine arbitrary subgroup $\langle a \rangle \subset G$. By lagrange's theorem it's order can be $p^2$, $p$, or $1$.


*

*If $|\langle a \rangle|=p^2$ we obtain an abelian subgroup order $p^2$ -- i.e. $\langle a \rangle$ generates G. So $\mathbf{Z}_{p^2} = \langle a \rangle = G$ (the first isomorphism established by sending $k \mapsto a^k$).

*If $|\langle a \rangle|=p$ we have an abelian subgroup of $G$ order of $p$. We can see $\mathbf{Z}_{p} = \langle a \rangle$ by again sending $k \mapsto a^k$.  Construct $G/\langle a \rangle$ (Can check $\langle a \rangle$ is normal in $G$). $|G/\langle a \rangle| = p$ by using coset definition and counting. By using Lagrange's theorem, one can show any group of order $p$ is cyclic and abelian. Thus we can construct the isomorphism: $\mathbf{Z}_{p} = G/\langle a \rangle$. We note: $\langle a \rangle = \mathbf{Z}_{p} = G/\langle a \rangle$. And so: $G/\langle a \rangle \oplus \langle a \rangle=\mathbf{Z}_p \oplus \mathbf{Z}_p$. (How do I show $G/\langle a \rangle \oplus \langle a \rangle$ = $G$? I think this is still missing)

*If $|\langle a \rangle|=1$ then $G/\langle a \rangle =G$. So we can refer to 1 and 2.
 A: Let $G$ be a group of order $p^2,$ by lagrange any element has order $1,p$ or $p^2,$
if any element has order $p^2$, $G$ is cyclic and so $G\cong \mathbb{Z}_{p^2},$ in the other case there is an element $x$ of order $p$, let $H=\langle x\rangle$
and  be the group generated by $x$ and let  $1\neq y\notin H,$ of order $p$ and calling $K=\langle y \rangle$, since  both are cyclic and $H\cap K=1,$ then
$|HK|=\frac{|H||K|}{|H\cap K|}=p^2,$ then
$G \cong HK\cong \mathbb{Z}_p\times\mathbb{Z}_p.$
A: Hint: By Lagrange's every element in $G $ will have order either $1,p$ or $p^2$.

Case-1: If some $g\in G$ has order $p^2$ then $G\cong \Bbb Z_{p^{2}}$.
Case-2: Suppose each non-identity element has order $p$. Let $e\neq a\in G$. Then $\langle a\rangle<G$ of order $p$. Also $\exists$ (why) $b\in G$ such that $b\notin \langle a\rangle$. Next show that G=$\langle a\rangle \oplus\langle b\rangle$ and finally give an isomorphism between G and $\Bbb Z_p \oplus\Bbb Z_p$.

A: If we have $\langle a\rangle$ is normal, then we get a group homomorphism 
$$G \rightarrow \text{Aut}(\langle a \rangle) \cong (C_p)^* \cong C_{p-1}$$
where the first arrow is $g \mapsto (a^i \mapsto ga^ig^{-1})$. The image of this homomorphism has an order $d$ that divides $p-1$, but it must by the isomorphism theorem also divide the order of $G$, that is $p^2$. This is only possible if $d=1$. This means the homomorphism is trivial, and unwinding what that means we get that $a \in Z(G)$. Now if we take $b$ not in $\langle a \rangle$, we have that $$(a^i,b^j) \mapsto a^ib^j$$ is the desired isomorphism, which is a homomorphism precisely because $a$ and $b$ commute. 
A: None of the answers so far shows the hardest part - why $\langle a\rangle$ is normal.
So assume that $G$ is of order $p^2$ and all non-trivial elements have order $p$. Let $e \neq a \in G$. If $\langle a \rangle$ is not normal, then there's some $x \in G$ s.t. $xax^{-1} \notin \langle a \rangle$. Now it's easy to prove that for any $b \notin  \langle a \rangle$, $G = \langle a \rangle \langle b \rangle$ i.e. every element of $G$ is expressible as $a^ib^j$. So by choosing $b = xax^{-1}$ we can express $x^{-1}$ this way:
$$x^{-1} = a^ib^j = a^ixa^jx^{-1}$$
So $e = a^ixa^j$, which implies that $x = a^{-i-j}$ $\to$ contradiction, because then $xax^{-1} \in \langle a \rangle$.
