A question about commutator subgroup let $G=H×K$ be a nonabelian group that $o(H) = p^2$ , $o(K) = p^3$  (p is prime number), why is $o(G') = p$?
 A: We will use two facts of a finite group $G$, which can be found in any decent textbook.
(a) If $G/Z(G)$ is cyclic, then $G$ is abelian.
(b) If $|G|$ is a $p$-power ($p$ prime), then $Z(G) \neq 1$.
From this we glean another fact:
(c) If $|G|=p^2$, then $G$ must be abelian (Proof: look at $Z(G)$, which cannot be trivial owing to (b): if $G=Z(G)$, then $G$ is abelian, if $|Z(G)|=p$, then $|G/Z(G)|=p$, whence $G/Z(G)$ is cyclic (by (a)) and $G$ is abelian after all.)
Now $G=H \times K$ is non-abelian, and $|H|=p^2$. By (c) $H$ is abelian and we conclude that $K$ must be non-abelian. Given $|K|=p^3$ and $|Z(K)| \gneq 1$, $|Z(K)|=p, p^2$ or $p^3$. If $|Z(K)|=p^3$, then $K=Z(K)$ and $K$ is abelian, which is not the case. If $|Z(K)|=p^2$, then $|K/Z(K)|=p$ and by (a) $K$ is abelian, again not the case. Hence, $|Z(K)|=p$. It follows that $|K/Z(K)|=p^2$, so $K/Z(K)$ is an abelian group by (c), and this means that the commutator subgroup $K'\subseteq Z(K)$. But $Z(K)$ has order $p$, so either $K'=1$ or $K'=Z(K)$. The first case $K'=1$ is not possible, since this is equivalent to $K$ being abelian. So after all, $|K'|=p$. Finally, $G'=(H \times K)' = H' \times K' = \{1\} \times K' \equiv C_p$. So $|G'|=p$.
