0

Lets say we have equation $q_1+q_2+q_3+q_4+q_5+q_6=26$

$1\leq q_i\leq 6$

How many integer solutions to equation?

Well, first thing - I made script, it counted $2247$ possible solutions.

Then amount of positive solutions to equation is $\binom {25} {5}=53130$, lets say them "unrestricted solutions".

But then by symmetry, $2247=53130-6x$, but $53130-2247$ is not divisable by 6. Or am I going wrong way of thought altogether?

Help apreciated

Update: I rewrote equation like $(5-p_1)+\dots+(5-p_5)=20$, yields $p_1+\dots+p_6=10$, script still counts $2247$ to this problem, so I am probably on right track.

It seems to me that there is $10$ stars and $5$ bars, yet $\binom{14}{4}=1001$. What is wrong now?

  • Assume them to be $1+a_1,1+a_2.....$ and then find solutions of new equation of u's – Archis Welankar Feb 18 '16 at 17:25
  • I dont understand about the $6x$. But you can solve equations of these kind, with constrain, using generating functions. See here. – Masacroso Feb 18 '16 at 17:33
  • I do not understand the symmetry argument, a permutation of a particular solution may be the same as the solution. – André Nicolas Feb 18 '16 at 17:35
  • 1
    I'm guessing your $x$ is the number of solutions with $q_i\gt6$. You are trying to exclude these for each $i$, but $\binom{25}{5}-6x$ doesn't work because some solutions with $q_i\gt6$ also have $q_j\gt6$. For example $[7,7,7,2,2,1]$ would be counted $3$ times. – Logophobic Feb 18 '16 at 17:50

2 Answers2

3

There are more sophisticated ways to solve the problem, for instance by using generating functions as suggested by Masacroso in the comments, but you can also use quite elementary tools: the stars and bars approach combined with the inclusion-exclusion principle.

If we ignore the upper bound of $6$, the former says that there are

$$\binom{26-1}{6-1}=\binom{25}5\tag{1}$$

solutions. Some of them, however, violate one or more of the upper bounds. Let’s see how many of them have $q_1\ge 7$.

Let $x_1=q_1-6$; then the solutions with $q_1\ge 7$ are exactly the positive solutions to

$$x_1+q_2+q_3+q_4+q_5+q_6=26-6=20\;,$$

and by the stars and bars calculation there are $\binom{20-1}{6-1}=\binom{19}5$ of them. There are also $\binom{19}5$ solutions with $q_2\ge 7$, $\binom{19}5$ with $q_3\ge 7$, and so on, so $(1)$ should be corrected to

$$\binom{25}5-6\cdot\binom{19}5\;.\tag{2}$$

Unfortunately, this overcorrects: any solution that has two of the variables greater than $6$ is counted once in $(1)$ but then subtracted twice in $(2)$ and is therefore counted $-1$ times instead of the desired $0$ times. Thus, we need to correct $(2)$ by adding back in the solutions that have two variables larger than $6$.

How many solutions are there with $q_1,q_2\ge 7$? Use the same trick as before. Let $x_1=q_1-6$ and $x_2=q_2-6$, and count the positive solutions to

$$x_1+x_2+q_3+q_4+q_5+q_6=26-2\cdot 6=14\;;$$

there are $\binom{14-1}{6-1}=\binom{13}5$ of them that we need to add back in to $(2)$. We need to do that for each of the $\binom62$ pairs of variables, so we correct $(2)$ to

$$\binom{25}5-6\cdot\binom{19}5+\binom62\binom{13}5\;.\tag{3}$$

And once again we’ve overcorrected: any solution to the original equation that has three variables over $6$ has been counted once in $(1)$, subtracted $3$ times in $(2)$, and added back in $3$ times in $(3)$, for a net count of $1$ instead of the desired $0$, so it has to be subtracted. I’ll not go through the details this time, because the reasoning is the same; we end up with $\binom63$ possible sets of $3$ variables, and for each of those sets $\binom{7}5$ solutions with all $3$ exceeding $6$, resulting in an improved result of

$$\binom{25}5-6\cdot\binom{19}5+\binom62\binom{13}5-\binom63\binom75\;.\tag{4}$$

And it’s not possible for a solution to have $4$ of the variables exceeding $6$, so we’re done: $(4)$ is the final total, and it works out to $2247$.

Brian M. Scott
  • 616,228
0
  • From generating function

$(x+x^2+x^3+x^4+x^5+x^6)^6$

the coefecient of $x^{26}$ is 2247, hence the answer.

Abr001am
  • 746