A finite group is nilpotent iff two elements with relatively prime order commute (Question 9 in chapter 6.1 of Dummit and Foote). Prove that a finite group G is nilpotent if and only if whenever $a, b \in G$ with $(|a|, |b|) = 1$ then $ab = ba$. It says to use the following theorem:
Let G be a finite group, $p_1$, $p_2$, ... $p_s$ be the distinct primes dividing its order, and $P_i \in Syl_{p_i}(G)$. Then G is nilpotent iff $G \cong P_1 \times P_2 \times ... P_s$.
I believe I know the if direction: an element $a \in G$ corresponds to an element $(g_1, g_2, ... g_s) \in P_1 \times P_2 \times ... P_s$ and $|a| = lcm(|g_1|, |g_2|, ... |g_s|)$. If $b$ corresponds to $(h_1, h_2, ... h_s)$ then $(|a|, |b|) = 1$ implies each $(|g_i|, |h_i|) = 1$. Since the order of the elements divides $|P_i|$ a prime power, $|g_i|$ or $|h_i|$ has to be 1 or their gcd would not be 1. So one of every pair $g_i$ and $h_i$ has to be 1, so they commute, so $a$ and $b$ commute.
I'm not sure how to do the only if direction. Any pointers? Thank you
 A: Here is the my proof:
I will use theorem which says: If G is finite nilpotent and $P_i$'s are Sylow-$p_i$-subgroups of G then $G= \displaystyle\prod_{p_i} P_i$ (Also this prodocut is direct but we dont need uniqueness).
Let $G$ be a nilpotent group and let $P_1$,$P_2$,..,$P_n$ be Sylow subgroups of G for every prime $p_i||G|$. Since $G$ is nilpotent we have $n_{p_i}(G)=1$ $\forall p_i$. Then $P_i$'s are normal subgroup. Since $P_i$ $\cap$ $P_j$ $=1$ for all $i \neq j$ and they are normal,  elements of $P_i$ and $P_j$ are commute (easy to check). By above theorem two elements of $G$ with relatively prime order commutes.
Conversely, suppose any two elements of $G$ with relatively prime orders are commute. Let $P_1,P_2,..P_n$ are sylow-$p_i$-subgroups of G $\forall p$ $|$ $ |G|$. So $P_i$ commutes with $P_j$  for all $i \neq j$. Then $P_i \subseteq N_G(P_j) $ for all $i \neq j$. Hence $G=N_G(P_j)$, and this implies all $P_i$'s are normal. $G$ is nilpotent.
A: I'm answering my own question since no-one has posted an answer, but credits go to Bungo. Also, I'm pretty sure there are cleaner ways to make the arguments for the proof..
Theorem: Let G be a finite group, let $p_1$, $p_2$, ... $p_s$ be the distinct primes dividing its order, and $P_i \in Syl_{p_i}(G)$. Then G is nilpotent iff $G \cong P_{1} \times P_{2} \times ... P_{s}$.
Only if: So G is a direct product of Sylow-p subgroups. An element $a \in G$ corresponds to an element $(g_1, g_2, ... g_s) \in P_1 \times P_2 \times ... P_s$ and $|a| = lcm(|g_1|, |g_2|, ... |g_s|)$. If $b$ corresponds to $(h_1, h_2, ... h_s)$, then $(|a|, |b|) = 1$ implies each $(|g_i|, |h_i|) = 1$, because if any $g_i$, $h_i$ has a factor greater than 1, that factor would show up in $a$ and $b$. 
Since the order of each of elements $g_i$, $h_i$ divides $|P_i|$ a prime power, $|g_i|$ or $|h_i|$ has to be 1 or their gcd would not be 1. So one of every pair $g_i$ and $h_i$ has to be 1, so they commute by the problem assumption, so $a$ and $b$ commute.

If direction: Consider $g \in P_i$ and $h \in P_j$. Their orders divide different prime powers, so their gcd is 1 and they commute. So every element of a Sylow-p subgroup centralizes any product of elements from other Sylow-p subgroups.
Consider the set $P_{1}P_{2}...P_{s} = \{ x_{1}x_{2}...x_{s} : x_i \in P_i \}$. As products in $G$, the ordering of each $x_i$ doesn't matter because elements from different Sylow-p subgroups commute. Certainly this set as products is contained in $G$. There are $|P_{1}||P_2|...|P_s| = |G|$ elements so they are equal - every element of $G$ corresponds to one of these products.
Now for a $P_i$, consider an element $h \in P_i$. Consider an element $g = x_{1}x_{2}...x_{s} \in G$, $x_j \in P_j$. Conjugation by this element equals $(x_{1}x_{2}...x_{s})h(x_{1}x_{2}...x_{s})^-1 = x_{1}x_{2}...(x_{s}hx_{s}^{-1})x_{s - 1}^{-1}...x_{1}^{-1}$. So each conjugation sends $h$ to itself (when for $x_j$, $j \neq i$) or sends $h$ to another element $h' \in P_i$ ($x_i \in P_i$, subgroup is closed).
So each $P_i$ is normal in $G$. Then $G \cong P_{1} \times P_{2} \times ... P_{s}$.
