• Nov 9, 2013, 09:19 AM
Sabarkantha
Maths question
For a particular problem, I have arranged the letters A and B twelve by twelve : AAAAAAAAAAAA, ABBAABBAAABA, and so on. Order matters: AB is not equal to BA. Altogether there are 2 raised to 12 or 4096 pemutations giving all possible combinations of A and B, twelve by twelve. Now amongst the 4096 lines of all the combinations, I want to select just the lines which have A six times, like for instance AABBBBBAAABA. How many such lines are there amongst the 4096? I tried the formula 4096!/(4096-6)! but I am not sure that this does the job, since it does not specifically choose lines with six times A.

Thanks for the answer. It is important to me.
• Nov 9, 2013, 10:58 AM
ebaines
There are $\left( \array 12\\ 6 \array \right)$ ways to place the 6 A's in the twelve letter positions. Thus:

$\left( \array 12\\ 6 \array \right) = \frac {12!/6!}{6!} = \frac {12 \times 11 \times 10 \times 9 \times 8 \times 7}{6 \times 5 \times 4 \times 3 \times 2 \times 1 } =924$

In general the number of ways that 'k' A's can be placed in a string of 'n' letter positions is:

$
\left( \array n\\ k \array \right) = \frac {n (n-1)(n-2)...(n-k+1)}{k(k-1)(k-2)...1} = \frac {n!}{k!(n-k)!}
$
• Nov 9, 2013, 06:28 PM
Sabarkantha
Quote:

Originally Posted by ebaines
There are $\left( \array 12\\ 6 \array \right)$ ways to place the 6 A's in the twelve letter positions. Thus:

$\left( \array 12\\ 6 \array \right) = \frac {12!/6!}{6!} = \frac {12 \times 11 \times 10 \times 9 \times 8 \times 7}{6 \times 5 \times 4 \times 3 \times 2 \times 1 } =924$

In general the number of ways that 'k' A's can be placed in a string of 'n' letter positions is:

$
\left( \array n\\ k \array \right) = \frac {n (n-1)(n-2)...(n-k+1)}{k(k-1)(k-2)...1} = \frac {n!}{k!(n-k)!}
$

Thanks a million for your answer. I suppose that this is independent of the total sample of 4096, all the ways you can arrange A and B, twelve by twelve. Since you are very knowledgeable, I want to ask you a further question in order to solve my problem completely. Now that I have reduced my sample to 954, keeping just the lines with six A's, I want to reduce it still further by just keeping the lines where three A's come in a row, side by side: AAA. How manu such lines will there be amongst the 954? Sorry for this further bother.
• Nov 10, 2013, 12:11 AM
Sabarkantha
Quote:

Originally Posted by Sabarkantha
Thanks a million for your answer. I suppose that this is independent of the total sample of 4096, all the ways you can arrange A and B, twelve by twelve. Since you are very knowledgeable, I want to ask you a further question in order to solve my problem completely. Now that I have reduced my sample to 954, keeping just the lines with six A's, I want to reduce it still further by just keeping the lines where three A's come in a row, side by side: AAA. How manu such lines will there be amongst the 954? Sorry for this further bother.

• Nov 10, 2013, 12:12 AM
Sabarkantha
• Nov 10, 2013, 08:31 AM
ebaines
To clarify your question - I assume you mean that if you get 4 or more A's in a row it's counted as a fail, and if you get two groups of 3 A's each separated by at least one B it's a success.

Start by considering how the three A's are arranged relative to B's:
Case 1. You can have the three A's as the first three letters followed by a B, and you don't care how the remaining 8 letters are arranged:: AAABxxxxxxxx.
Case 2. The first N letters can be anything, followed by the pattern BAAAB, and then the remaining 7-N letters can be anything; for example if N=2: xxBAAABxxxxx. This is valid for N=0 to N=7.
Case 3. The first 8 letters can be anything, followed by BAAA for the last four letters: xxxxxxxxBAAA.

For case 1 the number of ways that the last 8 letters can be arranged, given that they consist of 3 A's and 5 B's is:

$
\left( \array 8 \\ 3 \array \right) = \frac {8 \cdot 7 \cdot 6}{3!} = 56.
$

For case 2 the number of ways that the remaining 7 letters can be arranged, given that there are 3 A's and 4 B's, is:

$
\left( \array 7 \\ 3 \array \right) = \frac {7 \cdot 6 \cdot 5}{3!} = 35.
$

Note that case 2 can occur in 8 different ways, since the starting B can be in position 1, 2, 3, 4, 5, 6, 7, or 8. Thus the total number of ways that case 2 can occur is 8 x 35 = 280.

Finally for case 3 the math is the same as for case 1, so there are 56 ways it can occur.

Thus the total number of arrangements that yield 3 A's in a row, given that you have 6 A's and 6 B's, is 2x56+280 = 392.
• Nov 10, 2013, 09:39 AM
Sabarkantha
Quote:

Originally Posted by ebaines
To clarify your question - I assume you mean that if you get 4 or more A's in a row it's counted as a fail, and if you get two groups of 3 A's each separated by at least one B it's a success.

Start by considering how the three A's are arranged relative to B's:
Case 1. You can have the three A's as the first three letters followed by a B, and you don't care how the remaining 8 letters are arranged:: AAABxxxxxxxx.
Case 2. The first N letters can be anything, followed by the pattern BAAAB, and then the remaining 7-N letters can be anything; for example if N=2: xxBAAABxxxxx. This is valid for N=0 to N=7.
Case 3. The first 8 letters can be anything, followed by BAAA for the last four letters: xxxxxxxxBAAA.

For case 1 the number of ways that the last 8 letters can be arranged, given that they consist of 3 A's and 5 B's is:

$
\left( \array 8 \\ 3 \array \right) = \frac {8 \cdot 7 \cdot 6}{3!} = 56.
$

For case 2 the number of ways that the remaining 7 letters can be arranged, given that there are 3 A's and 4 B's, is:

$
\left( \array 7 \\ 3 \array \right) = \frac {7 \cdot 6 \cdot 5}{3!} = 35.
$

Note that case 2 can occur in 8 different ways, since the starting B can be in position 1, 2, 3, 4, 5, 6, 7, or 8. Thus the total number of ways that case 2 can occur is 8 x 35 = 280.

Finally for case 3 the math is the same as for case 1, so there are 56 ways it can occur.

Thus the total number of arrangements that yield 3 A's in a row, given that you have 6 A's and 6 B's, is 2x56+280 = 392.

Thanks once again for the perfectly clear answer. You have understood the problem well. I think that I can work things out myself now.

•  All times are GMT -7. The time now is 09:21 AM.