Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Combinatorics - Number of Derangements of The Word BOTTLE - Mathematics Stack Exchange

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

Mathematics Stack Exchange is a Anybody can ask a question


question and answer site for people
studying math at any level and
professionals in related fields. It only Anybody can answer
takes a minute to sign up.

Sign up to join this community The best answers are voted up


and rise to the top

Number of Derangements of the word BOTTLE


Asked 5 years, 5 months ago Modified 1 year, 2 months ago Viewed 6k times

I am wondering how to calculate the number of derangements for the word BOTTLE. I
understand how to actually do the formula for derangements already. My issue is what do
10 you do with repeated letters. Obviously, I will be over counting if I do the typical formula.
Makes me think it is the number of derangements with the letter T in their original space,
but I am not sure. Can anyone help, as I am wondering if I am supposed to use PIE to solve
this. Thanks.
10

combinatorics combinations inclusion-exclusion extremal-combinatorics derangements

Share Cite Follow edited Jun 23, 2021 at 8:07 asked Mar 16, 2017 at 5:49
Martin Sleziak Washington state one
50.2k 18 170 359 3 9
344

Inclusion-exclusion certainly seems like the most convenient approach to me. – JMoravitz Mar
16, 2017 at 5:52

1 my only issue is, if i use inclusion exclusion, what are my sets? this seems like the logical
approach but I do not know what I am over counting or undercounting
–  Washington state one Mar 16, 2017 at 6:15

4 Answers Sorted by: Highest score (default)

https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle Página 1 de 9
combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

The following answer is quite long but introduces a general method for solving problems
of this kind.
15
The answer to your question can be stated very succinctly as


1
2! ∫0
𝑒−𝑥 (𝑥 − 1)4 (𝑥2 − 4𝑥 + 2) 𝑑𝑥 = 84 (*)

But how do we get there?

An amazingly versatile approach which encompasses problems of permutations with


restricted positions is that of rook polynomials.

The first step is to re-frame the whole problem in terms of a 2-dimensional array called a
"chess-board" or just a "board". Along the top and the side of the board are the objects
(which are temporarily made distinct) to be permuted.

On the board we will place non attacking, identical "rooks" which specify a permutation.
We can then cater for our restrictions on position by greying out forbidden squares. This
collection of grey squares forms what is called the forbidden subboard.

Instead of explaining further consider how the board for your problem would look

https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle Página 2 de 9
combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

𝐁 𝐎 𝐓1 𝐓2 𝐋 𝐄

T1

T2

Along the top are your letters in their original positions and along the side are the letters to
be permuted, we will position 6 rooks, 1 in each row avoiding grey squares.

We place rooks so the horizontal positions of rooks in each row give the new location for
the letter of that row. The greyed out "forbidden" squares clearly prevent letters from being
placed in their original locations, and in the case of the two Ts neither is allowed in their
own original position or that of their twin. for example the following arrangement of rooks

https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle Página 3 de 9
combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

𝐁 𝐎 𝐓1 𝐓2 𝐋 𝐄

B !
O !
T1 !
T2 !
L !
E !
represents the valid permutation

Original positions 𝐁 𝐎 𝐓1 𝐓2 𝐋 𝐄
Permutation L E B O T1 T2

Okay, now that we have set up our board, how can we use it to count our valid
permutations?

We need to talk about rook polynomials

A standard rook polynomial is really quite a simple idea, if we have some chess board of any
configuration then the rook polynomial for that board

𝑅(𝑥) = 1 + 𝑟1 𝑥1 + 𝑟2 𝑥2 + … + 𝑟𝑘 𝑥𝑘 + … + 𝑟𝑛 𝑥𝑛

lists the number of ways 𝑟𝑘 that 𝑘 non-attacking rooks can be placed on it. Note that 𝑛 is
the smallest dimension of the board.

For square boards of dimension 𝑛 it is easy to verify that

∑ (𝑘)
𝑛 2
𝑛
𝑅(𝑥) = 𝑘! 𝑥𝑘
𝑘=0

https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle Página 4 de 9
combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

by arguing that we may choose 𝑘 rows in which to place 𝑘 rooks in (𝑛𝑘) ways, then order
those 𝑘 rooks (each in a different row) in 𝑛 columns in (𝑛𝑘)𝑘! ways.

You can see that your forbidden subboard is composed of four 1 × 1 square boards and one
2 × 2 square board and that these boards are all disjunct (that is: they have no common
rows or columns).

Each 1 × 1 board has rook polynomial

1+𝑥

and the 2 × 2 board has rook polynomial

1 + 4𝑥 + 2𝑥2

Without too much effort we can see that if we have two disjunct boards ℬ1 and ℬ2 or
subboards then multiplying their rook polynomials gives the rook polynomial of the union
of the two boards

𝑅ℬ1 (𝑥)𝑅ℬ2 (𝑥) = 𝑅ℬ1 ∪ℬ2 (𝑥)

So the rook polynomial for your entire forbidden subboard is

𝑅𝒮 (𝑥) = (1 + 𝑥)4 (1 + 4𝑥 + 2𝑥2 )

Now, once we have our rook polynomial for the forbidden subboard we want to use it to
count the ways in which our rooks can be placed so that none are on it.

This is where inclusion-exclusion comes in. If we define the sets of rook placements

𝐴𝑘
= rook placements where the rook in row 𝑘 is on the forbidden subboard

For a general forbidden subboard 𝒮ℊ with 𝑛 rows (≤ number of columns ) and rook
polynomial

𝑛
𝑟𝑘 𝑥𝑘

𝑅𝒮ℊ (𝑥) = (1)
𝑘=0

Then we have that the number of placements of rooks so that none of the rooks are on the
subboard is:

|(𝐴1 ∪ 𝐴2 ∪ … ∪ 𝐴𝑛 )′ | =

(
𝑛−1
𝑛! − | 𝑖| − | ∩ | + … + (−1
https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle
1 2 | 1 ∩ 2
Página 5 de 9
combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

(∑
|𝐴𝑖1 ∩ 𝐴𝑖2 | + … + (−1)𝑛−1 |𝐴1 ∩ 𝐴2

𝑛! − |𝐴𝑖 | −
𝑖 𝑖1 <𝑖2

)
∩ … ∩ 𝐴𝑛 |

Where we can see that


|𝐴𝑖 | = 𝑟1 (𝑛 − 1)!
𝑖


|𝐴𝑖1 ∩ 𝐴𝑖2 | = 𝑟2 (𝑛 − 2)!
𝑖1 <𝑖2

|𝐴1 ∩ 𝐴2 ∩ … ∩ 𝐴𝑛 | = 𝑟𝑛 (𝑛 − 𝑛)!

We can also see that (since 𝑟0 = 1 )

𝑛! = 𝑟0 (𝑛 − 0)!

so

|(𝐴1 ∪ 𝐴2 ∪ … ∪ 𝐴𝑛 )′ | =

𝑟0 (𝑛 − 0)! − 𝑟1 (𝑛 − 1)! + 𝑟2 (𝑛 − 2)! − …


+ (−1)𝑛 𝑟𝑛 (𝑛 − 𝑛)!
𝑛
(−1)𝑘𝑟𝑘(𝑛 − 𝑘)!

=
𝑘=0

This can be compared with the rook polynomial (1) for 𝒮ℊ so that all we need to do is
replace each 𝑥𝑘 with (−1)𝑘 (𝑛 − 𝑘)! . This is quite an acceptible way of calculating and if you
do this with your example you get

(1 + 𝑥)4 (1 + 4𝑥 + 2𝑥2 ) = 1 + 8 𝑥 + 24 𝑥2 + 36 𝑥3 + 29
𝑥4 + 12 𝑥5 + 2 𝑥6
⟹ |(𝐴1 ∩ 𝐴2 ∩ 𝐴3 ∩ 𝐴4 ∩ 𝐴5 ∩ 𝐴6 )′ |

= 6! − 8 ⋅ 5! + 24 ⋅ 4! − 36 ⋅ 3! + 29 ⋅ 2! − 12 ⋅ 1! + 2 ⋅ 0!
= 168

remembering the two T's are actually identical we divide by 2! to give 84 .

https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle Página 6 de 9
combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

To make this answer look like the one at the top we note that by modifying the rook
polynomials so that we have

(𝑥 − 1)4 (𝑥2 − 4𝑥 + 2) instead of (1 + 𝑥)4 (1 + 4𝑥 + 2𝑥2 )

Then multiplying these modified polynomials out gives

(𝑥 − 1)4 (𝑥2 − 4𝑥 + 2) = 𝑥6 − 8 𝑥5 + 24 𝑥4 − 36 𝑥3 + 29
𝑥2 − 12 𝑥 + 2

so that all we need to do to get our inclusion-exclusion formula is replace each 𝑥𝑘 with 𝑘! .
Well if we remember

∫0
𝑒−𝑥 𝑥𝑘 𝑑𝑥 = 𝑘!

For non-negative integer 𝑘 , then (*) follows immediately.

There is an excellent rook polynomial solver that will output both the standard rook
polynomial and the number of rook placements that avoid the user defined subboard.

For more on rook polynomials an Internet search will yield a plethora of results or for a
good book see John Riordan's Introducton to Combinatorial Analysis in which he devotes 2
whole chapters to the topic.

Share Cite Follow edited Mar 28, 2017 at 10:32 answered Mar 16, 2017 at 17:32
N. Shales
3,533 1 12 17

There are ⌊ 6!
𝑒 ⌋
= 265 derangements of a 6-element set, but applying that formula to the
letters of "BOTTLE" has two problems:
7
1. Some of these "derangements" move the T in the fourth position to the third position,
or vice versa, or both, so once we take that into account, they're no longer actual
derangements.

2. Of the valid derangements, each is counted twice: if you switch the two T's, that's a
different permutation of a 6 -element set, but shouldn't be a different derangement of
the letters of "BOTTLE".

We begin by fixing the first problem. There are three cases:

The false derangement actually swaps the two T's. This case is in bijection (by

https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle Página 7 de 9
combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

swapping the two T's) with permutations that fix both T's and derange everything else,
so there are ⌊ 4!
𝑒 ⌋ = 9 of these.

The false derangement moves the first T to the second T's place, and the second T to
somewhere other than the first T's place. This case is in bijection (by swapping the two
T's) with permutations that fix the second T and derange everything else, so there are
⌊ 𝑒 ⌋ = 44 of these.
5!

Same as the previous case, but with the second T going to the first T's place; also 44 of
these.

This leaves us with 265 − 44 − 44 − 9 = 168 actual derangements.

The second problem is easy to fix; now we can divide by 2 and get 84 as our final answer.

(I also cheated and confirmed this by brute force in Mathematica.)

Share Cite Follow answered Mar 16, 2017 at 6:52


Misha Lavrov
116k 10 106 197

@Mischa Lavrov Do you think you can provide me the mathematica code for this?
– Itsnhantransitive Oct 17, 2018 at 2:51

1 s = Characters["BOTTLE"]; StringJoin @@@ Select[Permutations[s],


Inner[Unequal, s, #, And] &] prints all 84 solutions. – Misha Lavrov Oct 17, 2018 at
3:33

1 Another way to make the Select statement work is Select[Permutations[s],FreeQ[s-


#,0]&] . – Misha Lavrov Oct 17, 2018 at 3:35

@Mischa Lavrov Wow thank you so much! Just out of curiosity, how did you come up with this
code? – Itsnhantransitive Oct 17, 2018 at 4:42

Many years of Mathematica usage. Permutations[s] gives us all the permutations, and then
we Select the ones that are derangements. The second way to test it is cute: we subtract s
(which has the characters of "BOTTLE") from a permutation of s , pointwise, and see if we get a
0 anywhere (which means we subtracted a letter from itself, so it's not a dreangement).
– Misha Lavrov Oct 17, 2018 at 4:56

Choose two valid locations for the letters 𝑇 , (42) ways. The letters that started at those
locations are "free", the other two are "unfree".
4
Choose a location for the first unfree letter from the the 3 available to it. Two cases:

choose one of the two 𝑇 start positions, in which case the other unfree letter has only

https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle Página 8 de 9
combinatorics - Number of Derangements of the word BOTTLE - Mathematics Stack Exchange 01/09/2022 21:28

two choices, or

choose the other unfree letter start position, in which case that letter is free.

Remaining 𝑛 free letters go as 𝑛! .

Over all we have (42)(2 ⋅ 2 ⋅ 2! + 1 ⋅ 3!) = 6 ⋅ (8 + 6) = 84 .

Steampunk Solutions Inc

Share Cite Follow edited Mar 16, 2017 at 20:40 answered Mar 16, 2017 at 18:19
Joffan
38.6k 5 42 80

There are four letters other than the 𝑇 s. Thus there are 4 ⋅ 3 = 12 choices for what to put
4!
under the two 𝑇 s. There are = 12 ways to arrange the remaining 4 letters (of which 2
0 2!
are identical) in the four remaining slots, but the two non 𝑇 s are in danger of being put in
3!
their original positions. There are = 3 ways of putting the first of them (or the second)
2!
2!
into its original position, and = 1 way of putting both in their original positions. Thus
2!
the answer is 12(12 − 3 − 3 + 1) = 84 .

Share Cite Follow answered Jun 19, 2021 at 4:59


Muralidharan
617 4 7

https://math.stackexchange.com/questions/2188975/number-of-derangements-of-the-word-bottle Página 9 de 9

You might also like