Alternating Subset Weights

S = {1,2,...,2013}. Find the sum of w(A) over every subset A ⊆ S.

Problem

A = {a₁ < a₂ < ... < aₖ}

w(A) = a₁ − a₂ + a₃ − a₄ + ...

① Don't sum subsets — track one number j

Suppose a subset contains j. Its sign depends on how many selected numbers are smaller than j.

sign(j) = (−1)# selected elements below j

Example: if two selected elements occur before j, then j is the third element of the subset and receives a + sign.

② Explore the cancellation

③ Why j > 1 disappears

The total coefficient of j is

ΣB⊆{1,...,j−1} (−1)|B|
↓
(1 − 1)j−1
↓
0    if j > 1

So every number 2,3,...,2013 has total contribution zero.

④ What happens to j = 1?

There are no smaller numbers than 1.

Therefore whenever a subset contains 1, it is always the first element:

+1

The remaining 2012 elements can independently be included or excluded.

# subsets containing 1 = 22012

Only 1 survives

contribution(1) = 1 × 22012
∑A⊆S w(A) = 22012

Interview shortcut

Instead of considering all 22013 subsets, ask:

"What is the total coefficient of each number j?"

For every j > 1, toggle one smaller element. This changes j's position from odd to even, or even to odd:

+j   ↔   −j

Thus they cancel pairwise. The number 1 has no smaller element available to toggle, so it is the only survivor.