Posts

Showing posts with the label dearrangement

Combinatorics stars and bars and dearrangement practice

Q1. Natural solutions of  50 < X + y + z <= 100 x + y + z <= 97 x + y + z + w = 97 Total: 100C3 Subtract those when x + y + z <= 50 x + y + z + w = 47 50C3 Answer: 100C3 - 50C3 Q2. Natural solutions of xyz = 2000 Solution: Factors: 2*2^3*5^3 = 2^4*5^3 It's like distributing 4 apples and 3 oranges among 3 people. Stars and bars twice: 6C2*5C2 = 150 Q3.  Integer solutions of xyz = 3000: Solution: Factorize: 2^3.3^1.5^3 Stars and bars thrice: 5C2*3C2*5C2 = 300 This is when all of x,y,z are positive. Now we can make 2 of  (x,y,z) negative at a time: 3C2 So 4*300 = 1200 is the answer. Q4. How many ways to put 4 numbered-slips in 4 numbered-boxes so that at least one of them is in the correct box. Solution: 4C1.D3 + 4C2.D2 + 4C3.D1 + 4C4.D0  = 4*2 + 6*1 + 4*0 + 1 = 15 Or total - when none is correct = 4! - !4 = 24 - 9 = 15 Q5 . 6 letters in 6 envelopes. How may ways if: a) exactly 2 letters in correct envelopes. 6C2.D4 = 15*9 = 135 b) at least 4 letters go in...

Derangement theory

Let's say there are 'n' people: P1, P2 ... Pn. And there are 'n' chairs: C1,C2....Cn. And we have to seat the people so that none of them gets the chair with same number. For e.g. for 2 people, there is only 1 way: P2,P1 For 3 people there are 2 ways: P2,P3,P1 P3,P1,P2 And so on.. These are called Derangements. For n  = 1 it's D1, for n = 2 it's D2 and in general it's Dn. How to compute Dn? There is a recursive formula: Dn = (n-1)(Dn-1 + Dn-2), D0 = 1, D1 = 0 Using this let's compute: D2 = (2-1)(D0 + D1) = 1.1 = 1 D3 = (3-1)(D1 + D2) = 2.(0+1) = 2 D4 = 3.(2+1) = 9 D5 = 4.(9+2) = 44 ...... There is non recursive formula also: Dn = (n!){1 -1/1! + 1/2! - 1/3! ....(-1)^n.1/n!} D1 = 1!(1-1) = 0 D2 = 2!(0+1/2) = 1 D3 = 3!(1/2-1/6) = 2 .... How do we derive the recursive formula? Let's P1 receives a chair Ci where i != 1. Now the person Pi can receive a chair in 2 ways: 1. Pi receives C1, i.e. P1 and Pi exchange their chairs. Now the remaining (n-2) peo...