Problem of semidirect product This is a problem of dummit foote about semidirect product. The problem is
if $p$ be an odd prime and $P$ be a p-group. Then if every subgroup of $P$ is normal then $P$ is abelian.
I am trying it but really couldn't find a possible way to solve it or anything. So any help would be appreciated. Thanks 
 A: Well, you can't immediately proceed by induction in the order of $P$, since a $p$-group need not be finite.  However, let $p^c\ge p^d$ be minimal with $o(a)=p^c$, $o(b)=p^d$, and $ab\ne ba$. Define as usual $[x,y]=x^{-1}y^{-1}xy$ and $x^y=y^{-1}xy$.  Since $<x>$ and $<y>$ are normal for all $x,y\in P$, we have $[x,y]\in<x>\cap<y>$, so $[x,y]$ commutes with both $x$ and $y$, so $[[x,y],y]=[[x,y],x]=1$.  From this one shows $$[x^{i+1},y]=x^{-(i+1)}y^{-1}x^{i+1}y=x^{-i}(x^{-1}y^{-1}xy)y^{-1}x^iy=x^{-i}[x,y]y^{-1}x^iy=[x^i,y][x,y],$$ and by induction $$(1)~~~~~[x^i,y]=[x,y]^i,$$ in $P$. One can also show in general $$(2)~~~~[uv,w]=[u,w]^v[v,w]=[u^v,w^v][v,w],$$.  Restricting our attention to $<a,b>$, using that all conjugates of $a$ are powers of a and similarly for $b$, we can use the preceding formulas to show that any commutator in $<a,b>$ is a power of $[a,b]$, since one can use (2) and the normality of $<a>$ and $<b>$ to rewrite as a product of factors of the form $[a^i,b^j]$ and then apply (1). Let $Q=<a,b>$.  We thus have $Q'=<[a,b]>\subseteq Z(Q)$, so all $[[x,y],z]=1$ for all $x,y,z\in Q$.  From this we can easily show that $(xy)^i=x^iy^i[y,x]^{i(i-1)/2}$, since we introduce one commutator each time we move $x$ past $y$ (as $yx=xy[y,x]$), and $[y,x]$ commutes with everything in the expression. 
By the minimality of $c$ and $d$, $[a,b]^p=[a^p,b]=1$.  Thus, $[a,b]$ has order $p$, is a power of $a$ and is a power of $b$, so for some $0<r,s<p$ we have $[a,b]=a^{rp^{c-1}}=b^{sp^{d-1}}$.  Let $g=a^{-rp^{c-d}}b^s$.  Then $[g,a]=[b^s,a]=[b,a]^s$ by (2) and (1), but since $0<s<p$, this is not $1$.  Thus, $g$ and $a$ do not commute, so the order of $g$ is at least $p^d$.  On the other hand, writing $f$ for $-rp^{c-d}$ we have $g^p=(a^fb^s)^p=a^{fp}b^{sp}[b^s,a^f]^{p(p-1)/2}=a^{fp}b^{sp}[b,a]^{sfp(p-1)/2}=a^{fp}b^{sp}~~$ since $p$ divides $p(p-1)/2$ for $p$ and odd prime.  Continuing in this way, $g^{p^{d-1}}=a^{fp^{d-1}}b^{sp^{d-1}}=a^{-rp^{c-1}}b^{sp^{d-1}}=1$, using the definition of $r$ and $s$ for the last equality.  But the order of $g$ was at least $p^d$.  Contradiction.
This adapted from Marshall Hall's proof of the classification of Hamiltonian groups (12.5.4 in The Theory of Groups), with some simplifications as his arguments are necessarily more general.
Note you can see why this proof does not work for $p=2$, since $p$ does not divide $p(p-1)/2$ when $p=2$.  And of course, when $p=2$ the statement is false, as the quaternion group of size $8$ shows.  In fact, the general statement is that a non-abelian group with all subgroups normal is a direct product of a quaternion group of size $8$, an abelian group all of whose elements have odd order, and an abelian group all of whose non-identity elements have order $2$.  It need not be finite, but all of its elements have finite order, and no element has order divisible by $8$.
A: Here is a slightly different take.
Note that by induction, all proper subgroups and quotients of $P$ are abelian.  In particular, every quotient $P/H$ is abelian, and so the commutator $P'$ is contained in every non-trivial subgroup.
If $P'$ is trivial, we're done. Otherwise, the above implies $|P'|=p$ and that $P'$ is the unique subgroup of order $p$. Let $c$ be a generator for $P'$.
For any two elements $x$ and $y$ in $P$, we see that $[x,y]=c^k$ for some integer $k$.  Because this element is central, you can check via induction that
$$ (xy)^j = x^jy^jc^{k\binom{j}{2}} $$
In particular, for $j=p$, we get $(xy)^p=x^py^p$. This works because when $p$ is odd, it divides $\binom{p}{2}$, and $c$ has order $p$.
Now every proper subgroup of $P$ is abelian, and contains a unique subgroup of order $p$ (the one generated by $c$, namely $P'$).  That easily implies these subgroups are cyclic, and so every proper subgroup of $P$ is both normal and cyclic.
Now assume $M$ and $N$ are two maximal subgroups of $P$, with $x$ generating $M$ and $y$ generating $N$.  Then $x^p\in N$. If $x^p$ was a generator for $N$, then $x$ would generate $P$. So $x^p=y^{np}$ for some integer $n$. By the above, $xy^{-n}$ has order $p$, and thus $xy^{-n}$ generates $P'$. This means $xy^{-n}\in N$, and so $x\in N$. That is, $N=M$.
This means $P$ only has one maximal subgroup.  This easily implies $P$ is cyclic (take any element outside $N$ as a generator).
This idea can be extended to show the following:
Theorem: If $P$ is a $p$-group for an odd prime $p$, and $P$ has only one subgroup of order $p$, then $P$ is cyclic.
Proof: By induction, all proper subgroups of $P$ are cyclic. So the maximal subgroups are cyclic and normal.  Every other subgroup is contained in a maximal subgroup.  Since subgroups of cyclic groups are characteristic, this implies all subgroups of $P$ are normal, and we can use the above to show $P$ is abelian, hence cyclic.
