一个经典组合问题的推
\(\textbf{Statement.}\)
化简下面的式子:
\[\sum_{x\in \{-1,1\}^n}|x_1+x_2+\dots+x_n|
\]
(先别急着看题解,可以当作练习题)
\(\textbf{Solution.}\)
较为详细的过程:
\[\begin{aligned}
&\sum_{x\in \{-1,1\}^n}|x_1+x_2+\dots+x_n|\\
&=\sum_{i=0}^{n}|n-2i|{n\choose i}\\
&=2\sum_{i=0}^{\lfloor n/2\rfloor}(n-2i){n\choose i}\\
&=2\sum_{i=0}^{\lfloor n/2\rfloor}{n\choose i}{n-i\choose 1}-{n\choose i}{i\choose 1}\\
&=2\sum_{i=0}^{\lfloor n/2\rfloor}{n\choose 1}{n-1\choose i}-{n\choose 1}{n-1\choose i-1}\\
&=2n\sum_{i=0}^{\lfloor n/2\rfloor}{n-1\choose i}-{n-1\choose i-1}\\
&=2n{n-1\choose \lfloor n/2\rfloor}
\end{aligned}
\]