How does this amount change if we add to it?

124 Views Asked by At

We can iterate over the naturals, with zero included. Here the focus is on the numbers from $0$ to $2^s - 1$, inclusive, in binary. So we have the numbers as:

$$0000, 0001, 0010, \dots 1111 \text{ for } s=4$$

We then have an ordered set of urns of size $s$. We can pick $a$ of the urns, and label them with a $1$, and label the rest as don't care, with an $x$. We can again iterate through all possible ordered combinations of urns. So, for $s=4, a=2$, we have:

$$11xx, 1x1x, 1xx1, x11x, x1x1, xx11$$

as labels for the urns.

We then try to match up each number, in binary, with the ordered set of urns. So, for example, $1101$ would fit in the urn labeled $11xx$ since the ones match, and the $x$s don't matter. However, $0101$ would not fit in the urn $11xx$, since there is a zero in the leftmost digit, but the urn has a one in the leftmost digit.

Now, if we count the matches between all combinations of numbers and urns, there is a formula that counts how many matches there are that have $m$ ones in the digits. I'm including this as a check to ensure that I've described the setup properly. It is:

$$\binom{s}{a}\cdot\binom{s-a}{m-a}$$

THE QUESTION

Now, we suppose that we enlarge the numbers by attaching $c$ ones to them. If we iterate over all possible combinations of picking $s$ digits from the newly enlarged numbers, what is the new formula for the number of valid matches?

AN EXAMPLE

If $s=5$, we get numbers that are the binary values of the numbers from $0$ to $2^5-1$, inclusive. So the numbers that we have are:

$$00000, 00001, 00010, \dots, 11111$$

The numbers all have 5 binary digits, so there are 5 urns. Now we can pick a number $a$, which is the amount of urns that will be labeled with a $1$. So again, if $a$ is two, we have urns labeled as:

$$11xxx, 1x1xx, 1xx1x, 1xxx1, x11xx, x1x1x, x1xx1, xx11x, xx1x1, xxx11$$

Then we are trying to count the amount of numbers that will fit in the urns. For example, the number $00000$ won't fit into any of the urns, since it simply doesn't have enough ones as digits. On the other hand $11100$ will fit into $11xxx$, since it has ones in the two leftmost positions. $11100$ will also fit into $1x1xx$ since it has two matching ones in the correct positions. $11100$ will also fit into $x11xx$, since it again has two ones in the correct positions.

For the formula so far, this would give $\binom{s}{a}$ ways of choosing the ones and $x$s, and then $\binom{s-a}{m-a}$ ways of choosing the numbers that fit.

The New Problem

We are adding a variable $c$ to the equations. We can suppose that $c=3$.

Now we basically add three ones to the left side of every number. So for example, if the original number is $9$, which is $01001$ in binary, we add $c=3$ ones to the left side to get $11101001$. We also expanded the size of the urns to accommodate for the new numbers. So if $a=2$, the new urns are labeled as:

$$11xxxxxx, 1x1xxxxx, 1xx1xxxx, 1xxx1xxx, \dots$$

...Essentially, we go through every possible combination of labeling $a=2$ urns with a one, and the rest as don't cares.

Now we want to get a new formula for these expanded values.

SOME NOTES

I believe the new formula will be somewhat similar to the old. The main difference is that we increase the size of the numbers (and urns) by $c$, while at the same time, forcing the $c$ leftmost digits to be $1$.

As for the number $a$, it represents the amount of urns that are labeled with a one. It is in both formulas. It simply tells us how many of the urns, in both equations, that we must label with a one. As another example, if there are 5 urns, and $a=4$, the possible combinations of urns are:

$$1111x, 111x1, 11x11, 1x111, x1111$$

1

There are 1 best solutions below

1
On BEST ANSWER

In the new problem, when we choose a configuration with a 1's and the rest x's, it is important to know whether the 1's occur in the c-block to the left of the number or in the rest. The reason is, suppose we start with s = 3 digits and c = 2, and also a = 2.

Then the string xx11x only matches 11110 and 11111, (one string with 4 1s and one string with 5). since in getting the new strings we were required to add 1's to the left. On the other hand, 11xxx matches eight strings: 11000, 11100, 11010, 11001, 11110, 11101, 11011, 11111. (I hope I'm understanding this problem correctly..)

So the formula will be written as a sum over how many of the a 1's occur in the left c-block in the urn label. Suppose this number is k. Then $a - k$ 1's appear in the right s-block. There are $\binom{c}{k}\binom{s}{a - k}$ ways to get our urn label. Now we want to count the number of matching strings with m total ones, then there are $s - (a - k)$ undetermined slots (marked with $x$'s) and $(m - c) - (a - k)$ of them have to be 1's. The formula is therefore:

$$\sum_{k}\binom{c}{k}\binom{s}{a - k}\binom{s - (a - k)}{(m - c) - (a - k)}$$

The constraints on the variables are: $s + c \geq m \geq c$ (the number of 1's must be at least $c$ and at most the length of the string $s + c$), $m \geq a$, and $s \geq a$. So what's the range on $k$: Well $k$ can be at most $c$, but it can also be no greater than $a$, and so we can write the formula slightly better:

$$\sum_{k = 0}^{min(c,a)}\binom{c}{k}\binom{s}{a - k}\binom{s - (a - k)}{(m - c) - (a - k)}$$