0

Suppose:

A monkey randomly writes down a series of +1 and -1.

The series contains $n$ elements. For example, if $n=2$, then the series can either be $\left \{ 1, 1 \right \}$ or $\left \{ -1, 1 \right \}$ or $\left \{ 1, -1 \right \}$ or $\left \{ -1, -1 \right \}$.

A human then sums up the elements contain in the series. For example, for $n=2$, the sum could either be 2 or 0 or -2.

Notice that there 2 series combination that results to a sum of 0. $\left \{ -1, 1 \right \}$ and $\left \{ 1, -1 \right \}$

I wish to find a formula that determines: for a given n, how many series combination that results to a sum of $x$?

To explain, here are some examples:

  1. If $n=2$ and $x=0$, then there are only 2 combinations (above example)

  2. If $n=4$ and $x=-2$, then there are only 4 combinations

  3. If $n=4$ and$x=4$, then there are only 1 combination

Non-critical notes:

  1. This question was asked to me by my sister and I have spent a long time trying to figure it out, but obviously I need help. Coming from engineering background, I have never touch combinatorics and counting since pretty much high school. I think the question is interesting because the set contains -1, which "cancels" out the +1, so traditional methods such as "stars & bars" does not work.

  2. For simplicity, $n$ is always even number. Additionally, because +1 and -1 are odd numbers, hence $x$ is also always an even number.

  3. For the case $n=2$, it is like drawing a 2 x 2 table where the row and column headers are 1 and -1, while the each entries are the sum of the respective row and col header. In this table, the entries are the same value in each top-left-to-buttom-right diagonals. For the case $n=3$, it is like drawing a 2 x 2 x 2 cube where the headers are 1 and -1, and again, similarly, in 1 of the diagonal direction, each entries have the same value in that diagonal. So this problem boils down to how many entry cells that a particular diagonal crosses.

0 Answers0