1

Let $ b_0 $ be a length $ n $ bit string of Hamming weight $ w_0 $. The sum $$ \sum_{wt(b)=w} (-1)^{b ~\cdot~ b_0} $$ over all length $ n $ bit strings $ b $ of some fixed Hamming weight $ w $ has $ \binom{n}{w} $ many terms. I would like a formula to compute this in a happier/ more efficient way. I've derived and used this formula successfully for the case of $ w_0< w $ $$ \sum_{wt(b)=w} (-1)^{b ~\cdot~ b_0}= \sum_{k=0}^{w_0} (-1)^k \binom{w_0}{k} \binom{n-w_0}{w-k} $$ where we think of $ k $ as the number of places in which each bit string $ b $ over laps with the fixed bit string $ b_0 $. Is this formula correct? Does anyone know any other/ better formulas? How do I generalize this formula for the case $ w_0> w $?

Is there a nice way to think of this in terms of inner products on binary vector spaces?

RobPratt
  • 50,938
  • 1
    Your formula also works in the case where $w_0\ge w$. What makes you think it only works when $w_0<w$? You might be worried about the factor of $\binom{n-w_0}{w-k}$ for the terms where $k>w$, but by definition, $\binom nh=0$ when $h$ is negative, so these terms are zero and cause no problem. – Mike Earnest Nov 21 '24 at 17:26
  • 1
    In either case, you sum is equal to $\sum_{k=0}^{\color{blue}{w}}(-1)^k\binom{w_0}k\binom{n-w_0}{w-k}$, which is exactly the sum discussed in this other MSE question. The answer there proves there is no closed form for the summation, except in the special case where $w_0=n-w_0$. – Mike Earnest Nov 21 '24 at 17:36

0 Answers0