Possible number of permutations with constraints

combinatoricspermutations

We have $5$ objects: A,B,C,D,E.

The number of permutation possible is $5!$.

But I have some constraints:

  • The first and the last position can only be occupied by A, B or C

  • There can be a repetition at the end of A, B, C
    (for example A, B, C, D, E, A)

To resume: If A,B,C are entry or exit points (considering it's a chain), how many possible chains are possible?

EDIT:
Thanks lulu, rules indeed are those:
To be clear, the rules I am guessing are: either you have a string of length 5 or length 6. The first type are just permutations of your five letters. The second type has a redundant A,B,C at the end. In both cases we require that the first and last character be one of A,B,C

Best Answer

There are two cases. If the string is of length $5$, so a permutation of ABCDE starting and ending with A, B or C, there are $3$ possibilities for the first letter. For each of these there are $2$ possibilities for the last letter. Now for each permutation of first and last letter there are $3!$ ways to arrange the middle three letters, giving $3\times2\times 3!$.

For the strings of length $6$ there are $3$ choices for the first letter and $3$ for the last letter (since these may be the same). Now the remaining letters are the four missing letters if the first and last are the same; otherwise they are the three missing letters plus another copy of the last letter. In either case there are four different letters to arrange in the middle, so $4!$ possibilities.

Overall, there are $3\times2\times 3!+3\times3\times4!$ suitable strings.

Related Question