6

How do you determine the number of tuples such that $x+y+z= 30$ and any integer cannot be greater than 15?

First I calculated all the the possible tuples by $\binom{32}{2}$ or 496. Then I tried to figure out how many cases there were where any integer has is greater than 15. I found it to be $\binom{16}{2}\times 3$ which is equal to $360$. Then I subtracted to obtain $136$ but apparently this is incorrect? Can someone let me know what I did wrong and how to approach the problem? Thanks.

Edit : The full question is jocko, wocko, and docko plan to buy a new toilet for their bathroom. The toilet costs 300 and each of them has saved 200 dollars in 10 dollar bills. They decide that each of them will start with contributing 50 dollars in 10 dollar bills(everyone contributes at least 50 dollars to the purchase.) Then, each of them will contribute some amount more money to reach the required 300 dollars to buy the toilet. For each $m \in \{\text{jocko, wocko, docko} \}$, we denote by $a_m$ the number of 10 dollar bills that each person m is left with after they buy the toilet. Count the number of possible triples of $\{jocko_m, wocko_m, docko_m \}$. Note that any person can contribute 0 dollars towards the purchase.

Robert Shore
  • 23,332
tantan69
  • 145
  • 1
    In general, it can be hard to impose caps on Stars and Bars (see this). In this case, with such a high cap it's not hard...no more than one variable can break the cap so just count the "bad" cases and subtract from the unconstrained total. – lulu Jan 26 '23 at 16:52
  • 2
    The answer should be $136$. I wrote a code that checks all tuples $0\leq x,y,z \leq 30$. The output was $136$. – ArashJafariyan Jan 26 '23 at 16:59
  • 4
    Note: you need to clarify the nature of $x,y,z$. Are you allowing any of them to be $0$? – lulu Jan 26 '23 at 17:00
  • "...but apparently this is incorrect?" What makes you say that? Do you have some list of expected solutions? What does it say the expected solution is for this? With that information, we may be able to intuit what the intended interpretation for the problem was. – JMoravitz Jan 26 '23 at 17:31
  • 1
    @MikeEarnest This seems like an answer, and it's a technique I hadn't seen before. – Robert Shore Jan 26 '23 at 17:55
  • Hi guys thanks for the clarification. I am not actually sure what the solution to question is yet because It wasn't posted to my class board yet but according to solutions I have seen online it's not 136. I think its because I interpreted the full question wrong. I posted the full question in the edit and if you would like, please take a look at it. – tantan69 Jan 26 '23 at 18:00
  • Confirmed by brute force that the answer is 136. Or 133 if 0 isn't allowed. – Dan Jan 26 '23 at 18:02
  • The problem in your title corresponds to the number of ways they can spend their remaining ten dollar bills. The original question asks for the number of ways the remaining money could be distributed after they have purchased the toilet. – N. F. Taussig Jan 26 '23 at 18:06
  • @N.F.Taussig I assumed that they would each have 10 bills remaining. So any tuple that summed up to 30 and where each variable is less than or equal to 15 is the solution? Is this incorrect? – tantan69 Jan 26 '23 at 18:20

4 Answers4

4

Let $x$ go from $0$ to $15$. For $x=0$ the only possibility is $(0,15,15)$

For $x=1$ we have $(1,14,15)$ and $1,15,14$ for two possibilities.

As $x$ increases to $15$, the number of possibilities increases by one for combinations of $y$ and $z$ with a maximum of sixteen possibilities for $x=0$.

Therefore, there are $$1+2+\dots+16=\frac{16\cdot 17}{2}=136$$ possible triples.

Sammy Black
  • 25,273
John Douma
  • 11,426
  • 2
  • 23
  • 24
  • Notation: \dots expands to vertically centered \cdots ellipsis in $1 + 2 + \dots + 16$. When surrounded by symbols on the baseline, it expands to \ldots like $1, 2, \dots, 16$. – Sammy Black Jan 28 '23 at 05:54
3

This is a perfect use of generating functions.

The key observation is that when we multiply two polynomials (or power series, even), the coefficient of $x^n$ in the product is related to the coefficients of the partitions of $n$ in the things we're producting. You can read more about this here.

For a small example, let's look at

$$(1 + x + x^2) \cdot (1 + x + x^2) = 1x^0 + 2x^1 + 3x^2 + 2x^3 + x^4$$

Notice that there's

  • $1$ way to partition $0$ into two pieces ($0 + 0$)
  • $2$ ways to partition $1$ into two pieces ($1+0$ and $0+1$)
  • $3$ ways to partition $2$ into two pieces ($2+0$ and $1+1$ and $0+2$)
  • $2$ ways to partition $3$ into two pieces ($2+1$ and $1+2$. Notice we only have access to the powers in $1+x+x^2$)
  • $1$ way to partition $4$ into two pieces ($2+2$)

It's worth thinking about why this is!

Similarly, the coefficient of $x^n$ in $(1+x+x^2)^3$ will give the number of ways to write $n$ as a partition of three integers, each between $0$ and $2$. Again, it's worth thinking about why this is.

So then, to compute the number of ways to partition $30$ into three pieces, each between $0$ and $15$, we're led to consider the $x^{30}$ coefficient in

$$ \left ( \sum_{k=0}^{15} x^k \right )^3 $$

Of course, we know that $\sum_{k=0}^{15} x^k = \frac{1 - x^{16}}{1 - x}$, so it's easy to ask sage to compute its cube:

sage: p = (1 - x^(16)) / (1-x)
sage: s = p^3
sage: s.taylor(x,0,30).coefficient(x,30)
136

Which agrees with the computations people have made in the comments.

If you want to read more about this kind of stuff, you can find more in Chapters 14 and 15 of van Lint and Wilson's A Course in Combinatorics. A great reference is also Wilf's (excellent!) book generatingfunctionology which I recommend everybody read.


I hope this helps ^_^

HallaSurvivor
  • 38,115
  • 4
  • 46
  • 87
  • Hi thank you. Just to clarify this is is the amount of distinct ways the tuple of people can have money remaining correct? – tantan69 Jan 26 '23 at 19:40
3

Responding to added material by you approx an hour ago.

  • Since the answer is to be in bills of $10\,$ dollars, cost of toilet is $30$ bills out of which $15$ bills have been paid, $15$ bills remain to be paid, and each person is still having $(20-5) = 15$ bills with them

  • After the three have contributed $15$ bills, $30$ bills are remaining with them with an individual having anything between $0$ and $15$ bills

  • We now apply stars and bars with inclusion-exclusion to get

Number of tuples remaining

$$= \binom{32}2 - 3\binom{16}2 = 136$$

P.S.

Actually, we could instead use simple stars and bars without inclusion- exclusion as $\large\binom{15+3-1}{3-1} =136$ for contributing for the purchase,
as taking out $15$ from three containers with $15$ each in anywhichway is exactly the same as putting in $30$ in three containers with a maximum of $15$ in each.

0

This problem is best solved using inclusion-exclusion.

Let us count the number of solutions to the equation, $$ x_1 + x_2 + \dots + x_n = N $$ with the requirement that $1\leq x_i\leq b$.

Let $A$ denote all such $n$-tuples which sum of $N$, and $A_i$ those $n$-tuples whose $i$-th coordinate is $>b$. Then the solution to the problem is, $$ |A| - \sum_i |A_i| + \sum_{i<j} |A_i\cap A_j| - \cdots $$ We know that $\displaystyle |A| = {{N-1}\choose {n-1}}$. To count $A_i$ that is equivalent to counting solutions to, $$ x_1 + \dots + (x_i + b) + \dots + x_n = N $$ Therefore, $\displaystyle |A_i| = {{N-b-1}\choose {n-1}}$. A similar argument will show that $\displaystyle |A_i\cap A_j| = {{N-2b-1}\choose {n-1}}$.

Now it only remains how how $i$'s we have, how many pairs $(i,j)$ with $i<j$ we have, ect. Therefore, the total count is equal to, $$ {{N-1}\choose {n-1}} - {n\choose 1}{{N-b-1}\choose {n-1}} + {n\choose 2}{{N-2b-1}\choose {n-1}} - \cdots $$

Sammy Black
  • 25,273