Uniqueness of the direct product decomposition of finite groups A group $G$ is  indecomposable  if:  $G = H \times K \Rightarrow \{  H,K \} = \{1, G \}$.
Then, a finite group $G$ decomposes into a direct product of indecomposable groups:  $G = \prod_i G_i$.  
Question: Is this decomposition unique (up to permutation and isomorphism)?
 A: This decomposition is not unique in the class of all groups, although, as the other answer points out, it is true fir finite groups.
One reason that the result fails in general is that groups are not cancellable in general. A group $H$ is cancellable if the following holds.
$$H\times Q\cong H\times P\Rightarrow P\cong Q$$
Finite groups are cancellable, but in general groups are not (see this question - $\mathbb{Z}$ is a counter-example). If your result held then the decompositions of $P$ and $Q$ would have to be the same, and hence $P$ and $Q$ they would have to be isomorphic, so all groups would be cancellable.
As finite groups are cancellable, this proof only works for general groups and not for finite groups.
A: Yes, the decomposition is unique for finite groups.  This is a consequence of the Remak-Krull-Schmidt Theorem, which applies to groups that satisfy both the minimum and maximum conditions on normal subgroups.  Since finite groups certainly have these properties, R-K-S applies here.
