5

I'm trying to solve the following questions:

  1. a) You are given the word "CALENDAR". How many ways can you rearrange the letters with the restriction that 'C' and 'A' must be together?

    b) With the same word "CALENDAR", how many ways can you rearrange the letters with the restriction that 'C' and 'A' must be together and 'N' and 'D' cannot be together?

  2. Given the word "POLYNOMIAL", how many ways can you rearrange the letters such that 'P' is next to 'O' and 'N' and 'M' cannot be together.

My approach for 1. a) was as follows:

Step 1: Group 'C' and 'A' together and substitute them with 'X'. Then, the word becomes "XLENDAR."

Step 2: Calculate the permutations of this pseudo 7-letter word while accounting for the fact that 'X' has two permutations for every appearance ('CA' or 'AC').

Number of permutations of "XLENDAR" = $7! \times 2 = 10,080$.

My confusion here is about the repetition of the letter 'A' in the original word "CALENDAR" and how to deal with it. Consider a sample of the permutations as follows:

A, CA, L, E, N, D, R
AC, A, L, E, N, D, R

This would be double-counting the same permutation if using the formula above, right? How do we deal with this pattern that can appear if the letters 'A' and 'CA' are arranged beside each other as a palindrome? This pattern can shift from the beginning of the word till the end a total of 6 times, so do we subtract 6 from 10,080?

For part b) I grouped 'D' and 'R' together as 'Y' to get XLEYAR. Following the same method as above, I calculated the permutations where 'D' and 'R' do appear together (remembering that both 'X' and 'Y' have 2 permutations each every occurrence).

$6! \times 2 \times 2 = 2880$.

Subtracting these occurrences from the original total should tell me all the permutations that satisfy the condition for 1b). Once again, though, my confusion lies with the repeated 'A' in this calculation.

I've seen some solutions presented as # of permutations $= 10,080 - 2880 = 7200$, but they don't address the repetition in their calculations.

I'd really appreciate some help as I'm not sure where to go from here. Thank you!

N. F. Taussig
  • 76,571
Vulture
  • 53
  • 5
  • 4
    +1 : to your posting. You are right that in part (1a), the $~ (7! \times 2) ~$ computation is wrong, and for the exact reason that you focused on. The easiest remedy is to deduct $~6!,~$ to adjust for the fact that the only situations being over-counted are ...ACA... – user2661923 Apr 03 '23 at 08:43
  • 1
    @user2661923 You should write up your comment as an answer. – N. F. Taussig Apr 03 '23 at 10:55
  • Why not just use a similar method for counting the overcount as the permutations of XLENDR where X represents [ACA]? – Daniel Schepler Apr 03 '23 at 19:52
  • @DanielSchepler See the second bullet point to Lemma-1, in my answer. – user2661923 Apr 03 '23 at 19:58

2 Answers2

2

Here we consider part 1a) and 1b) of the problem. We use PIE the inclusion-exclusion principle to count the number of valid $8$-letter words built from the letters $C,A,L,E,N,D,A,R$.

Part 1a): Valid words must contain string $AC$ or $CA$.

In order to do the job some kind of bookkeeping is helpful. We consider \begin{align*} &\color{blue}{\left(AC\ .\ .\ .\ .\ .\ .\ .|CA\ .\ .\ .\ .\ .\ .\ .\right)}\tag{1}\\ &\quad\color{blue}{-\left(ACA\ .\ .\ .\ .\ .\right)}\tag{2}\\ \end{align*}

Comment:

  • In (1) we count all $8$-letter words which contain either the substring $AC$ or $CA$ where the remaining six characters are indicated by six dots which gives $2\cdot 7!$.

  • In (2) we add words containing $ACA$ as compensation for those which we've counted twice in (1).

  • No more cases are left to consider.

We obtain according to (1) to (2): \begin{align*} 2\cdot 7!-6!=10\,080-720=\color{blue}{9\,360} \end{align*}

Part 1b): Valid words must contain string $AC$ or $CA$ and must not contain $DN$ or $ND$.

Here we consider \begin{align*} &\color{blue}{\left(AC\ .\ .\ .\ .\ .\ .\ .|CA\ .\ .\ .\ .\ .\ .\ .\right)}\tag{1}\\ &\quad\color{blue}{-\left(ACA\ .\ .\ .\ .\ .\right)}\tag{2}\\ &\quad\color{blue}{-\left(AC\ DN\ .\ .\ .\ .|AC\ ND\ .\ .\ .\ .|CA\ DN\ .\ .\ .\ .|CA\ ND\ .\ .\ .\ .\right)}\tag{3}\\ &\quad\color{blue}{+\left(ACA\ DN\ .\ .\ .|ACA\ ND\ .\ .\ .\right)}\tag{4}\\ \end{align*}

Comment:

  • In (1) and (2) we start as we did in problem 1a).

  • In (3) we subtract all occurrences which contains $AC$ or $CA$ and not $DN$ or $ND$.

  • In (4) we compensate double counts from (3) by adding those once again.

  • No more cases are left to consider.

We obtain according to (1) to (4): \begin{align*} 2\cdot7!-6!-4\cdot 6!+2\cdot 5! &=10\,080-720-2\,880+240\\ &=\color{blue}{6\,720} \end{align*}

Problem 2 can be done similarly.

Markus Scheuer
  • 108,315
1
  1. a) You are given the word "CALENDAR". How many ways can you rearrange the letters with the restriction that 'C' and 'A' must be together?
  1. b) With the same word "CALENDAR", how many ways can you rearrange the letters with the restriction that 'C' and 'A' must be together and 'N' and 'D' cannot be together?
  1. Given the word "POLYNOMIAL", how many ways can you rearrange the letters such that 'P' is next to 'O' and 'N' and 'M' cannot be together.

Normally, for a problem of this nature, I would use Inclusion-Exclusion theory to attack each of the three problems. See this article for an introduction to Inclusion-Exclusion. Then, see this answer for an explanation of and justification for the Inclusion-Exclusion formula. Inclusion-Exclusion generalizes well, which makes it a very handy tool to have in your toolbox.

Unfortunately, it would take a very sophisticated intuition to deal with Inclusion-Exclusion, for these problems. Therefore, I will use the alternative attack method of a hybrid of Inclusion-Exclusion with the direct approach. This hybrid approach, will be easier for a student new to Combinatorics to understand.


$\underline{\text{Preliminary Result}}$

Lemma-1
Suppose that you have a multiset of $~(n+2)~$ letters, where one of the letters has a multiplicity of $~2,~$ and each of the other $~n~$ letters are distinct (i.e. have a multiplicity of $~1$).

For example, in the multiset $~\{ ~A,A,C,L,N,D,E,R\},~$ the letter A has a multiplicity of $~2,~$ and the other letters in the multiset are distinct.

Then:

  • The total number of ways of rearranging the letters in the multiset is $~\dfrac{(n+2)!}{2!}.$

  • Assuming that the multiset contains two A's, and one C, the total number of ways of rearranging the letters in the multiset so that the C is together with one of the A's is $~\displaystyle [ ~2 \times (n+1)! ~] - n!.$

Proof

For the first bullet point, let A-1,A-2 represent the multiset element of multiplicity $~2.$ Then, when computing the number of rearrangements of the $~(n+2)~$ elements of the multiset, the computation of $~(n+2)!~$ must be adjusted by the over-counting adjustment factor of $~\dfrac{1}{2!}.~$

This is because otherwise, the rearrangements where A-1 precedes A-2 would be counted as distinct from the rearrangements where A-2 precedes A-1.

For the second bullet point, you can assume that the C and one of the A's have been fused into one unit. So, you now have $~(n+1)~$ distinct units to permute, and the fused unit can be internally permuted in $~(2!)~$ ways.

However, as discussed by the OP (i.e. original poster), this would over-count the rearrangements that have form "...ACA...". If you fuse the A,A, and C elements into an ACA fused unit, you now have $~n!~$ units to permute.

Therefore, the number of over-counted rearrangements that must be deducted, is $~n!.$

Therefore, the computation for the second bullet point is $~\displaystyle [ ~2 \times (n+1)! ~] - n!.$


$\underline{\text{Problem (1a)}}$

Here, you can simply apply the formula from the second bullet point of Lemma-1, with $~n = 6.$

So, the computation is $$[ ~2 \times 7! ~] - 6!$$


$\underline{\text{Problem (1b)}}$

Lemma 1 may be applied to this problem by:

  • Computing the number of ways that C is together with one of the A's.

  • Computing the number of ways that C is together with one of the A's, and the N and D are together.

  • Subtracting the computation in the second bullet point above, from the first bullet point above.

For the first bullet point to problem (1b), the computation has already been done in problem (1a), and is

$$[ ~2 \times 7! ~] - 6!$$

For the second bullet point to problem (1b), re-interpret this bullet point by redefining the original multiset into the multiset $\{ ~\text{A, A, C, L, E, R, X} ~\}, ~$ where the X element symbolizes the fused unit of the N and the D. The only adjustment to this re-interpretation is that the scalar of $~(2!)~$ is needed, since the fused unit of X = ND can be internally permuted in $~2!~$ ways.

Then, the revised multiset has $~(5+2)~$ elements, one of which has multiplicity $~2.$ Therefore, the computation for the second bullet point to problem (1b) is

$$2 \times \left\{ ~ [ ~2 \times (6!) ~] - 5! ~\right\} = (4 \times 6!) - (2 \times 5!).$$

So, the computation for the third bullet point to problem (1b), which represents the answer to problem (1b), is

$$\{ ~[ ~2 \times 7! ~] - 6! ~\} - \left\{ ~(4 \times 6!) - (2 \times 5!) ~\right\} $$

$$= (5!) \times \{ ~[84 - 6] - (24) + 2 \} = 56 \times 5!.$$


$\underline{\text{Problem (2)}}$

The approach taken in Problem (1b) will be repeated. However, first the structure of the two multisets must be compared against each other.

$$\text{\{A,A,C,E,L,R,N,D\}} ~~\text{versus}~~ \text{\{O,O,L,L,P,Y,I,A,M,N\}}.$$

In the expression above, the LHS multiset has $~8~$ elements, where one of the elements has multiplicity $~2.$

In the expression above, the RHS multiset has $~10~$ elements, where two of the elements each have multiplicity $~2.$

The analysis of Lemma-1, and the analysis of the previous section will be adjusted to accommodate the difference in the structure of the two multisets. Similar to the previous problem, problem (2) will be attacked by

  • Computing the number of ways that P is together with one of the O's.

  • Computing the number of ways that P is together with one of the O's, and the M and N are together.

  • Subtracting the computation in the second bullet point above, from the first bullet point above.

For the first bullet point to problem (2), you can reason that the P and one of the O's are fused into the unit X, which may be internally permuted in two ways.

Then, the initial (wrong) computation is $~2 \times ~$ the number of ways of permuting the elements in the multiset $ ~\text{\{X,O,L,L,Y,I,A,M,N\}}, ~$ which is $~\displaystyle 2 \times \frac{9!}{2} = 9!.$

Here, rearrangements of form ...OPO... are over-counted, and must be deducted. Letting Z represent the fused unit OPO, you are deducting the number of ways of permuting the elements in the multiset $ ~\text{\{Z,L,L,Y,I,A,M,N\}}, ~$ which is $~\dfrac{8!}{2!}.~$

Therefore, the computation for the first bullet point of problem (2) is

$$9! - \frac{8!}{2!}.$$

For the second bullet point of problem (2), you can pretend that you are computing the number of ways that the P is next to one of the O's in the multiset $~\text{\{O,O,L,L,P,Y,I,A,W\}},~$ where $~W~$ represents the fused unit $~M,N.~$ The only adjustment to this pretense is that the fused unit W = MN can be internally permuted in $~(2!)~$ ways.

All of the analysis in the first bullet point of problem (2) applies, specifically because the structure of the multiset $~\text{\{O,O,L,L,P,Y,I,A,M,N\}}~$ is the exact same as the structure of the multiset $~\text{\{O,O,L,L,P,Y,I,A,W\}}.$

That is, both multisets have two distinct elements, each of multiplicity $~2.~$ The only difference between the two multisets is that the second multiset has one less element.

So, for the second bullet point to problem (2), the initial (wrong) computation is

$$8! - \frac{7!}{2!}.$$

The only reason that the above computation is wrong is that the fused unit W=MN can be internally permuted in $~(2!)~$ ways.

Therefore, the correct computation to the second bullet point to problem (2) is

$$2 \times \left[ ~8! - \frac{7!}{2!} ~\right] = (2 \times 8!) - 7!.$$

So, the computation for the third bullet point to problem (2), which represents the answer to problem (2), is

$$\left[ ~9! - \frac{8!}{2!} ~\right] - \left[ ~(2 \times 8!) - 7! ~\right]$$

$$= 7! \times [ ~(72 - 4) - (16 - 1) ~] = 53 \times 7!.$$

user2661923
  • 35,619
  • 3
  • 17
  • 39