Combinatorics with just 2 letters
up vote
0
down vote
favorite
Using the letters A & B only to make two strings of 7 letters each, how many combinations are possible based on the following criteria?
Criteria 1: There must be at least 2 B's in each string.
Criteria 2: A can be on top or below A and B but B cannot be above or below another B.
Examples:
AAABBAA
BBBAAAB
ABABAAB
AABABAA
BAAABBB
ABBBAAA
BAAAAAB
ABAAABA
I think I understand how to calculate the number of combinations of the top string but I can't figure out how to link that to the bottom string.
Any help is greatly appreciated!
My solution for the top string combinations:
$sum_{i=1}^{4} binom{7}{2}binom{5}{5-i}$
Where $binom{7}{2}$ is the required 2 B's, and the $binom{5}{5-i}$ is the other choices for the remaining letters.
combinatorics combinations
add a comment |
up vote
0
down vote
favorite
Using the letters A & B only to make two strings of 7 letters each, how many combinations are possible based on the following criteria?
Criteria 1: There must be at least 2 B's in each string.
Criteria 2: A can be on top or below A and B but B cannot be above or below another B.
Examples:
AAABBAA
BBBAAAB
ABABAAB
AABABAA
BAAABBB
ABBBAAA
BAAAAAB
ABAAABA
I think I understand how to calculate the number of combinations of the top string but I can't figure out how to link that to the bottom string.
Any help is greatly appreciated!
My solution for the top string combinations:
$sum_{i=1}^{4} binom{7}{2}binom{5}{5-i}$
Where $binom{7}{2}$ is the required 2 B's, and the $binom{5}{5-i}$ is the other choices for the remaining letters.
combinatorics combinations
Designating two positions as those reserved for a B over counts those strings with more than two Bs.
– N. F. Taussig
Nov 23 at 22:33
@N.F.Taussig So it should be $sum_{i=1}^{4} binom{5}{5-i}$ ?
– jerome Williams
Nov 23 at 22:43
The number of top strings is $sum_{i = 2}^{7} binom{7}{i}$. Alternatively, if we subtract the number of strings with fewer than two $B$s from the $2^7$ possible strings, we obtain $2^7 - binom{7}{0} - binom{7}{1}$. The tricky part is criterion 2.
– N. F. Taussig
Nov 23 at 22:47
@fleablood There are two rows, each of which must have two $B$s. There cannot be two $B$s in the same column.
– N. F. Taussig
Nov 23 at 22:53
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Using the letters A & B only to make two strings of 7 letters each, how many combinations are possible based on the following criteria?
Criteria 1: There must be at least 2 B's in each string.
Criteria 2: A can be on top or below A and B but B cannot be above or below another B.
Examples:
AAABBAA
BBBAAAB
ABABAAB
AABABAA
BAAABBB
ABBBAAA
BAAAAAB
ABAAABA
I think I understand how to calculate the number of combinations of the top string but I can't figure out how to link that to the bottom string.
Any help is greatly appreciated!
My solution for the top string combinations:
$sum_{i=1}^{4} binom{7}{2}binom{5}{5-i}$
Where $binom{7}{2}$ is the required 2 B's, and the $binom{5}{5-i}$ is the other choices for the remaining letters.
combinatorics combinations
Using the letters A & B only to make two strings of 7 letters each, how many combinations are possible based on the following criteria?
Criteria 1: There must be at least 2 B's in each string.
Criteria 2: A can be on top or below A and B but B cannot be above or below another B.
Examples:
AAABBAA
BBBAAAB
ABABAAB
AABABAA
BAAABBB
ABBBAAA
BAAAAAB
ABAAABA
I think I understand how to calculate the number of combinations of the top string but I can't figure out how to link that to the bottom string.
Any help is greatly appreciated!
My solution for the top string combinations:
$sum_{i=1}^{4} binom{7}{2}binom{5}{5-i}$
Where $binom{7}{2}$ is the required 2 B's, and the $binom{5}{5-i}$ is the other choices for the remaining letters.
combinatorics combinations
combinatorics combinations
asked Nov 23 at 22:26
jerome Williams
153
153
Designating two positions as those reserved for a B over counts those strings with more than two Bs.
– N. F. Taussig
Nov 23 at 22:33
@N.F.Taussig So it should be $sum_{i=1}^{4} binom{5}{5-i}$ ?
– jerome Williams
Nov 23 at 22:43
The number of top strings is $sum_{i = 2}^{7} binom{7}{i}$. Alternatively, if we subtract the number of strings with fewer than two $B$s from the $2^7$ possible strings, we obtain $2^7 - binom{7}{0} - binom{7}{1}$. The tricky part is criterion 2.
– N. F. Taussig
Nov 23 at 22:47
@fleablood There are two rows, each of which must have two $B$s. There cannot be two $B$s in the same column.
– N. F. Taussig
Nov 23 at 22:53
add a comment |
Designating two positions as those reserved for a B over counts those strings with more than two Bs.
– N. F. Taussig
Nov 23 at 22:33
@N.F.Taussig So it should be $sum_{i=1}^{4} binom{5}{5-i}$ ?
– jerome Williams
Nov 23 at 22:43
The number of top strings is $sum_{i = 2}^{7} binom{7}{i}$. Alternatively, if we subtract the number of strings with fewer than two $B$s from the $2^7$ possible strings, we obtain $2^7 - binom{7}{0} - binom{7}{1}$. The tricky part is criterion 2.
– N. F. Taussig
Nov 23 at 22:47
@fleablood There are two rows, each of which must have two $B$s. There cannot be two $B$s in the same column.
– N. F. Taussig
Nov 23 at 22:53
Designating two positions as those reserved for a B over counts those strings with more than two Bs.
– N. F. Taussig
Nov 23 at 22:33
Designating two positions as those reserved for a B over counts those strings with more than two Bs.
– N. F. Taussig
Nov 23 at 22:33
@N.F.Taussig So it should be $sum_{i=1}^{4} binom{5}{5-i}$ ?
– jerome Williams
Nov 23 at 22:43
@N.F.Taussig So it should be $sum_{i=1}^{4} binom{5}{5-i}$ ?
– jerome Williams
Nov 23 at 22:43
The number of top strings is $sum_{i = 2}^{7} binom{7}{i}$. Alternatively, if we subtract the number of strings with fewer than two $B$s from the $2^7$ possible strings, we obtain $2^7 - binom{7}{0} - binom{7}{1}$. The tricky part is criterion 2.
– N. F. Taussig
Nov 23 at 22:47
The number of top strings is $sum_{i = 2}^{7} binom{7}{i}$. Alternatively, if we subtract the number of strings with fewer than two $B$s from the $2^7$ possible strings, we obtain $2^7 - binom{7}{0} - binom{7}{1}$. The tricky part is criterion 2.
– N. F. Taussig
Nov 23 at 22:47
@fleablood There are two rows, each of which must have two $B$s. There cannot be two $B$s in the same column.
– N. F. Taussig
Nov 23 at 22:53
@fleablood There are two rows, each of which must have two $B$s. There cannot be two $B$s in the same column.
– N. F. Taussig
Nov 23 at 22:53
add a comment |
4 Answers
4
active
oldest
votes
up vote
1
down vote
accepted
Since no $B$ can be in the same column as another $B$ and there must be at least two $B$s in each row, there are at least four columns that contain a $B$. If there are exactly $k$ columns in which a $B$ occurs, there are $binom{7}{k}$ ways of choosing which columns contain a $B$ and $2$ ways of choosing in which row that $B$ appears. From these, we must subtract those arrangements in which there are fewer than two $B$s in one the rows. Hence, the number of admissible arrangements is
$$sum_{k = 4}^{7} binom{7}{k}left[2^k - binom{2}{1}binom{k}{k} - binom{2}{1}binom{k}{k - 1}right]$$
where the term $binom{2}{1}binom{k}{k}$ represents the number of ways we could place all $k$ $B$s in the same row and the term $binom{2}{1}binom{k}{k - 1}$ represents the number of ways we could place all but one of the $B$s in the same row.
Does the last $binom{7}{7}2^7$ include the following arrangement? BBBBBBB AAAAAAA - the second row needs at least 2 B's so I just want to make sure this isn't included
– jerome Williams
Nov 23 at 23:10
Good catch. I have fixed the error.
– N. F. Taussig
Nov 23 at 23:31
Thanks for this! Does this also take out the arrangement BBAAAAA BBAAAAA because we are doing 7 choose 4 (selecting 4 distinct columns)?
– jerome Williams
Nov 23 at 23:53
Also can this be simplified to $sum_{k = 4}^{7} binom{7}{k}left[2^k - 2 - 2*binom{k}{k - 1}right]$ ?
– jerome Williams
Nov 24 at 0:19
Yes, it removes arrangements in which $B$s appear in the same column. The factor of $2^k$ represents the number of ways of choosing the row in which the $B$ is placed in each of those $k$ columns. Making that choice ensures no column contains two $B$s. Subtracting the term $binom{2}{1}binom{k}{k}$ ensures that we do no place all $k$ $B$s in the same row. Subtracting the term $binom{2}{1}binom{k}{k - 1}$ ensures that we remove those cases in which all but one of the $B$s are in the same row.
– N. F. Taussig
Nov 24 at 0:22
|
show 3 more comments
up vote
1
down vote
I think the simplest way to approach this is to consider the cases "there are exactly $k$ Bs in the top string" for each $k$ separately, and add everything up in the end.
For example, if there are exactly $2$ Bs in the top string, then there are $binom{7}{2}$ ways to choose the top string and $2^5 - 1 - 5$ ways to choose the bottom string (the two positions below the top string's Bs must be As, which leaves $5$ positions, at least two of which must be Bs).
You can continue for "exactly $3$ Bs in the top string," and so on.
This approach yields $$sum_{k=2}^5 binom{7}{k} (2^{7-k} - 1 - (7-k)).$$
I may be missing a more elegant approach though.
add a comment |
up vote
0
down vote
Suppose we initially drop the second condition and ask how many ways there are to arrange 7 A/B's in two rows with at least 2 B's in each row. In one row there are $2^7$ ways to arrange 7 A/B's. In $7$ of these there is only one B and in $1$ there are no B's. So one row can be arranged in $2^7-7-1$ ways, and two rows can be arranged in $N= (2^7-7-1)^2$ ways.
To find the number of these arrangements which satisfy the second condition (no two B's in the same column), we apply the Principle of Inclusion / Exclusion (PIE). Let's say an arrangement has "Property $i$" if column $i$ has two B's, for $i=1,2,3,dots,7$. Let $S_j$ be the number of arrangements with $j$ of the properties, for $j=1,2,3,dots,7$.
The case $j=1$ is a bit special. The single column can be chosen in $binom{7}{1}$ ways. In the first row the remaining columns can be filled in $2^6$ ways, but one of these ways consists of only A's, violating the rule that the row must contain at least two B's. So the letters in the first row can be arranged in $2^6-1$ ways, and similarly for the second row. So
$$S_1 = binom{7}{1}(2^6-1)^2$$
The cases $S_2, S_3, dots , S_7$ are a bit simpler than $S_1$, because when two or more of the columns contain B's, we have automatically satisfied the requirement that each row contain at least two B's. So
$$S_j = binom{7}{j} (2^{7-j})^2$$
for $j = 2,3,4, dots,7$.
Finally, by PIE, the number of arrangements with none of the properties, i.e. the arrangements in which no column contains two B's, is
$$begin{align}
N_0 &= N + sum_{j=1}^7 (-1)^j S_j \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=2}^7 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=0}^7 (-1)^j binom{7}{j} (2^{7-j})^2 - sum_{j=0}^1 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 - (1-4)^7 - 4^7 + 7 cdot 4^6\
end{align}$$
where we have applied the Binomial Theorem in the last line.
add a comment |
up vote
0
down vote
Another approach is to solve a more general problem, in which the lengths of the two strings are $r$. The original problem is then the case $r=7$.
Any single column consists of two letters, one of
$$alpha = begin{vmatrix} A\B end{vmatrix} qquad beta = begin{vmatrix}B\A end{vmatrix} qquad gamma = begin{vmatrix} A\A end{vmatrix}$$
An acceptable arrangement of length $r$ is a string of $r$ "characters" taken from $alpha, beta$ and $gamma$ with at least two $alpha$'s and at least two $beta$'s. The exponential generating function for the number of acceptable strings is
$$begin{align}
f(x) &= left( frac{1}{2!} x^2 + frac{1}{3!} x^3 + frac{1}{4!} x^4+ dots right)^2 left( 1 + x + frac{1}{2!} x^2 + dots right) \
&= (e^x-1-x)^2 ; e^x \
&= e^{3x}+e^x+x^2 e^x-2e^{2x}-2xe^{2x}+2xe^x
end{align}$$
From this last expression we can find the coefficient of $(1/7!)x^7$, which is the solution to the original problem:
$$7! ;[x^7] f(x) = 3^7 + 1 + 6 cdot 7 - 2^8 - 7 cdot 2^7 + 2 cdot 7 =1092$$
add a comment |
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Since no $B$ can be in the same column as another $B$ and there must be at least two $B$s in each row, there are at least four columns that contain a $B$. If there are exactly $k$ columns in which a $B$ occurs, there are $binom{7}{k}$ ways of choosing which columns contain a $B$ and $2$ ways of choosing in which row that $B$ appears. From these, we must subtract those arrangements in which there are fewer than two $B$s in one the rows. Hence, the number of admissible arrangements is
$$sum_{k = 4}^{7} binom{7}{k}left[2^k - binom{2}{1}binom{k}{k} - binom{2}{1}binom{k}{k - 1}right]$$
where the term $binom{2}{1}binom{k}{k}$ represents the number of ways we could place all $k$ $B$s in the same row and the term $binom{2}{1}binom{k}{k - 1}$ represents the number of ways we could place all but one of the $B$s in the same row.
Does the last $binom{7}{7}2^7$ include the following arrangement? BBBBBBB AAAAAAA - the second row needs at least 2 B's so I just want to make sure this isn't included
– jerome Williams
Nov 23 at 23:10
Good catch. I have fixed the error.
– N. F. Taussig
Nov 23 at 23:31
Thanks for this! Does this also take out the arrangement BBAAAAA BBAAAAA because we are doing 7 choose 4 (selecting 4 distinct columns)?
– jerome Williams
Nov 23 at 23:53
Also can this be simplified to $sum_{k = 4}^{7} binom{7}{k}left[2^k - 2 - 2*binom{k}{k - 1}right]$ ?
– jerome Williams
Nov 24 at 0:19
Yes, it removes arrangements in which $B$s appear in the same column. The factor of $2^k$ represents the number of ways of choosing the row in which the $B$ is placed in each of those $k$ columns. Making that choice ensures no column contains two $B$s. Subtracting the term $binom{2}{1}binom{k}{k}$ ensures that we do no place all $k$ $B$s in the same row. Subtracting the term $binom{2}{1}binom{k}{k - 1}$ ensures that we remove those cases in which all but one of the $B$s are in the same row.
– N. F. Taussig
Nov 24 at 0:22
|
show 3 more comments
up vote
1
down vote
accepted
Since no $B$ can be in the same column as another $B$ and there must be at least two $B$s in each row, there are at least four columns that contain a $B$. If there are exactly $k$ columns in which a $B$ occurs, there are $binom{7}{k}$ ways of choosing which columns contain a $B$ and $2$ ways of choosing in which row that $B$ appears. From these, we must subtract those arrangements in which there are fewer than two $B$s in one the rows. Hence, the number of admissible arrangements is
$$sum_{k = 4}^{7} binom{7}{k}left[2^k - binom{2}{1}binom{k}{k} - binom{2}{1}binom{k}{k - 1}right]$$
where the term $binom{2}{1}binom{k}{k}$ represents the number of ways we could place all $k$ $B$s in the same row and the term $binom{2}{1}binom{k}{k - 1}$ represents the number of ways we could place all but one of the $B$s in the same row.
Does the last $binom{7}{7}2^7$ include the following arrangement? BBBBBBB AAAAAAA - the second row needs at least 2 B's so I just want to make sure this isn't included
– jerome Williams
Nov 23 at 23:10
Good catch. I have fixed the error.
– N. F. Taussig
Nov 23 at 23:31
Thanks for this! Does this also take out the arrangement BBAAAAA BBAAAAA because we are doing 7 choose 4 (selecting 4 distinct columns)?
– jerome Williams
Nov 23 at 23:53
Also can this be simplified to $sum_{k = 4}^{7} binom{7}{k}left[2^k - 2 - 2*binom{k}{k - 1}right]$ ?
– jerome Williams
Nov 24 at 0:19
Yes, it removes arrangements in which $B$s appear in the same column. The factor of $2^k$ represents the number of ways of choosing the row in which the $B$ is placed in each of those $k$ columns. Making that choice ensures no column contains two $B$s. Subtracting the term $binom{2}{1}binom{k}{k}$ ensures that we do no place all $k$ $B$s in the same row. Subtracting the term $binom{2}{1}binom{k}{k - 1}$ ensures that we remove those cases in which all but one of the $B$s are in the same row.
– N. F. Taussig
Nov 24 at 0:22
|
show 3 more comments
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Since no $B$ can be in the same column as another $B$ and there must be at least two $B$s in each row, there are at least four columns that contain a $B$. If there are exactly $k$ columns in which a $B$ occurs, there are $binom{7}{k}$ ways of choosing which columns contain a $B$ and $2$ ways of choosing in which row that $B$ appears. From these, we must subtract those arrangements in which there are fewer than two $B$s in one the rows. Hence, the number of admissible arrangements is
$$sum_{k = 4}^{7} binom{7}{k}left[2^k - binom{2}{1}binom{k}{k} - binom{2}{1}binom{k}{k - 1}right]$$
where the term $binom{2}{1}binom{k}{k}$ represents the number of ways we could place all $k$ $B$s in the same row and the term $binom{2}{1}binom{k}{k - 1}$ represents the number of ways we could place all but one of the $B$s in the same row.
Since no $B$ can be in the same column as another $B$ and there must be at least two $B$s in each row, there are at least four columns that contain a $B$. If there are exactly $k$ columns in which a $B$ occurs, there are $binom{7}{k}$ ways of choosing which columns contain a $B$ and $2$ ways of choosing in which row that $B$ appears. From these, we must subtract those arrangements in which there are fewer than two $B$s in one the rows. Hence, the number of admissible arrangements is
$$sum_{k = 4}^{7} binom{7}{k}left[2^k - binom{2}{1}binom{k}{k} - binom{2}{1}binom{k}{k - 1}right]$$
where the term $binom{2}{1}binom{k}{k}$ represents the number of ways we could place all $k$ $B$s in the same row and the term $binom{2}{1}binom{k}{k - 1}$ represents the number of ways we could place all but one of the $B$s in the same row.
edited Nov 23 at 23:31
answered Nov 23 at 22:57
N. F. Taussig
42.9k93254
42.9k93254
Does the last $binom{7}{7}2^7$ include the following arrangement? BBBBBBB AAAAAAA - the second row needs at least 2 B's so I just want to make sure this isn't included
– jerome Williams
Nov 23 at 23:10
Good catch. I have fixed the error.
– N. F. Taussig
Nov 23 at 23:31
Thanks for this! Does this also take out the arrangement BBAAAAA BBAAAAA because we are doing 7 choose 4 (selecting 4 distinct columns)?
– jerome Williams
Nov 23 at 23:53
Also can this be simplified to $sum_{k = 4}^{7} binom{7}{k}left[2^k - 2 - 2*binom{k}{k - 1}right]$ ?
– jerome Williams
Nov 24 at 0:19
Yes, it removes arrangements in which $B$s appear in the same column. The factor of $2^k$ represents the number of ways of choosing the row in which the $B$ is placed in each of those $k$ columns. Making that choice ensures no column contains two $B$s. Subtracting the term $binom{2}{1}binom{k}{k}$ ensures that we do no place all $k$ $B$s in the same row. Subtracting the term $binom{2}{1}binom{k}{k - 1}$ ensures that we remove those cases in which all but one of the $B$s are in the same row.
– N. F. Taussig
Nov 24 at 0:22
|
show 3 more comments
Does the last $binom{7}{7}2^7$ include the following arrangement? BBBBBBB AAAAAAA - the second row needs at least 2 B's so I just want to make sure this isn't included
– jerome Williams
Nov 23 at 23:10
Good catch. I have fixed the error.
– N. F. Taussig
Nov 23 at 23:31
Thanks for this! Does this also take out the arrangement BBAAAAA BBAAAAA because we are doing 7 choose 4 (selecting 4 distinct columns)?
– jerome Williams
Nov 23 at 23:53
Also can this be simplified to $sum_{k = 4}^{7} binom{7}{k}left[2^k - 2 - 2*binom{k}{k - 1}right]$ ?
– jerome Williams
Nov 24 at 0:19
Yes, it removes arrangements in which $B$s appear in the same column. The factor of $2^k$ represents the number of ways of choosing the row in which the $B$ is placed in each of those $k$ columns. Making that choice ensures no column contains two $B$s. Subtracting the term $binom{2}{1}binom{k}{k}$ ensures that we do no place all $k$ $B$s in the same row. Subtracting the term $binom{2}{1}binom{k}{k - 1}$ ensures that we remove those cases in which all but one of the $B$s are in the same row.
– N. F. Taussig
Nov 24 at 0:22
Does the last $binom{7}{7}2^7$ include the following arrangement? BBBBBBB AAAAAAA - the second row needs at least 2 B's so I just want to make sure this isn't included
– jerome Williams
Nov 23 at 23:10
Does the last $binom{7}{7}2^7$ include the following arrangement? BBBBBBB AAAAAAA - the second row needs at least 2 B's so I just want to make sure this isn't included
– jerome Williams
Nov 23 at 23:10
Good catch. I have fixed the error.
– N. F. Taussig
Nov 23 at 23:31
Good catch. I have fixed the error.
– N. F. Taussig
Nov 23 at 23:31
Thanks for this! Does this also take out the arrangement BBAAAAA BBAAAAA because we are doing 7 choose 4 (selecting 4 distinct columns)?
– jerome Williams
Nov 23 at 23:53
Thanks for this! Does this also take out the arrangement BBAAAAA BBAAAAA because we are doing 7 choose 4 (selecting 4 distinct columns)?
– jerome Williams
Nov 23 at 23:53
Also can this be simplified to $sum_{k = 4}^{7} binom{7}{k}left[2^k - 2 - 2*binom{k}{k - 1}right]$ ?
– jerome Williams
Nov 24 at 0:19
Also can this be simplified to $sum_{k = 4}^{7} binom{7}{k}left[2^k - 2 - 2*binom{k}{k - 1}right]$ ?
– jerome Williams
Nov 24 at 0:19
Yes, it removes arrangements in which $B$s appear in the same column. The factor of $2^k$ represents the number of ways of choosing the row in which the $B$ is placed in each of those $k$ columns. Making that choice ensures no column contains two $B$s. Subtracting the term $binom{2}{1}binom{k}{k}$ ensures that we do no place all $k$ $B$s in the same row. Subtracting the term $binom{2}{1}binom{k}{k - 1}$ ensures that we remove those cases in which all but one of the $B$s are in the same row.
– N. F. Taussig
Nov 24 at 0:22
Yes, it removes arrangements in which $B$s appear in the same column. The factor of $2^k$ represents the number of ways of choosing the row in which the $B$ is placed in each of those $k$ columns. Making that choice ensures no column contains two $B$s. Subtracting the term $binom{2}{1}binom{k}{k}$ ensures that we do no place all $k$ $B$s in the same row. Subtracting the term $binom{2}{1}binom{k}{k - 1}$ ensures that we remove those cases in which all but one of the $B$s are in the same row.
– N. F. Taussig
Nov 24 at 0:22
|
show 3 more comments
up vote
1
down vote
I think the simplest way to approach this is to consider the cases "there are exactly $k$ Bs in the top string" for each $k$ separately, and add everything up in the end.
For example, if there are exactly $2$ Bs in the top string, then there are $binom{7}{2}$ ways to choose the top string and $2^5 - 1 - 5$ ways to choose the bottom string (the two positions below the top string's Bs must be As, which leaves $5$ positions, at least two of which must be Bs).
You can continue for "exactly $3$ Bs in the top string," and so on.
This approach yields $$sum_{k=2}^5 binom{7}{k} (2^{7-k} - 1 - (7-k)).$$
I may be missing a more elegant approach though.
add a comment |
up vote
1
down vote
I think the simplest way to approach this is to consider the cases "there are exactly $k$ Bs in the top string" for each $k$ separately, and add everything up in the end.
For example, if there are exactly $2$ Bs in the top string, then there are $binom{7}{2}$ ways to choose the top string and $2^5 - 1 - 5$ ways to choose the bottom string (the two positions below the top string's Bs must be As, which leaves $5$ positions, at least two of which must be Bs).
You can continue for "exactly $3$ Bs in the top string," and so on.
This approach yields $$sum_{k=2}^5 binom{7}{k} (2^{7-k} - 1 - (7-k)).$$
I may be missing a more elegant approach though.
add a comment |
up vote
1
down vote
up vote
1
down vote
I think the simplest way to approach this is to consider the cases "there are exactly $k$ Bs in the top string" for each $k$ separately, and add everything up in the end.
For example, if there are exactly $2$ Bs in the top string, then there are $binom{7}{2}$ ways to choose the top string and $2^5 - 1 - 5$ ways to choose the bottom string (the two positions below the top string's Bs must be As, which leaves $5$ positions, at least two of which must be Bs).
You can continue for "exactly $3$ Bs in the top string," and so on.
This approach yields $$sum_{k=2}^5 binom{7}{k} (2^{7-k} - 1 - (7-k)).$$
I may be missing a more elegant approach though.
I think the simplest way to approach this is to consider the cases "there are exactly $k$ Bs in the top string" for each $k$ separately, and add everything up in the end.
For example, if there are exactly $2$ Bs in the top string, then there are $binom{7}{2}$ ways to choose the top string and $2^5 - 1 - 5$ ways to choose the bottom string (the two positions below the top string's Bs must be As, which leaves $5$ positions, at least two of which must be Bs).
You can continue for "exactly $3$ Bs in the top string," and so on.
This approach yields $$sum_{k=2}^5 binom{7}{k} (2^{7-k} - 1 - (7-k)).$$
I may be missing a more elegant approach though.
answered Nov 23 at 22:47
angryavian
37.7k13180
37.7k13180
add a comment |
add a comment |
up vote
0
down vote
Suppose we initially drop the second condition and ask how many ways there are to arrange 7 A/B's in two rows with at least 2 B's in each row. In one row there are $2^7$ ways to arrange 7 A/B's. In $7$ of these there is only one B and in $1$ there are no B's. So one row can be arranged in $2^7-7-1$ ways, and two rows can be arranged in $N= (2^7-7-1)^2$ ways.
To find the number of these arrangements which satisfy the second condition (no two B's in the same column), we apply the Principle of Inclusion / Exclusion (PIE). Let's say an arrangement has "Property $i$" if column $i$ has two B's, for $i=1,2,3,dots,7$. Let $S_j$ be the number of arrangements with $j$ of the properties, for $j=1,2,3,dots,7$.
The case $j=1$ is a bit special. The single column can be chosen in $binom{7}{1}$ ways. In the first row the remaining columns can be filled in $2^6$ ways, but one of these ways consists of only A's, violating the rule that the row must contain at least two B's. So the letters in the first row can be arranged in $2^6-1$ ways, and similarly for the second row. So
$$S_1 = binom{7}{1}(2^6-1)^2$$
The cases $S_2, S_3, dots , S_7$ are a bit simpler than $S_1$, because when two or more of the columns contain B's, we have automatically satisfied the requirement that each row contain at least two B's. So
$$S_j = binom{7}{j} (2^{7-j})^2$$
for $j = 2,3,4, dots,7$.
Finally, by PIE, the number of arrangements with none of the properties, i.e. the arrangements in which no column contains two B's, is
$$begin{align}
N_0 &= N + sum_{j=1}^7 (-1)^j S_j \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=2}^7 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=0}^7 (-1)^j binom{7}{j} (2^{7-j})^2 - sum_{j=0}^1 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 - (1-4)^7 - 4^7 + 7 cdot 4^6\
end{align}$$
where we have applied the Binomial Theorem in the last line.
add a comment |
up vote
0
down vote
Suppose we initially drop the second condition and ask how many ways there are to arrange 7 A/B's in two rows with at least 2 B's in each row. In one row there are $2^7$ ways to arrange 7 A/B's. In $7$ of these there is only one B and in $1$ there are no B's. So one row can be arranged in $2^7-7-1$ ways, and two rows can be arranged in $N= (2^7-7-1)^2$ ways.
To find the number of these arrangements which satisfy the second condition (no two B's in the same column), we apply the Principle of Inclusion / Exclusion (PIE). Let's say an arrangement has "Property $i$" if column $i$ has two B's, for $i=1,2,3,dots,7$. Let $S_j$ be the number of arrangements with $j$ of the properties, for $j=1,2,3,dots,7$.
The case $j=1$ is a bit special. The single column can be chosen in $binom{7}{1}$ ways. In the first row the remaining columns can be filled in $2^6$ ways, but one of these ways consists of only A's, violating the rule that the row must contain at least two B's. So the letters in the first row can be arranged in $2^6-1$ ways, and similarly for the second row. So
$$S_1 = binom{7}{1}(2^6-1)^2$$
The cases $S_2, S_3, dots , S_7$ are a bit simpler than $S_1$, because when two or more of the columns contain B's, we have automatically satisfied the requirement that each row contain at least two B's. So
$$S_j = binom{7}{j} (2^{7-j})^2$$
for $j = 2,3,4, dots,7$.
Finally, by PIE, the number of arrangements with none of the properties, i.e. the arrangements in which no column contains two B's, is
$$begin{align}
N_0 &= N + sum_{j=1}^7 (-1)^j S_j \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=2}^7 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=0}^7 (-1)^j binom{7}{j} (2^{7-j})^2 - sum_{j=0}^1 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 - (1-4)^7 - 4^7 + 7 cdot 4^6\
end{align}$$
where we have applied the Binomial Theorem in the last line.
add a comment |
up vote
0
down vote
up vote
0
down vote
Suppose we initially drop the second condition and ask how many ways there are to arrange 7 A/B's in two rows with at least 2 B's in each row. In one row there are $2^7$ ways to arrange 7 A/B's. In $7$ of these there is only one B and in $1$ there are no B's. So one row can be arranged in $2^7-7-1$ ways, and two rows can be arranged in $N= (2^7-7-1)^2$ ways.
To find the number of these arrangements which satisfy the second condition (no two B's in the same column), we apply the Principle of Inclusion / Exclusion (PIE). Let's say an arrangement has "Property $i$" if column $i$ has two B's, for $i=1,2,3,dots,7$. Let $S_j$ be the number of arrangements with $j$ of the properties, for $j=1,2,3,dots,7$.
The case $j=1$ is a bit special. The single column can be chosen in $binom{7}{1}$ ways. In the first row the remaining columns can be filled in $2^6$ ways, but one of these ways consists of only A's, violating the rule that the row must contain at least two B's. So the letters in the first row can be arranged in $2^6-1$ ways, and similarly for the second row. So
$$S_1 = binom{7}{1}(2^6-1)^2$$
The cases $S_2, S_3, dots , S_7$ are a bit simpler than $S_1$, because when two or more of the columns contain B's, we have automatically satisfied the requirement that each row contain at least two B's. So
$$S_j = binom{7}{j} (2^{7-j})^2$$
for $j = 2,3,4, dots,7$.
Finally, by PIE, the number of arrangements with none of the properties, i.e. the arrangements in which no column contains two B's, is
$$begin{align}
N_0 &= N + sum_{j=1}^7 (-1)^j S_j \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=2}^7 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=0}^7 (-1)^j binom{7}{j} (2^{7-j})^2 - sum_{j=0}^1 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 - (1-4)^7 - 4^7 + 7 cdot 4^6\
end{align}$$
where we have applied the Binomial Theorem in the last line.
Suppose we initially drop the second condition and ask how many ways there are to arrange 7 A/B's in two rows with at least 2 B's in each row. In one row there are $2^7$ ways to arrange 7 A/B's. In $7$ of these there is only one B and in $1$ there are no B's. So one row can be arranged in $2^7-7-1$ ways, and two rows can be arranged in $N= (2^7-7-1)^2$ ways.
To find the number of these arrangements which satisfy the second condition (no two B's in the same column), we apply the Principle of Inclusion / Exclusion (PIE). Let's say an arrangement has "Property $i$" if column $i$ has two B's, for $i=1,2,3,dots,7$. Let $S_j$ be the number of arrangements with $j$ of the properties, for $j=1,2,3,dots,7$.
The case $j=1$ is a bit special. The single column can be chosen in $binom{7}{1}$ ways. In the first row the remaining columns can be filled in $2^6$ ways, but one of these ways consists of only A's, violating the rule that the row must contain at least two B's. So the letters in the first row can be arranged in $2^6-1$ ways, and similarly for the second row. So
$$S_1 = binom{7}{1}(2^6-1)^2$$
The cases $S_2, S_3, dots , S_7$ are a bit simpler than $S_1$, because when two or more of the columns contain B's, we have automatically satisfied the requirement that each row contain at least two B's. So
$$S_j = binom{7}{j} (2^{7-j})^2$$
for $j = 2,3,4, dots,7$.
Finally, by PIE, the number of arrangements with none of the properties, i.e. the arrangements in which no column contains two B's, is
$$begin{align}
N_0 &= N + sum_{j=1}^7 (-1)^j S_j \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=2}^7 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 + sum_{j=0}^7 (-1)^j binom{7}{j} (2^{7-j})^2 - sum_{j=0}^1 (-1)^j binom{7}{j} (2^{7-j})^2 \
&= (2^7-7-1)^2 - binom{7}{1}(2^6-1)^2 - (1-4)^7 - 4^7 + 7 cdot 4^6\
end{align}$$
where we have applied the Binomial Theorem in the last line.
answered Nov 26 at 21:02
awkward
5,73111022
5,73111022
add a comment |
add a comment |
up vote
0
down vote
Another approach is to solve a more general problem, in which the lengths of the two strings are $r$. The original problem is then the case $r=7$.
Any single column consists of two letters, one of
$$alpha = begin{vmatrix} A\B end{vmatrix} qquad beta = begin{vmatrix}B\A end{vmatrix} qquad gamma = begin{vmatrix} A\A end{vmatrix}$$
An acceptable arrangement of length $r$ is a string of $r$ "characters" taken from $alpha, beta$ and $gamma$ with at least two $alpha$'s and at least two $beta$'s. The exponential generating function for the number of acceptable strings is
$$begin{align}
f(x) &= left( frac{1}{2!} x^2 + frac{1}{3!} x^3 + frac{1}{4!} x^4+ dots right)^2 left( 1 + x + frac{1}{2!} x^2 + dots right) \
&= (e^x-1-x)^2 ; e^x \
&= e^{3x}+e^x+x^2 e^x-2e^{2x}-2xe^{2x}+2xe^x
end{align}$$
From this last expression we can find the coefficient of $(1/7!)x^7$, which is the solution to the original problem:
$$7! ;[x^7] f(x) = 3^7 + 1 + 6 cdot 7 - 2^8 - 7 cdot 2^7 + 2 cdot 7 =1092$$
add a comment |
up vote
0
down vote
Another approach is to solve a more general problem, in which the lengths of the two strings are $r$. The original problem is then the case $r=7$.
Any single column consists of two letters, one of
$$alpha = begin{vmatrix} A\B end{vmatrix} qquad beta = begin{vmatrix}B\A end{vmatrix} qquad gamma = begin{vmatrix} A\A end{vmatrix}$$
An acceptable arrangement of length $r$ is a string of $r$ "characters" taken from $alpha, beta$ and $gamma$ with at least two $alpha$'s and at least two $beta$'s. The exponential generating function for the number of acceptable strings is
$$begin{align}
f(x) &= left( frac{1}{2!} x^2 + frac{1}{3!} x^3 + frac{1}{4!} x^4+ dots right)^2 left( 1 + x + frac{1}{2!} x^2 + dots right) \
&= (e^x-1-x)^2 ; e^x \
&= e^{3x}+e^x+x^2 e^x-2e^{2x}-2xe^{2x}+2xe^x
end{align}$$
From this last expression we can find the coefficient of $(1/7!)x^7$, which is the solution to the original problem:
$$7! ;[x^7] f(x) = 3^7 + 1 + 6 cdot 7 - 2^8 - 7 cdot 2^7 + 2 cdot 7 =1092$$
add a comment |
up vote
0
down vote
up vote
0
down vote
Another approach is to solve a more general problem, in which the lengths of the two strings are $r$. The original problem is then the case $r=7$.
Any single column consists of two letters, one of
$$alpha = begin{vmatrix} A\B end{vmatrix} qquad beta = begin{vmatrix}B\A end{vmatrix} qquad gamma = begin{vmatrix} A\A end{vmatrix}$$
An acceptable arrangement of length $r$ is a string of $r$ "characters" taken from $alpha, beta$ and $gamma$ with at least two $alpha$'s and at least two $beta$'s. The exponential generating function for the number of acceptable strings is
$$begin{align}
f(x) &= left( frac{1}{2!} x^2 + frac{1}{3!} x^3 + frac{1}{4!} x^4+ dots right)^2 left( 1 + x + frac{1}{2!} x^2 + dots right) \
&= (e^x-1-x)^2 ; e^x \
&= e^{3x}+e^x+x^2 e^x-2e^{2x}-2xe^{2x}+2xe^x
end{align}$$
From this last expression we can find the coefficient of $(1/7!)x^7$, which is the solution to the original problem:
$$7! ;[x^7] f(x) = 3^7 + 1 + 6 cdot 7 - 2^8 - 7 cdot 2^7 + 2 cdot 7 =1092$$
Another approach is to solve a more general problem, in which the lengths of the two strings are $r$. The original problem is then the case $r=7$.
Any single column consists of two letters, one of
$$alpha = begin{vmatrix} A\B end{vmatrix} qquad beta = begin{vmatrix}B\A end{vmatrix} qquad gamma = begin{vmatrix} A\A end{vmatrix}$$
An acceptable arrangement of length $r$ is a string of $r$ "characters" taken from $alpha, beta$ and $gamma$ with at least two $alpha$'s and at least two $beta$'s. The exponential generating function for the number of acceptable strings is
$$begin{align}
f(x) &= left( frac{1}{2!} x^2 + frac{1}{3!} x^3 + frac{1}{4!} x^4+ dots right)^2 left( 1 + x + frac{1}{2!} x^2 + dots right) \
&= (e^x-1-x)^2 ; e^x \
&= e^{3x}+e^x+x^2 e^x-2e^{2x}-2xe^{2x}+2xe^x
end{align}$$
From this last expression we can find the coefficient of $(1/7!)x^7$, which is the solution to the original problem:
$$7! ;[x^7] f(x) = 3^7 + 1 + 6 cdot 7 - 2^8 - 7 cdot 2^7 + 2 cdot 7 =1092$$
answered Nov 27 at 18:36
awkward
5,73111022
5,73111022
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3010925%2fcombinatorics-with-just-2-letters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Designating two positions as those reserved for a B over counts those strings with more than two Bs.
– N. F. Taussig
Nov 23 at 22:33
@N.F.Taussig So it should be $sum_{i=1}^{4} binom{5}{5-i}$ ?
– jerome Williams
Nov 23 at 22:43
The number of top strings is $sum_{i = 2}^{7} binom{7}{i}$. Alternatively, if we subtract the number of strings with fewer than two $B$s from the $2^7$ possible strings, we obtain $2^7 - binom{7}{0} - binom{7}{1}$. The tricky part is criterion 2.
– N. F. Taussig
Nov 23 at 22:47
@fleablood There are two rows, each of which must have two $B$s. There cannot be two $B$s in the same column.
– N. F. Taussig
Nov 23 at 22:53