So I have a simple question: I would like to know if the converse of this question here is also true, that is, if $G$ is a group with $G'\leq Z(G)$ then $G$ is a nilpotent group of class 2.
I'm inclined to think this is true. By the definition of a nilpotent group we need to find a central series for $G$ with length 2. I claim that this series must be the following series: $$ 1 \leq G' \leq G. $$
All I have to do now is check if the quotients are central. In fact, by assumption we have $$ G'/1 = G' \subseteq Z(G) = Z(G/1) $$
For the inclusion $G/G' \subseteq Z(G/G')$, we use the fact that $G/G'$ is abelian.
I just want to know if my argument is correct.