Let $G =A \times B$, where I will call $A$ and $B$ as factors of group $G$.
For an example $Z_{21} =Z_7 \times Z_3$, $Z_3$ is a factor of group $Z_{21}$.
Given a group $G$ and a subgroup $A$ how to check whether $A$ is a factor of $G$ or not.
Here is my idea, find the $G/A$ and then set an homomorphism from $G/A$ to the group $G$.
Question : What is neccessary and sufficient conidtion for a subgroup to be a factor?
$A$ is a direct factor of $G$ if and only if the following two conditions hold:
(i) $AC_G(A)=G$; and
(ii) $Z(A)$ has a complement in $C_G(A)$.
Note that $G = A \times B$, where $B$ is any complement of $Z(A)$ in $C_G(A)$.