There are 4 letters with their 4 corresponding envelopes, along with 2 extra envelopes not bearing any letter. In how many ways can these letters be deranged? If A) the two extra envelopes are identical. B) the two extra envelopes are distinct.
I was able to solve part (B) using inclusion-exclusion, but my attempt for part (A) yielded wrong result.
My attempt:
Case 1: when no extra envelope is used then number ways is $D_4$.
Case 2: when 1 of the identical extra envelope is used then number of ways is $D_5$. (By assuming dummy letter for the extra envelope.)
Case 3: when both extra envelopes are used, then number of ways is same as : $ 4C2 •( 1+ 2C1•2C1 + 2!) $
EXPLANATION of case 3 : choosing 4 letters of the 2 identical envelopes (let A and B) and placing them there, then either exchanging the other two letters (let C and D) of their envelopes, Or choosing 1 out of C and D and placing them in one out of A's or B's envelope, Or placing C or D in A's or B's envelope in 2 ways.
Apparently, my answer is wrong. Can you help?
Given my interpretation of the problem, your answer is correct and I agree with your logic and would have done it in almost the same way (opting to use inclusion instead for case 3)
This is verified by the following quick and dirty javascript implementation:
The idea behind the code being that to account for the two blank envelopes being indistinguishable we can account for this by ensuring the labels of the contents being written in increasing order, and the two dummy blank letters being indistinguishable by their positions occurring in increasing order. Otherwise, the fact that it is a derangement is in checking the positions of the first four letters not being in their respective original envelopes.
It is, as mentioned, a bit dirty... but it confirms an answer of $95$. The list of valid derangements begins:
keeping in mind that here we are treating $5$ and $6$ as identical and the last two positions as indistinguishable