Skip to content

Commit 6266d65

Browse files
committed
link number of upper-bound integer sums with stars and bars
1 parent 3d6231e commit 6266d65

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/combinatorics/inclusion-exclusion.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,27 +137,29 @@ As we solved the inverse problem, we subtract it from the total of $3^n$ sequenc
137137

138138
$$3^n - (3 \cdot 2^n - 3 \cdot 1 + 0)$$
139139

140-
### The number of integer solutions to the equation
140+
<a id="the-number-of-integer-solutions-to-the-equation" />
141+
### Number of upper-bound integer sums {: #number-of-upper-bound-integer-sums }
141142

142143
Consider the following equation:
143144

144145
$$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 = 20$$
145146

146-
where $0 \le x_i \le 8 (i = 1,2,\ldots 6)$.
147+
where $0 \le x_i \le 8 ~ (i = 1,2,\ldots 6)$.
147148

148149
Task: count the number of solutions to the equation.
149150

150-
Forget the restriction on $x_i$ for a moment and just count the number of nonnegative solutions to this equation. This is easily done using [binomial coefficients](binomial-coefficients.md): we want to break a sequence of $20$ units into $6$ groups, which is the same as distributing $5$ "walls" over $25$ slots:
151+
Forget the restriction on $x_i$ for a moment and just count the number of nonnegative solutions to this equation. This is easily done using [Stars and Bars](stars_and_bars.html):
152+
we want to break a sequence of $20$ units into $6$ groups, which is the same as arranging $5$ _bars_ and $20$ _stars_:
151153

152154
$$N_0 = \binom{25}{5}$$
153155

154156
We will now calculate the number of "bad" solutions with the inclusion-exclusion principle. The "bad" solutions will be those in which one or more $x_i$ are greater than $9$.
155157

156-
Denote by $A_k (k = 1,2\ldots 6)$ the set of solutions where $x_k \ge 9$, and all other $x_i \ge 0 (i \ne k)$ (they may be $\ge 9$ or not). To calculate the size of $A_k$, note that we have essentially the same combinatorial problem that was solved in the two paragraphs above, but now $9$ of the units are excluded from the slots and definitely belong to the first group. Thus:
158+
Denote by $A_k ~ (k = 1,2\ldots 6)$ the set of solutions where $x_k \ge 9$, and all other $x_i \ge 0 ~ (i \ne k)$ (they may be $\ge 9$ or not). To calculate the size of $A_k$, note that we have essentially the same combinatorial problem that was solved in the two paragraphs above, but now $9$ of the units are excluded from the slots and definitely belong to the first group. Thus:
157159

158160
$$ | A_k | = \binom{16}{5} $$
159161

160-
Similarly, the size of the intersection between sets $A_k$ and $A_p$ is equal to:
162+
Similarly, the size of the intersection between two sets $A_k$ and $A_p$ (for $k \ne p$) is equal to:
161163

162164
$$ \left| A_k \cap A_p \right| = \binom{7}{5}$$
163165

src/combinatorics/stars_and_bars.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ $$\Leftrightarrow ~ ~ x_1' + x_2' + \dots + x_k' = n - a_1 - a_2 - \dots - a_k$$
5656

5757
with $x_i' \ge 0$.
5858
So we have reduced the problem to the simpler case with $x_i' \ge 0$ and again can apply the stars and bars theorem.
59+
60+
## Number of upper-bound integer sums
61+
62+
With some help of the [Inclusion-Exclusion Principle](./inclusion-exclusion.md), you can also restrict the integers with upper bounds.
63+
See the [Number of upper-bound integer sums](./inclusion-exclusion.md#number-of-upper-bound-integer-sums) section in the corresponding article.

0 commit comments

Comments
 (0)