Video 4, chapter 5

Pascal's Triangle Turns into a Fractal

Why shading the odd entries of Pascal's triangle modulo 2 draws Sierpinski's triangle, explained by the parity of binomial coefficients and by modular arithmetic, which makes the pattern copy itself at each power of two.

  • Video 4, chapter 5
  • Different recipes, the same structure

Pascal’s triangle is built by addition alone. Each row starts and ends with 1, and every other entry is the sum of the two entries just above it. Shade the odd entries and leave the even ones blank, and the shaded cells form triangles with upside-down triangular gaps, the same pattern as Sierpinski’s triangle. Why should a rule about adding numbers draw holes inside holes? This page shows that only the parity of each entry matters, uses arithmetic modulo 2 to explain why the pattern copies itself at every power of two, and makes the match with Sierpinski’s triangle exact.

Key terms

Pascal’s triangle modulo 2

Definition Pascal’s triangle has rows numbered n=0,1,2,…n = 0, 1, 2, \ldots from the top. Row 00 is the single number 11. Row nn has n+1n + 1 entries, in positions k=0,1,…,nk = 0, 1, \ldots, n counted from the left, it begins and ends with 11, and each of its other entries is the sum of the two entries just above it, its two parents. Pascal’s triangle modulo 2 replaces every entry by its remainder after division by 22, which is 11 for an odd entry and 00 for an even one, and shading the cells that hold 11 draws the picture. Its rows can be built directly, without the large numbers, because each row still begins and ends with 11 and every other cell holds 11 exactly when its two parents differ. The surprise is that the pattern copies itself. For every m≥2m \ge 2, the first 2m2^m rows, rows 00 to 2m−12^m - 1, consist of three copies of the first 2m−12^{m-1} rows, one at the top and two side by side below it, with an upside-down triangle of zeros between the two lower copies. Row 2m2^m is a 11, then 2m−12^m - 1 zeros, then a 11. Now draw the first 2m2^m rows inside one fixed equilateral triangle. Cut it into small triangles of side 2−m2^{-m} times its side. The small triangles that point up lie in 2m2^m rows holding 1,2,…,2m1, 2, \ldots, 2^m of them, so each entry of rows 00 to 2m−12^m - 1 can be given its own small triangle, in the same row and in the same order from left to right. The shaded cells are then exactly stage mm of the Sierpinski construction. As mm grows, these pictures approach the Sierpinski triangle, but each one is a finite stage with positive area, and only the limit is the gasket itself.

In plain words Forget how big the numbers are and keep only whether each one is odd or even. That single piece of information follows its own simple rule, and the rule makes the top block of rows reappear twice underneath itself, with a gap in between, every time the size doubles.

Example The first eight rows of Pascal’s triangle are

111121133114641151010511615201561172135352171\begin{array}{c} 1 \\ 1 \enspace 1 \\ 1 \enspace 2 \enspace 1 \\ 1 \enspace 3 \enspace 3 \enspace 1 \\ 1 \enspace 4 \enspace 6 \enspace 4 \enspace 1 \\ 1 \enspace 5 \enspace 10 \enspace 10 \enspace 5 \enspace 1 \\ 1 \enspace 6 \enspace 15 \enspace 20 \enspace 15 \enspace 6 \enspace 1 \\ 1 \enspace 7 \enspace 21 \enspace 35 \enspace 35 \enspace 21 \enspace 7 \enspace 1 \end{array}

and modulo 2 they become

111101111110001110011101010111111111\begin{array}{c} 1 \\ 1 \enspace 1 \\ 1 \enspace 0 \enspace 1 \\ 1 \enspace 1 \enspace 1 \enspace 1 \\ 1 \enspace 0 \enspace 0 \enspace 0 \enspace 1 \\ 1 \enspace 1 \enspace 0 \enspace 0 \enspace 1 \enspace 1 \\ 1 \enspace 0 \enspace 1 \enspace 0 \enspace 1 \enspace 0 \enspace 1 \\ 1 \enspace 1 \enspace 1 \enspace 1 \enspace 1 \enspace 1 \enspace 1 \enspace 1 \end{array}

Rows 0 to 3 form the top block. Rows 4 to 7 hold two copies of it, one starting at position 0 and one starting at position 4, and the zeros between them form an upside-down triangle of 33, 22 and 11 zeros. So rows 0 to 7 are three copies of rows 0 to 3, and in the same way rows 0 to 3 are three copies of rows 0 and 1. Counting the ones, the first 8 rows have 27 odd entries out of 36, and the first 16 rows have 81 out of 136. In general the first 2m2^m rows have 3m3^m odd entries out of 2m−1(2m+1)2^{m-1}(2^m + 1) entries, a fraction that shrinks toward zero, just as the area of the Sierpinski stages does.

Parity of binomial coefficients

Definition The entry in row nn and position kk of Pascal’s triangle is the binomial coefficient (nk)\binom{n}{k}, the number of ways to choose kk objects from nn objects, for 0≤k≤n0 \le k \le n. The add-the-two-parents rule is Pascal’s rule

(nk)=(n−1k−1)+(n−1k)\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}

for 1≤k≤n−11 \le k \le n - 1, together with (n0)=(nn)=1\binom{n}{0} = \binom{n}{n} = 1. The parity of a whole number says whether it is even or odd. Since odd plus odd is even, even plus even is even and odd plus even is odd, a coefficient (nk)\binom{n}{k} inside a row, with 1≤k≤n−11 \le k \le n - 1, is odd exactly when one of its two parents is odd and the other is even. The parity of an entry can also be read from binary digits. By Lucas’s theorem, published by Édouard Lucas in 1878, (nk)\binom{n}{k} is odd exactly when every place where the binary form of kk has a 11 is also a place where the binary form of nn has a 11. It follows that row nn has exactly 2j2^j odd entries, where jj is the number of ones in the binary form of nn. The counting meaning of these numbers is the subject of Pascal’s Triangle, a Pattern Factory, and this page needs only their parity.

In plain words Each entry of Pascal’s triangle counts something, but here only one question matters, whether it is odd or even. The answer for an entry inside a row depends only on the answers for its two parents, and the entry is odd exactly when its parents disagree.

Example Row 6 is 1,6,15,20,15,6,11, 6, 15, 20, 15, 6, 1, so its parities are 1,0,1,0,1,0,11, 0, 1, 0, 1, 0, 1. The entry (62)=15\binom{6}{2} = 15 is odd because its parents in row 5, the numbers 55 and 1010, are odd and even. The entry (63)=20\binom{6}{3} = 20 is even because its parents 1010 and 1010 are both even. In binary, 66 is 110110. Position 22 is 010010, whose single 11 sits under a 11 of 110110, so (62)\binom{6}{2} is odd, while position 11 is 001001, whose 11 sits under the 00 of 110110, so (61)=6\binom{6}{1} = 6 is even. The binary form 110110 has two ones, and row 6 has 22=42^2 = 4 odd entries, in positions 0, 2, 4 and 6.

Modular arithmetic

Definition Fix a whole number q≥2q \ge 2, called the modulus. Two integers aa and bb are congruent modulo qq, written a≡b(modq)a \equiv b \pmod{q}, when a−ba - b is a multiple of qq. Every integer is congruent to exactly one of the remainders 0,1,…,q−10, 1, \ldots, q - 1, and sums and products can be found from remainders alone. If a≡a′a \equiv a' and b≡b′b \equiv b' modulo qq, then a+b≡a′+b′a + b \equiv a' + b' and ab≡a′b′ab \equiv a'b' modulo qq. Modulo 2 the only remainders are 00 for even numbers and 11 for odd numbers, and 1+1≡01 + 1 \equiv 0. Polynomials can be reduced in the same way, coefficient by coefficient. Multiplying a polynomial by 1+x1 + x makes each new coefficient the sum of two neighboring old ones, which is Pascal’s rule, so the coefficients of (1+x)n(1 + x)^n are row nn of Pascal’s triangle. Modulo 2,

(1+x)2=1+2x+x2≡1+x2,(1 + x)^2 = 1 + 2x + x^2 \equiv 1 + x^2,

and more generally (u+w)2=u2+2uw+w2≡u2+w2(u + w)^2 = u^2 + 2uw + w^2 \equiv u^2 + w^2. Squaring again and again gives (1+x)2m≡1+x2m(1 + x)^{2^m} \equiv 1 + x^{2^m} for every m≥0m \ge 0, which is why row 2m2^m is odd only at its ends. For 0≤r<2m0 \le r < 2^m it then follows that

(1+x)2m+r=(1+x)2m(1+x)r≡(1+x2m)(1+x)r.\begin{aligned} &(1 + x)^{2^m + r} \\[0.4em] &\quad = (1 + x)^{2^m} (1 + x)^r \\[0.4em] &\quad \equiv \bigl(1 + x^{2^m}\bigr)(1 + x)^r. \end{aligned}

Multiplying row rr by 1+x2m1 + x^{2^m} gives one copy of row rr in positions 00 to rr and a second copy shifted 2m2^m places, in positions 2m2^m to 2m+r2^m + r. Because r<2mr < 2^m the two copies do not overlap, and the entries in positions r+1r + 1 to 2m−12^m - 1 between them are even. This is the self-copying of Pascal’s triangle modulo 2.

In plain words Modular arithmetic keeps only remainders, the way a clock keeps only the hour and forgets how many times the hand has gone around. Modulo 2 it keeps only whether a number is odd or even, and adding or multiplying the remainders gives the remainder of the sum or the product.

Example Take 2m=42^m = 4 and r=2r = 2, so row 6 comes from row 2. Modulo 2, row 2 is 1+x21 + x^2, the pattern 1,0,11, 0, 1, and

(1+x)6≡(1+x4)(1+x2)=1+x2+x4+x6.\begin{aligned} (1 + x)^6 &\equiv (1 + x^4)(1 + x^2) \\[0.4em] &= 1 + x^2 + x^4 + x^6. \end{aligned}

This is the pattern 1,0,1,0,1,0,11, 0, 1, 0, 1, 0, 1, with one copy of 1,0,11, 0, 1 in positions 0 to 2, another in positions 4 to 6, and a 00 in position 3 between them. The actual row 1,6,15,20,15,6,11, 6, 15, 20, 15, 6, 1 agrees. The same reasoning with r=0,1,2,3r = 0, 1, 2, 3 produces all of rows 4 to 7 as two copies of rows 0 to 3.

Check yourself

  1. Row 7 modulo 2 is all ones. Use only the rule that each row begins and ends with 11 and every other cell holds 11 exactly when its parents differ to write rows 8 and 9 modulo 2, and check them against the actual numbers.
Show the answer

Row 8 begins and ends with 11. Every other entry of row 8 has two parents in row 7, both equal to 11, so it is 00. Row 8 modulo 2 is therefore a 11, seven zeros and a 11.

Row 9 also begins and ends with 11. Its entries in positions 1 and 8 have the parents 11 and 00, so they are 11, and its entries in positions 2 to 7 have two parents equal to 00, so they are 00. Row 9 modulo 2 is

1,1,0,0,0,0,0,0,1,1.1, 1, 0, 0, 0, 0, 0, 0, 1, 1.

The actual rows are 1,8,28,56,70,56,28,8,11, 8, 28, 56, 70, 56, 28, 8, 1 and 1,9,36,84,126,126,84,36,9,11, 9, 36, 84, 126, 126, 84, 36, 9, 1, with exactly these parities. Row 8 has odd entries only at its ends because 88 is a power of two, and row 9 is two copies of row 1, as the copying rule predicts for 9=8+19 = 8 + 1.

  1. Someone guesses that every row whose number is a multiple of 4 has odd entries only at its two ends, as rows 4 and 8 do. Test the guess on row 12.
Show the answer

Write 12=8+412 = 8 + 4 and use the copying rule with 2m=82^m = 8 and r=4r = 4, which is allowed because 4<84 < 8. Row 12 modulo 2 is two copies of row 4, which is 1,0,0,0,11, 0, 0, 0, 1, placed in positions 0 to 4 and 8 to 12, with zeros in positions 5 to 7 between them. So row 12 modulo 2 is

1,0,0,0,1,0,0,0,1,0,0,0,1,1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,

with four odd entries, in positions 0, 4, 8 and 12. Indeed (124)=495\binom{12}{4} = 495 is odd, so the guess fails. The binary form of 1212 is 11001100, with two ones, which also gives 22=42^2 = 4 odd entries.

For rows numbered 11 or more, the two ends are the only odd entries exactly when the row number is a power of two, 1,2,4,8,161, 2, 4, 8, 16 and so on. Any other row number n≥3n \ge 3 can be written as 2m+r2^m + r with 2m2^m the largest power of two below nn and 1≤r<2m1 \le r < 2^m. Then row nn is two copies of row rr, which has at least two odd entries, its ends, so row nn has at least four.

  1. Change the modulus to 3 and mark the entries that are not multiples of 3. Find rows 0 to 8 modulo 3 and describe the pattern.
Show the answer

Rows 0 to 2 are 11, then 1,11, 1, then 1,2,11, 2, 1, with no multiples of 3. Row 3 is 1,3,3,11, 3, 3, 1, so modulo 3 it is 1,0,0,11, 0, 0, 1 and (1+x)3≡1+x3(1 + x)^3 \equiv 1 + x^3. For r=0,1,2r = 0, 1, 2 this gives

(1+x)3+r≡(1+x3)(1+x)r,(1+x)6+r≡(1+x3)2(1+x)r≡(1+2x3+x6)(1+x)r.\begin{aligned} (1 + x)^{3 + r} &\equiv (1 + x^3)(1 + x)^r, \\[0.4em] (1 + x)^{6 + r} &\equiv (1 + x^3)^2 (1 + x)^r \\[0.4em] &\equiv (1 + 2x^3 + x^6)(1 + x)^r. \end{aligned}

So rows 3 to 5 are two copies of rows 0 to 2, and rows 6 to 8 are three copies, with the middle copy doubled. Doubling modulo 3 turns 11 into 22 and 22 into 11, since 4≡14 \equiv 1, so it never creates a zero. Rows 0 to 8 modulo 3 are

111121100111011121121100200111022011121212121\begin{array}{c} 1 \\ 1 \enspace 1 \\ 1 \enspace 2 \enspace 1 \\ 1 \enspace 0 \enspace 0 \enspace 1 \\ 1 \enspace 1 \enspace 0 \enspace 1 \enspace 1 \\ 1 \enspace 2 \enspace 1 \enspace 1 \enspace 2 \enspace 1 \\ 1 \enspace 0 \enspace 0 \enspace 2 \enspace 0 \enspace 0 \enspace 1 \\ 1 \enspace 1 \enspace 0 \enspace 2 \enspace 2 \enspace 0 \enspace 1 \enspace 1 \\ 1 \enspace 2 \enspace 1 \enspace 2 \enspace 1 \enspace 2 \enspace 1 \enspace 2 \enspace 1 \end{array}

The marked entries form six copies of the three-row block at the top, arranged as one, two and three copies in the three bands of rows, with three upside-down triangles of zeros between them. Of the 45 entries, 36 are marked. The same reasoning with (1+x)9≡1+x9(1 + x)^9 \equiv 1 + x^9 repeats the pattern at the next size, and the first 3m3^m rows have 6m6^m marked entries. Scaled into a fixed triangle, the picture approaches a different fractal, the one from the last question on the page about Sierpinski’s triangle, which keeps six of nine third-size triangles at every stage.

How this lesson connects