What is the probability that the sum of 6 four-sided dice is less than or equal to 14? The solution given is shown below.
My question is how did they count the numerator like that?
What is the explanation for it please?
$$\begin{align}
\frac{C_6^{14}-C_1^6\times C_6^{10}+C_2^6 \times C_6^6}{4^6}&=\frac{3003-6\times 210+15\times 1}{4^6}\\
&= \frac{1758}{4^6}\\
&= \frac{879}{2048}
\end{align}$$
I understand  the denominator namely because each of the four sided dice has four choices and six of them so, all possible outcomes will be $4^6$.
I believe that the 4-sided dice here has 1, 2, 3, 4 printed on its faces.
Any help is appreciated.
 A: Simplified Answer
There are two forms of stars and bars, for positive integers with formula $\large\binom{n-1}{k-1}$ and for non-negative integers with formula $\large\binom{n+k-1}{k-1}$
I shall use the latter (to tally with the book solution), and add a slack variable $s$ to convert the desired sum from upto to exactly
With these changes, we need to solve over the non-negative integers for
$x_1 +x_2 +x_3 +x_4 +x_5 +x_6 +s = 14-6 = 8,\;\{ x_i \leq3\}$
Then using stars and bars with inclusion-exclusion, (note that there is no upper limit on the slack variable)
Number of ways $$=\binom{14}6 - \binom61\binom{10}6 + \binom62\binom66 = 1758$$
A: The following solution uses a generating function.  Readers not familiar with generating functions can find several resources in the answers to this question: How can I learn about generating functions?
There are $4^6$ possible outcomes when rolling six four-sided dice, all of which we assume are equally likely. We want to count the number of arrangements in which the sum is less than or equal to $14$.  This is the number of solutions in integers to
$$x_1+x_2+x_3+x_4+x_5+x_6 \le 14$$
sunbject to $1 \le x_i \le 4$ for $i=1,2,3,4,5,6$.  Equivalently, we want the number of integer solutions to
$$x_1+x_2+x_3+x_4+x_5+x_6+x_7 = 14 \tag{1}$$
where $0 \le x_7$. The generating function for the number of solutions is
$$\begin{align}
f(x) &= (x+x^2+x^3+x^4)^6 \cdot (1+x+x^2+ \dots) \\
&= x^6 \left( \frac{1-x^4}{1-x} \right)^6 \cdot \frac{1}{1-x} \tag{2} \\
&= x^6 \; (1-x^4)^6 \; (1-x)^{-7} \\
&= x^6 \; (1 -6x^4+15x^8+O(x^{12})) \; \sum_{i=0}^{\infty} \binom{7+i-1}{i} \tag{3} x^i
\end{align}$$
From $(3)$ we can see that the coefficient of $x^{14}$ in $f(x)$ is
$$[x^{14}]f(x) = \binom{7+8-1}{8} - 6 \binom{7+4-1}{4} + 15 = 1758$$
so the number of solutions to $(1)$ is $1758$, and the probability of rolling a sum of $14$ or less is
$$\frac{1758}{4^6}$$
Notes:
$(2)$  Summing geometric series (twice).
$(3)$  Applying the Binomial Theorem, first for a positive exponent and then for a negative exponent.
A: Integer Composition of a numebr $\leq 14$,
summand in $[1,4]$
$6$ summands

the number of IntegerCompositions of $n$ to $k$ summands with summand in $[1,r]$
$$
\left[z^n\right]\left(z+z^2+\ldots z^r\right)^k=\left[z^n\right]\left(z \frac{1-z^r}{1-z}\right)^k=\sum_j(-1)^j\left(\begin{array}{c}
k \\
j
\end{array}\right)\left(\begin{array}{c}
n-r j-1 \\
k-1
\end{array}\right)
$$
for your case,
$r=4,k=6$
$6 \leq n\leq 14$
Series Coefficient
SeriesCoefficient[(z*(1 - z^r)/(1 - z))^k /. {k -> 6, r -> 4}, {z, 
    0, #}] & /@ Range[6, 14, 1]

Total@% /(4^6)

$$
{1, 6, 21, 56, 120, 216, 336, 456, 546}
\\
\frac{879}{2048}
$$
Binomial sum
a[n_, r_, k_] := 
 Sum[(-1)^j*Binomial[k, j]*Binomial[n - r*j - 1, k - 1], {j, 0, 
   Min[Floor[(n - k)/r], k]}]
a[#, 4, 6] & /@ Range[6, 14, 1]

$$
{1, 6, 21, 56, 120, 216, 336, 456, 546}
\\
\frac{879}{2048}
$$
A: (I'm assuming you're familiar with Stars-and-Bars. If not, see true blue anil's solution which deals with that part of it.)
Consider finding the sum of 6 positive integers that is at most $14$, which is equivalent to 7 non-negative integers that sum to exactly $14-6=8$ (where the last variable is the dummy variable for the remainder). By Stars-and-bars, there are ${14 \choose 6 }$ ways of doing so.
Let $A_i$ be the event that the $i$th integer is 5 or more.
We're interested in $ | \cup A_i |$, which is the complement to "each is at most 4".
Notice that since $ 4 + 4 + 4 + 1 + 1 + 1 = 15 > 14$, hence at most 2 dice can show 5 or more. So $|A_i \cap A_j \cap A_k| = 0 $.
Thus, by PIE, $ | \cup A_i | = \sum |A_i| - \sum |A_i \cap A_j|$ (since the larger terms are all 0).
By Stars-and-Bars again, $|A_i| = {14 - 4 \choose 6 } $ and $ |A_i \cap A_j | = { 14 - 4 - 4 \choose 6}$.
There are clearly $ 6 \choose 1 $ events $ A_i$ and $ {6 \choose 2 }$ events $ A_i \cap A_j$.
So $ | \cup A_i |= \sum |A_i| - \sum |A_i \cap A_j| = { 6 \choose 1 } { 10 \choose 6} - { 6 \choose 2 } { 6 \choose 6}$
Hence, the number of ways is $ {14 \choose 6} - { 6 \choose 1 } { 10 \choose 6} + { 6 \choose 2 } { 6 \choose 6}.$
