Find the number of integer solutions to $a+b+c+d=18$ with $ 0≤a,b,c,d≤6$.
With no restrictions there are:
$$\binom{21}{3} = 1330$$
Ones that are invalid are: $a, b, c, d \ge 7$.
But how do I take them out?
Find the number of integer solutions to $a+b+c+d=18$ with $ 0≤a,b,c,d≤6$.
With no restrictions there are:
$$\binom{21}{3} = 1330$$
Ones that are invalid are: $a, b, c, d \ge 7$.
But how do I take them out?
On
A different approach:
$[\text{Number of combinations with sum } K] = [\text{Number of combinations with sum } 24-K]$.
So count the number of combinations with sum $6$ instead of $18$:
Hence the total number of combinations is $4+4+4+6+6+12+12+12+24=84$.
To be honest, you don't even need the opening statement.
You can simply edit each bullet, and invert each digit $N$ with $6-N$.
On
I know that the OP has most likely the Principle of Inclusion-Exclusion as the method, but just as a check you can use generating functions to verify the answer by barak manos. Just consider
$$(1+x+x^2+x^3+x^4+x^5+x^6)^4$$
Since we have 7 numbers to use for each $a,b,c,d$ and 4 variables to choose this will do the trick. Then just extract the coefficient from the $x^{18}$ term:
$$[x^{18}](1+x+x^2+x^3+x^4+x^5+x^6)^4=84$$
Setting $p=6-a$, $q=6-b$, $r=6-c$ and $s=6-d$ this comes to the same as finding the number of integer solutions of:
$$p+q+r+s=6$$
This under the condition that $p,q,r,s$ are firstly nonnegative and secondly do not exceed $6$.
Fortunately any solution that satisfies the first condition will automatically satisfy the second condition so we can leave that out, and use the Stars and Bars method.
Doing so we find: $$\binom{6+3}{3}=84$$ solutions.