Alphabetical word ranking (Permutations)

combinatoricspermutations

If all the 7 letter permutations of the word "EXEMPLARY" are ranked in a alphabetical order, what would be the rank of the word "EXAMPLE"

My attempt:-

Words starting with letter "A" =C(7,6) * 6! + C(6,4)*(6!/2!)

words with initials EA C(7,5)*5!
Similarly for EE,EL,EM,EP,ER, therefore a total of = C(7,5) *5!*6

EXAE= C(5,3)*3!

EXAL= C(4,3)*3!

EXAME = C(4,2)*2!

EXAML = C(3,2)*2!

EXAMPE= C(3,1)

EXAMPLE=1

Where am I going wrong , the answer is not matching with the official one given in the textbook

Best Answer

If all the 7 letter permutations of the word "EXEMPLARY" are ranked in a alphabetical order, what would be the rank of the word "EXAMPLE"

A case could be made that this response is defective, because I am not trying to diagnose your approach. Instead, I am offering a procedure that seems easier to me.

The letters can be grouped as

  • Group 1 : E,E
  • Group 2 : (in alphabetical order) A, L, M, P, R, X, Y.

The first thing to note is that if you have $n$ distinct letters to permute, that they can be permuted in $n!$ ways.

On the other hand, if $2$ of the $n$ letters are both E's, then the letters can only be permuted in $~\displaystyle \frac{n!}{2}~$ ways. This follows, because in the $(n!)$ computation, with the 2 E's being indistinguishable, each distinct permutation is counted twice.

I advise working left to right, as if you were going through the dictionary, $1$ letter at a time.

Below, I will let the variable $S_k$ denote the number of words in Stage $k$.


$\underline{\text{Stage 1 : the 1st letter is A}}$

Case 1a: $2$ E's are used.

Then, there are $~\displaystyle \binom{6}{4} = 15~$ ways of selecting the other $4$ letters.

Then, since $2$ E's are involved, there are $~\displaystyle \frac{6!}{2} = 360~$ ways of permuting the $6$ letters.

Therefore,
$S_{1a} = 15 \times 360 = 5400.$

Case 1b: Not both E's are used.

Then, there are $~\displaystyle \binom{7}{6} = 7~$ ways of selecting the $6$ letters.

Then, since $6$ distinct letters follow the A, there are $(6!) = 720~$ possible words.

Therefore,
$S_{1b} = 7 \times 720 = 5040.$

Therefore,

$$S_1 = 5400 + 5040 = 10440.\tag1 $$

As a note of explanation of (1) above, there are $10440$ words that begin with an A. Therefore, (for example) word # 10441 is represented by the word
EAELMPR.


$\underline{\text{Stage 2 : the 1st letter is E and the second letter is not X or Y}}$

The first thing to note here is that even if one of the 6 letters used is the 2nd E, there will still be $(6!) = 720$ permutations possible of the $6$ letters.

This is because one of the E's is locked into the first position, and you are only permuting $6$ other letters, all of which are distinct from each other.

With the X and Y excluded from being the 2nd letter chosen, there are $6$ choices for the 2nd letter.

Then, there are $\binom{7}{5} = 21$ choices for letters $3$ through $7$. Once these $5$ letters are chosen, they can be permuted in $5! = 120$ ways.

Therefore,

$$S_2 = 6 \times 21 \times 120 = 15120.$$


$\underline{\text{Stage 3 : the 1st three letters are EXA and the 4th letter is E or L}}$

There are $2$ choices for the $4$th letter.

Then, there are $\binom{5}{3}$ choices for the remaining $3$ letters.

Then, these remaining $3$ letters can be permuted in $(3!)$ ways.

$$S_3 = 2 \times 10 \times 3 = 60.$$


$\underline{\text{Stage 4 : the 1st 4 letters are EXAM and the 5th letter is E or L}}$

There are $2$ choices for the $5$th letter.

Then, there are $\binom{4}{2}$ choices for the remaining $2$ letters.

Then, these remaining $2$ letters can be permuted in $(2!)$ ways.

$$S_4 = 2 \times 6 \times 2 = 24.$$


$\underline{\text{Stage 5 : the 1st 6 letters are EXAMPE}}$

There are $3$ choices for the 7th letter.

$$S_5 = 3$$.


$\underline{\text{Final Computation}}$

The number of words that appear in the dictionary at or before the word EXAMPEY is

$$S_1 + S_2 + \cdots + S_5 = 10440 + 15120 + 60 + 24 + 3 = 25647.$$

The very next word after EXAMPEY is EXAMPLE.

Therefore, EXAMPLE is word number $25648.$

Related Question