Find the whole number solutions for W+X+Y+Z = 15 where W, X, Y, Z ≤ 6 I worked out a solution but don't know if its the right one. Is this the right way to approach the problem? Any help would be appreciated.
First, the number of non-negative integer solutions for $W+X+Y+Z = 15$ can be calculated using stars and bars:
$$\binom{n+k-1}{n} = \binom{15+4-1}{15}$$
Now, when value of W exceeds 6; i.e., for value of 7 violets the rule of the upper limit for W.
That means the number of violations W can have is among 15-7 = 8 identical items in 4 distinct bins.
Equation for violations becomes W+X+Y+Z = 15-7 = 8
As a result, total number of violations for W = C (n+k-1, k-1) = C (8+4-1, 4-1) = C (11, 3)
⸫ Total number of violations for all 4 bins when 1 bin cross upper limit = C (11, 3) × 4
Since, number of violations 8 is >n/2=15/2=7.5; we need to add in the subtracted repetitions.
When 2 bins cross above upper limit; W+X+Y+Z = 15-7-7 = 1
⸫ Total number of repetitions for all 4 bins when 2 bin cross upper limit = C (1+4-1, 4-1) × 4 = C (4, 3) × 4
When 3 bins cross above upper limit; W+X+Y+Z = 15-7-7-7 = -6 i.e., not possible.
Therefore, the number of integer solutions for $W+X+Y+Z = 15$ where $W, X, Y, Z \leq 6$ is $$\binom{18}{3} – \binom{11}{3} \times 4 + \binom43\times 4$$

There is a mistake in your last term. The answer should be $180$ and not $172$. Also you can simplify the working.
There are multiple ways to tackle the problem -

*

*Solve as is using P.I.E what you did

*Simplify using change of variable and solve

*Solve using generating function

a) Using first method (how you did; I have used boxes and balls analogy in my working),
the answer should be $\displaystyle {18 \choose 3} - {4 \choose 1} {11 \choose 3} + {4 \choose 2} {4 \choose 1} = 180$
The second term is where we choose one of the boxes to have $7$ balls and then distribute rest $8$ balls in any of the boxes.
The third term is where we choose two of the boxes to have $7$ balls each and then put one remaining ball in any of the boxes. This term is wrong in your working.
b) Using second method,
We substitute $a = 6 - w, b = 6 - x, c = 6- y, d = 6 - z$.
So we have, $a + b + c + d = 9 \ $ where $0 \leq a, b, c, d \leq 6$.
Only one of them can have more than $6$ balls. So the answer is
${12 \choose 3} - {4 \choose 1} {5 \choose 3} = 180$
c) Using generating function
Find coefficient of $x^{15}$ in $(1+x+x^2+x^3+x^4+x^5+x^6)^4$ which is indeed $180$. I will leave it to work through it if this is a method which is of interest to you.
