Solution (source code)

= Solution

Let $1=A_0\le\cdots\le A_r=A$ and $1=B_0\le\cdots\le B_s=B$ be <central series>. Pad the shorter chain by repeating its terminal group, so both have length $t=\max(r,s)$. In the <direct product of groups>, <group commutators> are coordinatewise, hence
$$
[A_i\times B_i,A\times B]=[A_i,A]\times[B_i,B]\le A_{i-1}\times B_{i-1}.
$$
The equality holds because commutators supported in either coordinate generate the corresponding factor independently. Therefore
$$
\boxed{1=A_0\times B_0\le\cdots\le A_t\times B_t=A\times B}
$$
is a <central series>, proving that \b[a direct product of two nilpotent groups is nilpotent]. More precisely, the coordinatewise recurrence for the <lower central series> gives $\Gamma_j(A\times B)=\Gamma_j(A)\times\Gamma_j(B)$, so the <nilpotency class of a direct product> is the maximum of the two factor classes.