Waiting For The Bathroom

Carla is attending a concert and she has to use the bathroom. Unfortunately, the concert venue has only one Porta-Potty! There are 10 people in line, and each person in line takes either 1, 2, 3, 4, or 5 minutes to go to the bathroom. If Carla had to wait 35 minutes to use the bathroom, how many possible ways could the people ahead of her have used the bathroom? In other words, how many ways can we fill a multiset of 10 elements with the numbers 1, 2, 3, 4, and 5 such that their sum is 35?

Details and Assumptions

  • For example, People 1 through 5 could all have used the bathroom for 3 minutes, while People 6 through 10 could each have used it for 4 minutes. 5 × 3 + 5 × 4 = 35 5\times3+5\times4=35 , therefore this is one of the possible lines that Carla could have waited in.

  • Carla gets in line the moment that Person 1 begins to use the Porta-Potty.


The answer is 473694.

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.

5 solutions

Garrett Clarke
Jul 4, 2015

After careful analysis and trying many different ways of calculating this number, I've derived a formula for the number of ways to fill a set of size d d with the numbers from 1 1 to m m such that the elements of the set sum to n n :

S ( d , m , n ) = k = 0 n d m ( 1 ) k ( d k ) ( n m k 1 d 1 ) S(d,m,n)=\large\displaystyle\sum_{k=0}^{\lfloor\frac{n-d}{m}\rfloor}(-1)^k{d\choose k}{n-mk-1\choose d-1}

Plugging in d = 10 d=10 , m = 5 m=5 and n = 35 n=35 we get:

S ( 10 , 5 , 35 ) = k = 0 5 ( 1 ) k ( 10 k ) ( 35 5 k 1 9 ) = 473694 S(10,5,35)=\large\displaystyle\sum_{k=0}^5(-1)^k{10\choose k}{35-5k-1\choose 9} = \boxed{473694}

Moderator note:

Great! I see that you've updated your solution from brute force computing to a combinatorial understanding.

Can you explain the thought process to arrive at the formula listed? Why is it true?

Hint: Principle of Inclusion and Exclusion .

You have the rest of the ideas needed.

Calvin Lin Staff - 5 years, 11 months ago

Log in to reply

Yes we can use PIE, but when i read the problem it comes to my mind the equation x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 <=35 not equal 35, whether 1<= xi <=5 . In the end, we should solve manually.

riska mulyani - 5 years, 11 months ago

You have a fan now. I've seen two of your Combinatorics problems (the chess one was crazy like what) and both are extremely nice. You deserve much more followers.

Kunal Verma - 5 years, 11 months ago

Log in to reply

Thank you, that's so nice of you to say! I'm posting a new combinatorics problem today actually, watch out for it!

Garrett Clarke - 5 years, 11 months ago

Log in to reply

I'm gonna admit I applied the cheat for this problem and used the same solution as Melissa's. But I really want to know how you arrived at the formula.

Kunal Verma - 5 years, 11 months ago
Mark Hennings
Nov 29, 2016

The number of orders is the coefficient of x 35 x^{35} in the series expansion of ( x + x 2 + x 3 + x 4 + x 5 ) 10 = x 10 ( 1 x 5 ) 10 ( 1 x ) 10 = x 10 ( j = 0 10 ( 1 ) j ( 10 j ) x 5 j ) ( j = 0 ( j + 9 9 ) x j ) (x+x^2+x^3+x^4+x^5)^{10} \; = \; x^{10}(1 - x^5)^{10}(1-x)^{-10} \; =\; x^{10} \left(\sum_{j=0}^{10} (-1)^j {10 \choose j} x^{5j}\right)\left(\sum_{j=0}^\infty {j+9 \choose 9}x^j \right) and hence is equal to j = 0 5 ( 1 ) j ( 10 j ) ( 34 5 j 9 ) = 473694 . \sum_{j=0}^5 (-1)^j {10 \choose j}{34-5j \choose 9} \; = \; \boxed{473694}\;.

Oh that's very neat!

Calvin Lin Staff - 4 years, 6 months ago
Melissa Quail
Jul 5, 2015

This problem is a perfect example of where generating functions can be used. The number of ways of choosing 10 numbers, each from the set {1, 2, 3, 4, 5} that add up to 35 is equal to the coefficient of x 35 x^{35} in the expansion of ( x 1 + x 2 + x 3 + x 4 + x 5 ) 10 (x^1 + x^2 + x^3 + x^4 + x^5)^{10} . Obviously, the problem with this method is that this then has to be multiplied out to find the coefficient of x 35 x^{35} which takes a long time or requires the use of Wolfram Alpha but when multiplied out, the coefficient of x 35 x^{35} is 473694 \boxed{473694} which is the answer.

Moderator note:

As you realized, the drawback is that the exact coefficient is hard to calculate. It simplifies the original calculation only by providing a simple framework of bookkeeping, instead of providing us deeper insights into potential approaches.

Generating function solutions are often more useful when we are able to manipulate them in a variety of ways. E.g. by relating them to known functions, convolution, differentiation/integration, etc.

This is great! Regardless of the time it took to get the answer in this case, I love the connection that was made here, using generating functions was a smart move. Thanks for the solution!

Garrett Clarke - 5 years, 11 months ago

Melissa, FYI you can easily link to wiki pages by using the command:

    [[wiki-start typing something

This will pull up a list of wiki pages that (currently) exact matches what you typed.

See here for further details

Calvin Lin Staff - 5 years, 11 months ago

Log in to reply

Okay that's great, I didn't know that. Thankyou!

Melissa Quail - 5 years, 11 months ago

If we sum x + x 2 + x 3 + x 4 + x 5 x + x^2 + x^3 + x^4 + x^5 as a GP, then determining the coefficient of x 35 x^{35} is not that ghastly a task. Generating functions are still very useful in this context. See my solution, which shows how to derive the formula given by @Garrett Clarke .

Mark Hennings - 4 years, 6 months ago
Shandy Rianto
Jul 9, 2015

Solve

x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 + x 8 + x 9 + x 10 = 35 x_{1} + x_{2} + x_{3} + x_{4} + x_{5} + x_{6} + x_{7} + x_{8} + x_{9} + x_{10} = 35

for 1 x i 5 1 \leq x_{i} \leq 5 , i = 1 , 2 , 3 , 4 , 5 , , 10 i = 1, 2, 3, 4, 5, \ldots , 10

Which is equal to

y 1 + y 2 + y 3 + y 4 + y 5 + y 6 + y 7 + y 8 + y 9 + y 10 = 25 y_{1} + y_{2} + y_{3} + y_{4} + y_{5} + y_{6} + y_{7} + y_{8} + y_{9} + y_{10} = 25

for 0 y i 5 0 \leq y_{i} \leq 5 , i = 1 , 2 , 3 , 4 , 5 , , 10 i = 1, 2, 3, 4, 5, \ldots , 10

Let n ( S ) n(S) the number of non negative integral solutions of y 1 + y 2 + y 3 + y 4 + y 5 + y 6 + y 7 + y 8 + y 9 + y 10 = 25 y_{1} + y_{2} + y_{3} + y_{4} + y_{5} + y_{6} + y_{7} + y_{8} + y_{9} + y_{10} = 25

n ( S ) = ( 10 + 25 1 25 ) = 52451256 n(S) = {10 + 25 - 1 \choose 25} = 52451256

Let A i A_{i} the number of solutions for y i 5 y_{i} \geq 5

Here we will use Principle of Inclusion and Exclusion - Multiple Sets

Let B i B_{i} be the number of solutions of 1 c d i A c A d A i \displaystyle \sum_{1 \leq c \leq d \leq \ldots \leq i} |A_{c} \cap A_{d} \cap \ldots \cap A_{i}|

A 1 A 2 A 3 A 4 A 9 A 10 = 0 |A_{1} \cap A_{2} \cap A_{3} \cap A_{4} \cap \ldots A_{9} \cap A_{10}| = 0 \triangleleft 10 × 5 25 10 \times 5 \geq 25

\rightarrow B 10 = 0 B_{10} = 0

A 1 A 2 A 3 A 4 A 8 A 9 = A 2 A 3 A 4 A 9 A 10 = 0 |A_{1} \cap A_{2} \cap A_{3} \cap A_{4} \cap \ldots A_{8} \cap A_{9}| = |A_{2} \cap A_{3} \cap A_{4} \cap \ldots A_{9} \cap A_{10}| = 0 \triangleleft 9 × 5 25 9 \times 5 \geq 25

\rightarrow B 9 = 0 B_{9} = 0

A 1 A 2 A 7 A 8 = A 2 A 3 A 8 A 9 = A 3 A 4 A 9 A 10 = 0 |A_{1} \cap A_{2} \cap \ldots A_{7} \cap A_{8}| = |A_{2} \cap A_{3} \cap \ldots A_{8} \cap A_{9}|\\= |A_{3} \cap A_{4} \cap \ldots A_{9} \cap A_{10}|= 0 \triangleleft 8 × 5 25 8 \times 5 \geq 25

\rightarrow B 8 = 0 B_{8} = 0

A 1 A 2 A 6 A 7 = A 1 A 2 A 6 A 8 = A 1 A 2 A 6 A 9 = A 1 A 2 A 6 A 10 = = A 2 A 3 A 7 A 8 = = A 4 A 5 A 9 A 10 = 0 |A_{1} \cap A_{2} \cap \ldots A_{6} \cap A_{7}| = |A_{1} \cap A_{2} \cap \ldots A_{6} \cap A_{8}| \\= |A_{1} \cap A_{2} \cap \ldots A_{6} \cap A_{9}| = |A_{1} \cap A_{2} \cap\ldots A_{6} \cap A_{10}| = \ldots \\= |A_{2} \cap A_{3} \cap \ldots A_{7} \cap A_{8}| = \ldots = |A_{4} \cap A_{5} \cap \ldots A_{9} \cap A_{10}|= 0

\triangleleft 7 × 5 25 7 \times 5 \geq 25

\rightarrow B 7 = 0 B_{7} = 0

A 1 A 2 A 5 A 6 = A 1 A 2 A 5 A 7 = A 1 A 2 A 5 A 8 = A 1 A 2 A 5 A 9 = = A 2 A 3 A 6 A 7 = = A 5 A 6 A 9 A 10 = 0 |A_{1} \cap A_{2} \cap \ldots A_{5} \cap A_{6}| = |A_{1} \cap A_{2} \cap \ldots A_{5} \cap A_{7}| \\= |A_{1} \cap A_{2} \cap \ldots A_{5} \cap A_{8}| = |A_{1} \cap A_{2} \cap\ldots A_{5} \cap A_{9}| = \ldots \\= |A_{2} \cap A_{3} \cap \ldots A_{6} \cap A_{7}| = \ldots = |A_{5} \cap A_{6} \cap \ldots A_{9} \cap A_{10}|= 0

\triangleleft 6 × 5 25 6 \times 5 \geq 25

\rightarrow B 6 = 0 B_{6} = 0

A 1 A 2 A 3 A 4 A 5 = A 1 A 2 A 3 A 4 A 6 = = A 2 A 3 A 4 A 5 A 6 = = A 6 A 7 A 8 A 9 A 10 = 1 |A_{1} \cap A_{2} \cap A_{3} \cap A_{4} \cap A_{5}| = |A_{1} \cap A_{2} \cap A_{3} \cap A_{4} \cap A_{6}| \\= \dots = |A_{2} \cap A_{3} \cap A_{4} \cap A_{5} \cap A_{6}| =\ldots = |A_{6} \cap A_{7} \cap A_{8} \cap A_{9} \cap A_{10}| = 1

\triangleleft 25 5 × 5 = 0 25 - 5 \times 5=0 \triangleleft \triangleleft ( 10 + 0 1 0 ) = 1 {10+0-1 \choose 0} = 1

\rightarrow B 5 = ( 10 5 ) × 1 = 252 B_{5} = {10 \choose 5} \times 1 = 252

A 1 A 2 A 3 A 4 = A 1 A 2 A 3 A 5 = = A 2 A 3 A 4 A 5 = = A 7 A 8 A 9 A 10 = 2002 |A_{1} \cap A_{2} \cap A_{3} \cap A_{4}| = |A_{1} \cap A_{2} \cap A_{3} \cap A_{5}| \\= \dots = |A_{2} \cap A_{3} \cap A_{4} \cap A_{5}| =\ldots \\= | A_{7} \cap A_{8} \cap A_{9} \cap A_{10}| = 2002

\triangleleft 25 4 × 5 = 5 25 - 4 \times 5=5 \triangleleft \triangleleft ( 10 + 5 1 5 ) = 2002 {10+5-1 \choose 5} = 2002

\rightarrow B 4 = ( 10 4 ) × 2002 = 420420 B_{4} = {10 \choose 4} \times 2002 = 420420

A 1 A 2 A 3 = A 1 A 2 A 4 = = A 2 A 3 A 4 = = A 3 A 4 A 5 = A 8 A 9 A 10 = 92378 |A_{1} \cap A_{2} \cap A_{3}| = |A_{1} \cap A_{2} \cap A_{4}| = \dots = |A_{2} \cap A_{3} \cap A_{4}| =\ldots \\= |A_{3} \cap A_{4} \cap A_{5}| = \ldots |A_{8} \cap A_{9} \cap A_{10}| = 92378

\triangleleft 25 3 × 5 = 10 25 - 3 \times 5=10 \triangleleft \triangleleft ( 10 + 10 1 10 ) = 92378 {10+10-1 \choose 10} = 92378

\rightarrow B 3 = ( 10 3 ) × 92378 = 11085360 B_{3} = {10 \choose 3} \times 92378 = 11085360

A 1 A 2 = A 1 A 3 = = A 2 A 3 = = A 3 A 4 = A 7 A 9 = A 7 A 10 = A 8 A 9 = A 9 A 10 = 1307504 |A_{1} \cap A_{2} | = |A_{1} \cap A_{3} | = \dots = |A_{2} \cap A_{3}| \\=\ldots = |A_{3} \cap A_{4}| = \ldots |A_{7} \cap A_{9} = |A_{7} \cap A_{10}| \\=|A_{8} \cap A_{9}|=\ldots |A_{9} \cap A_{10}|=1307504

\triangleleft 25 2 × 5 = 15 25 - 2 \times 5=15 \triangleleft \triangleleft ( 10 + 15 1 15 ) = 1307504 {10+15-1 \choose 15} = 1307504

\rightarrow B 2 = ( 10 2 ) × 1307504 = 58837680 B_{2} = {10 \choose 2} \times 1307504 = 58837680

A 1 = A 2 = A 3 = = A 10 = 10015005 |A_{1}| = |A_{2}| = |A_{3}| = \ldots = |A_{10}| = 10015005 \triangleleft 25 1 × 5 = 20 25 - 1 \times 5=20 \triangleleft \triangleleft ( 10 + 20 1 20 ) = 10015005 {10+20-1 \choose 20} = 10015005

\rightarrow B 1 = ( 10 1 ) × 10015005 = 100150050 B_{1} = {10 \choose 1} \times 10015005 = 100150050

i = 1 n A i = i = 1 n A i 1 i < j n A i A j + 1 i < j < k n A i A j A k + ( 1 ) n 1 A 1 A 1 0 \displaystyle \left|\bigcup_{i=1}^n A_i\right| = \sum_{i=1}^n\left|A_i\right|-\sum_{ 1 \leq i < j \leq n }\left|A_i\cap A_j\right| + \sum_{ 1\leq i< j < k \leq n}\left|A_i\cap A_j\cap A_k\right| \\-\ \cdots\ + \left(-1\right)^{n-1} \left|A_1 \cap\cdots\cap A_10 \right|

i = 1 10 A i = B 1 B 2 + B 3 B 4 + B 5 B 6 + B 7 B 8 + B 9 B 10 \displaystyle \left|\bigcup_{i=1}^{10} A_i\right| = B_{1} - B_{2} + B_{3} - B_{4} + B_{5} - B_{6} + B_{7} - B_{8} + B_{9} - B_{10}

i = 1 10 A i = 100150050 58837680 + 11085360 420420 + 252 0 + 0 0 + 0 \displaystyle \left|\bigcup_{i=1}^{10} A_i\right| = 100150050 - 58837680 + 11085360 - 420420 + 252 - 0 +0 - 0 + 0

i = 1 10 A i = 51977562 \displaystyle \left|\bigcup_{i=1}^{10} A_i\right| = 51977562

n ( i = 1 10 A i ) = n ( S ) n ( i = 1 10 A i ) n\overline{\left(\bigcup_{i=1}^{10} A_i\right)} = n(S) - n\left(\bigcup_{i=1}^{10} A_i\right)

n ( i = 1 10 A i ) = 52451256 51977562 n\overline{\left(\bigcup_{i=1}^{10} A_i\right)} = 52451256 - 51977562

n ( i = 1 10 A i ) = 473694 n\overline{\left(\bigcup_{i=1}^{10} A_i\right)} = \boxed{473694}

Sibasish Mishra
Mar 11, 2017

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...