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.