3
$\begingroup$

How many $(w_{1},w_{2},w_{3},\dots,w_{7})$ where each of the $w_{i}$'s are integers and $20\le w_{1},w_{2},w_{3},\dots,w_{7}\le 22$ such that they satisfy

$$w_{1}+w_{2}+w_{3}+\dots+w_{7}=148$$

ATTEMPT

I first did the trick $w_{i}=p_{i}+20$, thus turning our equation into:

$$p_{1}+p_{2}+p_{3}+\dots+p_{7}=8$$

and the restriction is now $0\le p_{1},p_{2},\dots,p_{7}\le2$, now to count how many integer solutions are there for the above equation (by not considering the restriction on $p_{i}$) we use stars and bars. That gives us $\binom{14}{6}=3003$ ways.

Obviously we overcounted (since we didn't consider the restriction) thus we need to subtract the ones $p_{i}\ge3$. Using the same trick by letting $q_{i}=p_{i}-3$,

$$q_{1}+p_{2}+p_{3}+\dots+p_{7}=5$$

This has $\binom{11}{6}=462$ ways (again by stars and bars), but notice that there are $7$ ways that I can place the $q_{i}$ so I need to multiply the result by a factor of $7$ giving us a total $7 \times 462 = 3234$ ways.

Now I'm stuck, I noticed that $3234>3003$ so I might've done something wrong here. Can someone point out where I was wrong or maybe I needed to add something back in?

$\endgroup$
1
  • 2
    $\begingroup$ Try $w_i=p_i+21$, instead. And don't go for Inclusion-Exclusion; just think your way through it, it's much simpler. $\endgroup$ Commented Jul 5 at 11:22

2 Answers 2

4
$\begingroup$

You have again double counted, because it's possible for two of the $p_i$ to be larger than $2$. So you need one more level of inclusion-exclusion:

There are $\binom 72 = 21$ ways to pick two indices to make a $p$ into a $q$. And for each such choice of two indices, we have to find the number of solutions to $$ q_1 + q_2 + p_3 + p_4 + p_5 + p_6 + p_7 = 2 $$ through stars-and-bars, giving us $\binom{8}2 = 28$ different solutions.

So you get a total of $3003 - 3234 + 588 = 357$ different solutions in total.

There is no more inclusion-exclusion, as it is impossible for three or more of the $p_i$ to be strictly larger than $2$.


Alternately, follow the hint given in the comment section above. Pick $w_i = p_i + 21$ instead, and you get $$ p_1 + \cdots + p_7 = 1 $$ with the restriction that each $p_i$ is either $0$ or $\pm 1$. You can count the number of solutions by first picking $k$ of them to be $-1$, then picking $k+1$ of the remaining ones to be $1$ (letting the rest be $0$). This yields the answer $$ \sum_{k = 0}^3\binom7{k}\binom{7-k}{k+1} = 357 $$ (It's also possible to do this exact approach with your $p_i = w_i-20$, but then you have to pick $k$ of them to be $0$ and $k+1$ of them to be $2$, leaving the rest to be equal to $1$, and the whole thing just isn't so transparent.)

$\endgroup$
1
  • $\begingroup$ Ah thanks for pointing that out! $\endgroup$
    – JAB
    Commented Jul 6 at 2:57
2
$\begingroup$

Given the small number of solutions I would find it easier to calculate the number of $(p_1,p_2,\dots, p_7)$ directly, so I offer this as an alternative approach.

There are $\binom{7}{3}\binom{4}{0}\binom{4}{4}=35$ of type $3\times 0+ 0\times 1+4\times 2$.

There are $\binom{7}{2}\binom{5}{2}\binom{3}{3}=210$ of type $2\times 0+ 2\times 1+3\times 2$.

There are $\binom{7}{1}\binom{6}{4}\binom{2}{2}=105$ of type $1\times 0+ 4\times 1+2\times 2$.

There are $\binom{7}{0}\binom{7}{6}\binom{1}{1}=35$ of type $0\times 0+ 6\times 1+1\times 2$.

So there are $357$ solutions.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .