2

Consider sampling a string of $N$ binary digits (in $\{0,1\}$), having exactly $N/2$ occurrences of each digit.
This can be also thought of as randomly permuting the string $\underbrace{000\dots0}_{N/2\text{ times}}\underbrace{111\dots1}_{N/2\text{ times}}$.

Define $X$ as the number of "switches" between $0$ and $1$ in such a random string of length $N$.
For instance, when $N=6$ then in $000111$ we have only one switch ($X=1$), and in $010101$ we have $5$ such switches ($X=5$).

I am interested in the distribution (or at least the expectation) of the number of switches $X$.

I couldn't think of a suitable reduction to a more traditional problem/distribution.

Itay
  • 143
  • 7
  • 1
    Related to https://math.stackexchange.com/questions/4463857/round-table-sitting-probability-expectation-of-number-of-switches. Where does this question come from? – Easymode44 Jun 02 '22 at 08:36
  • I agree, this is almost the same question. Pure coincidence though, as I independently thought of this during my research... – Itay Jun 02 '22 at 08:41
  • I undeleted this question because I'm also interested in the distribution, rather than the expectation like the other question – Itay Jun 02 '22 at 08:45
  • 1
    I agree, this question is also structured in a more general way, although that one has a circularity component to it. By the way, might this help you with your query? https://math.stackexchange.com/questions/258221/probability-distribution-of-number-of-switches?rq=1 – Easymode44 Jun 02 '22 at 08:47

1 Answers1

0

Mark switches with $1$ and non-switches with $0$ and keep the first number only. That way $100101$ becomes $1\_10111$, explanation $10$ is $1$, next $00$ is $0$, $01$ is $1$, $10$ is $1$, and $01$ is $1$. So if you take $n-1$ bit number, each number gives a unique $n$ bit number up to the first digit used. Since one possible combination will start with $1$ and another with $0$, that would be two totally different and unique combinations. Each combination has a unique representation in this manner.

So, the distribution of the number of switches is the same as the distribution of the number of $1$'s within $n-1$ bit number.

That comes to the question of how many different numbers you have where not a single $1$ is used, one $1$ is used, two $1$'s are used and so on $k$ $1$'s are used and that would be

$$\binom{n-1}{k}$$

which is Binomial distribution with all details of this particular distribution.

  • Thanks. One should also take into account the fact that $0$ is not a valid number of "switches". Numerically, the distribution seems a little different than the binomial distribution. – Itay Jun 02 '22 at 09:43
  • It looks like you missed the constraint that the string has exactly half ones and half zeroes, so the digits are not independent. (I made the same mistake.) – Karl Jun 02 '22 at 14:49