1

I found this question in a text book and solved it listing the possible sums:

$6,1,5$ gives $3!=6$

$6,2,4$ gives $3!=6$

$6,3,3$ gives $\frac{3!}{2!}=3$

$5,5,2$ gives $\frac{3!}{2!}=3$

$5,4,3$ gives $3!=6$

$4,4,4$ gives $\frac{3!}{3!}=1$

Then I just add up everything $3\times6+2\times 3+1=25$. And I know that's the answer but the thing is the book suggest a solution using inclusion-exclusion principle. The suggestion goes something like this:

The problem is equivalent to find all positive integer solutions of the equation $a_1+a_2+a_3=12$ (which is clear for me) with $a_1, a_2, a_3 \in \{1,...,6\}$ which we can rewrite as $x+y+z=9$ (why?) with $x,y,z \in \{0,...,5\}$ and subtract the solutions where at least one variable is greater than $5$.

I don't get why it's necessary to change the equation. How do I find this sums that are not $12$ using this method?

In this similar question: Rolling dice such that they add up to 13 — is there a more elegant way to solve this type of problem? OP gives a similar solution as mine but @user940 gives some suggestion that I found quite similar to the one in the textbook but I do not understand all his reasoning. I don't know much about generating functions yet so any help that leads me to understand the solution using the suggestion is greatly appreciated.

N. F. Taussig
  • 79,074
Grouper
  • 301
  • 1
    "I don't get why it's necessary to change the equation..." Strictly speaking, it's not necessary. Depending on how you were taught you may have first been taught that the number of non-negative integer solutions to $x_1+x_2+\dots+x_k = n$ is $\binom{n+k-1}{k-1}$, or you may have instead been first taught that the number of strictly positive integer solutions to $x_1+x_2+\dots+x_k=n$ is $\binom{n-1}{k-1}$. Since they suggested you change it to a question about non-negative solutions rather than strictly positive solutions, that suggests that they taught the former formula first. – JMoravitz Sep 24 '18 at 02:52
  • 1
    If you do approach with inclusion-exclusion and counting like they suggest, you will have to subtract solutions where $x$ is too large. To accomplish this, do a change of variable just like before. Notice that it is impossible for both $x$ and $y$ to simultaneously be "too large" to have been treated as a die result and have the sum be exactly $12$. – JMoravitz Sep 24 '18 at 02:55
  • Actually the the solutions formula given is ${n+k-1}\choose{k}$ – Grouper Sep 24 '18 at 03:03
  • I did not misspeak. Be careful about recognizing the meaning and purpose of $n$ and $k$. The formula you give would have been correct if the roles of $n$ and $k$ were reversed. The top number is the sum of the desired total and one less than the number of terms being added. The bottom is one less than the number of terms being added. Alternatively the bottom is the desired total, these give the same result. – JMoravitz Sep 24 '18 at 03:09
  • Ty. Now, what I'm really subtracting is the possibilities where I got, for example, two 6s? Why the reasoning is to think about one variable been to large if the maximum value that it can take is 6? – Grouper Sep 24 '18 at 03:17
  • 2
    The outcomes counted in stars and bars include such impossibilities for what you actually want to count such as "rolling a 10 on the first die followed by two ones" or "rolling a 2 on the first die rolling a 7 on the second and a 1 on the third." In traditional stars and bars we do not impose any upper limits on the numbers, so we subtract any outcomes where an upper limit we wanted was violated (here being that no die can roll higher than a 6). – JMoravitz Sep 24 '18 at 03:23
  • Ty. Much clearer now. – Grouper Sep 24 '18 at 03:25
  • I'd say there are just six combinations. Why should $(6,4,2)$ count for six different combinations if the dice are thrown simultaneously? – Christian Blatter Sep 24 '18 at 08:24

1 Answers1

2

Original problem: $$a_1+a_2+a_3=12; a_1, a_2, a_3 \in \{1,...,6\}.$$

Let $x=a_1+1,y=a_2+1,z=a_3+1$, then the transformed problem: $$x+y+z=9; x, y, z \in \{0,...,5\}.$$ The inclusion-exclusion: from 1) the choices for $0\le x,y,z\le 9$ subtract 2) the choices for $6\le x\le 9, 0\le z,y\le 3$ or its permutation.

1) Using Stars and Bars, it is: ${9+3-1\choose 3-1}=55$.

2) Let $x=t+6$, then the transformed problem: $$t+y+z=3; 0\le x,y,z\le 3.$$ Using Stars and Bars, it is: ${3+3-1\choose 3-1}=10$, which is multiplied by $3$ (the number of variables).

Hence, the final answer is: $55-3\cdot 10=25$.

farruhota
  • 32,168