Does an isomorphism of groups that can be written as a direct product induce isomorphisms on the factors? An answer to question Isomorphism of Direct Product of Groups says if you have two  (or more) group isomorphisms
$ \phi_1:A_1 \rightarrow X_1 $ and $ \phi_2:A_2 \rightarrow X_2 $ then it follows that $ A_1 \times A_2 \cong X_1 \times X_2 $ under the isomorphism $\phi(a_1,a_2)=(\phi_1(a_1),\phi_2 (a_2) )$
I am interested in whether the converse of this statement is true. 
If $\phi: A_1 \times A_2 \rightarrow X_1 \times X_2 $ is an isomorphism, is it true that $A_1 \cong  X_1 $ under an isomorphism  $ \phi_1 $ and $ A_2 \cong X_2 $ under an isomorphism $\phi_2$ such that $ \phi(a_1,a_2)= (\phi_1 (a_1), \phi (a_2)) $?
 A: I would add to the answers already provided that even if $A_1\cong X_1$ and $A_2\cong X_2$, there may not exist isomorphisms $\phi_1:A_1\to X_1$ and $\phi_2:A_2\to X_2$ such that $\phi(a_1,a_2)=(\phi_1(a_1),\phi_2(a_2))$.  For instance, let $A_1=A_2=X_1=X_2=\mathbb{Z}$ and consider $\phi:\mathbb{Z}\times\mathbb{Z}\to\mathbb{Z}\times\mathbb{Z}$ given by $\phi(a,b)=(a,b+a)$.  Then $\phi$ is an isomorphism (its inverse is given by $(a,b)\mapsto(a,b-a)$), but it cannot come from a pair of isomorphisms $\phi_1$ and $\phi_2$ because the second coordinate of $\phi$ depends on both coordinates of the input.
A: This is not true: Let $A_1 = \mathbb{Z}$, and consider $A_2 = \mathbb{Z} \times \mathbb{Z} \times \mathbb{Z} \times \cdots$. Also let $X_1$ be the trivial group, and $X_2 = A_2$. Then
$$
A_1 \times A_2 \cong A_2 \cong X_1 \times X_2
$$
and $A_2 \cong X_2$, but $A_1$ is not isomorphic to $X_1$.
A: No, and this is always false for any group that can be written as a direct product in a non-trivial way. For example, if $G = A \times B$ with neither $A$ nor $B$ the trivial group, then
$$A \times B = G \equiv G \times \{e\}$$
A: Yet another example: let $A\not\cong B$. Then $A\times B\cong B\times A$ . . .
