4

I am at a loss about how to do this

How many ways are there to arrange the letters DECIDED so that at least one pair of consecutive letters are the same (i.e. ‘3rd and 4th letter match’ or ‘5th and 6th letter match’, etc.)

I know that it would be 7!/3!2! for the total number of arrangements but that is over counting.

I was thinking about doing there are 6 legal pairs (de ec ci id de ed) and therefore 6 spots. I was thinking of treating this like a married couple question. Pick one of the 6 pairs and lay it down in one of the six places. There is only 1 spot that is legal for it to go. Therefore there are five options for it to go somewhere else. I was thinking of using PIE to solve it

Place one of the 6 pairs down in one of the 5 incorrect places, but then that would still be over counting which then it would 6 choose 2 and so on, but then I saw this wasnt going to work very well.

xxxxxxxxx
  • 13,688
  • Subtract the number of arrangements which have no consecutive letters that are the same from the total number of arrangements. – N. F. Taussig Apr 25 '17 at 01:55
  • 3
    I didn't downvote, but the reason this happens is because you haven't volunteered any of your own attempts or been specific about the kind of method you are expecting to use. The usefulness of the answers you get depend heavily on these things so it really does pay you to be a little more detailed with the question. – N. Shales Apr 25 '17 at 02:41
  • 1
    Please put the context of the question back, it may duplicate but please allow the mathSE community to decide. Several users have put quite a lot of effort in to helping you and now the answers don't make sense. I suggest you now accept an answer (I submit N.F. Taussig for this) – N. Shales Apr 25 '17 at 16:58

4 Answers4

7

We count arrangements with at least one pair of consecutive identical letters.

One pair of consecutive letters:

A pair of consecutive D's: This gives us six objects to arrange, namely DD, D, E, I, C. They can be arranged in $$\binom{6}{2}4! = \frac{6!}{2!4!} \cdot 4! = \frac{6!}{2!} = 360$$ ways since we choose two positions for the E's, then arrange the four distinct objects in the remaining positions.

A pair of consecutive E's: This gives us six objects to arrange, namely D, D, D, EE, I, C. They can be arranged in $$\binom{6}{3}3! = \frac{6!}{3!3!} \cdot 3! = \frac{6!}{3!} = 120$$ ways since we choose three positions for the D's, then arrange the three distinct objects in the remaining positions.

Two pairs of consecutive letters:

Two pairs of consecutive D's: This gives us five objects to arrange, namely DDD, E, E, I, C. They can be arranged in $$\binom{5}{2}3! = \frac{5!}{2!3!} \cdot 3! = \frac{5!}{2!} = 60$$ ways.

One pair of consecutive D's and one pair of consecutive E's: This gives us five objects to arrange, DD, D, EE, I, C. Since each object is distinct, they can be arranged in $$5! = 120$$ ways.

Three pairs of consecutive letters:

Two pairs of consecutive D's and one pair of consecutive E's: This gives us four objects to arrange, namely DDD, EE, I, C. Since each object is distinct, they can be arranged in $$4! = 24$$ ways.

By the Inclusion-Exclusion Principle, the number of arrangements of DECIDED with at least one pair of consecutive letters is $$360 + 120 - 60 - 120 + 24 = 324$$

N. F. Taussig
  • 79,074
3

Here is the answer:

$$\frac{7!}{3!2!}-\int_{0}^{\infty}e^{-t}t^2\left(\frac{1}{6}t^3-t^2+t\right)\left(\frac{1}{2}t^2-t\right)\,\mathrm{d}t=324\tag{Answer}$$

Instead of writing a separate explanation here I will reference my somewhat extensive answer to this question which you should definitely read in order to understand this answer.

In essence I have calculated the number of ways to arrange those letters so that there are no consecutive identical letters (this is the $\smash{\int_{0}^{\infty}e^{-t}t^2\left(\frac{1}{6}t^3-t^2+t\right)\left(\frac{1}{2}t^2-t\right)\,\mathrm{d}t}$ term) and then I have subtracted this from the total arrangements of those letters $7!/(2!3!)$.

[Edited: missed out a $t^2$ in the integral]

[Edit 2: This is the only way I can currently think of to solve the problem. At the very least it is a good check. The method derived in the link is very powerful for these kinds of "consecutive letter" type problems.]

N. Shales
  • 3,833
  • Please check your calculations against mine. I found $104$ arrangements in which no two consecutive letters are identical, which yields an answer of $420 - 104 = 316$ arrangements in which at least two consecutive letters are identical. – N. F. Taussig Apr 25 '17 at 03:28
  • @N.F.Taussig There are 324. I checked this by computer. – Sera Gunn Apr 25 '17 at 03:34
  • @T.Gunn, thank you for confirming. If you have time maybe you'd like to post the code you used as an answer that way others may find it useful. – N. Shales Apr 25 '17 at 03:39
  • Do you see where I over counted the arrangements in which no two consecutive letters are identical? – N. F. Taussig Apr 25 '17 at 03:42
  • @N.F.Taussig, I have checked with my method in the link and can't find anything wrong. I will have a look at your method as you ask. – N. Shales Apr 25 '17 at 03:42
  • 1
    @N.F.Taussig, With your count for DDEDE, DEDDE, EDDED, EDEDD you place either C or I between the D's then the other of C and I in $7$ spaces, but I believe it should be $6$ because when they are both between the D's you will over count with $7$ i.e. you will count ... D I C D ... by placing I first then C and again by placing C first then I. If we insist that they appear left to right between the Ds in the order they were placed then we can avoid this over-count but it reduces our $7$ to $6$ giving $4\cdot 2\cdot 6=48$, $42+48+6=96 \implies \frac{7!}{2!3!}-96=324$. – N. Shales Apr 25 '17 at 04:02
  • 1
    Good observation. I ended up using the Inclusion-Exclusion Principle to confirm your answer. – N. F. Taussig Apr 25 '17 at 04:08
3

The number of arrangements in which at least two adjacent letters are identical is found by subtracting the number of arrangements in which no consecutive letters are identical from the total number of arrangements.

We count the number of arrangements in which no two consecutive letters are identical.

There are $\binom{5}{3} = 10$ arrangements of three D's and two E's. They are $$\color{red}{DDDEE}, DDEDE, DDEED, DEDDE, DEDED, DEEDD$$ $$EDDDE, EDDED, EDEDD, \color{red}{EEDDD}$$ We must insert C and I in these arrangements in such a way that no two consecutive letters are identical, which is impossible for the two arrangements marked in red since three pairs of identical letters must be separated and we have just two letters left to use as separators.

Consider the sequence DEDED. No two consecutive letters are the same. We can insert C in one the six spaces indicated by a square $$\square D \square E \square D \square E \square D \square$$ That gives us a sequence of six letters, which creates seven spaces in which to insert the I, yielding $6 \cdot 7 = 42$ possible arrangements.

Consider the sequences DDEDE, DEDDE, EDDED, EDEDD. Each of these four sequences has one pair of adjacent letters which are identical.

We must separate them in one of two ways.

  1. We put both C and I between the two D's, which we can do in $2! = 2$ ways.
  2. We put exactly one of the letters C or I between two D's. This creates a six letter sequence such as D*DEDE, where the star marks the location of the C or I. We can then place the remaining letter in one of the five spaces indicated by a square.
    $$\square D*D\square E \square D \square E \square$$ Thus, there are $2 \cdot 5 = 10$ ways to do this.

In each of the four cases, there are $2 + 2 \cdot 5 = 12$ possible arrangements, for a total of $4 \cdot 12 = 48$ cases.

My thanks to @N.Shales for helping me with this case.

Consider the sequences DDEED, DEEDD, EDDDE. Each of these three sequences has two pairs of adjacent identical letters. We must separate them by inserting either a C or an I between the leftmost pair of adjacent identical letters then inserting the other letter between the remaining pair of adjacent identical letters. In each of the three cases, there are $2 \cdot 1$ possible arrangements, for a total of $3 \cdot 2 \cdot 1 = 6$ cases.

In total, there are $42 + 48 + 6 = 96$ arrangements in which no two adjacent letters are identical. Hence, there are $$\frac{7!}{3!2!} - 104 = 420 - 96 = 324$$ arrangements of the letters of the word DECIDED in which at least two consecutive letters are identical.

N. F. Taussig
  • 79,074
3

Posting this by request.

The basic way to do this by computer (i.e. without being clever) is

  1. Generate all possible permutations of [d,e,c,i,d,e,d];

  2. remove duplicate permutations;

  3. select those arrangements that have a repeated letter;

  4. count.

In Mathematica, you can do this as follows

HasRepetition[L_List] :=
    Fold[Or, False, Table[L[[i]] == L[[i + 1]], {i, 1, Length[L] - 1}]]

Length[
   Select[
      DeleteDuplicates[
         Permutations[StringSplit["decided", ""]]
   ], HasRepetition]
] (* Result: 324 *)
Sera Gunn
  • 27,981