How many different ways are there to order the letters A,B,C,D,E,G,H in a line in such a way the letter B be always between A and D? How many different ways are there to order the letters A,B,C,D,E,G,H in a line in such a way the letter B be always between A and D?
For examples $A,C,\textbf{B},E,G,H,D$ or $D,\textbf{B},C,A,G,H,E$ and so on.
Thanks in advance for your comments.
 A: This Can be Visualized as follows :
The total number of Permutations of seven letters would be
$\ \ \displaystyle 7! .$
Hence now we group 3 elements (A, B, D) together, now we know that permutations of the group is $\ \ \displaystyle 3! . \ \ $ But only two ways are correct (namely ABD, DBA).
Thus to get correct sequence of A,B,D : $\ \ \displaystyle \frac {7!}{3!} \cdot 2 = 1680 .$
A: EDIT: I originally had a stricter condition than what was asked by OP. I understood it so that B must be consecutively after A/D and before D/A in the draft, e.g GHABDCE is allowed, but GHAEBDC would not be. Following is a solution for both cases.
Letters do not necessarily have to be in consecutive order
The different relative orders of A, B and D is: ABD, ADB, BAD, BDA, DAB, DBA. From these 6 different orderings of {A,B,C} only 2 will fulfill the requirement of having B between A and D, i.e. ABD and DBA. One of these six orderings will occur in any permutation, and there is nothing special with any of the letters therefore any of the orders are equally likely to occur. This makes the total number of permitted permutations:
\begin{equation}
\text{Permutations} = \frac{2}{6}\cdot7! = 1680
\end{equation}
Letters must be in consecutive order
The total different combinations that can occur by placing the letters out randomly is:
\begin{equation}
\text{Permutations} = 7! = 5040.
\end{equation}
Out of these 5,040 permutations we know that the B can not be placed in the 1st or last position; simply because then it won't have both A and D surrounding it.
We can find the probability that B is placed in any specific positions with A and D surrounding it as:
\begin{equation}
\text{P(B in 2nd place)} = \text{P(A$\cup$D)$\cdot$P(B)$\cdot$P(D$\cup$A)} = \frac{2}{7}\frac{1}{6}\frac{1}{5} = 0.0095\\
\text{P(B in 3rd place)} = \text{P($\notin$ A,B,D)$\cdot$P(A$\cup$D)$\cdot$P(B)$\cdot$P(D$\cup$A)} = \frac{4}{7}\frac{2}{6}\frac{1}{5}\frac{1}{4} = 0.0095\\
\text{P(B in 4th place)} = \frac{4}{7}\frac{3}{6}\frac{2}{5}\frac{1}{4}\frac{1}{3} = 0.0095\\
\text{P(B in 5th place)} = \frac{4}{7}\frac{3}{6}\frac{2}{5}\frac{2}{4}\frac{1}{3}\frac{1}{2} = 0.0095\\
\text{P(B in 6th place)} = \frac{4}{7}\frac{3}{6}\frac{2}{5}\frac{1}{4}\frac{2}{3}\frac{1}{2}\frac{1}{1} = 0.0095
\end{equation}
Above we have the probability for the B in different positions with two specific letters surrounding it and we can see that the probability of it being in any of the allowed position with A and D around it is the same, 0.0095.
From this we can find the total number of permutations that allows for your condition as
\begin{equation}
\text{Permutations with B surrounded by A and D} = \left(P(\text{B in 2nd place})+P(\text{B in 3rd place})+P(\text{B in 4th place})+P(\text{B in 5th place})+P(\text{B in 6th place})\right)\cdot\text{Permutations}
\end{equation}
which yields
\begin{equation}
\text{Permutations with B surrounded by A and D} = 0.0095\cdot5\cdot5040 = 240.
\end{equation}
From this we see that there are 240 different permutations of the letters A, B, C, D, E, G, H where B will appear between A and D. This is in fact true for any specific letter surrounded by two other specific letters in a combination of 7 unique letters.
A: It's too easy to be solved. The 7 numbers may be divided into two parts - 4 letters are free and 3 letters(A,B,D) are to be used. So, number of ways of arranging the 7 numbers - 7!. But we want to restrict the 3 numbers so we would make it combination by dividing it by 3!. Now for each combination of A,B,D, we can only get two cases of arrangement - A,B,D and D,B,A. So we would multiply it by 2. Hence the answer is 7!/3. By calculation, it is 1680.
