Cards and envelopes permutation problem

In summary, the conversation discusses the problem of placing six cards in six envelopes, with each envelope containing one card and no card being placed in the envelope bearing the same number. It is also mentioned that card #1 must always be placed in envelope #2. The number of ways this can be done is discussed, with the equations and formulas for permutations being mentioned. A smarter approach is suggested, and it is revealed that the answer is 53. The conversation also mentions the concept of derangement and the principle of inclusion and exclusion.
  • #1
Raghav Gupta
1,011
76

Homework Statement


Six cards and six envelopes are numbered 1,2,3,4,5,6 and cards are to be placed in envelopes so that each envelope contains exactly one card and no card is placed in the envelope bearing the same number and moreover the card numbered 1 is always placed in envelope numbered 2. Then the number of ways it can be done is
264
265
53
67

Homework Equations


There are many permutations formulas. Some say to learn it not telling the reason behind it.

The Attempt at a Solution


I think here some formula is applicable of degenerate theorem of permutation but what is the intuition behind it?
It is better to analyse a formula before applying it anywhere.
 
Physics news on Phys.org
  • #2
Hello Raghav.

No general formulas here.

But your part so far has only been to reproduce the problem statement.
No equations, no effort. Just some musing. Not good enough by PF standards ! And I know you can do better !

You'll have to do some thinking !
 
  • #3
Okay,
So since card 1 is placed in envelope number 2. It is fixed,
so we have 5 envelopes and 5 cards left in which we can do some arrangements.
Envelopes are 1, 3,4,5,6
And cards 2,3,4,5,6.
Now same card can't go in same envelope and one envelope must contain one card.
Suppose we put 2 card in 1 envelope, then 3rd in 4 etc. so many cases!
Also nCr = n!/(n-r)!r!
 
  • #4
Very good. Card 1 into envelope 1 can only be done 1 way.

You have an equation that tells you the number nCr of ways to make a group of size r from n items.
You can learn it by heart or you can understand it:
For the first member of the group you have n choices
For the 2nd member of the group you have n-1 choices
For the 3rd member of the group you have n-2 choices
...
For the r th member of the group you have n-r + 1 choices

Product is n!/(n-r)!
But you have overcounted by the number of ways to order r items, so a factor 1/r!​
But in this exercise you only put one card in one envelope, so not much use for your formula ?

Number of ways to order your five remaining cards is only 5! Which already eliminates half of your answer options!
There are more conditions to fulfil, so 120 isn't one of the answers (but 67 + 53 = 120 !).

For the rest of the cards, card #2 can go in five places, but the others can't go into their own envelope, only in four places.

So there's a distinction between #2 in envelope 1 and #2 in one of the other envelopes. Those last four should each give the same number of possibilities, so you only have to find that number for e.g. #2 in envelope 3. Still work, but not that much any more. And who knows, you discover a smarter way !

(I cheated, so I know the answer now...)
 
  • #5
Yeah, there was a pattern.
When I place #2 in 1st envelope I get 9 ways.
When I place #2 in other envelopes for example in 3 , I get 11 ways. Now placing that in 4 we will get same ways, till 6th envelope. So 4*11 = 44.
Total ways = 44 + 9 = 53.
Thanks BvU. ( You have been helpful to me in many threads ).
Now how we can apply it to larger number of cards?
And what was your cheating?
 
  • #6
Well done !
I think a larger number of cards would be just as messy.
My cheating was that I simply made the list of 120 numbers (in Excel ?:) ) and checked which ones qualified and which ones didn't ...
There's even a name for that method: it's called brute force :wink:
 
  • Like
Likes Raghav Gupta
  • #7
This is an example of a derangement. You can apply the principle of inclusion and exclusion.
Forget the '1 goes in 2' constraint for the moment.
The total permutations are n! From that, we need to subtract those where 1 goes in 1, (n-1)!, and similiarly for 2 in 2 etc., giving n!-(n-1)!n. But we've subtracted the 1 in 1 and 2 in 2 twice, so we need to add those back in, and similarly the other pairs: +(n-2)!*n(n-1)/2. Continuing this process we get n!-n!+n!/2!-n!/3!... = n!(1/0!-1/1!+1/2!-1/3!...1/n!). In the limit, that tends to n!/e. Note that if we take it to be exactly n!/e then the error is O(1/n), so we can cheat by simply rounding n!/e to the nearest integer. For n=6, 264.8 or so rounds to 265.

Now to bring in the 1 goes in 2 constraint. I'll pose that as an exercise: what does that constraint do to the 265?
 
  • #8
haruspex said:
The total permutations are n! From that, we need to subtract those where 1 goes in 1, (n-1)!, and similiarly for 2 in 2 etc., giving n!-(n-1)!n. But we've subtracted the 1 in 1 and 2 in 2 twice, so we need to add those back in, and similarly the other pairs: +(n-2)!*n(n-1)/2. Continuing this process we get n!-n!+n!/2!-n!/3!... = n!(1/0!-1/1!+1/2!-1/3!...1/n!). In the limit, that tends to n!/e. Note that if we take it to be exactly n!/e then the error is O(1/n), so we can cheat by simply rounding n!/e to the nearest integer. For n=6, 264.8 or so rounds to 265.

Now to bring in the 1 goes in 2 constraint. I'll pose that as an exercise: what does that constraint do to the 265?
I'm not understanding this proof correctly.In that bold part how we have subtracted 1 in 1 and 2 in 2 twice?
 
  • #9
Raghav Gupta said:
I'm not understanding this proof correctly.In that bold part how we have subtracted 1 in 1 and 2 in 2 twice?
I subtracted all perms in which card 1 ends up in envelope 1, and all perms in which card 2 ends up in envelope 2. So any perm in which both of those happen has been subtracted twice.
Google principle of inclusion and exclusion.
 
  • #10
haruspex said:
I subtracted all perms in which card 1 ends up in envelope 1, and all perms in which card 2 ends up in envelope 2. So any perm in which both of those happen has been subtracted twice.
Google principle of inclusion and exclusion.
Okay.
haruspex said:
Now to bring in the 1 goes in 2 constraint. I'll pose that as an exercise: what does that constraint do to the 265?
Now when we have put 1 in 2 constraint, the 5 more cases are gone.
So total ways = 265/5 = 53.
Thanks.
 
  • #11
Bravo Haru ! Very elegant and much more scalable than a brute force approach. I fell for the attractive reduction by a factor of 6 far too early and it became messy. Much better to postpone as you did. Awesome.:smile:
 

FAQ: Cards and envelopes permutation problem

What is the "Cards and Envelopes Permutation Problem"?

The Cards and Envelopes Permutation Problem is a mathematical problem that involves arranging a set of cards and envelopes in such a way that each card is placed in a different envelope, and no card ends up in its corresponding envelope. This problem is also known as the "Montmort Matching Problem" or the "Derangement Problem".

How many possible permutations are there for a given set of cards and envelopes?

The number of possible permutations for a set of n cards and n envelopes can be calculated using the formula n!/e, where e is the mathematical constant e (approximately equal to 2.71828). For example, if there are 5 cards and 5 envelopes, there are 120 possible permutations (5!/2.71828).

What is the significance of the "Cards and Envelopes Permutation Problem"?

The problem has practical applications in fields such as computer science, cryptography, and statistics. It can also be used as a teaching tool to demonstrate the concept of derangements in combinatorics.

How can the "Cards and Envelopes Permutation Problem" be solved?

There are multiple methods for solving this problem, including the recursive approach and the inclusion-exclusion principle. However, for larger sets of cards and envelopes, it is more efficient to use an algorithm such as the "Heap's Algorithm" or the "Johnson-Trotter Algorithm".

Are there any real-life scenarios where the "Cards and Envelopes Permutation Problem" is applicable?

Yes, the problem can be applied in situations where items need to be randomly assigned, such as assigning seats in a classroom or allocating tasks among a group of people. It can also be used in cryptography to generate secure random keys.

Similar threads

Replies
8
Views
2K
Replies
13
Views
2K
Replies
1
Views
2K
Replies
5
Views
2K
Replies
13
Views
3K
Replies
4
Views
4K
Replies
4
Views
6K
Back
Top