The minimum size of generating set of the external direct product I have seen the following theorem here:

Suppose that $A$ and $B$ are finite groups whose orders are relatively prime to each other, and the minimum size of generating set (i.e., the smallest possible size of a generating set) of $A$ is $a$ while the minimum size of generating set of $B$ is $b$. Then, the minimum size of generating set of the external direct product $A × B$ is equal to $\max\{a, b\}$. 

But it has no proof, so I want to see the proof for the above theorem. 
Thanks
 A: If $S$ generates $A \times B$, then its image in $A$ generates $A$ (because $A \times B \to A$ is a surjective homomorphism), so that $|S| \geq a$. Similarly $|S| \geq b$. This shows $|S| \geq \max(a,b)$. This is true without any assumptions on $A$ and $B$.
Conversely, we have to show that $A \times B$ can be generated by $n=\max(a,b)$ elements. There are generating sets $\{a_1,\dotsc,a_n\}$ of $A$ and $\{b_1,\dotsc,b_n\}$ of $B$. Then we claim that $\{(a_1,b_1),\dotsc,(a_n,b_n)\}$ is a generating set of $A \times B$. Notice that the generated subgroup surjects onto $A$ and onto $B$. Thus, if suffices to prove:

Let $A,B$ be finite groups of coprime orders. Let $H \subseteq A \times B$ be a subgroup which surjects onto $A$ and onto $B$. Then $H = A \times B$.

In fact, since there is a surjective homomorphism $H \to A$, $\mathrm{ord}(A)$ divides $\mathrm{ord}(H)$. Similarly, $\mathrm{ord}(B)$ divides $\mathrm{ord}(H)$. Since $\mathrm{ord}(A)$ and $\mathrm{ord}(B)$ are coprime, it follows that $\mathrm{ord}(A \times B) = \mathrm{ord}(A) \cdot \mathrm{ord}(B)$ divides $\mathrm{ord}(H)$. This clearly implies $H = A \times B$.
Notice that this really fails when $\mathrm{ord}(A)$ and $\mathrm{ord}(B)$ are not coprime. For example, $([1],[1])$ doesn't generate $\mathbb{Z}/2\mathbb{Z} \times \mathbb{Z}/2\mathbb{Z}$.
