Balls in wrong place

I have eight boxes numbered 1 to 8 and eight balls numbered 1 to 8. In how many ways can I put the balls in the boxes so that there is one ball in each box, but with the condition that ball 1 is not in box 1, ball 2 is not in box 2, and ball 3 is not in box 3?


The answer is 27240.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

James Pohadi
Dec 30, 2016

Relevant wiki: Principle of Inclusion and Exclusion - Multiple Sets

Let:

A A be the condition when ball 1 is in box 1

B B be the condition when ball 2 is in box 2

C C be the condition when ball 3 is in box 3

By Principle of Inclusion and Exclusion (PIE) we have:

A B C = A + B + C A B A C B C + A B C A B C = 7 ! + 7 ! + 7 ! 6 ! 6 ! 6 ! + 5 ! A B C = 3 ( 7 ! ) 3 ( 6 ! ) + 5 ! \begin{aligned} \large |A\cup B \cup C|&= |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C| \\ \large |A\cup B \cup C|&=7!+7!+7!-6!-6!-6!+5! \\ \large |A\cup B \cup C|&= 3(7!)-3(6!)+5! \end{aligned}

A B C = 8 ! A B C A B C = 8 ! ( 3 ( 7 ! ) 3 ( 6 ! ) + 5 ! ) A B C = 27240 \begin{aligned} \large |A\cup B \cup C|'&=8!-\large |A\cup B \cup C| \\ \large |A\cup B \cup C|'&=8!-(3(7!)-3(6!)+5!) \\ \large |A\cup B \cup C|'&=\boxed{27240}\end{aligned}

What you found means ball 1 is in box 1, ball 2 is in box 2 and ball 3 in 3, I suppose. Correct me if wrong.

Vishal Yadav - 4 years, 3 months ago

@Vishal Yadav Yes, I made a mistake. It is actually like what you say. I have edited my solution. Thank you for the correction, mention[603768:Vishal Yadav]!!

James Pohadi - 4 years, 3 months ago
Aira Thalca
Dec 27, 2016

We draw a Venn diagram where S S represents all of the ways of placing the 8 balls to 8 boxes with one ball in each box without restriction. Circle A A represents all of the ways of placing the 8 balls to 8 boxes with ball 1 going to box 1, Circle B B represents all the ways of placing the 8 balls to 8 boxes with ball 2 going to box 2, and Circle C C represents all the ways of placing the 8 balls to 8 boxes with ball 3 going to box 3

Here, s s represents the number of ways of putting the balls in boxes so that ball 1 is not in box 1 ( s s is outside circle A A ), ball 2 is not in box 2 ( s s is outside circle B B ), and ball 3 is not in box 3 ( s s is outside circle C C ). We want to calculate s s .

The total number of ways in S S is 8 ! 8! .

Circle A A represents the ways when ball 1 is in box 1, and the other 7 balls are placed without restriction. There are 7 ! 7! such ways.

Similarly, the number of ways inside each of circle B B and circle C C is 7!

In other words, t + w + y + z = u + w + x + z = v + x + y + z = 7 ! t + w + y + z = u + w + x + z = v + x + y + z = 7!

The overlap between circle A A and B B represents the ways with ball 1 in box 1 and ball 2 in box 2, with the other 6 balls placed without restriction.

There are 6 ! 6! such ways.

Similarly, there are 6 ! 6! ways in the intersection of circles A A and C C , and circles B B and C C .

In other words, w + z = y + z = x + z = 6 ! w + z = y + z = x + z = 6!

Finally, the intersection of all three circles represents the ways in which ball 1 is in box 1, ball 2 is in box 2, ball 3 is in box 3, and the other 5 balls are placed without restriction.

There are 5 ! 5! such ways.

In other words, z = 5 ! z = 5!

Since z = 5 ! z = 5!

then

w = x = y = 6 ! 5 ! w = x = y = 6! - 5!

Futhermore

t = u = v = 7 ! 2 ( 6 ! 5 ! ) 5 ! = 7 ! 2 ( 6 ! ) + 5 ! t = u = v = 7! - 2(6! - 5!) - 5! = 7! - 2(6!) + 5!

Finally

s = 8 ! ( t + u + v + w + x + y + z ) s = 8! - (t + u + v + w + x + y + z)

s = 8 ! 3 ( 7 ! 2 ( 6 ! ) + 5 ! ) 3 ( 6 ! 5 ! ) 5 ! s= 8! - 3(7! - 2(6!) + 5!) - 3(6! - 5!) - 5!

s = 8 ! 3 ( 7 ! ) + 6 ( 6 ! ) 3 ( 5 ! ) 3 ( 6 ! ) + 3 ( 5 ! ) 5 ! s= 8! - 3(7!) + 6(6!) - 3(5!) - 3(6!) + 3(5!) - 5!

s = 8 ! 3 ( 7 ! ) + 3 ( 6 ! ) 5 ! s= 8! - 3(7!) + 3(6!) - 5!

Therefore,

s = 40320 3 ( 5040 ) + 3 ( 720 ) 120 = 27240 s = 40 320 - 3(5040) + 3(720) - 120 = 27 240

Thus, the number of ways of putting the balls in the boxes with the given restrictions is (27 240

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...