I am told that a random variable can take a value of $+1$ or $-1$. I am given the total number of times the random variable is counted, $N$, and the sum of the random variables, $n$, and asked to find how many ways such an outcome is possible. So if $N=3$ and $n=1$ I can have $(1, 1, -1)$, $(1, -1, 1)$ or $(-1, 1, 1)$. I figure this is a permutation problem and attempted to tackle it as follows.
If $A$ is the number of times our random variables takes the value +1, and $B$ is the number of times our random variable takes the value -1 then the number of ways this outcome is possible is
$$P(A,B)=\frac{(A+B)!}{A!B!}.$$
Obviously
$$A+B=N,$$
and
$$A-B=n.$$
Solving this for $N$ and $n$ in terms of $A$ and $B$ we get
$$A=\frac{N+n}{2},$$ $$B=\frac{N-n}{2}.$$
Therefore our permutation formula takes the following form:
$$P(N,n)=\frac{N!}{\left( \frac{N+n}{2} \right) ! \left( \frac{N-n}{2} \right) !}$$
I think this works for allowed values of $A$ and $B$, however based on that last formula I can choose values of $N$ and $n$ that should not be allowed such as $N=3$ and $n=2$. This gives fractional values for $A$ and $B$, which is not allowed. Therefore $P(3, 2)$ ought to be zero, however it's not based on my formula. I'm not really sure how to resolve this issue. Any help would be appreciated.
$$P(N,n)=\left[ \frac{N!}{\left( \frac{N+n}{2} \right) ! \left( \frac{N-n}{2} \right) !} \right] (-((N+n) mod 2)+1) $$
but that just looks ugly. I was wondering if there was a better way to write this.
– Dargscisyhp Feb 25 '15 at 03:01