Identities and Techniques, Proved

Study Sheet

Identities and Techniques, Proved

The hockey stick, Vandermonde, absorption, stars and bars, inclusion–exclusion and linearity — each one proved, not just stated

Counting the Same Thing Twice

Concept
The one move behind every identity in this topic

Almost every binomial identity a contest asks for is proved the same way: find a set of objects, count it one way, count it another way, and set the two answers equal. Nothing is manipulated; both sides are the size of the SAME collection, so they cannot disagree.

This is worth internalising before any particular identity, because it is what lets you rebuild a formula you have half-forgotten. If you can describe a set that both sides count, you have the proof.

Example
The warm-up: why (nk)=(nn−k)\dbinom{n}{k} = \dbinom{n}{n-k}

Count the ways to choose a committee of kk people from nn.

First count. Choose the kk who are IN: (nk)\dbinom{n}{k} ways.

Second count. Choose the n−kn-k who are OUT — that determines the committee just as completely: (nn−k)\dbinom{n}{n-k} ways.

Same set, two counts, so (nk)=(nn−k)\dbinom{n}{k} = \dbinom{n}{n-k}. With n=10n = 10, k=3k = 3: (103)=120\dbinom{10}{3} = 120 and (107)=120\dbinom{10}{7} = 120 ✓.

No algebra was used. That is the template.

Theorem
Pascal's Rule, and its proof

Claim. (nk)=(n−1k−1)+(n−1k)\dbinom{n}{k} = \dbinom{n-1}{k-1} + \dbinom{n-1}{k} for 1≤k≤n−11 \le k \le n-1.

Proof. Count the kk-subsets of {1,2,…,n}\{1, 2, \ldots, n\}, split by whether they contain the element nn.

If a subset CONTAINS nn, its remaining k−1k-1 elements come from the other n−1n-1: (n−1k−1)\dbinom{n-1}{k-1} such subsets.

If it does NOT contain nn, all kk elements come from the other n−1n-1: (n−1k)\dbinom{n-1}{k} such subsets.

Every kk-subset falls into exactly one case, so the two counts add to the whole. ■\blacksquare

Check. (73)=35\dbinom{7}{3} = 35 and (62)+(63)=15+20=35\dbinom{6}{2} + \dbinom{6}{3} = 15 + 20 = 35 ✓.

Side note
Why this beats induction

You could prove Pascal's Rule by expanding factorials, and it works. But the factorial proof tells you nothing about WHY, so it is the one you forget. "Split on whether the last element is in" is a sentence you can reconstruct in an exam.

The Hockey Stick Identity

Tip
The identity, and what it looks like in Pascal's triangle
1111211331146411510105116152015611721353521711 + 3 + 6 + 10 + 15 = 35
The stick (22)+(32)+⋯+(62)\binom22 + \binom32 + \cdots + \binom62 (boxed) and its blade (73)=35\binom73 = 35 (shaded).

Claim. For integers 0≤r≤n0 \le r \le n,

(rr)+(r+1r)+(r+2r)+⋯+(nr)=(n+1r+1)\displaystyle\binom{r}{r} + \binom{r+1}{r} + \binom{r+2}{r} + \cdots + \binom{n}{r} = \binom{n+1}{r+1}.

In Pascal's triangle this is a run of entries straight down a diagonal, and the answer sits one step down and one step across — the handle of the stick and its blade. That picture is where the name comes from, and it is also how you check you have written the identity the right way round.

With r=2r = 2 and n=6n = 6: 1+3+6+10+15=35=(73)1 + 3 + 6 + 10 + 15 = 35 = \dbinom{7}{3} ✓.

Theorem
Proof 1 — count the same subsets twice

Count the (r+1)(r+1)-element subsets of {1,2,…,n+1}\{1, 2, \ldots, n+1\}. There are (n+1r+1)\dbinom{n+1}{r+1} of them. That is the right-hand side.

Now count them by their LARGEST element. Every such subset has a largest element mm, and mm must be at least r+1r+1 (you need rr more elements below it) and at most n+1n+1.

For a fixed largest element mm, the remaining rr elements are chosen freely from {1,…,m−1}\{1, \ldots, m-1\}, which can be done in (m−1r)\dbinom{m-1}{r} ways.

Sum over the possible largest elements:

(n+1r+1)=∑m=r+1n+1(m−1r)=∑k=rn(kr)\displaystyle\binom{n+1}{r+1} = \sum_{m=r+1}^{n+1}\binom{m-1}{r} = \sum_{k=r}^{n}\binom{k}{r},

substituting k=m−1k = m - 1. Each subset is counted exactly once, because it has exactly one largest element. ■\blacksquare

Theorem
Proof 2 — telescope Pascal's Rule

Rearrange Pascal's Rule (k+1r+1)=(kr)+(kr+1)\dbinom{k+1}{r+1} = \dbinom{k}{r} + \dbinom{k}{r+1} into

(kr)=(k+1r+1)−(kr+1)\displaystyle\binom{k}{r} = \binom{k+1}{r+1} - \binom{k}{r+1}.

Sum from k=rk = r to nn. Every term on the right cancels against the next one:

∑k=rn(kr)=[(r+1r+1)−(rr+1)]+[(r+2r+1)−(r+1r+1)]+⋯+[(n+1r+1)−(nr+1)]\displaystyle\sum_{k=r}^{n}\binom{k}{r} = \left[\binom{r+1}{r+1} - \binom{r}{r+1}\right] + \left[\binom{r+2}{r+1} - \binom{r+1}{r+1}\right] + \cdots + \left[\binom{n+1}{r+1} - \binom{n}{r+1}\right].

What survives is the last positive term minus the first negative one: (n+1r+1)−(rr+1)\dbinom{n+1}{r+1} - \dbinom{r}{r+1}, and (rr+1)=0\dbinom{r}{r+1} = 0 because you cannot choose r+1r+1 things from rr. ■\blacksquare

Two proofs, two uses. The counting proof tells you what the identity MEANS; the telescoping proof is the one that generalises to other sums you can force into the form "next minus this".

Example
Worked example — a sum that looks nothing like the identity

Compute 1+2+3+⋯+201 + 2 + 3 + \cdots + 20 using the hockey stick.

Step 1 — rewrite the terms as binomial coefficients. k=(k1)k = \dbinom{k}{1}, so the sum is (11)+(21)+⋯+(201)\dbinom{1}{1} + \dbinom{2}{1} + \cdots + \dbinom{20}{1}.

Step 2 — apply the identity with r=1r = 1, n=20n = 20: the sum is (212)\dbinom{21}{2}.

Step 3 — evaluate. (212)=21⋅202=210\dbinom{21}{2} = \dfrac{21 \cdot 20}{2} = 210.

Check. 20⋅212=210\dfrac{20 \cdot 21}{2} = 210 ✓ — the familiar triangular-number formula IS the hockey stick with r=1r = 1.

Example
Worked example — a sum of triangular numbers

Compute 1+3+6+10+⋯+661 + 3 + 6 + 10 + \cdots + 66, the triangular numbers up to T11T_{11}.

Step 1 — recognise the terms. Tk=(k+12)T_k = \dbinom{k+1}{2}, so the sum is (22)+(32)+⋯+(122)\dbinom{2}{2} + \dbinom{3}{2} + \cdots + \dbinom{12}{2}.

Step 2 — hockey stick with r=2r = 2, n=12n = 12: the sum is (133)\dbinom{13}{3}.

Step 3 — evaluate. (133)=13⋅12⋅116=286\dbinom{13}{3} = \dfrac{13 \cdot 12 \cdot 11}{6} = 286.

Check by adding directly: 1+3+6+10+15+21+28+36+45+55+66=2861+3+6+10+15+21+28+36+45+55+66 = 286 ✓.

Side note
The commonest mistake

The top index moves up by one AND the bottom index moves up by one: ∑k=rn(kr)=(n+1r+1)\sum_{k=r}^{n}\dbinom{k}{r} = \dbinom{n+1}{r+1}. Writing (n+1r)\dbinom{n+1}{r} or (nr+1)\dbinom{n}{r+1} is the usual slip. The r=1r = 1 case is the safety check — it has to reproduce n(n+1)2\tfrac{n(n+1)}{2}.

Sums of Squares and Cubes, from Binomial Coefficients

Concept
Why the squares are the interesting case

The hockey stick adds binomial coefficients. A sum like 12+22+⋯+n21^2 + 2^2 + \cdots + n^2 is not obviously made of them — but it can be, and rewriting it that way is one of the most reusable tricks in counting. It replaces "memorise n(n+1)(2n+1)6\tfrac{n(n+1)(2n+1)}{6}" with "convert, then telescope", which also handles cubes, fourth powers, and sums nobody gave you a formula for.

Theorem
The conversion, and why it is exact

Claim. k2=(k1)+2(k2)k^2 = \dbinom{k}{1} + 2\dbinom{k}{2} for every integer k≥0k \ge 0.

Proof. (k1)+2(k2)=k+2⋅k(k−1)2=k+k(k−1)=k+k2−k=k2\dbinom{k}{1} + 2\dbinom{k}{2} = k + 2 \cdot \dfrac{k(k-1)}{2} = k + k(k-1) = k + k^2 - k = k^2. ■\blacksquare

What it means. Count the ordered pairs (a,b)(a, b) with a,b∈{1,…,k}a, b \in \{1, \ldots, k\} — there are k2k^2. Split them: the kk pairs with a=ba = b, and the pairs with a≠ba \ne b, which come from a 2-element subset in 22 orders, giving 2(k2)2\dbinom{k}{2}. Same set, two counts.

Check at k=5k = 5: (51)+2(52)=5+20=25=52\dbinom{5}{1} + 2\dbinom{5}{2} = 5 + 20 = 25 = 5^2 ✓.

Theorem
The sum of squares, derived rather than recalled

Start from the conversion and sum from k=1k = 1 to nn:

∑k=1nk2=∑k=1n(k1)+2∑k=1n(k2)\displaystyle\sum_{k=1}^{n} k^2 = \sum_{k=1}^{n}\binom{k}{1} + 2\sum_{k=1}^{n}\binom{k}{2}.

Apply the hockey stick to each piece. The first is (n+12)\dbinom{n+1}{2}; the second is (n+13)\dbinom{n+1}{3}. So

∑k=1nk2=(n+12)+2(n+13)\displaystyle\sum_{k=1}^{n} k^2 = \binom{n+1}{2} + 2\binom{n+1}{3}.

That is already a usable answer, and it is the form worth remembering. Expanding it recovers the familiar one:

(n+1)n2+2⋅(n+1)n(n−1)6=n(n+1)6[3+2(n−1)]=n(n+1)(2n+1)6\dfrac{(n+1)n}{2} + 2\cdot\dfrac{(n+1)n(n-1)}{6} = \dfrac{n(n+1)}{6}\left[3 + 2(n-1)\right] = \dfrac{n(n+1)(2n+1)}{6}. ■\blacksquare

Check at n=6n = 6: (72)+2(73)=21+70=91\dbinom{7}{2} + 2\dbinom{7}{3} = 21 + 70 = 91, and 1+4+9+16+25+36=911+4+9+16+25+36 = 91 ✓.

Example
The same machine on cubes

Step 1 — convert. k3=(k1)+6(k2)+6(k3)k^3 = \dbinom{k}{1} + 6\dbinom{k}{2} + 6\dbinom{k}{3}. (Check at k=4k=4: 4+6⋅6+6⋅4=4+36+24=64=434 + 6\cdot 6 + 6\cdot 4 = 4 + 36 + 24 = 64 = 4^3 ✓.)

Step 2 — sum and hockey-stick each piece.

∑k=1nk3=(n+12)+6(n+13)+6(n+14)\displaystyle\sum_{k=1}^{n} k^3 = \binom{n+1}{2} + 6\binom{n+1}{3} + 6\binom{n+1}{4}.

Step 3 — check at n=4n = 4. (52)+6(53)+6(54)=10+60+30=100\dbinom{5}{2} + 6\dbinom{5}{3} + 6\dbinom{5}{4} = 10 + 60 + 30 = 100, and 1+8+27+64=1001 + 8 + 27 + 64 = 100 ✓ — which is also (4⋅52)2\left(\tfrac{4\cdot 5}{2}\right)^2, the "sum of cubes is a square" fact.

Why this scales. The coefficients in the conversion are the Stirling numbers; you never need them by name, because you can always find them by matching a few values of kk.

Side note
What to do when you forget the formula

Convert to binomial coefficients by matching values at k=1,2,3k = 1, 2, 3, then hockey-stick. It is slower than recalling n(n+1)(2n+1)6\tfrac{n(n+1)(2n+1)}{6} and it never fails you, which is the trade you want in a timed contest.

Vandermonde's Identity

Theorem
The identity and its proof

Claim. ∑k=0r(mk)(nr−k)=(m+nr)\displaystyle\sum_{k=0}^{r}\binom{m}{k}\binom{n}{r-k} = \binom{m+n}{r}.

Proof. A club has mm women and nn men. Count the committees of size rr.

First count. Ignore the split: (m+nr)\dbinom{m+n}{r}.

Second count. Split by how many women are on it. If exactly kk women, choose them in (mk)\dbinom{m}{k} ways and the remaining r−kr-k men in (nr−k)\dbinom{n}{r-k} ways. Sum over kk.

Every committee has one definite number of women, so it is counted once in the second count. ■\blacksquare

Check with m=4m = 4, n=3n = 3, r=3r = 3: (40)(33)+(41)(32)+(42)(31)+(43)(30)=1+12+18+4=35=(73)\dbinom40\dbinom33 + \dbinom41\dbinom32 + \dbinom42\dbinom31 + \dbinom43\dbinom30 = 1 + 12 + 18 + 4 = 35 = \dbinom73 ✓.

Theorem
The corollary that shows up most: ∑(nk)2=(2nn)\sum \dbinom{n}{k}^2 = \dbinom{2n}{n}

Put m=nm = n and r=nr = n in Vandermonde:

∑k=0n(nk)(nn−k)=(2nn)\displaystyle\sum_{k=0}^{n}\binom{n}{k}\binom{n}{n-k} = \binom{2n}{n}.

Now use the symmetry (nn−k)=(nk)\dbinom{n}{n-k} = \dbinom{n}{k}, and the left side becomes ∑k(nk)2\sum_k \dbinom{n}{k}^2. ■\blacksquare

Read it directly: choosing nn people from two groups of nn means taking kk from one and n−kn-k from the other, and the symmetry says "n−kn-k from the second group" is the same count as "kk from it".

Check at n=4n = 4: 1+16+36+16+1=70=(84)1 + 16 + 36 + 16 + 1 = 70 = \dbinom{8}{4} ✓.

Example
Worked example — a sum with a shifted index

Compute ∑k=05(5k)(6k)\displaystyle\sum_{k=0}^{5}\binom{5}{k}\binom{6}{k}.

Step 1 — make the lower indices add to something fixed. They do not yet: both are kk. Use symmetry on one factor: (6k)=(66−k)\dbinom{6}{k} = \dbinom{6}{6-k}.

Step 2 — now the indices add to 66. The sum is ∑k(5k)(66−k)\sum_k \dbinom{5}{k}\dbinom{6}{6-k}, which is Vandermonde with m=5m = 5, n=6n = 6, r=6r = 6.

Step 3 — read off the answer. (116)=462\dbinom{11}{6} = 462.

Check by direct addition: 1⋅1+5⋅6+10⋅15+10⋅20+5⋅15+1⋅6=1+30+150+200+75+6=4621\cdot 1 + 5\cdot 6 + 10\cdot 15 + 10\cdot 20 + 5\cdot 15 + 1\cdot 6 = 1 + 30 + 150 + 200 + 75 + 6 = 462 ✓.

The technique is the whole point: Vandermonde only fires when the two bottom indices SUM to a constant, and symmetry is how you arrange that.

The Committee–Chair Identity

Theorem
k(nk)=n(n−1k−1)k\dbinom{n}{k} = n\dbinom{n-1}{k-1}, and why

Claim. k(nk)=n(n−1k−1)k\dbinom{n}{k} = n\dbinom{n-1}{k-1}.

Proof. Count the pairs (committee of size kk, chair chosen from that committee), out of nn people.

First count. Pick the committee ((nk)\dbinom{n}{k} ways), then pick its chair from the kk members (kk ways): k(nk)k\dbinom{n}{k}.

Second count. Pick the chair first, from all nn people (nn ways), then fill the remaining k−1k-1 seats from the other n−1n-1 people ((n−1k−1)\dbinom{n-1}{k-1} ways): n(n−1k−1)n\dbinom{n-1}{k-1}.

Both count the same pairs. ■\blacksquare

Check at n=8n = 8, k=3k = 3: 3(83)=3⋅56=1683\dbinom83 = 3\cdot 56 = 168 and 8(72)=8⋅21=1688\dbinom72 = 8 \cdot 21 = 168 ✓.

Theorem
What it is for: ∑k(nk)=n2n−1\sum k\dbinom{n}{k} = n2^{n-1}

Apply the identity term by term:

∑k=0nk(nk)=∑k=1nn(n−1k−1)=n∑j=0n−1(n−1j)=n 2n−1\displaystyle\sum_{k=0}^{n} k\binom{n}{k} = \sum_{k=1}^{n} n\binom{n-1}{k-1} = n\sum_{j=0}^{n-1}\binom{n-1}{j} = n\,2^{n-1},

using j=k−1j = k-1 and the fact that a full row of Pascal's triangle sums to a power of two. ■\blacksquare

In words: add up the sizes of all 2n2^n subsets of an nn-set. Each element lies in exactly half of them, so it contributes 2n−12^{n-1}, and there are nn elements.

Check at n=5n = 5: 0+5+20+30+20+5=80=5⋅160 + 5 + 20 + 30 + 20 + 5 = 80 = 5 \cdot 16 ✓.

The same trick with k2k^2 gives ∑k2(nk)=n(n+1)2n−2\sum k^2\dbinom{n}{k} = n(n+1)2^{n-2} — apply absorption twice, or use the square conversion from the previous section.

Side note
Where you meet it

Any time a sum has a kk multiplying a (nk)\dbinom{n}{k}, absorption is the first thing to try: it turns the kk into an nn and drops both indices by one, which is almost always progress.

Stars and Bars, Proved

Theorem
The theorem and the bijection that proves it

Claim. The number of solutions of x1+x2+⋯+xk=nx_1 + x_2 + \cdots + x_k = n in NON-NEGATIVE integers is (n+k−1k−1)\dbinom{n+k-1}{k-1}.

Proof. Write nn stars in a row and insert k−1k-1 bars among them; the bars cut the stars into kk (possibly empty) groups, and the group sizes are a solution.

The row has n+k−1n + k - 1 symbols in total, and the arrangement is determined entirely by WHICH of those positions hold bars — so there are (n+k−1k−1)\dbinom{n+k-1}{k-1} arrangements.

The map from arrangements to solutions is a bijection: every arrangement gives one solution, and every solution is produced by exactly one arrangement (put x1x_1 stars, a bar, x2x_2 stars, a bar, …). ■\blacksquare

Check: x1+x2+x3=4x_1+x_2+x_3 = 4 has (62)=15\dbinom{6}{2} = 15 non-negative solutions, and listing them gives 1515 ✓.

Example
The positive-integer version, and the bounded version

Positive solutions. Require xi≥1x_i \ge 1. Substitute yi=xi−1≥0y_i = x_i - 1 \ge 0; the equation becomes y1+⋯+yk=n−ky_1 + \cdots + y_k = n - k, so the count is (n−1k−1)\dbinom{n-1}{k-1}.

Check: x1+x2+x3=6x_1+x_2+x_3 = 6 in positive integers gives (52)=10\dbinom52 = 10 ✓.

With an upper bound — say every xi≤cx_i \le c — stars and bars alone over-counts, and inclusion–exclusion repairs it:

#{xi≤c}=∑j(−1)j(kj)(n−j(c+1)+k−1k−1)\displaystyle\#\{x_i \le c\} = \sum_{j}(-1)^j\binom{k}{j}\binom{n - j(c+1) + k - 1}{k-1},

where the jj-th term removes (and then restores) the cases where jj chosen variables have been pushed over the cap by c+1c+1.

Worked check. x1+x2+x3=10x_1+x_2+x_3 = 10 with each xi≤4x_i \le 4: (122)−3(72)+3(22)=66−63+3=6\dbinom{12}{2} - 3\dbinom72 + 3\dbinom22 = 66 - 63 + 3 = 6. Listing the solutions — the permutations of (2,4,4)(2,4,4) and (3,3,4)(3,3,4) — also gives 3+3=63 + 3 = 6 ✓.

Side note
The trap

Stars and bars counts solutions where the variables are DISTINGUISHABLE — x1=3,x2=1x_1 = 3, x_2 = 1 is different from x1=1,x2=3x_1 = 1, x_2 = 3. If the problem is about identical piles with no labels, this is the wrong tool and the answer is a partition count, which has no closed form.

Inclusion–Exclusion, and Why the Signs Alternate

Theorem
The theorem, proved by counting each element

Claim. ∣A1∪⋯∪An∣=∑∣Ai∣−∑∣Ai∩Aj∣+∑∣Ai∩Aj∩Ak∣−⋯\displaystyle\left|A_1 \cup \cdots \cup A_n\right| = \sum|A_i| - \sum|A_i \cap A_j| + \sum|A_i \cap A_j \cap A_k| - \cdots

Proof. Take any element xx in the union, and suppose it lies in exactly m≥1m \ge 1 of the sets. Count how much it contributes to the right-hand side.

It is counted (m1)\dbinom{m}{1} times among the single sets, (m2)\dbinom{m}{2} times among the pairwise intersections, (m3)\dbinom{m}{3} times among the triples, and so on. Its total contribution is

(m1)−(m2)+(m3)−⋯=1−[(m0)−(m1)+(m2)−⋯ ]=1−(1−1)m=1−0=1\displaystyle\binom{m}{1} - \binom{m}{2} + \binom{m}{3} - \cdots = 1 - \left[\binom{m}{0} - \binom{m}{1} + \binom{m}{2} - \cdots\right] = 1 - (1-1)^m = 1 - 0 = 1,

by the binomial theorem. So every element of the union contributes exactly 11, and elements outside contribute 00. ■\blacksquare

That is where the alternating signs come from: they are exactly what makes (1−1)m(1-1)^m collapse to zero.

Reminder — The binomial theorem:  (x+y)n=∑k=0n(nk)x n−kyk(x+y)^{n}=\sum_{k=0}^{n}\binom{n}{k}x^{\,n-k}y^{k}
Example
Worked example — derangements

How many permutations of 1,…,51, \ldots, 5 leave NO element in its own place?

Step 1 — name the bad sets. Let AiA_i be the permutations fixing ii. We want 5!−∣A1∪⋯∪A5∣5! - |A_1 \cup \cdots \cup A_5|.

Step 2 — size the intersections. Fixing a particular set of jj elements leaves the other 5−j5-j free: (5−j)!(5-j)! permutations. There are (5j)\dbinom{5}{j} such sets.

Step 3 — inclusion–exclusion.

D5=∑j=05(−1)j(5j)(5−j)!=120−120+60−20+5−1=44\displaystyle D_5 = \sum_{j=0}^{5}(-1)^j\binom{5}{j}(5-j)! = 120 - 120 + 60 - 20 + 5 - 1 = 44.

Step 4 — sanity check. Dn≈n!/eD_n \approx n!/e, and 120/e≈44.1120/e \approx 44.1 ✓. Brute-force enumeration of all 120120 permutations also gives 4444 ✓.

Linearity of Expectation

Theorem
The theorem — and the hypothesis it does NOT need

Claim. For any random variables X1,…,XnX_1, \ldots, X_n on the same sample space, E[X1+⋯+Xn]=E[X1]+⋯+E[Xn]E[X_1 + \cdots + X_n] = E[X_1] + \cdots + E[X_n].

Proof. Expectation is a weighted sum over outcomes:

E[∑iXi]=∑ωP(ω)∑iXi(ω)=∑i∑ωP(ω)Xi(ω)=∑iE[Xi]\displaystyle E\left[\sum_i X_i\right] = \sum_{\omega} P(\omega)\sum_i X_i(\omega) = \sum_i \sum_{\omega} P(\omega)X_i(\omega) = \sum_i E[X_i],

the middle step being nothing but swapping the order of a finite double sum. ■\blacksquare

Notice what is missing: independence. It is never used. This is why linearity is so powerful — it applies to variables that are tangled together in ways you could not possibly analyse directly.

Example
Worked example — expected fixed points

A permutation of 1,…,n1, \ldots, n is chosen at random. How many elements are expected to stay in place?

Step 1 — indicator variables. Let Xi=1X_i = 1 if ii is fixed and 00 otherwise. The number of fixed points is X=X1+⋯+XnX = X_1 + \cdots + X_n.

Step 2 — one expectation each. E[Xi]=P(i is fixed)=1nE[X_i] = P(i \text{ is fixed}) = \dfrac{1}{n}, because ii is equally likely to land anywhere.

Step 3 — add them. E[X]=n⋅1n=1E[X] = n \cdot \dfrac{1}{n} = 1, for every nn.

Check at n=3n = 3: the six permutations have 3,1,1,0,0,13, 1, 1, 0, 0, 1 fixed points, averaging 6/6=16/6 = 1 ✓.

Why this is remarkable. The XiX_i are NOT independent — knowing n−1n-1 of them tells you the last. Linearity does not care.

Example
Worked example — expected number of distinct birthdays

2020 people each pick a day from 365365 at random. How many days are expected to be chosen by at least one person?

Step 1 — indicator per DAY, not per person. Let Yd=1Y_d = 1 if day dd is picked by somebody. The number of distinct days is ∑d=1365Yd\sum_{d=1}^{365} Y_d.

Step 2 — complementary counting inside the expectation. E[Yd]=P(day d is used)=1−(364365)20E[Y_d] = P(\text{day } d \text{ is used}) = 1 - \left(\dfrac{364}{365}\right)^{20}.

Step 3 — add. E=365[1−(364365)20]≈19.49E = 365\left[1 - \left(\dfrac{364}{365}\right)^{20}\right] \approx 19.49.

The move worth stealing: choosing what to index the indicators BY. Indexing by person gives nothing; indexing by day gives the answer in one line.

Symmetry and the Even–Odd Split

Theorem
Half of every row: ∑k even(nk)=2n−1\sum_{k \text{ even}}\dbinom{n}{k} = 2^{n-1}

Claim. For n≥1n \ge 1, the even-index entries of row nn of Pascal's triangle sum to 2n−12^{n-1}, and so do the odd-index ones.

Proof. The binomial theorem gives two equations:

(1+1)n=∑k(nk)=2n\displaystyle (1+1)^n = \sum_k \binom{n}{k} = 2^n and (1−1)n=∑k(−1)k(nk)=0\displaystyle (1-1)^n = \sum_k (-1)^k\binom{n}{k} = 0.

Add them. The odd terms cancel and the even ones double: 2∑k even(nk)=2n2\sum_{k \text{ even}}\dbinom{n}{k} = 2^n, so the even sum is 2n−12^{n-1}. Subtracting instead gives the same value for the odd sum. ■\blacksquare

Check at n=5n = 5: evens 1+10+5=161 + 10 + 5 = 16, odds 5+10+1=165 + 10 + 1 = 16, and 24=162^4 = 16 ✓.

The technique in general is called a roots-of-unity filter: evaluating at 11 and −1-1 selects residues mod 22; evaluating at the cube roots of unity selects residues mod 33, and so on.

Example
Worked example — subsets of even size

How many subsets of {1,…,8}\{1, \ldots, 8\} have an even number of elements?

Step 1 — the identity answers it immediately: 28−1=1282^{8-1} = 128.

Step 2 — or see it by a bijection, which is worth knowing because it needs no algebra. Pair each subset SS with S△{8}S \triangle \{8\} — add the element 88 if it is absent, remove it if it is present. This pairing swaps even size with odd size and is its own inverse, so it matches the even subsets one-to-one with the odd ones. Exactly half of the 256256 subsets are even.

Check by adding the row: 1+28+70+28+1=1281 + 28 + 70 + 28 + 1 = 128 ✓.

Side note
When the bijection beats the algebra

The involution proof survives changes the algebra does not: it still works if you ask for subsets of even size avoiding some element, because you just pick a different element to toggle. Reach for a pairing whenever a problem says "show exactly half".