I am trying to determine the number of ways two dice can be rolled to have a sum of 8. This question can be easily brute-forced, but I want to use a technique that can be applied to similar questions that cannot be brute-forced so easily.
My solution was as follows, $$x_1 +x_2 = 8, x_1, x_2 \geq 1$$ $$x_1+1+x_2+1 = 8 \rightarrow x_1+x_2 =6$$ Now I can use the stars and bars method. So $C(6 +(2-1), (2-1))$ should be the answer, which is equal to $7$. But when I brute-forced this question, I only found $5$ solutions. What did I do wrong?
Normally if I wanted to find, say for example, the number of integer solutions to $x_1+x_2+x_3 = 12, x_i \geq 0$, I would apply the same method and do $C(12+(3-1), (3-1))$. What am I doing wrong?
You stated that you found that there are exactly $5$ solutions by listing all the possibilities, so I will assume you are considering six-sided dice.
What you have failed to do is account for the fact that the largest number a six-sided die can display is $6$.
Suppose we roll a blue die and a green die. Let $x_1$, $x_2$ denote, respectively, the numbers on the top face of the blue die and top face of the green die. Then $$x_1 + x_2 = 8 \tag{1}$$ where $1 \leq x_1, x_2 \leq 6$.
You opted to convert this to a problem in the nonnegative integers, so let's let $x_1' = x_1 - 1$ and $x_2' = x_2 - 1$. Since $x_1$ and $x_2$ are positive integers, $x_1'$ and $x_2'$ are nonnegative integers. Substituting $x_1' + 1$ for $x_1$ and $x_2' + 1$ for $x_2$ in equation 1 and simplifying yields $$x_1' + x_2' = 6 \tag{2}$$ Since equation 1 is an equation in positive integers not exceeding $6$, equation 2 is an equation in nonnegative integers not exceeding $5$.
Without that restriction, a solution of equation 2 corresponds to the placement of one addition sign in a row of six ones. For instance, $$1 1 + 1 1 1 1$$ corresponds to the solution $x_1' = 2$ and $x_2' = 4$. The number of such solutions is $$\binom{6 + 2 - 1}{2 - 1} = \binom{7}{1} = 7$$ since we must choose which of the seven positions required for six ones and one addition sign will be filled with an addition sign.
From these, we must subtract those solutions in which one of the variables exceeds $5$.
There are two ways to choose which variable violates the restriction that $x_1', x_2' \leq 5$. If a variable does violate that restriction, it must be equal to $6$ and the other must be equal to $0$, so there is only one possible solution of equation 2 for each variable that could violate the restriction that a variable cannot exceed $5$. Since there are two such variables, there are two solutions of equation 2 in which an upper bound is violated.
Hence, the number of possible ways for the numbers on the top faces of two six-sided dice to have a sum of $8$ is $$\binom{7}{1} - \binom{2}{1} = 7 - 2 = 5$$