0

Given n objects held by n people, how to find the total number of valid exchanges, where a valid exchange means that all persons hold different objects after the exchange?

eg for 4 objects 1 2 3 4: valid exchanges are:

2 1 4 3

2 3 4 1

2 4 1 3

3 1 4 2

3 4 1 2

3 4 2 1

4 1 2 3

4 3 1 2

4 3 2 1

Therefor the total number of valid exchanges are 9.

VishnuVS
  • 101
  • There are $!n$ such "exchanges" which are more commonly known as derangements. – JMoravitz Jun 28 '19 at 12:18
  • I don't really get it. Why aren't there any configurations where the first one is holding the first object? For example after 4 3 1 2 you could exhange so that the new one is 1 2 4 3 – Matti P. Jun 28 '19 at 12:19
  • what does !n mean, is it the same as n! ? – VishnuVS Jun 28 '19 at 12:19
  • 1
    No, $!n$ is not the same as $n!$. Read the link I posted in my comment above for the wikipedia article or read the answers in the linked post that I closed this as a duplicate of. Reading the word aloud, $!n$ is read as "n subfactorial" which is different than $n!$ which is "n factorial." The notation $!n$ is used to notate the solution to exactly the problem you are asking to count. Methods of actually calculating the values are given again in both links I provided. – JMoravitz Jun 28 '19 at 12:21
  • @MattiP. it is not a sequence, these are the possible exchanges after 1 2 3 4. 1 2 4 3 is not poossible because 1 and 2 are with the same person. – VishnuVS Jun 28 '19 at 12:21
  • @MattiP. you should read the links as well. Derangements are permutations with no fixed points. That is to say, if $\pi$ is a permutation it is a derangment iff $\pi(i)\neq i$ for all $i$. Of course, compositions of derangements are not necessarily going to be derangements themselves (though they could be). – JMoravitz Jun 28 '19 at 12:25
  • @JMoravitz thank you. – VishnuVS Jun 28 '19 at 12:27
  • Okay I guess I misunderstood the problem statement. – Matti P. Jun 28 '19 at 12:28

0 Answers0