What are differences between semidirect product and direct product? Given two groups $A, B$, we can construct direct product $A \times B$ whose elements are of the form $(a, b), a \in A, b\in B$. If $A, B$ are subgroups of a group $G$ and $A \cap B =\{1\}$, then we can construct semidirect product $A \rtimes B$ whose elements are of the form $ab, a\in A, b\in B$. In this case, is the semidirect product $A \rtimes B$ the same as direct product $A \times B$? Is the order of $AB$ equal to $|A||B|$? For example, is the order of $(\mathbb{Z}/2\mathbb{Z})^n \rtimes S_n$ equal to $2^n * n!$? Here $S_n$ is the symmetrical group of order $n$. Thank you very much.
 A: In your second sentence, $A$ is required to be a normal subgroup. The semi direct product $A \rtimes B$ will always have the same order as the direct product $A \times B$, but in a direct product $B$ will be normal too.
Take $A$ to be order 3, $B$ to be order 2, and consider two non-isomorphic groups of order 6. The cyclic group of order 6 will contain $A \times B$, but the symmetric group of degree 3 will contain $A \rtimes B$ that is not a direct product.
Weyl group example
The hyperoctahedral group $B_n$ is defined to be a semi-direct product $(\mathbb{Z}/2\mathbb{Z})^n \rtimes S_n$ and can be explicitly represented as the group of all integer matrices such that (1) all non-zero entries are ±1, and (2) each row and each column has exactly one nonzero entry.
The subgroup $A=(\mathbb{Z}/2\mathbb{Z})^n$ corresponds to the diagonal matrices with diagonal entries all being ±1, so $2^n$ different possibilities. This is a normal subgroup of the hyperoctahedral group.
The subgroup $B$ of permutation matrices, the group of all integer matrices such that (1) all non-zero entries are 1, and (2) each row and each column has exactly one nonzero entry, is also a subgroup of the hyperoctahedral group.  However, it is not normal.
You can see this form the presentation of the hyperoctahedral group on its Coxeter generators:
$$\left\langle s_1, s_2, \ldots, s_n : s_1^2 = s_i^2 = 1, (s_1 s_2)^4 = (s_i s_{i+1})^3 = (s_i s_j)^2 = 1 \mid 2 \leq i \leq n, i+2 \leq j, j \leq n \right\rangle$$
where the generator $s_1$ is the diagonal matrix with a single $-1$ in its top left entry, and 1s on the rest of the diagonal, and the generators $s_i$ are the permutation matrix formed from the identity by switching both the $i-1$st and $i$th rows, and the corresponding columns.
If this was a direct product, then we would need $n$ generators for $A$. In the semi-direct product, the elements of $B$, especially $s_i$ for $2 \leq i \leq n$, move the first generator $s_1$ of $A$, to the other $n$ generators needed.  In the direct product $(s_1 s_2)^2$ would be the identity, but in the hyperoctahedral group, it is the matrix whose first row has a $-1$ in the second position, whose second row has a 1 in the first position, and in all other rows, the 1 is in the same place as for an identity matrix.
A: Let me add that there is an abstract definition of the semi-direct product. 
Let $A$ and $B$ be groups and let $\varphi: B \to Aut(A)$ be a morphism, i.e. an action of $B$ on $A$. Given that you can define the semi-direct product $A \rtimes_\varphi B$ as the set $A\times B$ with group law
$$ 
  (a,b) * (a',b') = (a\varphi(b)(a'),bb')
$$ 
(In practice, $\varphi$ is often omitted in the notation $A \rtimes_\varphi B$ but the group law strongly depends on it: it tells you how $A$ and $B$ mix in the product). 
Now it is clear from the definition that 


*

*$|A \rtimes_\varphi B| = |A||B|$ since the underlying set is the product set

*If $\varphi$ is the trivial morphism then $A \rtimes_\varphi B$ is the usual direct product since $\varphi(b)(a') = a'$ in this case. 


In fact you can prove that as subgroups of $A \rtimes_\varphi B$, the two sub-groups $A$ and $B$ commute (meaning that $ab=ba$ forall $a \in A$, $b\in B$) if and only if $\varphi$ is trival (so that the semi-direct product is actually a direct product).
PS: To compare with other definitions of the semi-direct product, simply identify $A$ with $\{(a,1)~|~a\in A\}$ and $B$ with $\{(1,b)~|~b\in B\}$. Also note that if $A$ and $B$ are subgroups of $G$ with $A$ normal, then you can take the action by conjugation as $\varphi$: $\varphi(b)(a) = bab^{-1}$.  
