1

Number of strings that are made of $3$ 'a', $1$ 'b', $2$ 'c' and $2$ 'd' such that $aaa$ does not appear


I tried to first place the other letters such that $bccdd$ then we will have gaps ${\_b\_ c\_ c\_d \_d\_}$ for that we have $1!\cdot 2!\cdot 2!$ I thought to multiply by ${8 \choose 1}\cdot 1! \cdot {7 \choose 2} \cdot 2! \cdot {5 \choose 2 } \cdot 2!$ because of the total number of letters we have but that is already wrong as the correct answer should be $1500$ and this is beyond $1500$

I got stuck here how do I continue after placing the letters, how to place the "a" i thoguht about needing two cases , one for a single "a" and one for "aa"? thanks for any tips and help!

RobPratt
  • 50,938
Adamrk
  • 965
  • 2
    Arrange $bccdd$, obtain $6$ gaps. Count the unrestricted ways to put $3$ identical objects in those gaps. Subtract off the cases where all three go in the same gap. – lulu Feb 06 '23 at 15:04
  • See my answer for the requested alternative approaches, which includes a rehabilitation of your approach. – user2661923 Feb 06 '23 at 21:00

3 Answers3

3

Hint

You can start in the way that you did, but a simpler way is:

  • Count total permutations of all $8$ letters

  • Subtract permutations where $\boxed{AAA}$ is treated as one letter in the now $6$ "letters"

  • is it $8 \choose 3$ $\cdot $ $5\choose 2$ $\cdot$ $3 \choose 2$ $\cdot$ $1 \choose 1$ for all permutations? – Adamrk Feb 06 '23 at 15:58
  • Yes, but why not simply write it as $\Large\frac{8!}{3!2!2!1!}$ – true blue anil Feb 06 '23 at 16:03
  • I am trying to solve in both ways but I seem to get a different answer all the time , can you provide another hint on this way and the way I started please? – Adamrk Feb 06 '23 at 16:13
  • See https://math.stackexchange.com/questions/1759845/how-do-i-calculate-the-number-of-unique-permutations-in-a-list-with-repeated-ele/1759860#1759860 for permutations with repeating letters, and solve it the way I have suggested. Then if "your" way gets a different answer, I'll look at it. – true blue anil Feb 06 '23 at 16:16
  • @Adamrk Per true blue anil's last comment, if you do get a different answer, first, add an Addendum to your posting, where you very carefully, in a very detailed manner, show your work. Then, leave another comment following this answer. Since the comment will be following this answer, true blue anil will automatically be flagged. – user2661923 Feb 06 '23 at 17:27
  • @user2661923 I managed to get the correct answer using anil's method but the way I started it is just not working because I do not know how to , thanks for you help! if you would like to give me an explanation to the other way it would be very helpful if not then also thank you again! I usually put very detailed approaches to my questions but when I do not know what to do then there is nothing much to explain tbh – Adamrk Feb 06 '23 at 17:56
  • 1
    @Adamrk True blue anil's approach is definitely best, for this problem. I have a doctor's appt right now. However, later today, I will provide a separate answer that attacks the problem with the inferior method. After I finish my answer, I will leave you a notification comment. – user2661923 Feb 06 '23 at 17:59
  • @user2661923 Thank you much appreciated! – Adamrk Feb 06 '23 at 18:00
2

As discussed in the comments following true blue anil's answer, this response details methods of attack that are inferior to the method taken by true blue anil.

First of all, just to sanity check true blue anil's method:

  • First, you ignore the constraint against the $~3~$ A's together:

    $\displaystyle \frac{8!}{(3!) \times (1!) \times (2!) \times (2!)} = 1680.$

  • Then you consider the number of ways of violating the constraint against the $~3~$ A's together:

    As indicated in the answer of true blue anil, you construe the $~3~$ A's as being fused into one unit, so now you have $6$ units to distribute.

    $\displaystyle \frac{6!}{(1!) \times (1!) \times (2!) \times (2!)} = 180.$

  • Then, you perform the deduction:

    $1680 - 180 = 1500.$


First, I am going to critique your method. Then, I will show an alternative method of attack that is inferior to true blue anil's method.

$\underline{\text{Critique of Your Method}}$

This is the method that you started.

I tried to first place the other letters such that $bccdd$ then we will have gaps ${\_b\_ c\_ c\_d \_d\_}$ for that we have $1!\cdot 2!\cdot 2!$ I thought to multiply by ${8 \choose 1}\cdot 1! \cdot {7 \choose 2} \cdot 2! \cdot {5 \choose 2 } \cdot 2!$

This approach has two problems:

  • Instead of $\displaystyle {8 \choose 1}\color{red}{\times 1!} \times {7 \choose 2} \color{red}{\times 2!} \times {5 \choose 2 } \color{red}{\times 2!}$

    Your preliminary calculation should be :

    $\displaystyle {8 \choose 1} \times {7 \choose 2} \times {5 \choose 2 } = 1680.$

    The reason is that the $~2~$ C's are indistinguishable from each other. Labeling these letters as C-1 and C-2, having C-1 precede C-2 is the same as having C-2 precede C-1. Similarly, the $~2~$ D's are indistinguishable from each other.

  • With the correction in place, and the preliminary computation at $1680$, the approach fails to consider that you are not allowed to have the $~5~$ characters other than an A be positioned so that they create a gap of three consecutive unused positions.

    This is why the correction to your preliminary computation yields the same answer as the preliminary calculation of true blue anil, $~1680.$

To rehabilitate your method, you would then need to deduct the number of ways of placing the $~5~$ characters other than an A so that they create a gap of three consecutive unused positions.

There are $~6~$ potential starting positions for the gap of three consecutive unused positions, since this gap can begin anywhere between positions $~1~$ through $~6~$ inclusive.

For each of the $~6~$ placements of the gap of three consecutive unused positions, the number of ways of placing the $~5~$ letters other than an A in the $~5~$ remaining positions is:

$\displaystyle \binom{5}{1} \times \binom{4}{2} \times \binom{2}{2} = \frac{5!}{(1!) \times (2!) \times (2!)} = 30.$

Then, the number of sequences that need to be deducted is $~6 \times 30 = 180.$

So, you arrive at the final answer of $~1680 - (6 \times 30) = 1500.$


$\underline{\text{Alternative Method}}$

I am going to use a Stars and Bars approach. For Stars and Bars theory, see this article and this article.

The $~3~$ A's need to be positioned so that they are not all together. Consider the following illustration of placing the $~3~$ A's:

 _A_A_A_

That is, the $~3~$ A's (potentially) create $~4~$ regions; before the first A, and after each of the $~3~$ A's.

Consider the number of solutions to the following problem:

  • $x_1 + x_2 + x_3 + x_4 = 5.$
  • $x_1, x_2, x_3, x_4 \in \Bbb{Z_{\geq 0}}.$

Per Stars and Bars theory, the above problem has
$\displaystyle \binom{5+[4-1]}{4-1} = \binom{8}{3} = 56~$ solutions.

The variables $~x_1, \cdots, x_4~$ represent the size of the respective regions. The only way of violating the constraint against all three A's being together is if $~x_2~$ and $~x_3~$ are both equal to $0$.

This corresponds to the number of solutions to the following problem:

  • $x_1 + 0 + 0 + x_4 = 5.$
  • $x_1, x_4 \in \Bbb{Z_{\geq 0}}.$

Per Stars and Bars theory, the above problem has
$\displaystyle \binom{5+[2-1]}{2-1} = \binom{6}{1} = 6~$ solutions.

Therefore, the total number of ways of placing the $~3~$ A's so that they are not all together is $56 - 6 = 50.$

As discussed in the previous section, for each such satisfying placement of the $~3~$ A's, the number of ways of placing the remaining letters is
$\displaystyle \binom{5}{1} \times \binom{4}{2} \times \binom{2}{2} = \frac{5!}{(1!) \times (2!) \times (2!)} = 30.$

Therefore, the total number of satisfying sequences is

$$(56 - 6) \times 30 = 1500.$$

user2661923
  • 42,303
  • 3
  • 21
  • 46
2

The method described by true blue anil is optimal.

Let's correct your attempt. You wish to first arrange the five letters $b, c, c, d, d$. There are $5$ ways to place the $b$, which leaves $\binom{4}{2}$ ways to place the two $c$s. The two $d$s must be placed in the remaining two positions. Hence, there are $\binom{5}{1}\binom{4}{2}$ such arrangements. Arranging the letters $b, c, c, d, d$ creates six spaces in which to place the three $a$s.
$$\square L_1 \square L_2 \square L_3 \square L_4 \square L_5 \square$$ To ensure that we do not place all three $a$s consecutively, we must either choose three of these six spaces in which to place an $a$ so that no two $a$s are consecutive, which can be done in $\binom{6}{3}$ ways, or choose one of these six spaces in which to place the block $aa$ and one of the five remaining spaces in which to place the remaining $a$ to ensure that exactly two of the three $a$s are consecutive, which can be done in $\binom{6}{1}\binom{5}{1}$ ways. Hence, the number of arrangements of $a, a, a, b, c, c, d, d$ in which not all three $a$s are consecutive is $$\binom{5}{1}\binom{4}{2}\left[\binom{6}{3} + \binom{6}{1}\binom{5}{1}\right]$$

N. F. Taussig
  • 79,074