text
stringlengths
71
10k
in her own group when she arrives, or we can arrange the first n − 1 people into n−1 k groups, then pick a group for the last person to join. There are different k−1 ways to arrange the guests in the first case, and k different possibilities in the second. Therefore, n−. (2.96) For example, to partition the set {a, b, c, d} into two subsets, we can place d in its own set, yielding {a, b, c}, {d}, or we can split {a, b, c} into two sets, then add d to one of these sets. The latter possibility yields the six different partitions 2.8 More Numbers 233 {a, b, d}, {c}; {a, c, d}, {b}; {b, c, d}, {a}; {a, b}, {c, d}; {a, c}, {b, d}; {b, c}, {a, d}; ( (2.97 and = 7. Using identity (2.96), we can generate the triangle of Stirling set numbers shown in Table 2.6. The sequence {bn} that appears in this table as the sum across the rows of the triangle is studied in the next section 10 25 15 1 65 31 90 63 301 21 350 127 966 1701 1050 266 1 15 140 1 28 8 bn 1 1 2 5 15 52 203 877 1 4140 TABLE 2.6. Stirling set numbers, ( ) n k , and Bell numbers, bn. ) ( n k Exercise 8 analyzes the generating function for the sequence of Stirling set with n fixed. We can obtain a more useful relation, however, if we numbers replace the ordinary powers of x in this generating function with falling factorial powers. For fixed n, let so F0(x) = 1. If n ≥ 1, then Fn(x) = k Fn(x) = * n k xk, k * + xk + * xk * k k xk + (x − k = = xk+1 * xk n − 1 k = xFn−1(x), so by induction we obtain xn = n k k * xk, n ≥ 0. (2.98) 234 2. Combinatorics Therefore, the Stirling set numbers allow us to express ordinary powers as combinations of falling factorial powers. ) ( n k We can derive another useful formula by considering the generating function with k fixed. Let for the numbers Hk(x) = * n k n≥0 xn, so H0(x) = 1. For k ≥ 1, we obtain * Hk(x) = n≥1 n k xn = k n≥1 = kx * + xn + x * xn * xn n k − 1 n≥0 n≥0 = kxHk(x) + xHk−1(x), so and therefore Hk(x) = x 1 − kx Hk−1(x), Hk(x) = xk (1 − x)(1 − 2x) · · · (1 − kx) . (2.99) Next, we use partial fractions to expand this rational function. Our calculations are somewhat simpler if we multiply by k! first, so we wish to find constants A1, A2, . . . , Ak such that + k!xk m=1(1 − mx) k = k m=1 Am 1 − mx . Clearing denominators, we have k!xk = k Am m−1 (1 − jx) k (1 − jx), m=1 j=1 j=m+1 and setting x = 1/m, we obtain k! mk = Am 1 − j m m−1 j=1 k j=m+1 , 1 − j m so and Thus 2.8 More Numbers 235 k! = mAm m−1 (m − j) k (m − j) j=1 j=m+1 = mAm(m − 1)!(−1)k−m k j=m+1 (j − m) = (−1)k−mm!(k − m)!Am, Am = (−1)k−m . k m Hk(x) = = = k (−1)k−m m=1 k (−1)k−m 1 k! 1 k! k m 1 − mx k m m=1 n≥0 1 k! k (−1)k−m m=1 (mx)n n≥0 k m mn xn, and therefore * n k = 1 k! k (−1)k−m m=0 k m mn, (2.100) for any nonnegative integers n and k. This produces a formula for the Stirling set 3! (3 · 16 − 3 · 26 + 1 · 36) = 90. numbers. For example, we may compute ) 6 3 = 1 ( Exercises 1. Use (2.96) and Table 2.6 to compute the values of ) ( 9 k and ( ) 10 k for each k. 2. A hungry fraternity brother stops at the drive-through window of a fast-food restaurant and orders twelve different items. The server plans to convey the items using either three or four identical cardboard trays, and empty trays are never given to a customer. Use (2.96) and your augmented table from Exercise 1 to determine the number of ways that the server can arrange the items on the trays. 3. Use combinatorial arguments to determine simple formulas for ( ) . n n−2 4. A new casino game takes ten ping-pong balls, each labeled with a different number between 1 and 10, and drops each one at random into one of three identical buckets. A bucket may be empty after the ten balls are dropped. ( ) n 2 and 236 2. Combinatorics (a) Suppose a bet consists of identifying which balls have landed together in each bucket. For example, a bet may state that one bucket is empty, another has just the balls numbered 2, 3, and 7, and the rest are in the other bucket. How many bets are possible? (b) Suppose instead that a bet consists of identifying only the number of balls that land in the buckets. For example, a bet might state that one bucket is empty, another has three balls, and the other has seven. The numbers on the balls have no role in the bet. How many bets are possible? 5. How many different fifty-character sequences use every character of the 26-letter alphabet at least once? More generally, how many ways can one place n distinguishable objects into k distinguishable bins, if no bin may be empty? 6. Use (2.99) to prove that equals the sum of all products of n−k integers selected from {1, . . . , k}. For example = 90. Let rn,k denote the number of ways to divide n people into k groups, with at least two people in each group. For example, the list (2.97) shows that r4,2 = 3. Set r0,0 = 1. (a) Use a combinatorial argument to show that rn,k satisfies the recur- rence relation for n ≥ 1. rn,k = krn−1,k + (n − 1)rn−2,k−1 (b) Define rn for n ≥ 0 by rn = k rn,k. Compute the table of values of rn,k and rn for 0 ≤ n ≤ 8, similar to Table 2.6. (c) Determine a formula for r2n,n, for a positive integer n. (d) A rhyming scheme describes the pattern of rhymes in a poem. For example, the rhyming scheme of a limerick is (a, a, b, b, a), since a limerick has five lines, with the first, second, and last line exhibiting one rhyme, and the third and fourth showing a different rhyme. Also, a sonnet is a poem with fourteen lines. Shakespearean sonnets have the rhyming scheme (a, b, a, b, c, d, c, d, e, f, e, f, g, g); many Petrarchan sonnets exhibit the scheme (a, b, b, a, a, b, b, a, c, d, e, c, d, e). Argue that rn counts the number of possible rhyming schemes for a poem with n lines, if each line must rhyme with at least one other line. 8. Let Gn(x) = ) ( n xk, so G0(x) = 1. Show that Gn(x) = x(Gn−1(x)+ k k G n−1(x)) for n ≥ 1, and use this recurrence to compute G4(x). 2.8 More Numbers 237 9. Show that xn = k * n k (−1)n−kxk. (2.101) 10. Use (2.90) and (2.98), or (2.89) and (2.101), to prove the following identi- ties (−1)(n−k) = (−1)(n−k) = 1 0 1 0 if n = m, otherwise. if n = m, otherwise. (2.102) (2.103) 11. Prove that k≥0 knxk = k * n k k!xk (1 − x)k+1 for any nonnegative integer n. 12. Suppose {r1, . . . , r} and {s1, . . . , s} are two sets of positive integers, f (x) = j=1(xrj − xsj ), and N is a positive integer. Prove that sn j rn j = j=1 j=1 for every n with 1 ≤ n ≤ N if and only if f (n)(1) = 0 for every n with 1 ≤ n ≤ N . Here, f (n)(x) denotes the nth derivative of f (x). For example, select {1, 5, 9, 17, 18} and {2, 3, 11, 15, 19} as the two sets, and select N = 4. Then 1 + 5 + 9 + 17 + 18 = 2 + 3 + 11 + 15 + 19 = 50, 12 + 52 + 92 + 172 + 182 = 22 + 32 + 112 + 152 + 192 = 720, 13 + 53 + 93 + 173 + 183 = 23 + 33 + 113 + 153 + 193 = 11600, and 14 + 54 + 94 + 174 + 184 = 24 + 34 + 114 + 154 + 194 = 195684; and f (x) = x−x2 +x5 −x3 +x9 −x11 +x17 −x15 +x18 −x19 has f (n)(1) = 0 for 1 ≤ n ≤ 4. 2.8.4 Bell Numbers Silence that dreadful bell: it frights the isle. . . — William Shakespeare, Othello, Act II, Scene III The Bell number bn is the number of ways to divide n people into any number of groups. It is therefore a sum of Stirling set numbers, bn = * . n k k (2.104) 238 2. Combinatorics The first few values of this sequence appear in Table 2.6. We can derive a recurrence relation for the Bell numbers. To divide n people into groups, consider the different ways to form a group containing one particular person. We must choose some number k of the other n − 1 people to join this person in one group, then divide the other n − 1 − k people into groups. It follows that bn = k n − 1 k bn−1−k. Reindexing the sum by replacing k with n − 1 − k, then applying the symmetry identity for binomial coefficients, we find the somewhat simpler relation bn = k n − 1 k bk, n ≥ 1. (2.105) Rather than analyze the ordinary generating function for the sequence of Bell numbers, we introduce another kind of generating function that is often useful in combinatorial analysis. The exponential generating function for the sequence {an} is defined as the ordinary generating function for the sequence {an/n!}. For example, the exponential generating function for the constant sequence an = c is n≥0 cxn/n! = cex, and for the sequence an = (−1)nn!, it is 1/(1 + x). The exponential generating function for the sequence of Bell numbers is therefore E(x) = n≥0 bn n! xn. (2.106) We can compute a closed form for this series. Differentiating, we find n≥1 n≥1 n≥1 k≥0 E(x) = = = = = = bn (n − 1)! 1 (n − 1)! xn−1 k n − 1 k bk xn−1 n−1 k=0 bk k!(n − 1 − k)! xn−1 bk k!(n − 1 − k)! xn−1 n≥k+1 bk k!n! n≥0 xn+k k≥0 bk k! xk k≥0 xn n! n≥0 = exE(x). 2.8 More Numbers 239 Therefore, and so (ln E(x)) = ex, ln E(x) = ex + c for some constant c. Since E(0) = b0 = 1, we must have c = −1. Thus, E(x) = eex−1. (2.107) We can use this closed form to determine a formula for bn. Using the Maclaurin series for the exponential function twice, we find that eex k≥0 k≥0 E(xex)k k! 1 k! n≥0 n≥0 k≥0 (kx)n n! kn k! xn n! . Therefore, bn = 1 e k≥0 kn k! . (2.108) This formula is sometimes called Dobi´nski’s formula [79]. Exercises 1. How many ways are there to put ten different dogs into pens, if each pen can hold any number of dogs, and every pen is exactly the same? 2. Determine a closed form for the exponential generating function for each of the following sequences. (a) ak = ck, with c a constant. (b) ak = 1 if k is even and 0 if k is odd. (c) ak = k. (d) ak = kn, for a fixed nonnegative integer n. The number of terms in the answer may depend on n. 3. Verify that equation (2.108) for bn produces the correct value for b0, b1, and b2. 4. Show that the series in equation (2.108) converges for every n ≥ 0. 240 2. Combinatorics 5. Use a combinatorial argument to show that * 2.109) for n ≥ 1, and use this to derive the recurrence (2.105) for Bell numbers. 6. Define the complementary Bell number ,bn for n ≥ 0 by ,bn = k (−1)k * . n k Wilf asked if ,bn = 0 for infinitely many n, or if there even exists an int
eger n > 2 where ,bn = 0. The first few complementary Bell numbers are 1, −1, 0, 1, 1, −2, −9, −9, 50, 267, 413, −2180, −17731, −50533, and 110176. (a) Describe a combinatorial interpretation of ,bn. (b) Use (2.109) to determine a recurrence for the complementary Bell numbers. Then determine a closed form for their exponential generating function, ,E(x). How is this function related to the function E(x) of this section? (c) Use ,E(x) to determine a formula for ,bn, similar to the expression (2.108) for bn. It is known that the sequence ,bn changes sign infinitely often, and that ,bn = 0 for almost all values of n. See Yang [289] and de Wannemacker, Laffey, and Osburn [71] for more information on this problem. 7. Suppose P (x) is the exponential generating function for the sequence {pn}, and Q(x) is the exponential generating function for {qn}. Prove that the product P (x)Q(x) is the exponential generating function for the sequence { k n pkqn−k}. k 8. Let rn denote the number of rhyming schemes for a poem with n lines, if each line must rhyme with at least one other line, as in Exercise 7d of Section 2.8.3. Recall that r0 = 1. (a) Prove that rn = n−2 k=0 n − 1 k rk. (b) Determine a closed form similar to (2.107) for the exponential gener- ating function R(x) for the sequence {rn}. 2.8 More Numbers 241 (c) Use this generating function, together with Exercise 7, to show that rn = k n k (−1)n−kbk. (d) Prove that the number of rhyming schemes for n + 1 lines in which each line rhymes with at least one other line equals the number of rhyming schemes for n lines in which at least one line rhymes with no other line. Note that bn is the total number of rhyming schemes on n lines, including schemes where some lines rhyme with no others. 9. Let Ek(x) denote the exponential generating function for the sequence of Stirling cycle numbers with k fixed, Prove that Ek(x) = n k xn n! . n≥0 E k(x) = Ek−1(x) 1 − x , for k ≥ 1, and use this to derive a closed form for Ek(x), n≥0 n k xn n! = (−1)k k! (ln(1 − x))k . (2.110) Comtet [60] uses this identity, together with (2.100) and (2.113), to derive a complicated formula due to Schl¨omilch for the Stirling cycle numbers. We include it here without proof: n k = n−k (−1)n−k−m m=0 n − 1 + m k − 1 2n − −k m m=0 j=0 (−1)n−k−j n − 1 + m k − 1 2n − k n − k − m m j (2.111) jn−k+m m! . (2.112) 10. Use an argument similar to that of Exercise 9 to prove that * n k xn n! = 1 k! (ex − 1)k (2.113) n≥0 for every k ≥ 0. 242 2. Combinatorics 2.8.5 Eulerian Numbers 3 (Al Hamilton), 7 (Paul Coffey), 11 (Mark Messier), 17 (Jari Kurri), 31 (Grant Fuhr), 99 (Wayne Gretzky). — Retired jersey numbers, Edmonton Oilers Suppose that a pipe organ having n pipes needs to be installed at a concert hall. Each pipe has a different length, and the pipes must be arranged in a single row. Let us say that two adjacent pipes in an arrangement form an ascent if the one on the left is shorter than the one on the right, and a descent otherwise. Arranging the pipes from shortest to tallest yields an arrangement with n − 1 ascents and no descents; arranging them from tallest to shortest results in no ascents and n − 1 descents. Whether for aesthetic or acoustical reasons, the eccentric director of the concert hall demands that there be exactly k ascents in the arrangement of the n pipes. How many ways are there to install the organ? The answer is the Eulerian number . . n n is the number of permutations π of the k k integers {1, . . . , n} having π(i) < π(i + 1) for exactly k numbers i between 1 and n − 1. . Stated in more abstract terms, We list a few properties of these numbers. It is easy to see that there is only one arrangement of n pipes with no ascents, and only one with n − 1 ascents, so / 0 n 0 = 1, n ≥ 0, (2.114) (2.115) and 0 / n n − 1 = 1, n ≥ 1. The Eulerian numbers have a symmetry property similar to that of the binomial coefficients. An arrangement of n pipes with k ascents has n − 1 − k descents, so reversing this arrangement yields a complementary configuration with n − 1 − k ascents and k descents. Thus2.116) Next, by summing over k we count every possible arrangement of pipes precisely once, so 0 / = n!. (2.117) k n k We also note the degenerate cases / 0 n k = 0, if n > 0, and k < 0 or k ≥ n, (2.118) and 0 / 0 k = 0, if k = 0. (2.119) 2.8 More Numbers 243 We can derive a recurrence relation for the Eulerian numbers. To arrange n pipes with exactly k ascents, suppose we first place every pipe except the tallest into a configuration with exactly k ascents. Then the tallest pipe can be inserted either in the first position, or between two pipes forming any ascent. Any other position would yield an additional ascent. There are therefore k + 1 different places to insert the tallest pipe in this case. Alternatively, we can line up the n − 1 shorter pipes so that there are k − 1 ascents, then insert the last pipe either at the end of the row, or between two pipes forming any descent. There are n − 2 − (k − 1) = n − k − 1 descents, so there are n − k different places to insert the tallest pipe in this case. It is impossible to create a permissible configuration by inserting the tallest pipe into any other arrangement of the n − 1 shorter pipes, so / 0 n k = (k + 1n − k. (2.120, and For example, Figure 2.20 shows these eleven arrangements of four pipes with two ascents. = 3 + 8 = 11. = 3 = 2 + 2 + 2 We can use the recurrence (2.120) to compute the triangle of Eulerian numbers, shown in Table 2.7 11 11 26 66 26 1 302 57 302 120 1191 120 2416 247 4293 15619 15619 4293 1 57 1191 1 247 TABLE 2.7. Eulerian numbers, - . . n k 7 n! 1 1 2 6 24 120 720 5040 1 40320 Next, we study some generating functions involving the Eulerian numbers. Recall that in Section 2.6.5 we computed the generating function for the sequence {0, 1, 2, 3, . . .} by differentiating both sides of the identity 1−x , then multiplying by x: k≥0 xk = 1 k≥0 kxk = x · d dx xk k≥0 = x · d dx 1 1 − x = x (1 − x)2 . (2.121) 244 2. Combinatorics FIGURE 2.20. Four organ pipes with two ascents. Clearly, we can obtain a generating function for the sequence of squares {k2} by applying the same differentiate-and-multiply operator to (2.121). We find that k≥0 k2xk = x · d dx x (1 − x)2 = x 2x (1 − x)3 + 1 (1 − x)2 (2.122) = x(1 + x) (1 − x)3 . In the same way, we may use this operator to calculate the generating function for the sequence of cubes, then fourth powers and fifth powers. After a bit of simplifying, we find that 2.8 More Numbers 245 k≥0 k≥0 k≥0 k3xk = x(1 + 4x + x2) (1 − x)4 , k4xk = x(1 + 11x + 11x2 + x3) (1 − x)5 , k5xk = x(1 + 26x + 66x2 + 26x3 + x4) (1 − x)6 . (2.123) (2.124) (2.125) A glance at Table 2.7 shows that the coefficients appearing on the right side of these formulas are all Eulerian numbers, and we would suspect that the numbers . n will appear in the generating function for the sequence of nth powers of intek gers. This is in fact the case. Theorem 2.16. If n ≥ 0 then k≥1 knxk = x (1 − x)n+1 0 xk. / n k k (2.126) Proof. We use induction on n. The formula is easy to verify when n = 0, so we assume it holds for a nonnegative integer n. We calculate 0 xk n k k≥1 kn+1xk = x · d dx k≥1 knxk / = x · d dx x (1 − x)n+1 = x 1 (1 − x)n+1 − x)n+2 x (1 − x)n+2 x (1 − x)n+k + 1) k / 0 xk. n + 1 k k (k + 1)xk + n + 1 (1 − x)n+2 (1 − x) (k + 1)xk + (n + 1) n k / / 0 xk+1 k k / 0 xk n k − 1 0 xk + k (n + 1 − k) n k − 1 xk The last step follows from the recurrence relation (2.120). 246 2. Combinatorics We can use (2.126) to obtain a formula for and powers. We calculate . n k in terms of binomial coefficients (1 − x)m+1 x m≥1 (m + 1)nxm mnxm m≥0 (−1)j j n + 1 j 0 xk = / n k k = = = m≥0 j≥0 k (−1)j k≥0 j=0 n + 1 j (k + 1 − j)nxk. n + 1 j (−1)jxj (2.127) (m + 1)nxj+m Now the first and last expressions in (2.127) are power series in x, so we can . n equate coefficients to obtain a formula for the Eulerian number . We find that k 0 / n k = k j=0 (−1)j n + 1 j (k + 1 − j)n. (2.128) Last, we derive one more interesting identity involving Eulerian numbers, binomial coefficients, and ordinary powers. Consider a sort of generating function x+k for the sequence { n in place of xk. Let . n } with n fixed, where we use the binomial coefficient k / 0 Fn(x) = k n k x + k n , so that F0(x) = 1. For n ≥ 1, we calculate Fn(x) = (k + 1n − kn − kn − k − 1) k k k = = (k + 1) (k + 1+k+1 n . x + k + 1 n by the sum Combining the two sums on the right, and replacing the term x+k n x+k , we find that n−1 + Fn(xn − k − 1) x + k n − 1 (x + k)n−1 (n − 1)! (x + k − n + 1) + (n − k − 1) 2.8 More Numbers 247 = xFn−1(x). Therefore, Fn(x) = xn, so we obtain xn = / . (2.129) This is known as Worpitzky’s identity [287]. Thus, Eulerian numbers allow us to write ordinary powers as linear combinations of certain generalized binomial coefficients. For example, x4 = + 11 + 11 + x+2 4 x+3 . 4 x+1 4 x 4 Exercises 1. Use an ordinary generating function to find a simple formula for verify your formula using (2.128). 2. Let En(x) denote the polynomial - . n , and 1 En(x) = / k 0 xk. n k Use (2.126) to show that the exponential generating function for the sequence of polynomials {En(x)}n≥0 is That is, show that E(x, t) = 1 − x et(x−1) − x . E(x, t) = n≥0 En(x)tn n! . 3. (From [282].) Use (2.126) and Exercise 11 of Section 2.8.3 to prove that / k 0 2k = n k * k! n k k for any nonnegative integer n. 4. Use (2.128) to establish the following identity for n ≥ 1: n j=0 (−1)j n j (j + 1)n−1 = 0. 248 2. Combinatorics 5. A neurotic running back for an American football team will run between two offensive linemen only if the jersey number of the player on the left is less than the jersey number of the player on the right. The player will not run outside the last player on either end of the offensive line. The coach wants to be sure that the running back has at least three options on every play. If the coach always puts seven players on the offensive line, and there are fifteen players on the team capable of playing any position on
the offensive line, each of whom has a different jersey number, how many formations of linemen are possible? 2.9 Stable Marriage How do I love thee? Let me count the ways. — Elizabeth Barrett Browning, Sonnet 43, Sonnets from the Portuguese Most of the problems we have considered in this chapter are questions in enumerative combinatorics, concerned with counting arrangements of objects subject to various constraints. In this section we consider a very different kind of combinatorial problem. Suppose we must arrange n marriages between n men and n women. Each man supplies us with a list of the women ranked according to his preference; each woman does the same for the men. Is there always a way to arrange the marriages so that no unmatched man and woman prefer each other to their assigned spouses? Such a pairing is called a stable matching. Consider a simple example with n = 2. Suppose Aaron prefers Yvonne over Zo¨e, and Bj¨orn prefers Zo¨e over Yvonne. We denote these preferences by A : Y > Z, B : Z > Y. Suppose also that Yvonne and Zo¨e both prefer Aaron over Bj¨orn, so Y : A > B, Z : A > B. Then the matching of Aaron with Zo¨e and Bj¨orn with Yvonne is unstable, since Aaron and Yvonne prefer each other over their partners. The preferences of Bj¨orn and Zo¨e are irrelevant: Indeed, Zo¨e would prefer to remain with Aaron in this case. On the other hand, the matching of Aaron with Yvonne and Bj¨orn with Zo¨e is stable, for no unmatched pair prefers to be together over their assigned partners. The stable marriage problem is a question of existential combinatorics, since it asks whether a particular kind of arrangement exists. We might also consider it as a problem in constructive combinatorics, if we ask for an efficient algorithm for 2.9 Stable Marriage 249 finding a stable matching whenever one does exist. In fact, we develop just such an algorithm in Section 2.9.1. The stable marriage problem and its variations have many applications in prob- lems involving scheduling and assignments. We mention three examples. 1. Stable Roommates. Suppose 2n students at a university must be paired off and assigned to n dorm rooms. Each student ranks all of the others in order of preference. A pairing is stable if no two unmatched students prefer to room with each other over their assigned partners. Must a stable pairing always exist? This variation of the stable marriage problem, known as stable roommates, is considered in Exercise 1. 2. College Admissions. Suppose a number of students apply for admission to a number of universities. Each student ranks the universities, and each university ranks the students. Is there a way to assign the students to universities in such a way that no student and university prefer each other over their assignment? This problem is similar to the original stable marriage question, since we are matching elements from two sets using information on preferences. However, there are some significant differences—probably not every student applies to every university, and each university needs to admit a number of students. Some variations on the stable marriage problem that cover extensions like these are considered in Section 2.9.2. 3. Hospitals and Residents. The problem of assigning medical students to hospitals for residencies is similar to the problem of matching students and universities: Each medical student ranks hospital residency programs in order of preference, and each hospital ranks the candidates. In this case, however, a program has been used to make most of the assignments in the U.S. since 1952. The National Resident Matching Program was developed by a group of hospitals to try to ensure a fair method of hiring residents. Since medical students are not obligated to accept the position produced by the matching program, it is important that the algorithm produce a stable matching. (Since the program’s inception, a large majority of the medical students have accepted their offer.) We describe this matching algorithm in the next section. Exercises 1. Suppose that four fraternity brothers, Austin, Bryan, Conroe, and Dallas, need to pair off as roommates. Each of the four brothers ranks the other three brothers in order of preference. Prove that there is a set of rankings for which no stable matching of roommates exists. 250 2. Combinatorics 2. Suppose M1 and M2 are two stable matchings between n men and n women, and we allow each woman to choose between the man she is paired with in M1 and the partner she receives in M2. Each woman always chooses the man she prefers. Show that the result is a stable matching between the men and the women. 3. Suppose that in the previous problem we assign each woman the man she likes less between her partners in the two matchings M1 and M2. Show that the result is again a stable matching. 4. The following preference lists for four men, {A, B, C, D}, and four women, {W, X, Y, Z}, admit exactly ten different stable matchingsa) Prove that the matching {(A, X), (B, Z), (C, W ), (D, Y )} is stable. (b) Determine the remaining nine stable matchings. 2.9.1 The Gale–Shapley Algorithm Matchmaker, matchmaker, make me a match! — Chava and Hodel, Fiddler on the Roof In 1962, Gale and Shapley [117] proved that a stable matching between n men and n women always exists by describing an algorithm for constructing such a matching. Their algorithm is essentially the same as the one used by the hospitals to select residents, although apparently no one realized this for several years [143, chap. 1]. In the algorithm, we first choose either the men or the women to be the proposers. Suppose we select the men; the women will have their chance soon. Then the men take turns proposing to the women, and the women weigh the offers that they receive. More precisely, the Gale–Shapley algorithm has three principal steps. Algorithm 2.17 (Gale–Shapley). Construct a stable matching. Input. A set of n men, a set of n women, a ranked list of the n women for each man, and a ranked list of the n men for each woman. Output. A stable matching that pairs the n men and n women. Description. 2.9 Stable Marriage 251 Step 1. Label every man and woman as free. Step 2. While some man m is free, do the following. Let w be the highest-ranked woman on the preference list of m to whom m has not yet proposed. If w is free, then label m and w as engaged to each other. If w is engaged to m and w prefers m over m, then label m as free and label m and w as engaged to one another. Otherwise, if w prefers m over m, then w remains engaged to m and m remains free. Step 3. Match all of the engaged couples. For example, consider the problem of arranging marriages between five men, Mack, Mark, Marv, Milt, and Mort, and five women, Walda, Wanda, Wendy, Wilma, and Winny. The men’s and women’s preferences are listed in Table 2.8. 1 2 3 4 5 Mack Winny Wilma Wanda Walda Wendy Mark Wanda Winny Wendy Wilma Walda Marv Winny Walda Wanda Wilma Wendy Winny Wilma Wanda Wendy Walda Milt Mort Wanda Winny Walda Wilma Wendy Walda Milt Wanda Milt Wendy Mort Wilma Mark Mort Winny Marv Mort Mort Marv Mort Mack Milt Milt Mark Mack Mark Marv Mark Mack Marv Mark Mack Marv Mack Milt TABLE 2.8. Preferences for five men and women. First, Mack proposes to Winny, who accepts, and Mark proposes to Wanda, who also accepts. Then Marv proposes to Winny. Winny likes Marv much better than her current fianc´e, Mack, so Winny rejects Mack and becomes engaged to Marv. This leaves Mack without a partner, so he proceeds to the second name on his list, Wilma. Wilma currently has no partner, so she accepts. Our engaged couples are now (Mack, Wilma), (Mark, Wanda), and (Marv, Winny). Next, Milt proposes to his first choice, Winny. Winny prefers her current partner, Marv, so she rejects Milt. Milt proceeds to his second choice, Wilma. Wilma rejects Mack in favor of Milt, and Mack proposes to his third choice, Wanda. Wanda prefers to remain with Mark, so Mack asks Walda, who accepts. Our engaged couples are now (Mack, Walda), (Mark, Wanda), (Marv, Winny), and (Milt, Wilma). 252 2. Combinatorics Now our last unmatched man, Mort, asks his first choice, Wanda. Wanda accepts Mort over Mark, then Mark asks his second choice, Winny. Winny rejects Mark in favor of her current partner, Marv, so Mark proposes to his third choice, Wendy. Wendy is not engaged, so she accepts. Now all the men and women are engaged, so we have our matching: (Mack, Walda), (Mark, Wendy), (Marv, Winny), (Milt, Wilma), and (Mort, Wanda). We prove that this is in fact a stable matching. Theorem 2.18. The Gale–Shapley algorithm produces a stable matching. Proof. First, each man proposes at most n times, so the procedure must terminate after at most n2 proposals. Thus, the procedure is an algorithm. Second, the algorithm always produces a matching. This follows from the observations that a woman, once engaged, is thereafter engaged to exactly one man, and every man ranks every woman, so the last unmatched man must eventually propose to the last unmatched woman. Third, we prove that the matching is stable. Suppose m prefers w to his partner in the matching. Then m proposed to w, and was rejected in favor of another suitor. This suitor is ranked higher than m by w, so w must prefer her partner in the matching to m. Therefore, the matching is stable. We remark that the Gale–Shapley algorithm is quite efficient: A stable matching is always found after at most n2 proposals. (Exercise 8 establishes a better upper bound.) Suppose that we choose the women as the proposers. Does the algorithm produce the same stable matching? We test this by using the lists of preferences in Table 2.8. First, Walda proposes to Milt, who accepts. Next, Wanda proposes to Milt, and Milt prefers Wanda over Walda, so he accepts. Walda must ask her second choice, Mort, who accepts. Then Wendy proposes to Mort, who declines, so she asks Mack, and Mack accepts. Last, Wilma asks Mark, and Winny proposes to Marv, and both accept. We therefor
e obtain a different stable matching: (Walda, Mort), (Wanda, Milt), (Wendy, Mack), (Wilma, Mark), and (Winny, Marv). Only Winny and Marv are paired together in both matchings; everyone else receives a higher-ranked partner precisely when he or she is among the proposers. Table 2.9 illustrates this for the two different matchings. The pairing obtained with the men as proposers is in boldface; the matching resulting from the women as proposers is underlined. The next theorem shows that this is no accident. The proposers always obtain the best possible stable matching, and those in the other group, which we call the proposees, always receive the worst possible stable matching. We define two terms before stating this theorem. We say a stable matching is optimal for a person p if p can do no better in any stable matching. Thus, if p is matched with q in an optimal matching for p, and p prefers r over q, then there is no stable matching 2.9 Stable Marriage 253 1 2 3 4 5 Mack Winny Wilma Wanda Walda Wendy Mark Wanda Winny Wendy Wilma Walda Marv Winny Walda Wanda Wilma Wendy Winny Wilma Wanda Wendy Walda Milt Mort Wanda Winny Walda Wilma Wendy Walda Milt Wanda Milt Wendy Mort Wilma Mark Winny Marv Mort Marv Mack Mort Mort Marv Mack Mark Mark Mort Mack Mark Marv Milt Mack Marv Milt Mack Milt Mark TABLE 2.9. Two stable matchings. where p is paired with r. Similarly, a stable matching is pessimal for p if p can do no worse in any stable matching. So if p is matched with q in a pessimal matching for p, and p prefers q over r, then there is no stable matching where p is paired with r. Finally, a stable matching is optimal for a set of people P if it is optimal for every person p in P , and likewise for a pessimal matching. Theorem 2.19. The stable matching produced by the Gale–Shapley algorithm is independent of the order of proposers, optimal for the proposers, and pessimal for the proposees. Proof. Suppose the men are the proposers. We first prove that the matching produced by the Gale–Shapley algorithm is optimal for the men, regardless of the order of the proposers. Order the men in an arbitrary manner, and suppose that a man m and woman w are matched by the algorithm. Suppose also that m prefers a woman w over w, denoted by m : w > w, and assume that there exists a stable matching M with m paired with w. Then m was rejected by w at some time during the execution of the algorithm. We may assume that this was the first time a potentially stable couple was rejected by the algorithm. Say w rejected m in favor of another man m, so w : m > m. Then m has no stable partner he prefers over w, by our assumption. Let w be the partner of m in the matching M . Then w = w, since m is matched with w in M , and so m : w > w. But then m and w prefer each other to their partners in M , and this contradicts the stability of M . The optimality of the matching for the proposers is independent of the order of the proposers, so the first statement in the theorem follows immediately. Finally, we show that the algorithm is pessimal for the proposees. Suppose again that the men are the proposers. Assume that m and w are matched by the algorithm, and that there exists a stable matching M where w is matched with a man m and w : m > m. Let w be the partner of m in M . Since the Gale– Shapley algorithm produces a matching that is optimal for the men, we have m : 254 2. Combinatorics w > w. Therefore, m and w prefer each other over their partners in M , and this contradicts the stability of M . Exercises 1. Our four fraternity brothers, Austin, Bryan, Conroe, and Dallas, plan to ask four women from the neighboring sorority, Willa, Xena, Yvette, and Zelda, to a dance on Friday night. Each person’s preferences are listed in the following table. 1 2 Yvette Xena Austin Bryan Willa Conroe Yvette Xena Zelda Dallas Willa 3 4 Zelda Willa Zelda Zelda Willa Xena Yvette Yvette Xena Willa Xena Yvette Zelda Austin Dallas Conroe Bryan Conroe Dallas Bryan Austin Dallas Bryan Conroe Austin Austin Dallas Conroe Bryan (a) What couples attend the dance, if each man asks the women in his order of preference, and each woman accepts the best offer she receives? (b) Suppose the sorority hosts a “Sadie Hawkins” dance the following weekend, where the women ask the men out. Which couples attend this dance? 2. Determine the total number of stable matchings that pair the four men Axel, Buzz, Clay, and Drew with the four women Willow, Xuxa, Yetty, and Zizi, given the following preference lists. Axel Buzz Clay Drew 1 3 2 Yetty Willow Zizi Zizi Yetty Xuxa Xuxa Zizi Yetty Willow Yetty Xuxa Zizi 4 Xuxa Willow Willow Willow Buzz Drew Xuxa Buzz Axel Yetty Drew Clay Drew Axel Zizi Axel Clay Axel Buzz Clay Drew Buzz Clay 3. Determine a list of preferences for four men and four women where no one obtains his or her first choice, regardless of who proposes. 2.9 Stable Marriage 255 4. Determine a list of preferences for four men and four women where one proposer receives his or her lowest-ranked choice. 5. Determine a list of preferences for four men and four women where one proposer receives his or her lowest-ranked choice, and the rest of the proposers receive their penultimate choice. 6. Suppose that all the men have identical preference lists in an instance of the stable marriage problem. Show that there exists exactly one stable matching by completing the following argument. Let M be the matching obtained by the Gale-Shapley algorithm using the men as proposers, and suppose another stable matching M exists. Among all women who change partners between M and M , let w be the woman who ranks lowest on the men’s common preference list. Suppose m and w are matched in M , and m and w in M . Determine a contradiction. 7. Suppose that the preference lists of the men m1, . . . , mn and the women w1, . . . , wn have the property that mi ranks wi ahead of each of the women wi+1, . . . , wn, and wi ranks mi ahead of each of the men mi+1, . . . , mn, for each i. (a) Show that the matching (m1, w1), . . . , (mn, wn) is stable. (b) (Eeckhout [86].) Show that this is the unique stable matching in this case. (c) Prove that there are (n!)n−1 different sets of preference lists for m1, . . . , mn that have the property that mi ranks wi ahead of each of the women wi+1, . . . , wn, for each i. (d) Prove that at least 1/n! of the possible instances of the stable marriage problem for n couples admits a unique solution. 8. (Knuth [178].) Prove that the Gale–Shapley algorithm terminates after at most n2 − n + 1 proposals by showing that at most one proposer receives his or her lowest-ranked choice. 9. Suppose that more than one woman receives her lowest-ranked choice when the men propose. Prove that there exist at least two stable matchings between the men and the women. 2.9.2 Variations on Stable Marriage I want what any princess wants—to live happily ever after, with the ogre I married. — Princess Fiona, Shrek 2 The stable marriage problem solves matching problems of a rather special sort. Each member of one set must rank all the members of the other set, and the two 256 2. Combinatorics sets must have the same number of elements. In this section, we consider several variations of the stable marriage problem, in order to apply this theory much more broadly. In each case, we study two main questions. First, how does the change affect the existence and structure of the stable pairings? Second, can we amend the Gale-Shapley algorithm to construct a stable matching in the new setting? Unacceptable Partners Suppose each of n men and n women ranks only a subset of their potential mates. Potential partners omitted from a person’s list are deemed unacceptable to that person, and we do not allow any pairing in which either party is unacceptable to the other. Clearly, we cannot in general guarantee even a complete matching, since for instance a confirmed bachelor could mark all women as unacceptable. This suggests a modification of our notion of a stable matching for this problem. We say a matching (or partial matching) M is unstable if there exists a man m and woman w who are unmatched in M , each of whom is acceptable to the other, and each is either single in M , or prefers the other to their partner in M . We will show that every such problem admits a matching that is stable in this sense, and further that every stable matching pairs the same subcollection of men and women. We first require a preliminary observation. We say a person p prefers a matching M1 over a matching M2 if p strictly prefers his or her partner in M1 to p’s match in M2. Lemma 2.20. Suppose M1 and M2 are stable matchings of n men and n women, whose preference lists may include unacceptable partners. If m and w are matched in M1 but not in M2, then one of m or w prefers M1 over M2, and the other prefers M2 over M1. Proof. Suppose m0 and w0 are paired in M1 but not M2. Then m0 and w0 cannot both prefer M1, since otherwise M2 would not be stable. Suppose that both prefer M2. Then both have partners in M2, so suppose (m0, w1) and (m1, w0) are in M2. Both m0 and w1 cannot prefer M2, since M1 is stable, so w1 must prefer M1, and likewise m1 must prefer M1. These two cannot be paired in M1, so denote their partners in M1 by m2 and w2. By the same reasoning, both of these people must prefer M2, but cannot be matched together in M2, so we obtain m3 and w3, who prefer M1, but are not paired to each other in M1. We can continue this process indefinitely, obtaining a sequence m0, w0, m2, w2, m4, w4, . . . of distinct men and women who prefer M2 over M1, and another sequence m1, w1, m3, w3, . . . of different people who prefer M1 over M2. This is impossible, since there are only finitely many men and women. We can now establish an important property of stable matchings when some unacceptable partners may be included: For a given set of preferences, every stable matching leaves the same group of men and women single. Theorem 2.21. Suppose each of n women ranks a su
bset of n men as potential partners, with the remaining men deemed unacceptable, and suppose each of the 2.9 Stable Marriage 257 men rank the women in the same way. Then there exists a subset X0 of the women and a subset Y0 of the men such that every stable matching of the n men and n women leaves precisely the members of X0 and Y0 unassigned. Proof. Suppose M1 and M2 are distinct stable matchings, and suppose m1 is matched in M1 but not in M2. Let w1 be the partner of m1 in M1. Since m1 clearly prefers M1 over M2, by Lemma 2.20 w1 must prefer M2 over M1. Let m2 be the partner of w1 in M2. Then m2 prefers M1, and so his partner w2 in M1 must prefer M2 over M1. Continuing in this way, we obtain an infinite sequence (m1, w1), (m2, w2), (m3, w3), . . . of distinct couples in M1 (and another sequence (m2, w1), (m3, w2), (m4, w3), . . . in M2), which is impossible. We still need to show that at least one stable matching exists, and we can do this by altering the Gale-Shapley algorithm for preference lists that may include unacceptable partners. We require just two modifications. First, we terminate the loop either when all proposers are engaged, or when no free proposer has any remaining acceptable partners to ask. Second, proposals from unacceptable partners are always rejected. It is straightforward to show that this amended procedure always produces a stable matching (see Exercise 1). We can illustrate it with an example. Suppose the four men Iago, Julius, Kent, and Laertes each rank a subset of the four women Silvia, Thaisa, Ursula, and Viola, and each of the women ranks a subset of the men, as shown in Figure 2.21. Potential partners omitted from a person’s list are deemed unacceptable to that person, so for example Iago would not consider marrying Thaisa or Ursula FIGURE 2.21. Preferences with unacceptable partners. Suppose the men propose. Iago first asks Viola, but she rejects him as an unacceptable partner, so he asks Silvia, who happily accepts. Next, Julius asks Silvia, who rejects him in favor of Iago, so he proposes to Viola, who now accepts. Ursula then rejects Kent, then Thaisa accepts his proposal. Finally, Laertes proposes to Silvia, then Thaisa, then Viola, but each rejects him. Our stable matching is then (Iago, Silvia), (Julius, Viola), and (Kent, Thaisa). The set X0 of unmatchable bachelorettes contains only Ursula, and Y0 = {Laertes}. We have shown how to adapt the Gale-Shapley algorithm to handle incomplete preference lists, but we can also describe a way to alter the data in such a way that we can apply the Gale-Shapley algorithm without any modifications. To do this, we introduce a fictitious man to mark the boundary between the acceptable and unacceptable partners on each woman’s list, and similarly introduce a fictitious 258 2. Combinatorics woman for the men’s lists. We’ll call our invented man the ogre, and our fictitious woman, the ogress. Append the ogre to each woman’s ranked list of acceptable partners, then add her unacceptable partners afterwards in an arbitrary order. Thus, each woman would sooner marry an ogre than one of her unacceptable partners. Do the same for the men with the ogress. The ogre prefers any woman over the ogress, and the ogress prefers any man over the ogre (people are tastier!), but the rankings of the humans on the ogre’s and ogress’ lists are immaterial. For example, we can augment the preference lists of Figure 2.21 to obtain the 5 × 5 system of Figure 2.22, using M to denote the ogre and W for the ogress FIGURE 2.22. Augmented preference lists. We can now characterize when the original configuration has a complete stable matching, that is, a stable pairing where no one is left single. Theorem 2.22. Suppose each of n men ranks some subset of n women as acceptable partners, and each of the women does the same for the men. Suppose further that we obtain an instance of the standard stable marriage problem on n + 1 men and women by adding an ogre M and ogress W, and augmenting the preference lists in the manner described above. Then the original system has a complete stable matching if and only if the augmented system has a stable matching where M is paired with W. Proof. Suppose the original system has a complete stable matching. Then each woman prefers her partner in this matching to the ogre under the augmented preferences, and likewise no man would leave his partner for the ogress. Thus, adding (M, W) to this pairing produces a stable matching for the augmented system. Next, suppose the augmented system has a stable matching P that includes (M, W), and let P = P \ {(M, W)}. Suppose (m, w) ∈ P . If m is unacceptable to w, then w would prefer the ogre M over m, and certainly M prefers w over W. This contradicts the stability of P . Similarly, w must be acceptable to m. Thus, P is a complete matching of mutually acceptable partners, and stability follows at once from the stability of P . Exercise 2 asks you to show that M and W must be paired together in all stable matchings of the augmented system, if they are paired in any particular stable matching. Thus, we can determine if a complete stable matching exists by running the original Gale-Shapley algorithm on the augmented preference lists, choosing either set as the proposers. 2.9 Stable Marriage 259 While applying the Gale-Shapley algorithm in this way always produces a matching that is stable with respect to the augmented preferences, it is important to note that restricting such a pairing back to the original preferences might not produce a stable matching! For example, when the men propose using the augmented lists of Figure 2.22, we obtain the stable matching (Iago, Silvia), (Julius, Viola), (Kent, Ursula), (Laertes, Ogress), (Ogre, Thaisa). (2.130) However, Kent is not acceptable to Ursula, so we must disband this pair when we restrict to the original preference lists. The surviving pairs are (Iago, Silvia) and (Julius, Viola), and now Kent and Thaisa are unmatched but mutually acceptable. Indifference In the original stable marriage problem, we required that all preferences be strictly ordered, since each person needed to assign each potential partner a different rank. However, rankings often contain items that are valued equally. What happens if we allow weakly ordered rankings, that is, rankings that may contain some elements of the same rank? Suppose that each of n men supplies a weak ordering of a set of n women, and each of the women does the same for the men. We’ll assume for now that all rankings are complete, so there are no unacceptable partners. Must a stable ranking exist? Can we construct one? We first require a clarification of our notion of stability for this situation. We say a matching M of the men and women is unstable if there exists an unmatched couple m and w, each of whom strictly prefers the other to his or her partner in M . For example, if m strictly prefers w to his partner, but w ranks m equal to her partner, then the pair m and w do not violate stability under this definition. One can certainly study this problem with other notions of stability. For instance, one could demand that no unmatched man and woman weakly prefer each other to their assigned partners. A matching with no such couples is called superstable. Or one could require that no unmatched couple prefer each other, one in a strict sense and the other in a weak manner. Such a matching is said to be strongly stable. Since the notion that we employ is the least restrictive, matchings with this property are often called weakly stable. Given a collection of weakly ordered preference lists for n men and n women, we can certainly create a corresponding set of strongly ordered preference lists by breaking each tie in an arbitrary way. We call the strongly ordered preferences a refinement of the original weak preferences. A stable matching for the refined lists certainly exists, and it is easy to see that this matching is also a (weakly) stable matching for the original, weakly ordered lists. Furthermore, every stable matching for the original preferences can be obtained in this way. We can summarize these facts in the following theorem. Theorem 2.23. Suppose each of n men ranks a collection of n women, with tied rankings allowed, and each woman does the same for the men. Then a stable 260 2. Combinatorics matching for these preferences exists, and further every such stable matching is a stable matching for some refinement of these weakly ordered rankings. Proof. For the first part, let P be a refinement of the given list of preferences P , and let M be a stable matching for P . If m and w are unmatched in M , and according to P strictly prefer each other to their partners in this matching, then they also strictly prefer each other according to P . This is impossible, since M is stable with respect to P . Thus, M is stable with respect to P . For the second part, suppose M is a stable matching with respect to P . We need to construct a refinement P of P where M is stable. If (m, w) ∈ M , and m ranks w equal to w in P , then let m rank w ahead of w in P . Likewise, if w ranks m equal to m in P , then w ranks m ahead of m in P . Any remaining tied rankings are broken arbitrarily to complete P . Suppose then that m0 and w0 are unmatched in P , but prefer each other (according to P ) to their partners in M . Since M is stable with respect to P , then either m0 ranks w0 equal to his partner in M , or w0 ranks m0 equal to her partner in M (or both). We obtain a contradiction in either case, by the construction of FIGURE 2.23. Preference lists with indifference. The Gale-Shapley algorithm requires no modifications for this variation, once a refinement is selected. Of course, the algorithm may produce different matchings for different refinements, even when the same group proposes. For example, suppose the four men Gatsby, Hawkeye, Ishmael, and Kino, and four women Apolonia, Cora, Daisy, and Fayaway, submit the preference lists shown in Figure 2.2
3. Using the refinement obtained by replacing each = in these lists with >, the Gale-Shapley algorithm produces the following matching when the men propose: (Gatsby, Apolonia), (Hawkeye, Fayaway), (Ishmael, Cora), (Kino, Daisy). (2.131) However, if we reverse the order of Apolonia and Cora in the refinement of Gatsby’s list, and the order of Apolonia and Fayaway in Hawkeye’s, we then obtain a very different stable matching: (Gatsby, Cora), (Hawkeye, Fayaway), (Ishmael, Daisy), (Kino, Apolonia). (2.132) Finally, we may also ask about combining this extension of the stable marriage problem with the prior one. Suppose the men and women supply weakly ordered 2.9 Stable Marriage 261 rankings, and may also declare some potential partners as unacceptable. The stable matching problem becomes much more complicated in this case. Even the size of a stable matching may vary, in contrast to the case of unacceptable partners with strict rankings, where Theorem 2.21 guarantees that all stable matchings have not only the same size, but match exactly the same men and women. For example, consider the following 2 × 2 system from [196], where A finds Y acceptable but not Z, and Z finds B acceptable but not A These preferences admit exactly two stable matchings, which have different sizes: {(A, Y ), (B, Z)} and {(B, Y )}. We might ask if we could determine a stable matching of maximal size in a problem like this, since this would often be desirable. However, no fast algorithm is known for computing this in the general n × n case. (Here, a “fast” algorithm would have its running time bounded by a polynomial in n.) In fact, it is known [196] that this problem belongs to a family of difficult questions known as NPcomplete problems. The problem remains hard even if ties are allowed in only the men’s or only the women’s preferences, and all ties occur at the end of each list, even if each person is allowed at most one tied ranking. Sets of Different Sizes Every stable marriage problem we have considered so far required an equal number of men and women. Suppose now that one group is larger than the other. Of course, we could not possibly match everyone with a partner now, but can we find a stable matching that pairs everyone in the smaller set? Here, we say a matching (or partial matching) M is unstable if there exists a man m and woman w, unmatched in M , such that each is either single in M , or prefers the other to his or her partner in M . We can solve this variation by considering it to be a special case of the problem with unacceptable partners. Suppose we have k men and n women, with n > k. Suppose also that each of the men rank each of the women in strict order, and each of the women reciprocate for the men. We introduce n−k ghosts to the set of men. Each ghost finds no woman to be an acceptable partner, and each women would not accept any ghost. Then a stable matching exists by the modified Gale-Shapley algorithm for unacceptable partners, and by Theorem 2.21 there exists a set X0 of women and Y0 of ghosts and men such that the members of X0 and Y0 are precisely the unassigned parties in any stable matching. Certainly Y0 includes all the ghosts, since they have no acceptable partners. But no man can be unassigned in a stable matching, since each man is acceptable to all the women. Thus, X0 is empty and Y0 is precisely the set of ghosts, and we obtain the following theorem. Theorem 2.24. Suppose each of k men ranks each of n women in a strict ordering, and each of the women ranks the men in the same way. Then (i) a stable matching exists, 262 2. Combinatorics (ii) every stable matching pairs every member of the smaller set, and (iii) there exists a subset X of the larger set such that every stable matching leaves the members of X unassigned, and the others all matched. An example with groups of different sizes appears in Exercise 6. Some other interesting variations (and combinations of variations) on the stable marriage problem are introduced in the exercises too. We will study marriage problems further in Chapter 3, where in Section 3.8 we investigate matchings for various infinite sets. Exercises 1. Prove that the Gale-Shapley algorithm, amended to handle unacceptable partners, always produces a stable matching. 2. Prove that if the ogre and ogress are paired in some stable matching for an augmented system of preferences as in Theorem 2.22, then they must be paired in every such stable matching. 3. (a) Verify the stable matching (2.130) produced by the Gale-Shapley algorithm when the men propose using the preferences in Figure 2.22. (b) Compute the stable matching obtained when the women propose using these preferences. Does this pairing restrict to a stable matching for Figure 2.21? (c) In the augmentation procedure for the case of unacceptable partners, we can list the unacceptable partners for each person in any order after the ogre or ogress, and we can list the humans in any order in the lists for the ogre and ogress. Show that one can select orderings when augmenting the preferences of Figure 2.21 so that when the men propose in the Gale-Shapley algorithm, one obtains a pairing that restricts to a stable matching of Figure 2.21. 4. The following problems all refer to the weakly ordered preference lists of Figure 2.23. (a) Verify the matching (2.131) obtained from the refinement obtained by replacing each = with >, when the men propose in the Gale-Shapley algorithm. Then determine the matching obtained when the women propose. (b) Verify (2.132) using the refinement obtained from the previous one by reversing the order of Apolonia and Cora in Gatsby’s list, and Apolonia and Fayaway in Hawkeye’s. Then determine the matching obtained when the women propose. (c) Construct another refinement by ranking any tied names in reverse alphabetical order. Compute the stable matchings constructed by the 2.9 Stable Marriage 263 Gale-Shapley algorithm when the men propose, then when the women propose. 5. Construct three refinements of the following preference lists so that the Gale-Shapley algorithm, amended for unacceptable partners, produces a stable matching of a different size in each case. Suppose the five men Arceneaux, Boudreaux, Comeaux, Duriaux, and Gautreaux, each rank the three women Marteaux, Robichaux, and Thibodeaux in order of preference, and the women each rank the men, as shown in the following tables Determine the stable matching obtained when the men propose, then the matching found when the women propose. What is the set X of Theorem 2.24 for these preferences? 7. Suppose we allow weakly ordered rankings in the hypothesis of Theorem 2.24. Determine which of the conclusions still hold, and which do not necessarily follow. Supply a proof for any parts that do hold, and supply a counterexample for any parts that do not. 8. Suppose that each of n students, denoted S1, S2, . . . , Sn, ranks each of m universities, U1, U2, . . . , Um, and each university does the same for the students. Suppose also that university Uk has pk open positions. We say an assignment of students to universities is unstable if there exists an unpaired student Si and university Uj such that Si is either unassigned, or prefers Uj to his assignment, and Uj either has an unfilled position, or prefers Si to some student in the new class. (a) Assume that m k=1 pk = n. Explain how to amend the preference lists so that the Gale-Shapley algorithm may be used to compute a stable assignment of students to universities, with no university exceeding its capacity. 264 2. Combinatorics (b) Repeat this problem without assuming that the number of students matches the total number of open positions. (c) Suppose each student ranks only a subset of the universities, and each university ranks only a subset of the students who apply to that school. Assume that unranked possibilities are unacceptable choices. Modify the definition of stability for this case, then describe how to use the Gale-Shapley algorithm to determine a stable assignment. 9. Suppose that each of n students, denoted S1, S2, . . . , Sn, needs to enroll in a number of courses from among m possible offerings, denoted C1, C2, . . . , Cm. Assume that student Si can register for up to qi courses, and course Cj can admit up to rj students. An enrollment is a set of pairs (Si, Cj ) where each student Si appears in at most qi such pairs, and each course Cj appears in at most rj pairs. Suppose each student ranks a subset of acceptable courses in order of preference, and the supervising professor of each course ranks a subset of acceptable students. Define a stable enrollment in an appropriate way. 2.10 Combinatorial Geometry We should expose the student to some material that has strong intuitive appeal, is currently of research interest to professional mathematicians, and in which the student himself may discover interesting problems that even the experts are unable to solve. — Victor Klee, from the translator’s preface to Combinatorial Geometry in the Plane [144] The subject of combinatorial geometry studies combinatorial problems regarding arrangements of points in space, and the geometric figures obtained from them. Such figures include lines and polygons in two dimensions, planes and polyhedra in three, and hyperplanes and polytopes in n-dimensional space. This subject has much in common with the somewhat broader subject of discrete geometry, which treats all sorts of geometric problems on discrete sets of points in Euclidean space, especially extremal problems concerning quantities such as distance, direction, area, volume, perimeter, intersection counts, and packing density. In this section, we provide an introduction to the field of combinatorial geometry by describing two famous problems regarding points in the plane: a question of Sylvester concerning the collection of lines determined by a set of points, and a problem of Erd˝os, Klein, and Szekeres on the existence of certain polygons that can be formed from large coll
ections of points in the plane. The latter problem leads us again to Ramsey’s theorem, and we prove this statement in a more general form than what we described in Section 1.8. (Ramsey theory is developed further in Chapter 3.) In particular, we establish some of the bounds on the Ramsey numbers R(p, q) that were cited in Section 1.8. 2.10 Combinatorial Geometry 265 2.10.1 Sylvester’s Problem Thufferin’ thuccotash! — Sylvester the cat, Looney Tunes James Joseph Sylvester, a British-born mathematician, spent the latter part of his career at Johns Hopkins University, where he founded the first research school in mathematics in America, and established the first American research journal in the subject, The American Journal of Mathematics. Toward the end of his career, Sylvester posed the following problem in 1893, in the “Mathematical Questions” column of the British journal, Educational Times [265]. Sylvester’s Problem. Given n ≥ 3 points in the plane which do not all lie on the same line, must there exist a line that passes through exactly two of them? Given a collection of points in the plane, we say a line is ordinary if it passes through exactly two of the points. Thus, Sylvester’s problem asks if an ordinary line always exists, as long as the points are not all on the same line. This problem remained unsolved for many years, and seemed to have been largely forgotten until Erd˝os rediscovered it in 1933. Tibor Gallai, a friend of Erd˝os’ who is also known as T. Gr¨unwald, found the first proof in the same year. Erd˝os helped to revive the problem by posing it in the “Problems” section of the American Mathematical Monthly in 1933 [89], and Gallai’s solution was published in the solution the following year [264]. Kelly also produced a clever solution, which was published in a short article by Coxeter in 1948 [62], along with a version of Gallai’s argument. Forty years later, the computer scientist Edsger Dijkstra derived a similar proof, but with a more algorithmic viewpoint [76]. The proof we present here is based on Dijkstra’s algorithm. Given any collection of three or more points which do not all lie on the same line, it constructs a line with the required property. In this method, we start with an arbitrary line 1 connecting at least two points of the set, and some point S1 from the set that does not lie on 1. If 1 contains just two of the points, we are done, so suppose that at least three of the points lie on 1. The main idea of the method is to construct from the current line 1 and point S1 another line 2 and point S2, with S2 not on 2. Then we iterate this process, constructing 3 and S3, then 4 and S4, etc., until one is assured of obtaining a line that connects exactly two of the points of the original collection. In order to ensure that the procedure does not cycle endlessly, we introduce a termination argument: a strictly monotone function of the state of the algorithm. A natural candidate is the distance dk from the point Sk to the line k, so dk = d(Sk, k). We therefore aim to construct k+1 and Sk+1 from k and Sk in such a way that dk+1 < dk. Since there are only finitely many points, there are only finitely many possible values for dk, so if we can achieve this monotonicity, then it would follow that the procedure must terminate. We derive a procedure that produces a strictly decreasing sequence {dk}. Suppose the line k contains the points Pk, Qk, and Rk from our original collection, and Sk is a point from the set that does not lie on k. We need to choose k+1 and 266 2. Combinatorics Sk+1 so that dk+1 < dk. Suppose we set Sk+1 to be one of the points that we labeled on k, say Sk+1 = Qk. Certainly Qk does not lie on either of the lines PkSk or RkSk, so we might choose one of these two lines for our k+1. Can we guarantee that one of these choices will produce a good value for dk+1? To test this, let and We require then that pk = d(Qk, PkSk) rk = d(Qk, RkSk). min(pk, rk) < dk. (2.133) S k kd Pk Q k kp FIGURE 2.24. Similar triangles in the construction. Using similar triangles in Figure 2.24, we see that the inequality pk < dk is equivalent to the statement d(Pk, Qk) < d(Pk, Sk), (2.134) and likewise rk < dk is equivalent to the inequality d(Qk, Rk) < d(Sk, Rk). (2.135) Now at least one of (2.134) or (2.135) must hold if d(Pk, Qk) + d(Qk, Rk) < d(Pk, Sk) + d(Sk, Rk). Further, since Sk does not lie on k, by the triangle inequality we know that d(Pk, Rk) < d(Pk, Sk) + d(Sk, Rk). Therefore, inequality (2.133) follows from the statement d(Pk, Qk) + d(Qk, Rk) ≤ d(Pk, Rk). However, by the triangle inequality, we know that d(Pk, Qk) + d(Qk, Rk) ≥ d(Pk, Rk). 2.10 Combinatorial Geometry 267 Thus, we require that d(Pk, Qk) + d(Qk, Rk) = d(Pk, Rk). Clearly, this latter condition holds if and only if Qk lies between Pk and Rk on k. We therefore obtain the following algorithm for solving Sylvester’s problem. Algorithm 2.25. Construct an ordinary line. Input. A set of n ≥ 3 points in the plane, not all on the same line. Output. A line connecting exactly two of the points. Description. Step 1. Let 1 be a line connecting at least two of the points in the given set, and let S1 be a point from the collection that does not lie on 1. Set k = 1, then perform Step 2. Step 2. If k contains exactly two points from the original collection, then out- put k and stop. Otherwise, perform Step 3. Step 3. Let Pk, Qk, and Rk be three points from the given set that lie on k, with Qk lying between Pk and Rk. Set Sk+1 = Qk, and set k+1 = PkSk if d(Qk, PkSk) < d(Qk, PkRk); otherwise set k+1 = RkSk. Then increment k by 1 and repeat Step 2. Now Sylvester’s problem is readily solved: The monotonicity of the sequence {dk} guarantees that the algorithm must terminate, so it must produce a line connecting just two points of the given set. An ordinary line must therefore always exist. We can illustrate Dijkstra’s algorithm with an example. Figure 2.25 shows a collection of thirteen points that produce just six ordinary lines (shown in bold), along with 21 lines that connect at least three of the points. Figure 2.26 illustrates the action of Algorithm 2.25 on these points, using a particular initial configuration. Each successive diagram shows the line k, the point Sk off the line, and the points Pk, Qk, and Rk on the line. Much more is now known about Sylvester’s problem. For example, Csima and Sawyer [64, 65] proved that every arrangement of n ≥ 3 points in the plane, not all on the same line, must produce at least 6n/13 ordinary lines, except for certain arrangements of n = 7 points. Figure 2.25 shows that this bound is best possible, and Exercise 2 asks you to determine an exceptional configuration for n = 7. Also, it has long been conjectured that there are always at least n/2 ordinary lines for a set of n non-colinear points, except for n = 7 and n = 13, but this remains unresolved. For additional information on Sylvester’s problem and several of its generalizations, see the survey article by Borwein and Moser [34], or the book by Brass, Moser, and Pach [37, sec. 7.2]. 268 2. Combinatorics FIGURE 2.25. A collection of thirteen points with just six ordinary lines. Exercises 1. Exhibit an arrangement of six points in the plane that produce exactly three ordinary lines. 2. Exhibit an arrangement of seven points in the plane that produce exactly three ordinary lines. 3. Exhibit an arrangement of eight points in the plane that produce exactly four ordinary lines. 4. Exhibit an arrangement of nine points in the plane that produce exactly six ordinary lines. 5. Suppose n ≥ 3 points in the plane do not all lie on the same line. Show that if one joins each pair of points with a straight line, then one must obtain at least n distinct lines. 6. We say a set of points B is separated if there exists a positive number δ such that the distance d(P, Q) ≥ δ for every pair of points P and Q in B. Describe an infinite, separated set of points in the plane, not all on the same line, for which no ordinary line exists. What happens if you apply Dijkstra’s algorithm to this set of points? 7. Repeat problem 6, if each of the points (x, y) must in addition satisfy |y| ≤ 1. 2.10 Combinatorial Geometry 269 FIGURE 2.26. Dijkstra’s algorithm. 270 2. Combinatorics 8. Let the set S consist of the point (0, 0), together with all the points in the 3k−2 ), where k is 3k−1 , plane of the form ( an arbitrary integer. Show that every line connecting two points of S must intersect a third point of S. 3k−1 ), ( −1 3k−1 ), or (0, 1 3k−1 , 2 1 1 9. Consider the following collection T of three-element subsets of the seven- element set S = {a, b, c, d, e, f, g}: T = {{a, b, c}, {a, d, e}, {a, f, g}, {b, d, f }, {b, e, g}, {c, d, g}, {c, e, f }}. (a) Verify that each two-element subset of S is in fact a subset of one of the members of T , and that any two distinct sets in T have at most one element in common. (b) Explain how this example is germane to Sylvester’s problem. Hint: Try thinking of the elements of S as points, and the elements of T as lines. 2.10.2 Convex Polygons I would certainly pay $500 for a proof of Szekeres’ conjecture. — Paul Erd˝os, [92, p. 66] A set of points S in the plane is said to be convex if for each pair of points a and b in S, the line segment joining a to b lies entirely in S. Loosely, then, a convex set has no “holes” in its interior, and no “dents” in its boundary. Line segments, triangles, rectangles, and ellipses are thus all examples of convex sets. The convex hull of a finite collection of points T in the plane is defined as the intersection of all closed convex sets which contain T . Less formally, if one imagines T represented by a set of pushpins in a bulletin board, then the convex hull of T is the shape enclosed by a rubber band when it is snapped around all the pushpins. The convex hull of a set of three points then is either a triangle or a line segment, and for four points we may obtain one of these shapes, or a convex quadrilateral. In order t
o avoid degenerate cases, we will assume in this section that our given collection of points is in general position, which means that no three points lie on the same line, or, using the term from the previous section, that each line connecting two of the points is ordinary. Thus, the convex hull of a set of four points in general position forms either a quadrilateral, or a triangle whose interior contains the fourth point of the collection. In the early 1930s, Esther Klein observed that one can always find a convex quadrilateral in a collection of five points in general position. Theorem 2.26. Any collection of five points in the plane in general position contains a four-element subset whose convex hull is a quadrilateral. Proof. Suppose we are given a collection of five points in the plane, with no three on the same line. If their convex hull is a pentagon or a quadrilateral, then the 2.10 Combinatorial Geometry 271 statement follows, so suppose that it forms a triangle. Let a and b be the two points of the collection lying inside the triangle, and let be the line connecting a and b. Since the points are in general position, two of the vertices of the triangle lie on one side of . Label them c and d. Then the convex hull of {a, b, c, d} is a quadrilateral. See Figure 2.27. FIGURE 2.27. A convex quadrilateral may always be found among five points in general position. Klein then asked about a natural generalization. How many points in the plane (in general position) are required in order to be certain that some subset forms the convex hull of a polygon with n sides? Does such a number exist for each n? For example, Figure 2.28 illustrates a collection of eight points, no five of which produce a convex pentagon, and a set of sixteen points, no six of which forms a convex hexagon. Thus, at least nine points are needed for n = 5, and at least seventeen for n = 6. FIGURE 2.28. Eight points with no convex pentagon, and sixteen points with no convex hexagon. Erd˝os and Szekeres studied this problem in their first joint paper, in 1935 [94]. There they independently developed a version of Ramsey’s theorem, and the proof we describe in this section is based on their argument. The statement we develop here is much more general than the special case of Ramsey’s theorem that we described in Section 1.8, although Ramsey in fact established a still more general 272 2. Combinatorics result in his seminal paper of 1930 [232] (see Exercise 7). We will also derive the bounds on the ordinary Ramsey numbers R(m, n) stated in Theorems 1.63 and 1.64 of Section 1.8 as special cases. Let ES(n) denote the minimal number of points in the plane in general position that are required so that there must exist a subcollection of n points whose convex hull is a polygon with n sides (an n-gon). Thus, we have seen that ES(3) = 3, ES(4) = 5, and, from Figure 2.28, that ES(5) ≥ 9 and ES(6) ≥ 17. We aim to show that ES(n) exists for each n by obtaining an upper bound on its value, in terms of n. As a first step, we show that it is enough to find a collection of n points, each of whose four-element subsets forms a convex quadrilateral. Theorem 2.27. Suppose S is a set of n points in the plane in general position with the property that each four-element subset of S is the vertex set of a convex quadrilateral. Then S is the set of vertices of a convex n-gon. Proof. Let H denote the convex hull of S, and suppose a ∈ S lies in the interior of H. Let b ∈ S with a = b. Divide H into triangles by joining b to each vertex of H. Then a lies in the interior of one of these triangles, and we label its vertices b, c, and d. But then {a, b, c, d} is a four-element subset of S whose convex hull is a triangle, contradicting our assumption. Next, we develop the more general version of Ramsey’s theorem. Recall that in Section 1.8 we defined R(m, n) to be the smallest positive integer N such that any 2-coloring of the edges of the complete graph KN (using the colors red and blue) must produce either a red Km or a blue Kn as a subgraph. Coloring each edge of KN is certainly equivalent to assigning a color to each of the subsets of size 2 of the set {1, 2, . . . , N }, and so we might consider what happens more generally N subsets of size k, for a fixed positive when we assign a color to each of the k integer k. We call such a subset a k-subset of the original set. Ramsey’s theorem extends in a natural way to this setting. For convenience, we let [N ] denote the set {1, 2, . . . , N }, and we define the generalized Ramsey numbers in the following way. N 2 Definition. For positive integers k, m, and n, with m ≥ k and n ≥ k, the Ramsey number Rk(m, n) is defined as the smallest positive integer N such that in any 2-coloring of the k-subsets of [N ] (using the colors red and blue) there must exist either a subset of m elements, each of whose k-subsets is red, or a subset of n elements, each of whose k-subsets is blue. Thus, the Ramsey numbers R(m, n) of Section 1.8 are denoted by R2(m, n) here. Also, just as the ordinary Ramsey numbers can be described in terms of coloring edges of complete graphs, so too can we describe Rk(m, n) in terms of coloring edges of certain hypergraphs (see Exercise 1). The next theorem establishes that the Ramsey numbers Rk(m, n) always exist, and provides an upper bound on their values. 2.10 Combinatorial Geometry 273 Theorem 2.28 (Ramsey’s Theorem). Let k, m, and n be positive integers, with min{m, n} ≥ k. Then the Ramsey number Rk(m, n) exists. Furthermore, for each such k, m, and n, we have R1(m, n) = m + n − 1, Rk(k, n) = n, Rk(m, k) = m, (2.136) (2.137) (2.138) and, if min{m, n} > k ≥ 2, then Rk(m, n) ≤ Rk−1 Rk(m − 1, n) + Rk(m, n − 1) + 1. (2.139) Proof. First, consider the case k = 1. If the elements of [N ] are each colored red or blue, and there are fewer than m red elements and fewer than n blue elements, then certainly N ≤ m + n − 2, and (2.136) follows. Second, suppose k = m, and suppose that each k-subset of [N ] is colored red or blue. If any is red then we have a qualifying m-subset, so suppose all are blue. Then we have a qualifying n-subset precisely when N ≥ n. Thus, the formula (2.137) follows, and by symmetry so does (2.138). To establish (2.139), suppose min{m, n} > k ≥ 2. Using induction on k, we may assume that Rk−1(a, b) exists for all integers a and b with min{a, b} ≥ k − 1, and further by induction on m + n we may assume that Rk(m − 1, n) and Rk(m, n − 1) both exist. Let m = Rk(m − 1, n), n = Rk(m, n − 1), and N = Rk−1(m, n) + 1, and consider an arbitrary 2-coloring C of the k-subsets of [N ] using the colors red and blue. Create a coloring C of the (k − 1)-subsets of [N − 1] by assigning a subset X of size k − 1 the color of the set X ∪ {N } in C. Since N − 1 = Rk−1(m, n), the coloring C must produce either a subset of [N − 1] of cardinality m, each of whose (k − 1)-subsets is red, or a subset of [N − 1] of cardinality n, each of whose (k − 1)-subsets is blue. Suppose the first possibility occurs (the argument for the second case is symmetric), and let S be a qualifying subset of [N − 1]. Since S has m = Rk(m − 1, n) elements, there must exist either a subset of size m − 1 of S, each of whose k-subsets is red in the original coloring C, or a subset of size n of S, each of whose k-subsets is blue in C. In the latter case, we are done, so suppose the former case occurs, and let T be such a subset of [N − 1]. Let T = T ∪ {N }, and suppose X is a k-subset of T . If N ∈ X, then X ⊆ S, so X is red in C. If N ∈ X, then X \ {N } is a (k − 1)-subset of S and so is red in C, and thus X is red in C. Using this result, we can now establish the upper bound for the original Ramsey numbers R2(m, n) that was cited in Section 1.8. Corollary 2.29. Suppose m and n are integers with min{m, n} ≥ 2. Then R2(m, n) ≤ R2(m − 1, n) + R2(m, n − 1) (2.140) and R2(m, n2.141) 274 2. Combinatorics Proof. The inequality (2.140) follows at once from (2.136) and (2.139). The formulas (2.137) and (2.138) produce equality in (2.141) for the cases m = 2 and n = 2 respectively, and the general inequality follows by induction on m + n (see Exercise 3). Armed with Ramsey’s theorem, we may now prove that a sufficiently large collection of points in the plane in general position must contain a subset that forms the vertices of a convex n-gon, for any positive integer n. Theorem 2.30. If n ≥ 3 is an integer, then ES(n) ≤ R4(5, n). Proof. Let S be a collection of N = R4(5, n) points in the plane in general position. For each four-element subset T of S, assign T the color red if its convex hull is a triangle, and assign it the color blue if it is a quadrilateral. By Ramsey’s Theorem, there must exist either a five-element subset of S whose 4-subsets are all red, or an n-element subset of S whose 4-subsets are all blue. The former case is impossible by Theorem 2.26, so the latter case must occur, and this implies that the n points form the vertex set of a convex n-gon by Theorem 2.27. Much more is known about the quantity ES(n). In the same article [94], Erd˝os and Szekeres employ a separate geometric argument to show that in fact ES(n) ≤ 2n − 4 n − 2 + 1. Since then, this bound has been improved several times. For example, in 2005 T´oth and Valtr [268] proved that ES(n) ≤ 2n − 5 n − 2 + 1 for n ≥ 5. Few exact values of ES(n) have been determined. In [94], Erd˝os and Szekeres noted that Makai first proved that ES(5) = 9, so Figure 2.28 exhibits an extremal configuration. Proofs of this statement were published later in [171] and [30]. In 2006, Szekeres and Peters [266] employed a computational strategy to establish that ES(6) = 17. Thus, again Figure 2.28 illustrates an optimal arrangement. Erd˝os and Szekeres conjectured that in fact ES(n) = 2n−2 + 1 for all n ≥ 3, and this problem remains open. This is the $500 conjecture that Erd˝os was referring to in the quote that opens this section. It is known that ES(n) cannot be any smaller than the conjectured value. In 1961, Erd˝os a
nd Szekeres [95] described a method for placing 2n−2 points in the plane in general position so that no convex n-gon appears. Their construction was later corrected by Kalbfleisch and Stanton [172]. Thus, certainly ES(n) ≥ 2n−2 + 1 for n ≥ 7. For additional information on this problem and many of its generalizations, see for instance the books by Brass, Moser, and Pach [37, sec. 8.2] and 2.10 Combinatorial Geometry 275 Matouˇsek [200, chap. 3], the survey article by Morris and Soltan [208], or the note by Dumitrescu [82]. Exercises 1. State Ramsey’s theorem in terms of coloring edges of certain hypergraphs. 2. Exhibit a collection of eight points in general position in the plane whose convex hull is a triangle, so that no subset of four points forms the vertex set of a convex quadrilateral. 3. Complete the proof of Corollary 2.29. 4. (Johnson [169].) If S is a finite set of points in the plane in general position, and T is a subset of S of size 3, let ψS(T ) denote the number of points of S that lie in the interior of the triangle determined by T . Complete the following argument to establish a different upper bound on ES(n). (a) Let n ≥ 3 be an integer. Prove that if S is sufficiently large, then there exists a subset U of S of size n such that either every 3-subset T of U has ψS(T ) even, or every such subset has ψS(T ) odd. (b) If U does not form the vertex set of a convex n-gon, then by Theorem 2.27 there exist four points a, b, c, and d of U , with d lying inside the triangle determined by a, b, and c. Show that ψS({a, b, c}) = ψS({a, b, d}) + ψS({b, c, d}) + ψS({a, c, d}) + 1. (c) Establish a contradiction and conclude that ES(n) ≤ R3(n, n). 5. (Tarsy [188].) If a, b, and c form the vertices of a triangle in the plane, let θ(a, b, c) = 1 if the path a → b → c → a induces a clockwise orientation of the boundary, and let θ(a, b, c) = −1 if it is counterclockwise. Thus, for example, θ(a, b, c) = −θ(a, c, b). Complete the following argument to establish an upper bound on ES(n). (a) Let n ≥ 3 be an integer, and let S = {v1, v2, . . . , vN } be a set of labeled points in the plane in general position. Prove that if N is sufficiently large, then there exists a subset U of S of size n such that either every 3-subset {vi, vj , vk} of U with i < j < k has θ(vi, vj, vk) = 1, or every such subset has θ(vi, vj, vk) = −1. (b) Prove that if S contains a 4-subset whose convex hull is a triangle, then this subset must contain triangles of both orientations with respect to the ordering of the vertices. (c) Conclude that ES(n) ≤ R3(n, n). 276 2. Combinatorics 6. Complete the proof of Theorem 1.64 by proving that if m and n are positive integers with min{m, n} ≥ 2, and R2(m−1, n) and R2(m, n−1) are both even, then R2(m, n) ≤ R2(m − 1, n) + R2(m, n − 1) − 1. Use the following strategy. Let r1 = R2(m − 1, n), r2 = R2(m, n − 1), and N = r1 + r2 − 1. Suppose that the edges of KN are 2-colored, using the colors red and blue, in such a way that no red Km nor blue Kn appears. (a) Show that the red degree of any vertex in the graph must be less than r1. (b) Show that the red degree of any vertex in the graph must equal r1 − 1. (c) Compute the number of red edges in the graph, and establish a con- tradiction. 7. Prove the following more general version of Ramsey’s theorem. Let k, n1, n2, . . . , nr be positive integers, with min{n1, . . . , nr} ≥ k, and let c1, c2, . . . , cr denote r different colors. Then there exists a positive integer Rk(n1, . . . , nr) such that in any r-coloring of the k-subsets of a set with N ≥ Rk(n1, . . . , nr) elements, there must exist a subset of ni elements, each of whose k-subsets has color ci, for some i with 1 ≤ i ≤ r. 8. (Schur [251].) If C is an r-coloring of the elements of [N ], then let C be the r-coloring of 2-subsets of [N ] ∪ {0} obtained by assigning the pair {a, b} the color of |b − a| in C. (a) Use the generalized Ramsey’s Theorem of Exercise 7 to assert that if N is sufficiently large then in [N ] ∪ {0} there must exist a set of three nonnegative integers, each of whose 2-subsets has the same color in C. (b) Conclude that if N is sufficiently large then there exist integers a and b in [N ], with a + b ≤ N , such that a, b, and a + b all have the same color in C. 9. Let S be a finite set of points in the plane, and let P be a convex polygon whose vertices are all selected from S. We say P is empty (with respect to S) if its interior contains no points of S. Erd˝os asked if for each integer n ≥ 3 there exists a positive integer ES0(n) such that any set of at least ES0(n) points in general position in the plane must contain an empty ngon, but this need not be the case for sets with fewer than ES0(n) points. (a) Compute ES0(3) and ES0(4). (b) (Ehrenfeucht [91].) Prove that ES0(5) exists by completing the following argument. Let S be a set of ES(6) points in general position in the plane, and let P be a convex hexagon whose vertices lie in S, selected so that its interior contains a minimal number of points of S. Denote this number by m. 2.11 References 277 i. Complete the proof if m = 0 or m = 1. ii. If m ≥ 2, let H be the convex hull of the points of S lying inside P , and let be a line determined by two points on the boundary of H. Finish the proof for this case. The argument above establishes that ES0(5) ≤ 17; in 1978 Harborth [151] showed that in fact ES0(5) = 10. Horton [164] in 1983 proved the surprising result that ES0(n) does not exist for n ≥ 7. More recently, Gerken [121] and Nicol´as [215] solved the problem for n = 6: A sufficiently large set of points in the plane in general position must contain an empty convex hexagon. The precise value of ES0(6) remains unknown, though it must satisfy 30 ≤ ES0(6) ≤ ES(9) ≤ 1717. (An example by Overmars [219] establishes the lower bound; additional information on the upper bound can be found in [182, 271].) 2.11 References You may talk too much on the best of subjects. — Benjamin Franklin, Poor Richard’s Almanack We list several additional references for the reader who wishes to embark on further study. General References The text by van Lint and Wilson [273] is a broad and thorough introduction to the field of combinatorics, covering many additional topics. Classical introductions to combinatorial analysis include Riordan [235] and Ryser [246], and many topics in discrete mathematics and enumerative combinatorics are developed extensively in Graham, Knuth, and Patashnik [133]. The text by P´olya, Tarjan, and Woods [227] is a set of notes from a course in enumerative and constructive combinatorics. A problems-oriented introduction to many topics in combinatorics and graph theory can be found in Lov´asz [191]. The book by Nijenhuis and Wilf [216] describes efficient algorithms for solving a number of problems in combinatorics and graph theory, and a constructive view of the subject is developed in Stanton and White [263]. Texts by Aigner [4, 5], Berge [24], Comtet [60], Hall [146], and Stanley [261, 262] present more advanced treatments of many aspects of combinatorics. Combinatorial Identities The history of binomial coefficients and Pascal’s triangle is studied in Edwards [85], and some interesting patterns in the rows of Pascal’s triangle are observed by Granville [138]. Combinatorial identities are studied in Riordan [236], and automated techniques for deriving and proving identities involving binomial coefficients and other quantities are developed in Petkovˇsek, Wilf, and Zeilberger 278 2. Combinatorics [222]. Combinatorial proofs for many identities are also developed in the book by Benjamin and Quinn [22]. Pigeonhole Principle More nice applications of the pigeonhole principle, together with many other succinct proofs in combinatorics and other subjects, are described in Aigner and Ziegler [6]. An interesting card trick based in part on a special case of Theorem 2.4 is described by Mulcahy [210]. Polynomials with {−1, 0, 1} coefficients and a root of prescribed order m at x = 1, as in Exercise 14 of Section 2.4, are studied by Borwein and Mossinghoff [35]. Generating Functions More details on generating functions and their applications can be found for instance in the texts by Wilf [284] and Graham, Knuth, and Patashnik [133], and in the survey article by Stanley [260]. The problem of determining the minimal degree dk of a polynomial with {0, 1} coefficients that is divisible by (x + 1)k, as in Exercise 5 of Section 2.6.5, is studied by Borwein and Mossinghoff [36]. Some properties of the generalized Fibonacci numbers (Exercise 8b of Section 2.6.5) are investigated by Miles [203]. P´olya’s Theory of Counting P´olya’s seminal paper on enumeration in the presence of symmetry is translated into English by Read in [226]. Redfield [233] independently devised the notion of a cycle index for a group, which he termed the group reduction formula, ten years before P´olya’s paper. As a result, many texts call this topic P´olya-Redfield theory. This theory, along with the generalization incorporating a color group, is also described in the expository article by de Bruijn [68], and his research article [69]. Further generalizations of this theory are explored by de Bruijn in [70], culminating in a “monster theorem.” Another view of de Bruijn’s theorem is developed by Harary and Palmer in [149; 150, chap. 6]. Applications of this theory in chemistry are described in the text by Fujita [116], and additional references for enumeration problems in this field are collected in the survey article [13]. Some applications of P´olya’s and de Bruijn’s theorems in computer graphics appear for example in articles by Banks, Linton, and Stockmeyer [15, 16]. More Numbers The book [10] by Andrews and Eriksson is an introduction to the theory of partitions of integers, directed toward undergraduates. A more advanced treatment is developed by Andrews [9]. Euler’s original proof of the pentagonal number theorem, along with some of its additional ramifications, is described by Andrews i
n [8]. 2.11 References 279 The history of Stirling numbers, the notations developed for them, and many interesting identities they satisfy are discussed by Knuth in [177]. Rhyming schemes, as in Exercise 7d of Section 2.8.3 and Exercise 8 of Section 2.8.4, are analyzed by Riordan [237]. Stirling set numbers arise in a natural way in an interesting problem on juggling in an article by Warrington [280]. Some identities involving the complementary Bell numbers (Exercise 6 of Section 2.8.4) are established in the article by Uppuluri and Carpenter [270]. Eulerian numbers appear in the computation of the volume of certain slabs of ndimensional cubes in articles by Chakerian and Logothetti [51] and Marichal and Mossinghoff [197], and in the solution to a problem concerning a novel graduation ceremony in an article by Gessel [122]. The reference book by Sloane and Plouffe [258] and website by Sloane [257] catalog thousands of integer sequences, many of which arise in combinatorics and graph theory, and list references to the literature for almost all of these sequences. The book by Conway and Guy [61] is an informal discussion of several kinds of numbers, including many common combinatorial sequences. Stable Marriage The important results of Gale and Shapley appeared in [117]. A fast algorithm that solves the “stable roommates” problem whenever a solution exists was first described by Irving in [166]. Stable matching problems are studied in Knuth [178] as motivation for the mathematical analysis of algorithms, and the structure of stable matchings in marriage and roommate problems is described in detail by Gusfield and Irving [143], along with algorithms for their computation. A matching algorithm for the “many-to-many” variation of the stable marriage problem, as in Exercise 9 of Section 2.9.2, is developed by Ba¨ıou and Balinski [14]. The monograph by Feder [103] studies extensions of the stable matching problem to more general settings. Combinatorial Geometry A survey on Sylvester’s problem regarding ordinary lines for collections of points, as well as related problems, appears in Borwein and Moser [34]. A variation of Sylvester’s theorem for an infinite sequence of points lying within a bounded region in the plane is investigated by Borwein [33]. The influential paper of Erd˝os and Szekeres on convex polygons, first published in [94], also appears in the collection by Gessel and Rota [123]. The survey by Morris and Soltan [208] summarizes work on this problem and several of its variations. Dozens of problems in combinatorial geometry, both solved and unsolved, are described in the books by Brass, Moser, and Pach [37], Hadwiger, Debrunner, and Klee [144], Herman, Kuˇcera, and ˇSimˇsa [158], and Matouˇsek [200], as well as the survey article by Erd˝os and Purdy [93]. 280 2. Combinatorics Collected Papers The collection [123] by Gessel and Rota contains many influential papers in combinatorics and graph theory, including the important articles by Erd˝os and Szekeres [94], P´olya [225], and Ramsey [232]. The two-volume set edited by Graham and Neˇsetˇril [134,135] is a collection of articles on the mathematics of Paul Erd˝os, including many contributions regarding his work in combinatorics and graph theory. The Handbook of Combinatorics [131, 132] provides an overview of dozens of different areas of combinatorics and graph theory for mathematicians and computer scientists. 3 Infinite Combinatorics and Graphs . . . the definitive clarification of the nature of the infinite has become necessary. . . — David Hilbert [160] Infinite sets are very peculiar, and remarkably different from finite sets. This can be illustrated with a combinatorial example. Suppose we have four pigeons and two pigeonholes. If we place the pigeons in the pigeonholes, one of the pigeonholes must contain at least two pigeons. This crowding will always occur, regardless of the arrangement we choose for the pigeons. Furthermore, the crowding will occur whenever there are more pigeons than holes. In general, if P (pigeons) is a finite set, and H (pigeonholes) is a proper subset of P , then there is no matching between the elements of P and H. Now suppose that we have a pigeon for each real number in the closed interval P = [0, 2]. Put a leg tag on each pigeon with its real number. Also suppose that we have a pigeonhole for each real number in the interval H = [0, 1]. Put an address plate on each pigeonhole with its real number. Note that H P , so the set of address plate numbers is a proper subset of the set of leg tag numbers. For each x ∈ [0, 2], place the pigeon tagged x in the pigeonhole with address x/2. Using this arrangement, no two pigeons will be assigned to the same pigeonhole. Thus, if P is infinite and H is a proper subset of P , there may be a matching between the elements of P and those of H. Infinite sets behave differently from finite sets, and we have used ideas from graph theory and combinatorics to illustrate this difference. One of the justifications for studying infinite versions of combinatorial and graph-theoretic theorems is to gain more insight into the behavior of infinite sets and, by contrast, more J.M. Harris et al., Combinatorics and Graph Theory, DOI: 10.1007/978-0-387-79711-3 3, c Springer Science+Business Media, LLC 2008 282 3. Infinite Combinatorics and Graphs A B C D 0 1 2 3 FIGURE 3.1. A matching. insight into finite sets. Sections 3.1 and 3.2 follow this agenda, culminating in a proof of a finite combinatorial statement using infinite tools. We can also use combinatorial properties to distinguish between different sizes of infinite sets, as is done in Section 3.7. This requires the deeper understanding of the axioms for manipulating infinite sets provided by Sections 3.3 and 3.4, and a precise notion of size that appears in Section 3.5. Combinatorial and graph-theoretic properties can also illuminate the limitations of our axiom systems, as shown in Sections 3.6 and 3.9. The chapter concludes with a hint at the wealth of related topics and a list of references. 3.1 Pigeons and Trees I wonder about the trees. — Robert Frost, The Sound of Trees The chapter introduction shows one way to use pigeons to distinguish between some finite and infinite sets. We could use this as a basis for defining finite sets, but this approach has some drawbacks that we will see in Section 3.4. It is more straightforward to say that a set is infinite if its not finite, and that a set is finite if its elements can be matched with a bounded initial segment of N. For example, the set {A, B, C, D} is finite, because the matching in Figure 3.1 exists. Note that the least integer not used in this matching is 4, which is also the size of the set {A, B, C, D}. This nifty trick, the result of using 0 in our matchings, reappears in Section 3.5. Using the preceding notion of infinite and finite sets, we can propose another pigeonhole principle. Suppose we have an infinite number of pigeons that we stuff into a finite number of pigeonholes. Momentarily disregarding physical considerations, we must have at least one pigeonhole that contains an infinite number of pigeons. Letting P be the set of pigeons, H the set of holes, and f the stuffing function, we obtain the following theorem. Theorem 3.1 (Infinite Pigeonhole Principle). Suppose P is infinite, H is finite, and f : P → H. Then there is an element h ∈ H such that the pre-image set {p ∈ P | f (p) = h} is infinite. Proof. Let P , H, and f be as in the hypothesis of the theorem. In particular, let H = {h0, h1, . . . , hn}. Suppose, by way of contradiction, that for each hi ∈ H, 3.1 Pigeons and Trees 283 r a0 a1 b0 b1 b2 c0 c1 c2 FIGURE 3.2. A tree with labels. the set Pi = {p ∈ P | f (p) = hi} has si elements. Because P can be written as P = P0 ∪ P1 ∪ · · · ∪ Pn, we see that i≤n si is the size of P . Thus P is finite, providing the desired contradiction. A physicist might suggest that the density of matter resulting from cramming an unbounded number of pigeons into a bounded pigeonhole would yield a fusion explosion, obliterating any evidence that could be used by litigious animal rights advocates. Home experiments with actual live pigeons are strongly discouraged. Despite the physical impracticality of our theorem, it is handy for proving a very nice theorem about trees. As stated in Chapter 1, a tree is a connected acyclic graph. For big trees, it is handy to designate a root and label the vertices. Figure 3.2 is an example. As a convenient convention, we always think of the root r as the bottom of the tree and vertices farther from r as being higher in the tree. A path through a tree is a path leading up and away from the root. For example, r, a1, b2 and r, a1, b1, c0 are paths in the tree above. The sequence r, a1, b0 is not a path, because a1b0 is not an edge in the graph. If we add the edge a1b0, the resulting graph is not a tree. (Find the cycle!) A level in a tree is the collection of all vertices at a fixed distance from the root. The levels in our sample tree are {r}, {a0, a1}, {b0, b1, b2} and {c0, c1, c2}. If v is a vertex and w is a neighboring vertex in the next higher level, then we call w an immediate successor of v. In the sample, b1 is an immediate successor of a1, and b0 is not. We can even say that c1 is a successor of a1, but not an immediate successor. The vertex labels in the sample tree are arbitrary; if we want more than 26 levels, we could use a different labeling scheme. It is even possible to reuse labels in some circumstances, as shown in Exercise 2. Now we are ready to state K¨onig’s Lemma. The result concerns infinite trees, that is, trees with an infinite number of vertices. Essentially, K¨onig’s Lemma says that big skinny trees are tall. 284 3. Infinite Combinatorics and Graphs Theorem 3.2 (K¨onig’s Lemma). If T is an infinite tree and each level of T is finite, then T contains an infinite path. Proof. Let T be an infinite tree in which every level is finite. Let L0 = {r}, L1, L2, . . . be the levels of T . We will co
nstruct a path as follows. Let r be the first element of the path. There are infinitely many vertices in T above r. Each of these vertices is either in L1 or above a unique vertex in L1. Map each of the vertices above r to the vertex of L1 that it is equal to or above. We have mapped infinitely many vertices (pigeons) to the finitely many vertices of L1 (pigeonholes). By Theorem 3.1, there is at least one vertex of L1 that is above r and has infinitely many vertices above it; pick one and call it v1. The path so far is r, v1. Since there are infinitely many vertices above v1, we can replace r by v1 in the preceding argument and select v2. Similarly, for each n ∈ N, when we have found vn we can find vn+1. Thus T contains an infinite path. K¨onig’s Lemma appears in the 1927 paper of D´enes K¨onig [179]. Some authors (e.g [218]) refer to the lemma as K¨onig’s Infinity Theorem. The name K¨onig’s Theorem is usually reserved for an unrelated result on cardinal numbers proved by Julius K¨onig, another (earlier) famous Hungarian mathematician. Exercises 1. Suppose we arrange finitely many pigeons in infinitely many pigeon holes. Use the Infinite Pigeonhole Principle to prove that there are infinitely many pigeonholes that contain no pigeons. 2. Reusing labels in trees. Figure 3.3 shows an example of a tree where labels are reused. r 0 1 0 1 0 0 1 FIGURE 3.3. A tree with reused labels. Note that in this tree, each vertex can be reached by a path corresponding to a unique sequence of labels. For example, there is exactly one vertex corresponding to r, 0, 1. 3.2 Ramsey Revisited 285 (a) Give an example of a tree with badly assigned labels, resulting in two vertices that have the same sequence of labels. (b) Prove that if the immediate successors of each vertex in a tree have distinct labels, then no two vertices can have matching sequences of labels. (c) Prove the converse of part 2b. 3. 2-coloring an infinite graph. Suppose G is a graph with vertices V = {vi | i ∈ N} and every finite subgraph of G can be 2-colored. Use K¨onig’s Lemma to prove that G is 2-colorable. (Hint: Build a tree of partial colorings. Put the vertex root, red, blue, blue in the tree if and only if assigning red to v0, blue to v1, and blue to v2 yields a 2-coloring of the subgraph with vertices {v0, v1, v2}. An infinite path through such a tree will be a coloring of G. You must prove that the tree is infinite and that each level is finite.) 4. Construct an infinite graph where each finite subgraph can be colored using a finite number of colors, but where infinitely many colors are needed to color the entire graph. (Hint: Use lots of edges.) 5. Heine–Borel Theorem on compactness of the real interval [0, 1]. Use K¨onig’s Lemma to prove that if (a0, b0), (a1, b1), . . . are open intervals in R and [0, 1] ⊂ (a0, b0) ∪ (a1, b1) ∪ · · · , then for some finite value n, [0, 1] ⊂ (a0, b0) ∪ (a1, b1) ∪ · · · ∪ (an, bn). (Hint: Build a tree where the labels in the ith level are the closed intervals obtained by removing (a0, b0) ∪ (a1, b1) ∪ · · · ∪ (ai, bi) from [0, 1] and the successors of a vertex v are labeled with subintervals of the interval for v. Use the fact that the intersection of any sequence of nested closed intervals is nonempty to show that the tree contains no infinite paths. Apply the contrapositive of K¨onig’s Lemma.) 3.2 Ramsey Revisited Ah! the singing, fatal arrow, Like a wasp it buzzed and stung him! — H. W. Longfellow, The Song of Hiawatha Suppose that we 2-color the edges of K6, the complete graph with six vertices, using the colors red and blue. As we proved in Chapter 1, the colored graph must contain a red K3 or a blue K3. Since we can 2-color K5 in a way that prevents monochromatic triangles, K6 is the smallest graph that must contain a monochromatic triangle. Thus, the Ramsey number R(3, 3) is 6, as noted in Theorem 1.61. If we want to guarantee a monochromatic K4 subgraph then we must 2-color K18, because R(4, 4) = 18. Exact values for R(p, p) when p ≥ 5 are not known, but by 286 3. Infinite Combinatorics and Graphs the Erd˝os–Szekeres bound (Theorem 1.63) we know that these Ramsey numbers exist. Suppose that G is the complete graph with vertices V = {vi | i ∈ N}. If we 2color the edges of G, what can we say about monochromatic complete subgraphs? Since G contains K6, it must contain a monochromatic K3. Similarly, since G contains K18, it must contain a monochromatic K4. For p ≥ 5, we know that R(p, p) is finite and that G contains KR(p,p) as a subgraph, so G must contain a monochromatic Kp. So far we know that G must contain arbitrarily large finite monochromatic complete subgraphs. As a matter of fact, G contains an infinite complete monochromatic subgraph, though this requires some proof. Theorem 3.3. Let G be a complete infinite graph with vertices V = {vi | i ∈ N}. Given any 2-coloring of the edges, G will contain an infinite complete monochromatic subgraph. Proof. Suppose the edges of G are colored using red and blue. We will build an infinite subsequence wi | i ∈ N of V by repeatedly applying the pigeonhole principle (Theorem 3.1). Let w0 = v0. For each i > 0, the edge v0vi is either red or blue. Since this assigns vi to one of two colors for each i > 0, there is an infinite set of vertices V0 such that all the edges {v0v | v ∈ V0} are the same color. Suppose we have selected wn and Vn. Let wn+1 be the lowest-numbered vertex in Vn, and let Vn+1 be an infinite subset of Vn such that the edges in the set {wn+1v | v ∈ Vn+1} are the same color. This completes the construction of the sequence. This sequence wi | i ∈ N has a very interesting property. If i < j < k, then wj and wk are both in Vi, and consequently wiwj and wiwk are the same color! We will say that a vertex wi is blue-based if j > i implies wiwj is blue, and red-based if j > i implies wiwj is red. Each vertex in the infinite sequence wi | i ∈ N is blue-based or red-based, so by the pigeonhole principle there must be an infinite subsequence wi0 , wi1 , . . . where each element has the same color base. As a sample case, suppose the vertices in the subsequence are all bluebased. Then for each j < k, since wij is blue-based, the edge wij wik is blue. Thus all the edges of the complete subgraph with vertices {wi0 , wi1 , . . . } are blue. If the subsequence vertices are red-based, then the edges of the associated infinite complete subgraph are red. Using the preceding theorem, we can prove that the finite Ramsey numbers exist without relying on the Erd˝os–Szekeres bound. Theorem 3.4. For each n ∈ N there is an m ∈ N such that R(n, n) = m. Proof. By way of contradiction, suppose that there is an n such that for every m there is a 2-coloring of the edges of Km that contains no monochromatic Kn subgraph. Let G be the complete graph with vertices V = {vi | i ∈ N}. Suppose E = {ei | i ∈ N} is an enumeration of the edges of G. Construct a tree T of partial edge colorings of G as follows. Include the sequence r oot, c0, c1, c2, . . . , ck in T if and only if whenever edge ei is colored color ci for all i ≤ k, the subgraph of 3.2 Ramsey Revisited 287 G containing e0, e1, . . . , ek contains no monochromatic Kn. The kth level of T contains at most 2k vertices, so each level is finite. Since we have assumed that there is a way of coloring any Km so that no monochromatic Kn appears, T is infinite. By K¨onig’s Lemma (Theorem 3.2), T has an infinite path. This infinite path provides a 2-coloring of G that contains no monochromatic Kn. Thus for this coloring, G has no infinite complete monochromatic subgraph, contradicting the preceding theorem. Our initial supposition must be false, and so for each n, there is an m such that R(n, n) = m. We just used the infinite pigeonhole principle, infinite trees, and colorings of infinite graphs to prove a result about finite graphs! (In doing so, we are imitating Ramsey [232].) Besides being inherently fascinating, infinite constructions are very handy. Furthermore, the arguments are easily generalized. In order to take full advantage of our work, we need some new notation. Here come the arrows! The notation κ → (λ)2 c means that every c-colored complete graph on κ vertices contains a monochromatic complete subgraph with λ vertices. Most people pronounce κ → (λ)2 c as “kappa arrows lambda 2 c.” The statement that R(3, 3) = 6 combines the facts that 6 → (3)2 2 (K6 is big enough) and 5 → (3)2 2 (K5 is not big enough). If we imitate set theorists and write ω for the size of the set V = {vi | i ∈ N}, we can rewrite Theorem 3.3 as ω → ω2 2. Abbreviating “for all n” by ∀n and “there exists an m” by ∃m, Theorem 3.4 becomes ∀n∃m m → (n)2 2. Arrow notation is particularly useful if we want to use lots of colors. It is easy to check that if every use of two colors is replaced by some finite value c in the proof of Theorem 3.3, the result still holds. The same can be said for Theorem 3.4. Consequently, for any c ∈ N we have ω → (ω)2 c and ∀n∃m m → (n)2 c. Note that when c is largish, the arrow notation is particularly convenient. For example, the statement “m is the least number such that m → (3)2 9” translates into Ramsey number notation as the unwieldy formula R(3, 3, 3, 3, 3, 3, 3, 3, 3) = m. Nobody would want to translate m → (3)2 1000. On the other hand, R(3, 4) = 9 does not translate into our arrow notation. The 2 in κ → (λ)2 c indicates that we are coloring unorderedpairs of elements taken from a set of size κ. When we edge color a graph, we are indeed assigning colors to the pairs of vertices corresponding to the edges. However, we can extend Ramsey’s theorem by coloring larger subsets. The resulting statements are still very combinatorial in flavor, though they no longer refer to edge colorings. For example, the notation κ → (λ)n c means that for any assignment of c colors to the unordered n-tuples of κ, there is a particular color (say lime) and a subset X ⊂ κ of size λ such that no matter how we select n elements from X, the corresponding n-tuple will be lime colored. The proofs of Theorems 3.
3 and 3.4 can be modified to prove the following theorems. Theorem 3.5 (Infinite Ramsey’s Theorem). For all n ∈ N and c ∈ N, ω → (ω)n c . 288 3. Infinite Combinatorics and Graphs Proof. By induction on n. Exercise 2 gives hints. Theorem 3.6 (Finite Ramsey’s Theorem). For all k, n, c ∈ N, there is an m ∈ N such that m → (k)n c . Proof. Follows from Theorem 3.5. Exercise 3 gives hints. Throughout this section we have been very picky about our infinite sets. For example, V = {vi | i ∈ N} has a built-in matching with N. What happens if we look at graphs with a vertex for each real number? In Section 3.7 we will learn that the analog of Theorem 3.3 fails for an infinite graph of this sort. For what sorts of infinite graphs does Theorem 3.3 hold? To answer this question, we need a deeper understanding of the infinite. Exercises 1. Let X = {xi | i ∈ N} be a set. Suppose that the relation ≤ is a partial ordering on X. That is, for any a, b, c ∈ X, suppose that • a ≤ a, • if a ≤ b and b ≤ a, then a = b, and • if a ≤ b ≤ c, then a ≤ c. Use Theorem 3.3 to prove that there is an infinite subset Y ⊂ X such that either • for every a, b ∈ Y , either a ≤ b or b ≤ a, or • for every a, b ∈ Y , both a ≤ b and b ≤ a. A subset of the first type is called a chain, and a subset of the second type is called an antichain. 2. Prove Theorem 3.5. Begin by proving Theorem 3.5 for 2 colors. Proceed by induction on n. For n = 1, use the pigeonhole principle as a base case. For the induction step, assume that ω → (ω)n by imitating the proof of Theorem 3.3, substituting applications of ω → (ω)n 2 for the use of the pigeonhole principle. 2 , and prove that ω → (ω)n+1 2 Given the theorem for 2 colors, there are many ways to prove it for other finite numbers of colors. You could replace 2 by c everywhere in the proof you just did, or you could try proving the theorem for c colors and n-tuples by using the theorem for 2 colors and 2n-tuples. 3. Prove Theorem 3.6. Imitate the proof of Theorem 3.4, using Theorem 3.5 in place of Theorem 3.3. 3.2 Ramsey Revisited 289 0 1 2 3 4 Red Blue FIGURE 3.4. A tripartite graph representing a 2-coloring. 4. One way to visualize coloring triples. We can represent a coloring of triples by attaching a claw to a triple that points in a particular direction. For example, the tripartite graph in Figure 3.4 represents coloring {0, 1, 2} red and {1, 3, 4} blue. Figure 3.5 represents a 2-coloring of the ten triples that can be formed from the set V = {0, 1, 2, 3, 4}. You can check that every four-element subset of V contains a triple with a claw on the blue side and a triple with a claw on the red side. Thus, Figure 3.5 illustrates that 5 → (4)3 2. Red Blue 0 1 2 3 4 FIGURE 3.5. A 2-coloring of the triples from {0, 1, 2, 3, 4}. (a) Find a different coloring that shows that 5 → (4)3 2 and represent it as a tripartite graph. (How do you know that your coloring is significantly different?) (b) Find a tripartite graph that shows that 5 → (3)2 2. (c) Devise a way to draw a similar graph that shows that 6 → (3)2 3. (d) Find a tripartite graph that shows that 6 → (4)3 2. Since every triple gets a claw, make your life easier by drawing only the red claws. 290 3. Infinite Combinatorics and Graphs 3.3 ZFC No one shall be able to drive us from the paradise that Cantor created for us. — David Hilbert [160] Paraphrasing Hilbert, in Cantor’s paradise mathematicians can joyfully prove new and rich results by employing infinite sets. Since we have been living reasonably comfortably in this paradise since the beginning of the chapter, Hilbert’s anxiety about eviction may seem misplaced. However, Russell and other mathematicians discovered some set-theoretic paradoxes that made the na¨ıve use of infinite sets very questionable. Hilbert responded by calling for a careful investigation with the goal of completely clarifying the nature of the infinite. One could argue that Hilbert’s call (made in 1925) had already been answered by Zermelo in 1908. In the introduction to [293], Zermelo claimed to have reduced the entire theory created by Cantor and Dedekind to seven axioms and a few definitions. Although we now use formulations of the axioms of separation and replacement that more closely resemble those of Fraenkel and Skolem, the most commonly used axiomatization of set theory, ZFC, consists primarily of axioms proposed by Zermelo. The letters ZFC stand for Zermelo, Fraenkel, and Axiom of Choice. Although Skolem does not get a letter, it would be hard to overestimate his influence in recasting ZFC as a first order theory. ZFC succinctly axiomatizes what has become the de facto foundation for standard mathematical practice. With sufficient diligence, it would be possible to formalize every theorem appearing so far in this book and prove each of them from the axioms of ZFC. Since these proofs can be carried out in a less formal setting, foundational concerns are insufficient motivation for adopting an axiomatic approach. However, many of the results in Sections 3.4 through 3.10 cannot even be stated without referring to ZFC. We will use ZFC as a base theory to explore the relative strength of some very interesting statements about sets. In particular, ZFC will be central to our discussion of large cardinals and infinite combinatorics. 3.3.1 Language and Logical Axioms The comfort of the typesetter is certainly not the summum bonum. — Gottlob Frege [112] Before we discuss the axioms of ZFC, we need to list the symbols we will use. Although some of these symbols may be unfamiliar, they can be used as a very convenient shorthand. Variables can be uppercase or lowercase letters with subscripts tacked on if we please. Good examples of variables include A, B, x, and y3. The symbol ∅ denotes the empty set, and P and ∪ are function symbols for the power set and union. The exact meaning of ∅, P(x), and ∪x are determined by the axioms in the next section. (∪x is not a typographical error; a discussion appears later.) A 3.3 ZFC 291 Formula Translation ¬xθ ∃xθ not θ θ and ψ θ or ψ if θ then ψ θ if and only if ψ for all sets x, θ holds there is a set x such that θ holds TABLE 3.1. Translations of connectives and quantifiers. term is a variable, the symbol ∅, or the result of applying a function to a term. In ZFC, terms always denote sets. Consequently, all the objects discussed in ZFC are sets. Some early formalizations of set theory include distinct objects with no elements. These objects are usually called atoms or urelements. They do not show up in ZFC. The atomic formulas of ZFC are x ∈ y and x = y, where x and y could be any terms. As one would expect, the formula x ∈ y means x is an element of y. The connection between ∈ and = is partly determined by the axiom of extensionality (in the next section) and partly determined by the fact that = really does denote the familiar equality relation. All other formulas of ZFC are built up by repeatedly applying logical connectives and quantifiers to the atomic formulas. Table 3.1 lists typical formulas and their translations. The letters θ and ψ denote formulas of ZFC. Specifying that ZFC is a first order theory implicitly appends the axioms for predicate calculus with equality to the axioms for ZFC. In a nutshell, these logical axioms tell us that the connectives and quantifiers have the meanings shown in Table 3.1, and that = is well behaved. In particular, we can substitute equal terms. Thus, if x = y and θ(x) both hold, then θ(y) holds, too. As a consequence, we can prove the following theorem. Theorem 3.7. Equal sets have the same elements. Formally, x = y → ∀t(t ∈ x ↔ t ∈ y). Proof. Suppose x = y. Fix t. If t ∈ x, then by substitution, t ∈ y. Similarly, if t ∈ y, then t ∈ x. Our choice of t was arbitrary, so ∀t(t ∈ x ↔ t ∈ y). We could completely formalize the preceding argument as a symbolic logic proof in any axiom system for predicate calculus with equality. Some good formal axiom systems can be found in Mendelson [201] or Kleene [176] by readers with a frighteningly technical bent. It is very convenient to write x ⊂ y for the formula ∀t(t ∈ x → t ∈ y). Using this abbreviation and only the axioms of predicate calculus, we could prove that ∀x(x ⊂ x), showing that every set is a subset of itself. We could also prove that 292 3. Infinite Combinatorics and Graphs containment is a transitive relation, which can be formalized as ∀x∀y∀z((x ⊂ y ∧ y ⊂ z) → x ⊂ z). The preceding results (which appear in the exercises) rely on logical axioms rather than on the actual nature of sets. To prove meaty theorems, we need more axioms. 3.3.2 Proper Axioms . . . I tasted the pleasures of Paradise, which produced these Hell torments. . . — Pangloss, in Candide The axiom system ZFC consists of nine basic axioms plus the axiom of choice. Typically, the nine basic axioms are referred to as ZF. In this section, we will examine the axioms of ZF, including their formalizations, some immediate applications, and a few random historical comments. This should be less painful than the affliction of Pangloss. 1. Axiom of extensionality: If a and b have the same elements, then a = b. Formally, ∀x(x ∈ a ↔ x ∈ b) → a = b. This axiom is the converse of Theorem 3.7, so ZF can prove that a = b if and only if a and b have exactly the same elements. Using this, we can prove the following familiar theorem about the connection between subsets and equality. Theorem 3.8. For all sets a and b, a = b if and only if a ⊂ b and b ⊂ a. Formally, ∀a∀b(a = b ↔ (a ⊂ b ∧ b ⊂ a)). Proof. First suppose that a = b. Since a ⊂ a (see Exercise 1), by substitution we have a ⊂ b and b ⊂ a. Thus, a = b → (a ⊂ b ∧ b ⊂ a). To prove the converse, suppose a ⊂ b and b ⊂ a. Since a ⊂ b, for every x we have that if x ∈ a then x ∈ b. Similarly, since b ⊂ a, x ∈ b implies x ∈ a. Summarizing, for all x, x ∈ a ↔ x ∈ b. By the axiom of extensionality, a = b. The axiom of extensionality and the preceding theorem give us strategies for proving that sets are equal. Most proofs of set equality apply one of
these two approaches. 2. Empty set axiom: ∅ has no elements. Formally, ∀x(x /∈ ∅). The empty set has some unusual containment properties. For example, it is a subset of every set. Theorem 3.9. ∅ is a subset of every set. Formally, ∀t(∅ ⊂ t). 3.3 ZFC 293 Proof. The proof relies on the mathematical meaning of implication. Suppose t is a set. Pick any set x. By the empty set axiom, x /∈ ∅, so x ∈ ∅ implies x ∈ t. (When the hypothesis is false, the implication is automatically true. If I am the king of the world, then you will send me all your money. The statement is true, but no checks have arrived.) Formally, ∀x(x ∈ ∅ → x ∈ t), so ∅ ⊂ t. The preceding proof also implies that ∅ ⊂ ∅, although Exercise 1 provides a more direct proof. 3. Pairing axiom: For every x and y, the pair set {x, y} exists. Formally, ∀x∀y∃z∀t(t ∈ z ↔ (t = x ∨ t = y)). In the formal version of the axiom, the set z has x and y as its only elements. Thus, z is {x, y}. The pair sets provided by the pairing axiom are unordered, so {x, y} = {y, x}. The pairing axiom can be used to prove the existence of singleelement sets, which are often called singletons. Theorem 3.10. For every x, the set {x} exists. That is, ∀x∃z∀t(t ∈ z ↔ t = x). Proof. Fix x. Substituting x for y in the pairing axiom yields a set z such that ∀t(t ∈ z ↔ (t = x ∨ t = x)). By the axiom of extensionality, z = {x}. The empty set axiom, the pairing axiom, and Theorem 3.10 on the existence of singletons are all combined in Zermelo’s original axiom of elementary sets [293]. As an immediate consequence he solves Exercise 4, showing that singleton sets have no proper subsets. The statement of the next axiom uses the union symbol in an unusual way. In particular, we will write ∪{x, y} to denote the familiar x ∪ y. This prefix notation is very convenient for writing unions of infinite collections of sets. For example, if X = {xi | i ∈ N}, then the infinite union x0 ∪ x1 ∪ x2 ∪ · · · can be written as ∪X, eliminating the use of pesky dots. The union axiom says that ∪X contains the appropriate elements. 4. Union axiom: The elements of ∪X are precisely those sets that are elements of the elements of X. Formally, ∀t(t ∈ ∪X ↔ ∃y(t ∈ y ∧ y ∈ X)). Exercise 5 is a verification that ∪{x, y} is exactly the familiar set x ∪ y. The notion of union extends naturally to collections of fewer than two sets, also. By the union axiom, t ∈ ∪{x} if and only if there is a y ∈ {x} such that t ∈ y, that is, if and only if t ∈ x. Thus, ∪{x} = x. For an exercise in wildly vacuous reasoning, try out Exercise 6, showing that ∪∅ = ∅. Like the union axiom, the power set axiom defines one of our built-in functions. 294 3. Infinite Combinatorics and Graphs 5. Power set axiom: The elements of P(X) are precisely the subsets of X. Formally, ∀t(t ∈ P(X) ↔ t ⊂ X). This is the same power set operator that appears in the first chapter of dozens of mathematics texts. For example, P({a, b}) = {∅, {a}, {b}, {a, b}}. If X is a finite set of size n, then P(X) has 2n elements. Thus for finite sets, the size of P(X) is always larger than the size of X. In Section 3.5 we will prove that this relation continues to hold when X is infinite. It may seem odd that we do not have other built-in functions, like intersection, set-theoretic difference, or Cartesian products. However, all these operations can be defined using the next axiom and are omitted in order to reduce redundancy in the axioms. Our version of the separation axiom is the invention of Skolem [255]. Both Skolem and Fraenkel [109] proposed emendations to Zermelo’s version of the separation axiom. 6. Separation axiom: If ψ(x) is a formula and X is a set, then the set denoted by {x ∈ X | ψ(x)} exists. More formally, given any set X and any formula ψ(x) in the language of ZFC, if ψ(x) does not contain the variable S, then ∃S∀x(x ∈ S ↔ (x ∈ X ∧ ψ(x))). Note that ψ(x) may contain unquantified variables that can be viewed as parameters. Thus S can be defined in terms of X and other given sets. We can use the separation axiom to prove that intersections exist. It is nice to use intersection notation that is parallel to our union notation, so we write ∩{a, b} for a ∩ b. In general, an element should be in ∩X precisely when it is in every element of X. Theorem 3.11. For any nonempty set X, ∩X exists. That is, for any set X there is a set Y such that ∀x(x ∈ Y ↔ ∀t(t ∈ X → x ∈ t)). Proof. Fix X. Let Y = {x ∈ ∪X | ∀t(t ∈ X → x ∈ t)}. By the separation axiom, Y exists. We still need to show that Y is the desired set. By the definition of Y , if x ∈ Y , then ∀t(t ∈ X → x ∈ t). Conversely, if ∀t(t ∈ X → x ∈ t), then since X is nonempty, ∃t(t ∈ X ∧ x ∈ t). Thus x ∈ ∪X. Because x ∈ ∪X and ∀t(t ∈ X → x ∈ t), we have x ∈ Y . Summarizing, x ∈ Y if and only if ∀t(t ∈ X → x ∈ t). It is also possible to show that ∩X is unique. (See Exercise 8.) Since we can show that for all X the set ∩X exists and is unique, we can add the function 3.3 ZFC 295 symbol ∩ to the language of ZFC. Of course, the symbol itself could be subject to misinterpretation, so we need to add a defining axiom. The formula ∀x(x ∈ ∩X ↔ ∀t(t ∈ X → x ∈ t)) will do nicely. The resulting extended theory is more convenient to use, but proves exactly the same theorems, except for theorems actually containing the symbol ∩. Mathematical logicians would say that ZFC with ∩ is a conservative extension of ZFC. Using the same process, we can introduce other set-theoretic functions. For example, we can specify a set that represents the ordered pair (x, y), and define the Cartesian product X × Y = {(x, y) | x ∈ X ∧ y ∈ Y }. Ordered n-tuples can be defined in a number of reasonable ways from ordered pairs. We could define the relative complement of Y in X by X − Y = {x ∈ X | x /∈ Y }. See Exercises 9, 10, and 11 for more discussion of these operations. There are some significant restrictions in the sorts of functions that could be conservatively added to ZFC. For example, as above it is acceptable to introduce the relative complement, but not a full-blown general complement. (Books usually use X or X c to denote a general complement.) Given a general complement, we could prove that X ∪ X c existed. This would give us a set of all sets, but that is prohibited by the separation axiom. Theorem 3.12. There is no universal set. That is, there is no set U such that ∀x(x ∈ U ). Proof. Suppose by way of contradiction that ∀x(x ∈ U ). Applying the separation axiom, there is a set X such that X = {z ∈ U | z /∈ z}. Note that for all z, z ∈ X if and only if z ∈ U and z /∈ z. Furthermore, z ∈ U and z /∈ z if and only if z /∈ z. Thus, z ∈ X if and only if z /∈ z for any z we care to choose. In particular, substituting X for z gives us X ∈ X if and only if X /∈ X, yielding the desired contradiction. The preceding proof contains the gist of Russell’s paradox. Briefly, Russell’s paradox says that the existence of {z | z /∈ z} leads inexorably to contradictions. Note that the existence of {z | z /∈ z} is not proved by the separation axiom, because the specified set is not bounded. For any bound X, we can prove that {z ∈ X | z /∈ z} exists; it is just a harmless subset of X. By requiring bounds on definable sets, we cleverly sidestep paradoxes that ensnare the users of na¨ıve set theory. For another experiment with Russell’s style of argument, try Exercise 12. Part of Hilbert’s motivation for the rigorous study of set theory was to gain a deeper understanding of infinite sets. So far, our axioms do not guarantee the existence of a single infinite set. (Readers who love technical details may want to construct a model of axioms 1 through 6 in which every set is finite. The universe for this model will be infinite, but each element in the universe will be finite.) One way to construct an infinite set is to start with ∅ and successively apply Theorem 3.10. If we let x0 = ∅ and xn+1 = {xn} for each n, this yields a set for 296 3. Infinite Combinatorics and Graphs each natural number. In particular, x0 = ∅, x1 = {∅}, x2 = {{∅}}, and so on. The next axiom affirms the existence of a set containing all these sets as elements. 7. Infinity axiom: There is a set Z such that (i) ∅ ∈ Z and (ii) if x ∈ Z, then {x} ∈ Z. Formally, ∃Z(∅ ∈ Z ∧ ∀x(x ∈ Z → ∃y(y ∈ Z ∧ ∀t(t ∈ y ↔ t = x)))). The axiom of infinity guarantees the existence of some set satisfying properties (i) and (ii). By applying the power set axiom, the separation axiom, and taking an intersection, we can find the smallest set with this property. For details, see Exercise 13. Zermelo’s axiomatization of set theory consists of axioms 1 through 7 plus the axiom of choice. We will discuss the axiom of choice shortly. In the meantime, there are two more axioms that have been appended to ZF that should be mentioned. The first of these is the axiom of replacement, proposed in various versions by Fraenkel ([107], [108], and [110]), Skolem [255], and Lennes [186]. 8. Replacement axiom: Ranges of functions restricted to sets exist. That is, if f (x) is a function and D is a set, then the set R = {f (x) | x ∈ D} exists. More formally, if ψ(x, y) is a formula of set theory such that ∀x∀y∀z((ψ(x, y) ∧ ψ(x, z)) → y = z), then for every set D there is a set R such that ∀y(y ∈ R ↔ ∃x(x ∈ D ∧ ψ(x, y)). Note that the formula ψ(x, y) in the formal statement of the axiom can be viewed as defining the relation f (x) = y. The replacement axiom is useful for proving the existence of large sets. In particular, if we assume that ZFC and the continuum hypothesis are consistent, in the absence of the replacement axiom it is impossible to prove that any sets of size greater than or equal to ℵω exist. (To find out what ℵω is, you have to stick around until Section 3.5.) The final axiom of ZF is the regularity axiom. In a nutshell, it outlaws some rather bizarre behavior, for example having x ∈ y ∈ x. Attempts to avoid these strange constructs can be found in the work of Mirimanoff [207], but Skolem [255] and von Neumann [276] are usually given credit for proposing the actual axiom
. 9. Regularity axiom: Every nonempty set x contains an element y such that x ∩ y = ∅. Formally, ∀x(x = ∅ → ∃y(y ∈ x ∧ x ∩ y = ∅)). 3.3 ZFC 297 The idea here is that ∈ can be viewed as a partial ordering on any set by letting x < y mean x ∈ y. The regularity axiom says that every set has a minimal element in this ordering. This rules out loops (like x ∈ y ∈ x) and infinite descending chains (like · · · ∈ x3 ∈ x2 ∈ x1 ∈ x0). The following theorem shows that tight loops are outlawed. Theorem 3.13. For all x, x /∈ x. Proof. By way of contradiction, suppose x ∈ x. By Theorem 3.10, we know the set X = {x} exists. The set X is nonempty, so by the regularity axiom, there is an element y ∈ X such that X ∩ y = ∅. The only element of X is x, so y = x and X ∩ x = ∅. However, x ∈ X and x ∈ x, so x ∈ X ∩ x = ∅, a contradiction. Summarizing this section, the proper axioms of ZF are: 1. Axiom of extensionality, 2. Empty set axiom, 3. Pairing axiom, 4. Union axiom, 5. Power set axiom, 6. Separation axiom, 7. Infinity axiom, 8. Replacement axiom, and 9. Regularity axiom. We are still missing one axiom from Zermelo’s list, the axiom of choice. 3.3.3 Axiom of Choice Vizzini: . . . so I can clearly not choose the wine in front of me. Man in black: You’ve made your decision then? Vizzini: [happily] Not remotely! — The Princess Bride Suppose that we, like Vizzini, are faced with the task of selecting one glass from a set of two glasses. Since the set of glasses is nonempty, we can select one element and get on with our lives, which hopefully will be much longer than Vizzini’s. To be very technical, the justification for our selection is the logical principle of existential instantiation. Similarly, using only axioms of ZF, we can always select one element from any nonempty set, without regard for the size of the set. Furthermore, we could repeat this process any finite number of times, so we can choose one element from each set in any finite list of nonempty sets. 298 3. Infinite Combinatorics and Graphs By contrast, making an infinite number of choices simultaneously can often be problematic, depending on the circumstances. Suppose that we have an infinite collection of pairs of boots. We can pick one boot from each pair by specifying that we will select the left boot from each pair. Because each nonempty set (pair of boots) has a designated element (left boot), ZF suffices to prove the existence of the set of selected boots. Working in ZF, we cannot carry out the same process with an infinite collection of pairs of socks, because socks are not footed. We need a new axiom. In [244], Russell discusses this boot problem, though rather than selecting socks, he considers the case where “the left and right boots in each pair are indistinguishable.” Cruel shoes indeed! The axiom of choice guarantees the existence of a set of selected socks. The following version of the axiom is very close to that of Zermelo [293]. 10. Axiom of choice (AC): If T is a set whose elements are all sets that are nonempty and mutually disjoint, then ∪T contains at least one subset with exactly one element in common with each element of T . Most recent works use a formulation of the axiom of choice that asserts the existence of choice functions. In terms of socks, when a choice function is applied to a pair of socks, it outputs a designated sock. In the following statement, if T is a set of pairs of socks, t would be a pair of socks, and f (t) would be a sock. 10. Axiom of choice (AC2): If T is a set of nonempty sets, then there is a function f such that for every t ∈ T , f (t) ∈ t. We use ZFC to denote ZF plus either version of AC. This is not imprecise, since we can prove that the two versions of the axiom of choice are interchangeable. Theorem 3.14. ZF proves that AC holds if and only if AC2 holds. Proof. First assume all the axioms of ZF plus AC. Let T be a set of nonempty sets. Define the function g with domain T by setting g(t) = {(t, y) | y ∈ t} for each t ∈ T . Essentially, g(t) looks like the set t with a flag saying “I’m in t” attached to each element. By the replacement axiom, the set Y = {g(t) | t ∈ T } exists. The elements of Y are nonempty and disjoint, so by AC there is a set S that contains exactly one element from each element of Y . Thus S is a set of ordered pairs of the form (t, y), where exactly one pair is included for each t ∈ T . Let f (t) be the unique y such that (t, y) ∈ S. Then f is the desired choice function. To prove the converse, assume ZF plus AC2. Let T be a set whose elements are nonempty and disjoint. By AC2, there is a function f such that for each t ∈ T , f (t) ∈ t. By the replacement axiom, S = {f (t) | t ∈ T } exists. S is the desired subset of ∪T . 3.3 ZFC 299 Zermelo ([291], [292]) used AC to prove that every set can be well-ordered. Hartogs [155] extended Zermelo’s result by proving that AC is equivalent to this well-ordering principle. Hartogs’ result is identical in format to the equivalence result that we just proved. What really makes Hartogs’ result and our equivalence theorem interesting is the fact that AC can neither be proved nor disproved in ZF. (Technically, we just implicitly assumed that ZF is consistent. I assure you that many people make much more bizarre assumptions in their daily lives.) G¨odel [125] proved that ZF cannot disprove AC, and Cohen ([58], [59]) showed that ZF cannot prove AC. Thus our equivalence theorem and the theorem of Hartogs list statements that we can add interchangeably to strengthen ZF. In later sections we will see more examples of equivalence theorems and more examples of statements that strengthen ZF and ZFC. Exercises 1. Prove that set containment is reflexive. That is, prove ∀x(x ⊂ x). (This requires only logical properties.) 2. Prove that set containment is transitive. That is, prove ∀x∀y∀z((x ⊂ y ∧ y ⊂ z) → x ⊂ z). (This requires only logical properties.) 3. Prove that the empty set is unique. That is, if ∀x(x /∈ y), then y = ∅. 4. Prove that if y ⊂ {x}, then y = ∅ or y = {x}. 5. Prove that ∪{x, y} is exactly the familiar set x ∪ y. That is, prove that t ∈ ∪{x, y} if and only if t ∈ x or t ∈ y. 6. Prove that ∪∅ = ∅. 7. Find P(∅), P(P(∅)), and P(P(P(∅))). (To make your answers look really bizarre and drive your instructor nuts, write { } for ∅.) 8. Prove that ∩X is unique. That is, show that if Y is a set that satisfies the formula ∀x(x ∈ Y ↔ ∀t(t ∈ X → x ∈ t)) and Z is a set that satisfies the formula ∀x(x ∈ Z ↔ ∀t(t ∈ X → x ∈ t)), then Y = Z. (Proving the existence of Y and Z requires the separation axiom (see Theorem 3.11), but this problem uses the axiom of extensionality.) 9. Let X − Y denote the set {x ∈ X | x /∈ Y }. (a) Prove that for every X and Y , X − Y exists. (b) Prove that for every X and Y , X − Y is unique. (c) Under what circumstances does X − Y = Y − X? 300 3. Infinite Combinatorics and Graphs 10. Representations of ordered pairs. (a) Kuratowski [184] suggested that the ordered pair (a, b) can be represented by the set {{a, b}, a}. (This encoding is still in use.) Using this definition, prove that (a, b) = (c, d) if and only if a = c and b = d. (b) Using Kuratowski’s encoding, show that if X and Y are sets, then the set X × Y defined by X × Y = {(x, y) | x ∈ X ∧ y ∈ Y } exists and is uniquely determined by X and Y . (c) Wiener [283] suggested that the ordered pair (x, y) can be represented by the set {{{x}, ∅}, {{y}}}. If you dare, repeat parts 10a and 10b using this encoding. (d) Show that encoding (a, b) by {a, {b}} leads to difficulties. (Find two distinct ordered pairs that have the same representation in this encoding.) 11. Representations of n-tuples. (a) Usually, set theorists represent (a, b, c) by ((a, b), c), where pairs are represented using the Kuratowski encoding from Exercise 10. Using this representation prove the following: (i) (a, b, c) = (d, e, f ) ↔ ( ), (ii) X × Y × Z exists, and (iii) X × Y × Z is unique. (b) To address type-theoretic concerns, Skolem [256] suggested representing (a, b, c) by ((a, c), (b, c)). Repeat part 11a with this encoding. (c) Using parts 11a and 11b as the base cases in an induction argument, extend the statements in part 11a to n-tuples for each natural number n. (If you do this, you clearly have a great love for long technical arguments. You might as well repeat the whole mess with the Wiener encoding.) (d) Show that encoding (a, b, c) by {{a, b, c}, {a, b}, {a}} leads to difficulties. (You can find distinct triples with the same representation, or you can find an ordered pair that has the same representation as an ordered triple.) 12. Prove that for all X, P(X) ⊂ X. (Hint: Suppose that for some X, P(X) ⊂ X. Define Y = {t ∈ X | t /∈ t}. Show that Y ∈ X and shop for a contradiction.) 13. Let Z be the set provided by the infinity axiom. Let T be the set of subsets of Z that satisfy properties (i) and (ii) of the infinity axiom. Let Z0 = ∩T . (a) Prove that T exists. (Hint: T ⊂ P(Z).) 3.4 The Return of der K¨onig 301 (b) Prove that Z0 exists. (c) Prove that if X satisfies properties (i) and (ii) of the infinity axiom, then Z0 ⊂ X. 14. Use the regularity axiom to prove that for all x and y either x /∈ y or y /∈ x. 3.4 The Return of der K¨onig And Aragorn planted the new tree in the court by the fountain. — J. R. R. Tolkien, The Return of the King It may seem that the discussion of the last section strayed from our original topics in graph theory and combinatorics. However, AC is actually a statement about infinite systems of distinct representatives (SDR). As defined in Section 1.7.2, an SDR for a family of sets T is a set that contains a distinct element from each set in T . For disjoint families, we have the following theorem. Theorem 3.15. ZF proves that the following are equivalent: 1. AC. 2. If T is a family of disjoint nonempty sets, then there is a set Y that is an SDR for T . Proof. First, assume ZF and AC and suppose T is a family of disjoint nonempty sets. By AC, there is a set Y ⊂ ∪T that has exactly one element in common with each
element of T . Since the elements of T are disjoint, Y is an SDR for T . To prove the converse, suppose T is a family of disjoint nonempty sets. Let Y be an SDR for T . Then Y ⊂ ∪T , and Y has exactly one element in common with each element of T , as required by AC. What if T is not disjoint? For finite families of sets, it is sufficient to know that every union of k sets has at least k elements. This is still necessary for infinite families, but no longer sufficient. Consider the family of sets T = {X0, X1, X2, . . . } defined by X0 = {1, 2, 3, . . . }, X1 = {1}, X2 = {2}, and so on. The union of any k sets from T has at least k elements. As a matter of fact, any collection of k sets from T has an SDR. However, the whole of T has no SDR. To build an SDR for T , we must pick some n as a representative for X0. This immediately leaves us with no element to represent Xn. We are out of luck. Note that if we chuck X0, we can find an SDR for the remaining sets. (There are not many options for the representatives; it is hard to go wrong.) The infinite set X0 is the source of all our problems. If we allow only finite sets in the family, then we get a nice SDR existence theorem originally proved by Marshall Hall [145]. Theorem 3.16. Suppose T = {X0, X1, X2, . . . } is a family of finite sets. T has an SDR if and only if for every k ∈ N and every collection of k sets from T , the union of these sets contains at least k elements. 302 3. Infinite Combinatorics and Graphs Proof. Let T = {X0, X1, X2, . . . } and suppose that each Xi is finite. If T has an SDR, then for any collection of k sets, their representatives form a k element subset of their union. To prove the converse, assume that for every k ∈ N, the union of any k elements of T contains at least k elements. By Theorem 1.52, for each k the subfamily {X0, X1, . . . , Xk} has an SDR. Let Y be the tree whose paths are of the form r, x0, x1, . . . , xk, where xi ∈ Xi for i ≤ k and {x0, x1, . . . , xk} is an SDR for {X0, X1, . . . , Xk}. Since arbitrarily large finite subfamilies of T have SDRs, the tree Y is infinite. Furthermore, the size of the kth level of the tree Y is at most |X0| · |X1| · · · |Xk|, where |Xi| denotes the size of Xi. Since these sets are all finite, each level is finite. By K¨onig’s Lemma, Y has an infinite path, and that path is an SDR for T . In the preceding proof we made no immediately obvious use of AC. Here is a question: Have we actually avoided the use of AC, or did we merely disguise it? The answer is that we have used some of the strength of AC in a disguised form. There are two very natural ways to restrict AC. Recall that AC considers a family of sets. We can either restrict the size of the sets or restrict the size of the family. If we require that each set is finite, we get the following statement. Axiom of choice for finite sets (ACF): If T is a family of finite, nonempty, mutually disjoint sets, then ∪T contains at least one subset having exactly one element in common with each element of T . If we specify that the family can be enumerated, we get the following statement. (We say that an infinite set is countable if it can be written in the form {x0, x1, x2, . . . }.) Countable axiom of choice (CAC): If T = {X0, X1, X2, . . . } is a family of nonempty, mutually disjoint sets, then ∪T contains at least one subset having exactly one element in common with each element of T . Combining both restrictions gives us CACF, the countable axiom of choice for finite sets. The statement of CACF looks like CAC with the added hypothesis that each Xi is finite. This weak version of AC is exactly what we used in proving Theorem 3.16. Theorem 3.17. ZF proves that the following are equivalent: 1. K¨onig’s Lemma. 2. Theorem 3.16. 3. CACF. Proof. The proof of Theorem 3.16 shows 1 implies 2. The proofs that 2 implies 3 and 3 implies 1 are Exercises 1 and 2. 3.4 The Return of der K¨onig 303 The relationships between our various versions of choice are very interesting. It is easy to see that ZF proves AC→CAC, AC→ACF, CAC→CACF, and ACF→CACF. It is not at all obvious, but can be shown, that not a single one of the converses of these implications is provable in ZF, and also that CACF is not a theorem of ZF. To prove that ZF cannot prove these statements we would assume that ZF is consistent and build special models where each particular statement fails. The models are obtained by lifting results from permutation models or by forcing. Jech’s book The Axiom of Choice [167] is an excellent reference. Since ZF proves that K¨onig’s Lemma is equivalent to CACF and CACF is not a theorem of ZF, we know that K¨onig’s Lemma is not a theorem of ZF. Of course, ZFC can prove K¨onig’s Lemma, so it is perfectly reasonable to think of it as a theorem of mathematics. Also, ZF can prove some restrictions of K¨onig’s Lemma, for example if all the labels in the tree are natural numbers. Many applications of K¨onig’s Lemma can be carried out with a restricted version. Our proof closely ties K¨onig’s Lemma to countable families of sets. As we will see in the next section, not all families are countable. We will see bigger sets where the lemma fails, and still bigger sets where it holds again. This is not the last return of K¨onig. (K¨onig means “king” in German.) In the introduction to this chapter we noted that if P is finite, then whenever H is a proper subset of P there is no matching between P and H. A set X is called Dedekind finite if no proper subset of X can be matched with X. Thus, the introduction shows that if X is finite, then X is Dedekind finite. Exercise 4 shows that CAC implies the converse. Thus, in ZFC, the finite sets are exactly the Dedekind finite sets. This characterization of the finite sets requires use of a statement that is weaker than CAC, but not provable in ZF [167]. Exercises 1. Prove in ZF that Theorem 3.16 implies CACF. (Hint: Use disjointness to show that the union of any k sets contains at least k elements.) 2. Challenging exercise. Prove K¨onig’s Lemma using ZF and CACF. To do this, let S be the set of nodes in the tree that have infinitely many successors. Find an enumeration for S. (It is easy to slip up and use full AC when finding the enumeration.) For each s ∈ S, let Xs be the set of immediate successors of s that have infinitely many successors. Apply CACF to the family {Xs | x ∈ S}. Use the selected vertices to construct a path through the tree. 3. Disjointification trick. Suppose that {Xn | n ∈ N} is a family of sets. For each n ∈ N let X n = {(n, x) | x ∈ Xn}. Show that {X n | n ∈ N} exists and is a disjoint family of sets. 4. Use CAC to prove that every infinite set has a countable subset. (Hint: Suppose that W is infinite. For each k ∈ N let Wk be the set of all subsets of W of size k. Apply CAC to a disjointified version of the family {Wk | k ∈ N}. Show that the union of the selected elements is a countable subset of W .) 304 3. Infinite Combinatorics and Graphs 5. Assume that every infinite set has a countable subset. Prove that if X cannot be matched with any proper subset of itself, then X is finite. (Hint: Suppose X is infinite and use a countable subset of X to find a matching between X and a proper subset of X.) 3.5 Ordinals, Cardinals, and Many Pigeons Whenever Gutei Osh¯o was asked about Zen, he simply raised his finger. Once a visitor asked Gutei’s boy attendant, “What does your master teach?” The boy too raised his finger. Hearing of this, Gutei cut off the boy’s finger with a knife. The boy, screaming with pain, began to run away. Gutei called to him, and when he turned around, Gutei raised his finger. The boy suddenly became enlightened. — Mumon Ekai, The Gateless Gate The previous section contains some references to infinite sets of different sizes. To make sense of this we need to know what it means for sets to be the same size. We can illustrate two approaches by considering some familiar sets. Thanks to the gentleness of my religious training, I have the same number of fingers on my left and right hands. This can be verified in two ways. I can count the fingers on my left hand, count the fingers on my right hand, and check that the results match. Note that in the process of counting, I am matching fingers with elements of a canonical ordered set, probably {1, 2, 3, 4, 5}. By emphasizing the matching process, I can verify the equinumerousness of my fingers without using any canonical set middleman. To do this, I match left thumb with right thumb, left forefinger with right forefinger, and so on. When my pinkies match, I know that I have the same number of fingers on my left and right hands. One advantage of this technique is that it works without modification for people with six or more fingers on each hand. For infinite sets, either method works well. We will start by comparing sets directly, then study some canonical ordered sets, and finish the section off with some applications to pigeons and trees. 3.5.1 Cardinality The big one! — Connie Conehead Suppose we write X Y if there is a one-to-one function from X into Y , and X ∼ Y if there is a one-to-one function from X onto Y . Thus X ∼ Y means that there is a matching between X and Y . If X Y and X Y , so X can be embedded into but not onto Y , we will write X ≺ Y . With this notation, we can describe relative sizes of some infinite sets. 3.5 Ordinals, Cardinals, and Many Pigeons 305 First consider the sets N = {0, 1, 2, . . . } and Z = {. . . , −2, −1, 0, 1, 2, . . . }. Define the function f : N → Z by f (n) = (−1)n+1 2n + 1 4 + 1 4 . It is not hard to verify that if f (j) = f (k), then j = k, proving that f is a oneto-one function. Additionally, if m > 0, then f (2m − 1) = m, and if t ≤ 0, then f (−2t) = t, so f maps the odd natural numbers onto the positive integers and the even natural numbers onto the negative integers and 0. Thus, f witnesses that N ∼ Z, and we now know that N and Z are the same size. If X is a set satisfying N ∼ X, then we say that X is countable (or countably infinite if we are being very precise.)
We just prove that Z is countable. Not every infinite set is countable, as shown by the following theorem of Cantor. Theorem 3.18 (Cantor’s Theorem). For any set X, X ≺ P(X). In particular, N ≺ P(N). Proof. Define f : X → P(X) by setting f (t) = {t} for each t ∈ X. Since f is one-to-one, it witnesses that X P(X). It remains to show that X P(X). Suppose g : X → P(X) is any one-to-one function. We will show that g is not onto. Let y = {t ∈ X | t /∈ g(t)}. Suppose by way of contradiction that for some x ∈ X, g(x) = y. Because g(x) = y, x ∈ g(x) if and only if x ∈ y, and by the definition of y, x ∈ y if and only if x /∈ g(x). Concatenating, we get x ∈ g(x) if and only if x /∈ g(x), a clear contradiction. Thus y is not in the range of g, completing the proof. One consequence of Cantor’s Theorem is that any function from P(N) into N must not be one-to-one. More combinatorially stated, if we try to ram a pigeon for each element of P(N) into pigeonholes corresponding to the elements of N, some pigeonhole must contain at least two pigeons. Another consequence is that by sequentially applying Cantor’s Theorem to an infinite set, we get lots of infinite sets, including some very big ones. Corollary 3.19. There are infinitely many infinite sets of different sizes. Proof. N is infinite, and N ≺ P(N) ≺ P(P(N)) · · · by Cantor’s Theorem. Using only the definition of ∼ and chasing some functions, we can prove that ∼ is an equivalence relation. (See Exercise 2.) In particular, for any sets A, B, and C, we have • A ∼ A, • if A ∼ B then B ∼ A, and • if A ∼ B and B ∼ C, then A ∼ C. 306 3. Infinite Combinatorics and Graphs These are handy shortcuts, and it would be nice to have analogous statements for the relation. We can easily show that A A and that if A B and B C, then A C. (See Exercise 3.) Symmetry does not hold for the relation, but we can prove that if A B and B A then A ∼ B. This last statement is the Cantor–Bernstein Theorem, an incredibly handy shortcut for showing that sets are the same size. After discussing the proof and history of the theorem, we will look at some nice applications. Theorem 3.20 (Cantor–Bernstein Theorem). If both X Y and Y X, then X ∼ Y . Proof. Suppose f : A → B and g : B → A are one-to-one functions. We will sketch the construction of a function h : A → B that is one-to-one and onto. Define a set of subsets of A as follows. Let A0 = A, A1 = g(B), and An = g(f (An−2)) for n ≥ 2. In particular, writing g ◦ f (A) for g(f (A)), we have A0 = A, A1 = g(B), A2 = g ◦ f (A), A3 = g ◦ f ◦ g(B), A4 = g ◦ f ◦ g ◦ f (A), and A5 = g ◦ f ◦ g ◦ f ◦ g(B). Note that An is defined with n function applications. It goes “back and forth” n times. Using induction as described in Exercise 4a, it is fairly easy to prove the following claim. Claim 1: For all n, An ⊃ An+1. n = An − An+1 for each n. Also define the set ω = ∩n∈NAn. These sets form a partition of A into disjoint pieces, as claimed Given Claim 1, define the sets A A below. Hints for the proof of this claim appear in Exercise 4b. Claim 2: For every x ∈ A there is a unique n ∈ {ω, 0, 1, 2, . . . } such that x ∈ A n. Define the function h : A → B by the following formula: f (x) g−1(x) h(x) = if x ∈ ∪{A if x ∈ ∪{A ω, A 1, A 0, A 3, A 2, . . . }, 5, . . . }. By Claim 2, h(x) is well-defined and has all of A as its domain. It remains to show that h(x) is one-to-one and onto. This can be accomplished by defining B0 = B, and Bn+1 = f (An) for each n ≥ 0. Imitating our work with the An, in Exercise 4c we prove the following. 3.5 Ordinals, Cardinals, and Many Pigeons 307 Claim 3: For all n, Bn ⊇ Bn+1. Furthermore, if we define the prime sets B ω = ∩n∈NBn, then for every y ∈ B, there is a unique n ∈ {ω, 0, 1, 2, . . . } such that y ∈ B n. n = Bn − Bn+1 and B The partitions of A and B are closely related. In particular, Exercise 4d gives hints for proving the following claim. Claim 4: For each n ∈ N, h(A h(A ω) = B ω. 2n) = B 2n+1 and h(A 2n+1) = B 2n. Also, Since h matches the A pieces with the B pieces and is one-to-one and onto on these pieces, h is the desired one-to-one and onto function. One indication of the importance of the Cantor–Bernstein Theorem is the number of mathematicians who have produced proofs of it. The following is a partial listing. According to Levy [187], Dedekind proved the theorem in 1887. Writing in 1895, Cantor [47] described the theorem as an easy consequence of a version of the axiom of choice. In the endnotes of [49], Jourdain refers to an 1896 proof by Schr¨oder. Some texts, [209] for example, refer to the theorem as the Schr¨oder– Bernstein Theorem. Bernstein proved the theorem without using the axiom of choice in 1898; this proof appears in Borel’s book [32]. Additional later proofs were published by Peano [220], J. K¨onig [181], and Zermelo [292]. It is good to remember that the axioms for set theory were in flux during this period. These mathematicians were making sure that this very applicable theorem was supported by the axioms du jour. Now we will examine a pair of applications of the Cantor–Bernstein Theorem. Note that we are freed of the tedium of constructing onto maps. Corollary 3.21. N ∼ Z. Proof. Define f : N → Z by f (n) = n. Note that f is one-to-one, so N Z. Define g : Z → N by g(z) = 2z 2|z| + 1 if z ≥ 0, if z < 0. Note that g is one-to-one, so Z N. Applying the Cantor–Bernstein Theorem, N ∼ Z. Corollary 3.22. N ∼ N × N. Proof. The function f : N → N × N defined by f (n) = (0, n) is one-to-one, so N N×N. The function g : N×N → N defined by g(m, n) = 2m+1·3n+1 is also one-to-one, so N × N N. By the Cantor–Bernstein Theorem, N ∼ N × N. Corollary 3.23. P(N) ∼ R. Consequently, R is uncountable. 308 3. Infinite Combinatorics and Graphs Proof. First we will prove that P(N) R. Define f : P(N) → R by setting n∈X 10−n for each X ∈ P(N). As an example of how this map f (X) = works, if X consists of the odd natural numbers, then f (X) = 0.1010. If X and Y are distinct subsets of N, then they differ at some least natural number n, and f (X) and f (Y ) will differ in the nth decimal place. Thus, f is one-to-one, and so P(N) R. Now we must construct a one-to-one function g : R → P(N). Let r be a real number. If we avoid decimal expansions that terminate in an infinite sequence of 9’s, we can assume that r has a unique decimal expansion of the form (−1) ⎛ ⎝ i∈X1 ki10i + j∈X2 ⎞ dj10−j ⎠ , where ∈ {0, 1}, each ki and dj is between 1 and 9, X1 is a set of natural numbers, and X2 is a set of nonzero natural numbers. In this representation, (−1) dj 10−j is the ki10i is the integer portion of r, and is the sign of r, fractional portion of r. Define the function g by setting j∈X2 i∈X1 g(r) = {} ∪ {102i+1 + ki | i ∈ X1} ∪ {102j + dj | j ∈ X2} for each r ∈ R. As a concrete example of the behavior of this map, consider g(−12.305) = {1, 1001, 12, 103, 1000005}. Since different reals differ in some decimal place, g is one-to-one. By the Cantor–Bernstein Theorem, P(N) ∼ R. By Theorem 3.18, N ≺ P(N). Together with P(N) ∼ R, this implies that N ≺ R, so R is uncountable. Note that we did not construct a one-to-one function from P(N) onto R. The Cantor–Bernstein Theorem tells us that such a function must exist, so we are not obligated to construct it. (If you are not already convinced that existence theorems are tremendously convenient, try doing a direct construction for the preceding corollary. This is intentionally not listed in the exercises.) 3.5.2 Ordinals and Cardinals The aleph was heavy, like trying to carry a small engine block. — William Gibson, Mona Lisa Overdrive For Gibson, an aleph is a huge biochip of virtually infinite storage capacity. For a linguist, aleph is ℵ, the first letter of the Hebrew alphabet. For a set theorist, an aleph is a cardinal number. Saying that there are ℵ0 natural numbers is like saying that there are five fingers on my right hand. Alephs are special sorts of ordinals, and ordinals are special sorts of well-ordered sets. Suppose that X is set and ≤ is an ordering relation on X. We write x < y when x ≤ y and x = y. The relation ≤ is a linear ordering on X if the following properties hold for all x, y, and z in X. 3.5 Ordinals, Cardinals, and Many Pigeons 309 Antisymmetry: (x ≤ y ∧ y ≤ x) → x = y. Transitivity: x ≤ y → (y ≤ z → x ≤ z). Trichotomy. Familiar examples of linear orderings include N, Z, Q, and R with the typical orderings. We say that a linear ordering is a well-ordering if every nonempty subset has a least element. Since every subset of N has a least element, N is a well-ordering (using the usual ordering). Since the open interval (0, 1) has no least element, the usual ordering does not well-order R. An analyst would say that 0 is the greatest lower bound of (0, 1), but 0 is not the least element of (0, 1) because 0 /∈ (0, 1). The following theorem gives a handy characterization of wellordered sets. Theorem 3.24. Suppose X with ≤ is a linearly ordered set. X is well-ordered if and only if X contains no infinite descending sequences. Proof. We will prove the contrapositive version, that is, X is not well-ordered if and only if X contains an infinite descending sequence. First suppose X is not well-ordered. Then X has a nonempty subset Y with no least element. Pick an element x0 in Y . Since x0 is not the least element of Y , there is an element x1 in Y such that x0 > x1. Continuing in this fashion, we obtain x0 > x1 > x2 > · · · , an infinite descending sequence. To prove the converse, suppose X contains x0 > x1 > x2 > · · · , an infinite descending sequence. Then the set Y = {xi | i ∈ N} is a nonempty subset of X with no least element. Thus, X is not well-ordered. For any set X, the ∈ relation defines an ordering on X. To see this, for each x, y ∈ X, let x ≤∈ y if x ∈ y or x = y. In general, this is not a particularly pretty ordering. For example, if a = b then the set X = {a, b, {a, b}} is not linearly ordered by the ≤∈ relation. On the other hand, Y = {a, {a, b}, {a, {a, b}}} is well-ordered by the ≤∈ relation. In a moment, we will use
this property as part of the definition of an ordinal number. A set X is transitive if for all y ∈ X, if x ∈ y then x ∈ X. A transitive set that is well-ordered by ≤∈ is called an ordinal. The ordinals have some interesting properties. Theorem 3.25. Suppose X is a set of ordinals and α and β are ordinals. Then the following hold: 1. ∪X is an ordinal. 2. α ∪ {α} is an ordinal. 3. α ∈ β or α = β or β ∈ α. Proof. See Exercises 10, 13, 14, 15, and 16. 310 3. Infinite Combinatorics and Graphs The first two properties in the preceding theorem give good ways to build new ordinals from old ones. For example, a little vacuous reasoning shows that ∅ is an ordinal. By the theorem, the sets ∅ ∪ {∅} = {∅}, {∅} ∪ {{∅}} = {∅, {∅}}, and {∅, {∅}} ∪ {{∅, {∅}}} = {∅, {∅}, {∅, {∅}}} are all ordinals. Set theorists have special names for these finite ordinals. They write ∅ = 0, {∅} = {0} = 1, {∅, {∅}} = {0, 1} = 2, {∅, {∅}, {∅, {∅}}} = {0, 1, 2} = 3, and so on for all k ∈ N. Since each k is a set, we can define ω by ω = ∪k∈Nk, and use the first property in the theorem to see that ω is an ordinal. We do not have to stop here. Since ω is an ordinal, so is ω ∪ {ω} = {ω, 0, 1, 2, . . . }, and we start all over. Sometimes, texts write α + 1 for the ordinal α ∪ {α} and call ordinals like 1, 2, 3, and ω + 1 successor ordinals. Ordinals that are not successors are called limit ordinals. The set ω is a good example of a limit ordinal. Traditionally, greek letters are used to denote ordinals. Also, we usually write α ≤ β rather than α ≤∈ β. Consequently, for ordinals the formula α < β means the same thing as α ∈ β. Because ordinals are transitive, α ∈ β implies α ⊂ β, although the converse is not always true. There are three ways to think about ordinals and well-orderings. First, every ordinal is a well-ordered set under the ≤ relation. Second, the class of all ordinals is well-ordered by the ≤ relation. Third, every well-ordered set looks just like an ordinal. The next theorem is a precise expression of the way that ordinals act as canonical well-orderings. Theorem 3.26. Every nonempty well-ordered set is order isomorphic to an ordinal. That is, if X is well-ordered by ≤, then there is an ordinal α and a function h : X → α such that h is one-to-one and onto, and for all x and y in X, x ≤ y implies h(x) ≤ h(y). Proof. Let X be a well-ordered set. For each x ∈ X, define the initial segment for x by Ix = {t ∈ X | t ≤ x}. Let W be the subset of X consisting of all elements x such that Ix is order isomorphic to an ordinal. Note that for each x ∈ W , Ix is order isomorphic to a unique ordinal. By the replacement axiom, we can construct a set A of all the ordinals isomorphic to initial segments of X. Let α = ∪A; by Theorem 3.25, α is an ordinal. If x, y ∈ W , x ≤ y, γ and δ are ordinals, and hx and hy are order isomorphisms such that hx : Ix → γ and hy : Iy → δ, then for all t < x, hy(t) = hx(t). Using the replacement axiom, we can form the set of all the order isomorphisms corresponding to the initial segments, and concatenate them to build a new function h. This new function is an order isomorphism from W onto α. To complete the proof, we claim that W = X. Suppose not; since X is well-ordered, we can find a least t in X such that t /∈ W . If we extend h by setting h(t) = α, then h witnesses that It is order isomorphic to α + 1. Thus t ∈ W , yielding a contradiction and completing the proof. 3.5 Ordinals, Cardinals, and Many Pigeons 311 The next theorem shows that using AC we can well-order any set, widening the applicability of the preceding theorem. Our proof of the “well-ordering principle” uses ideas from Zermelo’s [291] original proof. The proof can also be viewed as a special case of Zorn’s Lemma. See Exercise 18 for more about Zorn’s Lemma. Theorem 3.27. Every set can be well-ordered. Proof. Let X be a set. We will construct a one-to-one map h : α → X from an ordinal α onto X. This suffices to prove the theorem, since the elements of α are well-ordered and h matches elements of α with elements of X. By AC we can pick x ∈ X − t for each nonempty t ⊂ X. There are two things to note here. First, xt is never an element of t. This is important later in the proof. Second, this is the only use of AC in this entire proof. This is handy for the exercises. Suppose that f : α → Y is a one-to-one map of an ordinal α onto a set Y ⊂ X. For each β < α, let f [β] denote {f (δ) | δ ∈ β}. (Remember, since β and α are ordinals, β < α is the same thing as β ∈ α.) We say that f is a γ-function if f (β) = xf [β] for every β ∈ α. Let Γ be the set of all γ-functions. The γ-functions cohere nicely; if f and g are γ-functions and β is in both of their domains, then f (β) = g(β). (See Exercise 17.) If we view the functions in Γ as sets of ordered pairs, ∪Γ is also a set of ordered pairs. Since the functions cohere and are one-toone, ∪Γ is actually a one-to-one function; call it h. By Theorem 3.25, the union of the ordinals that are domains of the functions in Γ is also an ordinal, so for some ordinal α, h : α → X. Furthermore, h is a γ-function. It gets better. Suppose that h does not map α onto X, so h[α] X. Then we can define an extension h by setting h(β) = h(β) for β < α and h(α) = xh[α]. This extension h is also a γ-function, so h ∈ Γ. Applying the definition of h, we find that h(α) is in the range of h. But h(α) = xh[α] and the range of h is h[α], so we have xh[α] ∈ h[α], contradicting the statement two paragraphs back. Summarizing, h is a one-to-one map of α onto X, so X is well-ordered. Combining the last two theorems yields the following corollary. Corollary 3.28. For every X there is a unique least ordinal α such that X ∼ α. Proof. Fix X. By Theorem 3.27, X can be well-ordered. By Theorem 3.26, X ∼ β for some ordinal β. Let A = {γ ≤ β | γ ∼ X} be the set of ordinals less than or equal to β that are equinumerous with X. Since A is a nonempty set of ordinals well-ordered by ≤, A contains a least element, α. Let δ be any ordinal such that X ∼ δ. By Theorem 3.25, δ < α or α ≤ δ. If δ < α, then δ ≤ β and we have δ ∈ A, contradicting the minimality of α. Thus α ≤ δ, and α is unique. Since every set has a unique least equinumerous ordinal, we can define |X| as the least ordinal α such that X ∼ α. We say that an ordinal κ is a cardinal number if |κ| = κ. In slogan form, a cardinal number is the least ordinal of its cardinality. The finite pigeonhole principle asserts that every finite ordinal is a cardinal. Thus, 0, 1, and 17324 are all cardinals. The infinite pigeonhole principle shows that ω 312 3. Infinite Combinatorics and Graphs cannot be mapped one-to-one into any finite cardinal, so ω is a cardinal number; indeed, it is the least infinite cardinal. On the other hand, ω+1 ∼ ω and ω+2 ∼ ω, so ω+1 and ω+2 are not cardinals. The elements of the next larger cardinal cannot be matched with the elements of ω, so the next larger cardinal is uncountable. Even though every cardinal number is an ordinal, we have special notation to distinguish the cardinals. When we are thinking of ω as a cardinal, we denote it with an aleph, so ω = ℵ0. The next larger (and consequently uncountable) cardinal is ℵ1. Proceeding in this way, and using unions at limit ordinals, we can define ℵα for every ordinal number α. For example, the least cardinal bigger than ℵ0, ℵ1, ℵ2, . . . is ℵω. Assuming AC, for every infinite set X, there is an ordinal α such that |X| = ℵα. The ordinals are like a long string of beads. The infinite cardinals, which are the alephs, appear like infrequent pearls along the string. The ordinals are good for counting steps in order (like rosary beads), and the cardinals are ideal for summing up sizes (like abacus beads). For finite sets, cardinals and ordinals are identical. Thus |{A, B, C, D}| = 4 = {0, 1, 2, 3} and {A, B, C, D} ∼ {0, 1, 2, 3}. In general, the matching approach to measuring the sizes of sets agrees with the cardinality approach. This is formalized in the following theorem. Theorem 3.29. For all sets X and Y , |X| = |Y | if and only if X ∼ Y . Proof. Suppose |X| = |Y | = κ. Then X ∼ κ and Y ∼ κ, so X ∼ Y . Conversely, suppose X ∼ Y , and let κ1 = |X| and κ2 = |Y |. Since κ1 ∼ X ∼ Y ∼ κ2, we have κ1 ∼ κ2. Since κ1 and κ2 are cardinals, κ1 ∼ κ2 implies κ1 = κ2. Thus |X| = |Y |. 3.5.3 Pigeons Finished Off Every Sunday you’ll see My sweetheart and me, As we poison the pigeons in the park. — Tom Lehrer At this point, we know quite a bit about stuffing pigeons into pigeonholes. For example, if p and h are both finite cardinal numbers, we have the following finite pigeonhole principle. • If we put p pigeons into h pigeonholes and h < p, then some pigeonhole contains at least two pigeons. The idea here is that any function from the set of larger cardinality into the set of smaller cardinality must fail to be one-to-one. By the Cantor–Bernstein Theorem, this holds for infinite cardinals as well. Thus for any cardinals κ and λ, we get the following analogue of the finite pigeonhole principle. • If we put κ pigeons into λ pigeonholes and λ < κ, then some pigeonhole contains at least two pigeons. 3.5 Ordinals, Cardinals, and Many Pigeons 313 The preceding infinite analogue of the finite pigeonhole principle is not the same as the infinite pigeonhole principle of Theorem 3.1. Here is a restatement of Theorem 3.1 using our notation for cardinals. • If we put ℵ0 pigeons into h pigeonholes and h < ℵ0, then some pigeonhole contains ℵ0 pigeons. The infinite pigeonhole principle says that some pigeonhole is infinitely crowded. This does not transfer directly to higher cardinalities. For example, we can put ℵω pigeons into ℵ0 pigeonholes is such a way that every pigeonhole has fewer than ℵω pigeons in it. To do this, put ℵ0 pigeons in the 0th hole, ℵ1 pigeons in the 1st hole, ℵ2 pigeons in the 2nd hole, and so on. The total number of pigeons is ℵω = ∪n∈ωℵn, but each hole contains ℵn pigeons for some n < ω. This peculiar behavior stems from the singular nature of ℵω. A cardinal κ is called singular
if there is a cardinal λ < κ and a function f : λ → κ such that ∪α<λf (α) = κ. (Remember, κ is transitive, so if f (α) ∈ κ, then f (α) ⊂ κ.) As an example, if we define f : ℵ0 → ℵω by f (n) = ℵn, then ∪α<ℵ0 f (α) = ℵω, showing that ℵω is singular. Any infinite cardinal number that is not singular is called regular. One good example of a regular cardinal is ℵ0; it is not equal to any finite union of finite cardinals. We can generalize the infinite pigeonhole principle for regular cardinals, but to prove the new result, we will need the following theorem. Theorem 3.30. For every infinite cardinal κ, |κ × κ| = κ. We will postpone the proof of Theorem 3.30 for a while and jump right to the avian corollary. Since this is the last pigeonhole principle in this book, we will call it ultimate. Of course our list of pigeonhole principles is not all inclusive. For example, more set theoretic pigeonhole principles are given in [72]. Corollary 3.31 (Ultimate Pigeonhole Principle). The following are equivalent: 1. κ is a regular cardinal. 2. If we put κ pigeons into λ < κ pigeonholes, then some pigeonhole must contain κ pigeons. Proof. First suppose that λ < κ and κ is regular. Suppose that g : κ → λ is an assignment of κ pigeons to λ pigeonholes. Define f (α) = |{x ∈ κ | g(x) = α}| for each α < λ, so f (α) is the population of the αth pigeonhole. Suppose, by way of contradiction, that f (α) < κ for each α. Because each f (α) is a cardinal, μ = ∪α<λf (α) is a cardinal. Furthermore, μ < κ because κ is regular. For each α, f (α) ≤ μ, so the population of the αth pigeonhole can be matched with a subset of μ. Since there are λ pigeonholes, the entire pigeon population can be matched with a subset of μ × λ, so κ ≤ |μ × λ|. Let ν = max{μ, λ}. Since μ ≤ ν and λ ≤ ν, |μ × λ| ≤ |ν × ν|. By Theorem 3.30, |ν × ν| = ν. Since μ < κ and λ < κ, we have ν < κ, and concatenating inequalities yields κ ≤ |μ × λ| ≤ |ν × ν| = ν < κ, 314 3. Infinite Combinatorics and Graphs a contradiction. Thus, for some α, f (α) = κ and the αth pigeonhole contains κ birds. To prove the converse, suppose that κ is a singular cardinal. Then there is a cardinal λ < κ and a function f : λ → κ such that ∪α<λf (α) = κ. Define g : κ → λ by letting g(β) be the least α such that β ∈ f (α). Since ∪α<λf (α) = κ and λ is well-ordered, g is well-defined and maps each element of κ to an element of λ. Furthermore, for each α < λ, |{β ∈ κ | g(β) = α}| ≤ |f (α)| < κ. Thus g can be viewed as an assignment of κ pigeons to λ pigeonholes so that the population of each pigeonhole is less than κ. The first part of the preceding proof can be adapted to prove that lots of cardinals are regular. This is a nice fact, since it means that we can apply the pigeonhole principle in lots of situations. Corollary 3.32. For each ordinal α, the cardinal ℵα+1 is regular. Proof. We will sketch the argument. Suppose f : λ → ℵα+1, where λ is any cardinal such that λ < ℵα+1. Then λ ≤ ℵα, and for each β < λ, |f (β)| ≤ ℵα. Applying Theorem 3.30 yields | ∪α<λ f (α)| ≤ |ℵα × ℵα| = ℵα < ℵα+1. We should list the regular cardinals we have found. ℵ0 is regular, and by the preceding corollary so are ℵ1(= ℵ0+1), ℵ2(= ℵ1+1), ℵ3, ℵ4, and so on. We have seen that the limit cardinal ℵω is singular; the subscript cannot be written as α+1, so this does not contradict Corollary 3.32. However, ℵω+1 is regular, as are ℵω+2, ℵω+3, and so on. Our only good example of a regular limit cardinal is ℵ0. We do not have an example of an uncountable regular limit cardinal. The reason for this is explained in Section 3.6. It seems that Theorem 3.30 is a handy way to bound the sizes of unions. Here is a nice way to capsulize that. Corollary 3.33. If κ is an infinite cardinal and |Xα| ≤ κ for each α < κ, then | ∪α<κ Xα| ≤ κ. In particular, a countable or finite union of at most countable sets is at most countable. Proof. Suppose |Xα| ≤ κ for each α < κ. For each α, let gα : Xα → κ be a oneto-one map. Define f : ∪α<κXα → κ × κ by f (x) = (α, gα(x)), where α is the least ordinal such that x ∈ Xα. The function f is one-to-one, so ∪α<κXα κ×κ. Thus by Theorem 3.30, | ∪α<κ Xα| ≤ |κ × κ| = κ. To prove the particular case, let κ = ℵ0. We have used Theorem 3.30 repeatedly, but still have not proved it. It is time to pay the piper. Proof of Theorem 3.30. We will use induction to prove that |κ × κ| = κ for every infinite cardinal κ. For the base case, apply Corollary 3.22 to get |ℵ0 × ℵ0| = ℵ0. 3.5 Ordinals, Cardinals, and Many Pigeons 315 As the induction hypothesis, assume |λ×λ| = λ for every infinite cardinal λ < κ. Since κ κ × κ, by the Cantor–Bernstein Theorem, it suffices to show that κ × κ κ. Define the ordering < on κ × κ as follows. Let (α, β), (α, β) ∈ κ × κ and let μ = max{α, β} and μ = max{α, β}. We say that (α, β) < (α, β) if and only if μ < μ, or μ = μ and α < α, or μ = μ and α = α and β < β. Informally, this relation sorts κ × κ by looking at maxima, then first elements, and then second elements. A routine but technical argument shows that < is a well-ordering of κ × κ. By Theorem 3.26, κ × κ under < is order isomorphic to some ordinal. Let δ denote that ordinal, and let f : κ × κ → δ be the order isomorphism. If δ ≤ κ, then κ × κ δ κ and the proof is complete. Suppose by way of contradiction that κ < δ. Since δ is an ordinal, we know that κ ∈ δ, so there is an element (σ, τ ) ∈ κ × κ such that f (σ, τ ) = κ. Let μ denote max{σ, τ } and note that σ < κ, τ < κ, and consequently μ < κ. Furthermore, by definition of the well-ordering on κ × κ, {(α, β) ∈ κ × κ | f (α, β) < κ} ⊂ μ × μ, so κ μ × μ and κ ≤ |μ × μ|. Let λ = |μ|. Since λ ∼ μ, we have |μ × μ| = |λ × λ|. Since μ < κ, λ is a cardinal less than κ, so by the induction hypothesis, |λ × λ| = λ < κ. Concatenating inequalities yields κ ≤ |μ × μ| = |λ × λ| < κ, a contradiction that completes the proof. Exercises 1. Define f : N → Z by f (n) = (−1)n+1( 1 4 )(2n + 1) + ( 1 4 ). (a) Show that f is one-to-one. (Assume f (j) = f (k) and prove j = k.) (b) Show that f is onto. (Show that if m > 0, then f (2m − 1) = m and if t ≤ 0 then f (−2t) = t.) 2. Prove that ∼ is an equivalence relation. That is, show that for all sets A, B and C, the following hold: (a) A ∼ A, (b) A ∼ B → B ∼ A, and (c) (A ∼ B ∧ B ∼ C) → A ∼ C. 3. Show that for all sets A, B, and C, the following hold: (a) A A (so is reflexive), and 316 3. Infinite Combinatorics and Graphs (b) (A B ∧ B C) → A C (so is transitive). 4. Details of the Cantor–Bernstein proof. This problem uses notation from the proof of Theorem 3.20. (a) Use induction to prove Claim 1. As a base case, show A0 ⊃ A1 ⊃ A2. For the induction step, assume An ⊃ An+1 ⊃ An+2 and show that An+2 ⊃ An+3, using the fact that An ⊃ An+1 implies g ◦ f (An) ⊃ g ◦ f (An+1). (b) Prove Claim 2. Use the fact that either x ∈ A such that x /∈ Aj to show that each x is in some A natural number or ω.) To prove that x is in a unique A x is in two such sets, and seek a contradiction. ω or there is a least j n. (Here n is a n, suppose that (c) Prove Claim 3. Use Claim 1 to get a short proof that Bn ⊃ Bn+1. The remainder of the argument parallels the proof of Claim 2. (d) Prove Claim 4. To show that h(A 2n+1, note that because f is one-to-one we have f (A2n) − f (A2n−1) = f (A2n − A2n−1), and so 2n) = B B 2n+1 = B2n+1−B2n = f (A2n)−f (A2n−1) = f (A 2n) = h(A 2n). The proof that B of h(A have that f (∩n∈ωAn) = ∩n∈ωf (An). 2n = h(A 2n+1) is similar. For the limit, the proof ω relies on the fact that since f is one-to-one, we must ω) = B 5. Let Q denote the set of rationals. Prove that Q ∼ N. 6. Let Seq denote the set of all finite sequences of natural numbers. Prove that Seq ∼ N. 7. Without using Theorem 3.24, prove that Z with the usual ordering is not well-ordered. 8. Using Theorem 3.24, prove that Z with the usual ordering is not well- ordered. 9. Repeat Exercises 7 and 8 for the set Q+ = Q ∩ [0, ∞) with the usual ordering. 10. Suppose that X is a transitive set. (a) Prove that X = X ∪ {X} is transitive. (b) Prove that ∪X is transitive. 11. Give an example of a nontransitive set where ≤∈ is a transitive relation. (Hint: The relation ≤∈ is vacuously transitive on every two-element set.) 12. Give an example of a transitive set where ≤∈ is not a transitive relation. (Hint: There is an example with three elements.) 3.5 Ordinals, Cardinals, and Many Pigeons 317 13. Prove that if α is an ordinal, then so is α = α ∪ {α}. (Hint: Exercise 10a shows that α is transitive. Use the fact that α is well-ordered by ≤∈ to show that α is too.) 14. Prove that if α and β are ordinals, then α ∩ β = α or α ∩ β = β. (Hint: Let C = α ∩ β and suppose that C = α and C = β. Let γ be the least element of α such that γ /∈ C. Show that γ = C, so C ∈ α. Similarly, C ∈ β, so C ∈ α ∩ β = C, contradicting Theorem 3.13.) 15. Prove that if X is a set of ordinals, then ∪X is an ordinal. (Hint: To show that ∪X is transitive, note that if x ∈ y ∈ ∪X, then for some ordinal z ∈ X we have y ∈ z. The fact that ≤∈ well-orders each element of X helps in proving antisymmetry and transitivity. Exercise 14 is useful in showing that trichotomy holds. Use the axiom of regularity to show that ∪X has no infinite descending sequences.) 16. Prove that if α and β are ordinals, then α ∈ β, α = β, or β ∈ α. 17. Details from the proof of Theorem 3.27. Let f : β1 → X and g : β2 → X be γ-functions as defined in the proof of Theorem 3.27. Prove that if β ∈ β1 ∩ β2, then f (β) = g(β). (If f and g disagree, then there is a least β such that f (β) = g(β). For this β, f [β] = g[β]. Apply the definition of a γ-function.) 18. Zorn’s Lemma and AC. Prove in ZF that the following are equivalent: 1. AC. 2. Zorn’s Lemma: Let P be a partial ordering (transitive and antisymmetric) such that every chain (linearly ordered subset) has an upper bound in P . Then P contains a maximal element (an element with no elements above it.) 3. Every set can be well-ordered. (a) Prove that 1 implies 2. (Hint: Emulate the proof of Theorem 3.27. Suppose P has no maximal elements. For each chai
n C, let xC be an upper bound of C that is not an element of C. Call C a γ-chain if for every p ∈ C, x{y∈C | y<p} = p. Use the union of the γ-chains to derive a contradiction.) (b) Prove that 2 implies 3. (Hint: Fix a set X to well-order. Let P be the set of all one-to-one maps from ordinals to subsets of X. P is partially ordered by function extension. Show that every chain has an upper bound. Show that a maximal element maps an ordinal one-toone onto X.) (c) Prove that 3 implies 1. 318 3. Infinite Combinatorics and Graphs 19. Describe a way to place ℵ0 pigeons in ℵ0 pigeonholes so that each pigeonhole contains at most one pigeon and ℵ0 of the pigeonholes are empty. (Hint: |Z| = |N| = ℵ0.) 20. Describe a way to place ℵ0 pigeons in ℵ0 pigeonholes so that each pigeon- hole contains ℵ0 pigeons. (Hint: |ℵ0 × ℵ0| = ℵ0.) 21. Describe a way to place ℵ0 pigeons in ℵ0 pigeonholes so that for each κ ≤ ℵ0 exactly one pigeonhole contains exactly κ pigeons. 22. Describe a way to place ℵ0 pigeons in ℵ0 pigeonholes so that for each κ ≤ ℵ0 exactly ℵ0 pigeonholes contain exactly κ pigeons. 23. Show that if we put κ pigeons into λ pigeonholes and κ < λ, then λ pigeonholes will remain empty. (Hint: The set of all pigeonholes is the union of the empty holes and the occupied holes.) 3.6 Incompleteness and Cardinals . . . we never assumed that (ZFC) included all the “true” facts. — Levy [187] In the last section we noted the absence of an example of an uncountable regular limit cardinal. We do not have an example because in ZFC we cannot prove that uncountable regular limit cardinals exist, assuming that ZFC is consistent. We have to assume that ZFC is consistent, because ZFC cannot prove that either. The last sentence is essentially G¨odel’s Second Incompleteness Theorem and the starting point for our exploration of large cardinals. 3.6.1 G¨odel’s Theorems for PA and ZFC G¨odel’s 1931 (paper) was undoubtably the most exciting and the most cited article in mathematical logic and foundations to appear in the first eighty years of the (twentieth) century. — Kleene [126] G¨odel’s First Incompleteness Theorem [124] is a statement about the provability of a formula in formal Peano Arithmetic (PA). In a nutshell, G¨odel’s first theorem says that if PA is ω-consistent, then there is a formula G such that PA does not prove G and PA does not prove ¬G. In order to make this clear, we should discuss PA, ω-consistency, and the formula G. The axioms of PA are an attempt to describe the important properties of the natural numbers under the operations of successor (adding one), addition, and multiplication. PA includes predicate calculus and axioms that say that • 0 is not the successor of any element, 3.6 Incompleteness and Cardinals 319 • x + 0 = x and x + (n + 1) = (x + n) + 1, • x · 0 = 0 and x · (n + 1) = x · n + x, and • the distributive laws hold. PA also includes an induction scheme that can be used to prove a wealth of facts about the natural numbers. At one point, it was thought that PA might be able to prove every true statement about N, but then G¨odel’s work ruled that possibility out. We say that a theory is consistent if there is no formula A such that the theory proves both A and ¬A. A theory that is inconsistent and includes predicate calculus can prove every formula. Thus a theory is consistent if and only if there is some formula the theory cannot prove. When we say PA is ω-consistent, we mean PA cannot prove both ∃xA(x) and every formula in the list ¬A(0), ¬A(1), ¬A(2), and so on. Assuming ω-consistency is very reasonable, but a little stronger than assuming regular old consistency. Rosser [242] devised a way to prove G¨odel’s first theorem assuming only the consistency of PA. His replacement for G¨odel’s sentence G is a slightly more complicated formula. Informally, G¨odel’s formula G says “there is no proof in PA of the formula G.” This is encoded in the language of arithmetic. Given our daily exposure to word processors and automated spelling and grammar checkers, we are used to the idea that formulas and lists of formulas (like proofs) can be represented as strings of zeros and ones, and that such strings can be viewed as integers and described by arithmetical formulas. It is very remarkable that G¨odel devised and utilized an encoding scheme in 1931, long before the advent of electronic computers. The method for making G refer to G is very entertaining. Let G0(x) be the formula that says “there is no number that encodes a proof in PA of the formula obtained by substituting the number x for the free variable in the formula encoded by the number x.” Suppose that n is the number that encodes G0(x). Note that the formula obtained by substituting n for the free variable in the formula encoded by n is exactly G0(n). Informally, G0(n) says “there is no number that encodes a proof in PA of G0(n).” Thus, G0(n) is the desired formula G. Once we have the encoding procedures in hand and have created the formula G, the remainder of the proof of G¨odel’s First Incompleteness Theorem is straightforward. Suppose that PA is ω-consistent. First, suppose that PA proves G. Then this proof is encoded by a number n and PA proves that “there is a number that encodes a proof in PA of G.” Thus, PA proves ¬G, contradicting the consistency of PA. Now suppose that PA proves ¬G. Then PA proves that “there is a number that encodes a proof of G.” By the ω-consistency of PA, we can find some number that actually does encode such a proof, and so PA proves G. Again, we have contradicted the consistency of PA. G¨odel’s Second Incompleteness Theorem [124] says that if PA is consistent, then there is no proof in PA that PA is consistent. Much of the machinery used for the first theorem applies here also. The formula that asserts that PA is consistent, Con PA, is an encoding of the sentence “there are no numbers x and y such that x 320 3. Infinite Combinatorics and Graphs encodes a proof in PA of a formula and y encodes a proof in PA of the negation of that formula.” It is possible to prove in PA that Con PA → G. Thus, if PA proved Con PA, then PA would prove G, and that contradicts G¨odel’s First Incompleteness Theorem. Perhaps the most remarkable quality of the incompleteness theorems is the ubiquity of their applicability. The theorems utilize only a few important features of PA and therefore apply to a wide variety of formal theories. In particular, the proofs of the theorems rely heavily on the ability to carry out a modest amount of arithmetic and the ability to check proofs in a mechanical fashion. Consequently, if a theory has enough axioms (to prove facts about encoding) but not too many axioms (so proof checking is not incomprehensibly complicated), then both incompleteness theorems apply. For example, both incompleteness theorems hold for ZFC. Thus, assuming that ZFC is consistent, there is a formula Z such that ZFC proves neither Z nor ¬Z, and ZFC does not prove Con ZFC. The incompleteness theorems also hold for ZF and for any extensions of ZF by a finite number of axioms. 3.6.2 Inaccessible Cardinals Better to reign in L, than serve in Heav’n. — Milton, Paradise Lost (slightly misquoted) If κ is an uncountable regular limit cardinal, then we say κ is weakly inaccessible. Our goal is to prove that the existence of weakly inaccessible cardinals is not provable in ZFC. At the end of this section we will link this back to our study of pigeonhole principles. The plan for achieving the goal is straightforward. The first step is to prove in ZFC that if there is a weakly inaccessible cardinal, then ZFC is consistent. Then we apply G¨odel’s Second Incompleteness Theorem and get the desired result. The first step requires a journey to L, the constructible universe. We will build the constructible universe in stages. Let L0 = ∅. If Lα is defined, let Lα+1 be the set of all subsets of Lα that are definable by restricted formulas with parameters from Lα. To be precise, a set X will be placed in Lα+1 if all of the following conditions hold. • X ⊂ Lα, • u1, u2, . . . , un ∈ Lα is a finite list of parameters, • ψ is a formula in the language of set theory, • ψ does not contain the power set or union symbols, • each quantifier in ψ is of the form ∃x ∈ Lα or ∀x ∈ Lα, and • X = {y ∈ Lα | ψ(y, u1, u2, . . . , un)}. 3.6 Incompleteness and Cardinals 321 If α is a limit ordinal, let Lα = ∪β<αLβ. This suffices to define Lα for each ordinal number α. Note that for each α, Lα is a set. The constructible universe, L, is the class defined by L = ∪Lα, where the union ranges over all ordinal numbers. Neither {Lα | α is an ordinal number} nor L itself are sets, but it is convenient to refer to them using set-theoretic notation. The finite levels of the constructible universe are simple in structure. For each k < ω, each Lk is finite and Lk+1 = P(Lk). By definition L0 = ∅, and so L1 = P(∅) = {∅} and L2 = P({∅}) = {∅, {∅}}. Rewriting with ordinal notation, L0 = 0, L1 = 1, and L2 = 2. At the next level, L3 breaks this pattern, since L3 = P(L2) = {0, 1, {1}, 2}, which is not an ordinal. Lω is defined by a union, so every element of Lω is an element of Lk for some k < ω. Beyond Lω, the sets become vastly more complicated very rapidly. If κ is weakly inaccessible, the Lκ is an abridged version of the entire universe. This is stated more formally in the following theorem. Theorem 3.34. If κ is weakly inaccessible, then Lκ is a model of ZFC. That is, if we restrict the quantifiers in the axioms to Lκ, then the axioms of ZFC all hold. Comments on the proof. For a detailed treatment, see [80] or [73]. We provide only a hint of some of the main issues in the proof. The basic idea is to verify that the axioms of ZFC hold in Vκ in much the same way that one would show that the axioms defining vector spaces hold in R3. Some axioms are very easy to manage. For example, ∅ ∈ L1, so the empty set axiom holds. If a and b are in Lα, then {a, b} is in Lα+1, so some instances of the pairing axiom are easy to verify. Ve
rification of the infinity axiom relies on κ being larger than ℵ0, since every set in Lℵ0 is finite. The verification of the power set axiom is particularly tricky and relies on the assumption that κ is a regular limit cardinal. Now we can finish our proof of the unprovability of the existence of a weakly inaccessible cardinal. The proof relies on the fact that any set of axioms with a model must be consistent. If M is any model for a set of axioms T , then every theorem that can be proved from T is true in M . (This is actually what makes proofs useful. If you prove a theorem from the axioms for vector spaces, then it has to be true in every vector space.) If T is inconsistent, then it proves a contradiction that would have to be true in M . But models are concrete (think of R3 as a model for the vector space axioms), so no contradiction can be true in a model. For a more technical discussion of models, truth, and provability, see [201]. Theorem 3.35. If ZFC is consistent, then ZFC does not prove the existence of a weakly inaccessible cardinal. Proof. Assume that ZFC is consistent. Suppose, by way of contradiction, that ZFC proves that there is a cardinal κ that is weakly inaccessible. Then ZFC proves that the set Lκ exists. By Theorem 3.34 we know that Lκ is a model of ZFC, so ZFC is consistent. Thus ZFC proves the consistency of ZFC, contradicting G¨odel’s Second Incompleteness Theorem and completing the proof. 322 3. Infinite Combinatorics and Graphs The unprovability of the existence of weakly inaccessible cardinals is not like the unprovability of AC in ZF. If we write I for the statement “there is a weakly inaccessible cardinal” and write ZFC " I for “ZFC proves I,” then the preceding theorem says that ZFC " I, provided that ZFC is consistent. To show that I is independent of ZFC (like AC is for ZF) we would also need to prove ZFC " ¬I assuming that ZFC is consistent. Thanks to G¨odel, we know that this is an unattainable goal. To see this, suppose (for an eventual contradiction) that from Con ZFC we can prove in ZFC that ZFC " ¬I. If ZFC " ¬I, then Con ZFC+I . Thus, our hypothesis boils down to ZFC " Con ZFC → Con ZFC+I . Since ZFC+I is an extension of ZFC, we have ZFC+I " Con ZFC → Con ZFC+I . Theorem 3.34 shows that ZFC+I " Con ZFC. Concatenating the last two lines, we obtain ZFC+I " Con ZFC+I , contradicting G¨odel’s Second Incompleteness Theorem for ZFC+I. Finally, we should summarize the combinatorial implications of this section. We know that if ZFC is consistent, then it cannot prove the existence of a weakly inaccessible cardinal. Also, κ is weakly inaccessible if and only if it is an uncountable regular limit cardinal. By the Ultimate Pigeonhole Principle, κ is regular if and only if whenever κ pigeons are placed in fewer than κ pigeonholes, then some hole contains κ pigeons. So a weakly inaccessible cardinal is an uncountable limit cardinal with this pigeonhole property. In Section 3.5 we proved that ℵ0 and ℵα+1 for each ordinal α have this pigeonhole property. In this section we have proved that we cannot prove the existence of any more cardinals with this property. 3.6.3 A Small Collage of Large Cardinals All for one . . . and more for me. — Cardinal Richelieu in The Three Musketeers A cardinal number is said to be large if there is no proof in ZFC of its existence. We just met our first large cardinal, the weakly inaccessible cardinal. There are many other large cardinals related to combinatorial principles. This section lists the ones we need for the next two sections. Recall that a weakly inaccessible cardinal is an uncountable regular limit cardinal. We say that a cardinal κ is a strong limit if for every λ < κ we have |P(λ)| < κ. An uncountable regular strong limit cardinal is called strongly inaccessible (or just inaccessible). Every strongly inaccessible cardinal is weakly inaccessible. If we assume the generalized continuum hypothesis (GCH), then every weakly inaccessible cardinal is also strongly inaccessible. (See Exercise 6.) The hypothesis GCH is independent of ZFC, and has inspired a great deal of interesting work [173]. We say that κ is weakly compact if κ is uncountable and κ → (κ)2 2. This arrow notation is the same used in Section 3.2, so κ → (κ)2 2 means that if we color the edges of a complete graph with κ vertices using two colors, then it must contain a monochromatic complete subgraph with κ vertices. These cardinals reappear in the next section. 3.6 Incompleteness and Cardinals 323 We will also look at some results concerning subtle cardinals, another type of large cardinal defined in terms of colorings of unordered n-tuples. Suppose that κ is a cardinal and let [κ]n denote the set of n-element subsets of κ. We say that a function S : [κ]n → P(κ) is an (n, κ)-sequence if for each element of [κ]n of the form α1 < α2 < · · · < αn < κ, we have S({α1, α2, . . . , αn}) ⊂ α1. A subset C ⊂ κ is closed if the limit of each sequence of elements in C is either κ or in C. The subset C ⊂ κ is unbounded if for each α ∈ κ, there is a β ∈ C such that α < β. We abbreviate closed and unbounded by writing club. The cardinal κ is n-subtle if for every (n, κ)-sequence S and every club set C ⊂ κ, there exist elements β1, β2, . . . , βn+1 ∈ C such that S(β1, β2, . . . , βn) = β1 ∩ S(β2, β3, . . . , βn+1). The basic idea is that given a coloring S and a large set C, the large set must contain some elements that are monochromatic. The n-subtle cardinals are closely related to n-ineffable cardinals. More information on both these types of cardinals can be found in [18], [19], [80], and especially [157]. One variation on coloring n-tuples for fixed values of n is to color n-tuples for all n ∈ ω simultaneously. Let [κ]<ω denote the set of all finite subsets of κ. We say κ is a Ramsey cardinal and write κ → (κ)<ω if for every function f : [κ]<ω → 2 there is a set X of size κ such that for each n, f is constant on [X]n. Note that the same X works for all n, though when j = k the j-tuples may not be the same color as the k-tuples. 2 One type of cardinal often mentioned in the literature is bigger than anything we have listed so far. We say that κ is a measurable cardinal if there is a κ-additive two-valued measure on κ. Roughly, this means that there is a way of assigning a value μ(X) to each X ⊂ κ so that μ acts a lot like the measures that appear in analysis. One way to organize all these cardinals is by comparing the sizes of the least example of each type of cardinal. Suppose we assign letters as follows: W : Least weakly inaccessible cardinal, I : Least strongly inaccessible cardinal, C : Least weakly compact cardinal, S1: Least 1-subtle cardinal, S2: Least 2-subtle cardinal, ... Sn: Least n-subtle cardinal, ... R : Least Ramsey cardinal, M : Least measurable cardinal. Then we have the following relationships: W ≤ I < C < S1 < S2 < · · · < Sn < · · · < R < M. 324 3. Infinite Combinatorics and Graphs The proofs of these relationships are frequently nontrivial. Good references include [80] and [168]. Exercises 1. For each k ∈ ω show that |Lk+1| = 2|Lk|. 2. Using Exercise 1, prove that Lω is countable. 3. Prove that for each ordinal α, Lα is transitive. (Hint: Lα is transitive if x ∈ y ∈ Lα implies x ∈ Lα. Use induction on the ordinals.) 4. Prove that if α < β, then Lα ⊂ Lβ. 5. Prove that if κ is a limit cardinal and x ∈ Lβ for some β < κ, then we also have ∪x ∈ Lκ. 6. The generalized continuum hypothesis (GCH) asserts that for every ordinal α, |P(ℵα)| = ℵα+1. Assuming GCH, prove that every limit cardinal is a strong limit cardinal. As a corollary, show that GCH implies that every weakly inaccessible cardinal is strongly inaccessible. 7. Construct a 2-coloring f of [ω]<ω such that f is constant on [ω]n for each n, but no pair has the same color as any triple. 3.7 Weakly Compact Cardinals Watch out for that tree! — George of the Jungle theme song Theorem 3.3 says that if we 2-color a complete graph G with ℵ0 vertices, then it must contain a monochromatic subgraph with ℵ0 vertices. In arrow notation, this is written as ℵ0 → (ℵ0)2 2, where the first ℵ0 is the size of G and the second ℵ0 is the size of the desired monochromatic subgraph. It would be nice to know what other cardinals κ satisfy κ → (κ)2 2. We call an uncountable cardinal with this property weakly compact. Judging from the next theorem, our list of weakly compact cardinals may be very short. Theorem 3.36. |R| → (ℵ1)2 2 and consequently, ℵ1 → (ℵ1)2 2. Proof. Let κ = |R| and let g : κ → R be a matching between the ordinals less than κ and the reals. Let G be a complete graph with κ vertices. We can think of each vertex of G as having two labels, an ordinal α < κ and a real number g(α). Color the edges of G using the scheme χ(αβ) = red blue if α < β ↔ g(α) < g(β), if α < β ↔ g(β) < g(α). 3.7 Weakly Compact Cardinals 325 Informally, χ colors the edge αβ red if the order on the ordinal labels agrees with the order on the real number labels, and colors the edge blue if the orders disagree. Suppose that S is a subgraph of G and |S| = ℵ1. We will show that S is not monochromatic. Since the ordinal labels for the vertices of S are a well-ordered subset of κ, we can list them in increasing order as αγ | γ < ℵ1. We consider two cases. First, suppose that S is red. Then the ordering on the real labels of the vertices of S agrees with the ordering on the ordinal labels. This gives us an uncountable well-ordered increasing sequence of reals, g(αγ) | γ < ℵ1. Using the fact that Q is dense in R, for each γ ∈ ℵ1, choose a rational qγ such that g(αγ) < qγ < g(αγ+1). Then qγ | γ < ℵ1 is an uncountable sequence of distinct rationals, contradicting the countability of Q. (See Exercise 5 in Section 3.5.) Thus, S is not red. Second, suppose that S is blue. This yields an uncountable decreasing sequence of reals. By choosing qγ such that g(αγ) > qγ > g(αγ+1) we obtain another contradiction in the same fashion as in the preceding case. Summarizing, S is neither red nor bl
ue. Thus G contains no monochromatic subgraph of size ℵ1. To prove the last statement in the theorem, we note that by Theorem 3.18 and Corollary 3.23, N ≺ R. Thus ℵ0 < |R|, and so |R| ≥ ℵ1. Since there is a way to color a graph with |R| vertices so that no ℵ1-sized monochromatic subgraphs exist, we can certainly do the same for a (possibly smaller) graph with a mere ℵ1 vertices. Summarizing, we know that ℵ0 → (ℵ0)2 ize Theorem 3.36 to show that ℵα+1 → (ℵα+1)2 cardinals from our hunt for weakly compact cardinals. Theorem 3.37. |P(ℵα)| → (ℵα+1)2 2. 2, but ℵ1 → (ℵ1)2 2. We can general2, eliminating all the successor Proof. Imitate the preceding proof using P(ℵα) in the role of R. To do this, prove and use the fact that when P(ℵα) is ordered by the relation X < Y if and only if min((X − Y ) ∪ (Y − X)) ∈ Y, it contains no increasing or decreasing sequences of size ℵα+1. At this point we know that any weakly compact cardinal must be an uncountable limit cardinal. In the following theorem, we emulate Erd˝os and Tarski [97] in showing that any weakly compact cardinal is inaccessible, and therefore large. Their studies of weakly compact cardinals were motivated by questions in infinite combinatorics stated in their 1943 paper [96]. Theorem 3.38. If κ is weakly compact, then κ is strongly inaccessible. Proof. Suppose that κ → (κ)2 limit cardinal. 2. We need to show that κ is regular and a strong 326 3. Infinite Combinatorics and Graphs First suppose that κ is not regular, so for some λ there is a function f : λ → κ such that ∪α<λf (α) = κ. We may assume that f is increasing. We will use f to construct a 2-coloring of a complete graph with κ vertices. For each α < β < κ, color the edge αβ using the scheme χ(αβ) = red blue if ∃γ(α < f (γ) ≤ β), otherwise. Informally, f chops κ into λ intervals. An edge is red if it connects two intervals. Thus, no red subgraph can be larger than size λ. Also, each interval chopped out by f is smaller than κ, so there is no blue subgraph of size κ. This contradicts κ → (κ)2 2, proving that no function like f exists and that κ is regular. 2. But ℵα+1 ≤ κ, so this implies that κ → (κ)2 Now suppose that ℵα < κ. If κ ≤ |P(ℵα)|, then by Theorem 3.37, κ → (ℵα+1)2 2, contradicting weak compactness. Thus, if ℵα < κ, then |P(ℵα)| < κ, proving that κ is a strong limit cardinal. We have seen that if κ is uncountable and κ → (κ)2 2, then κ is a large cardinal. By the results in Section 3.6, we know that ZFC cannot prove that such cardinals exist. Interestingly enough, increasing the number of colors (to any value less that κ) or increasing the size of the n-tuples (from 2 to any n < ω) does not lead to larger cardinals. That is, if λ < κ, n ∈ ω, and κ is weakly compact, then λ. (Details are left as exercises.) We could color n-tuples for all n ∈ ω, κ → (κ)n and look for a single set that is monochromatic for n-tuples for each n. This leads to the Ramsey cardinals mentioned in Section 3.6, which are considerably larger than the weakly compact cardinals. In Section 3.1 we saw a close relationship between Ramsey’s Theorem and K¨onig’s Lemma. This relationship reappears at higher cardinalities. We say that a cardinal κ has the tree property if whenever T is a tree with κ many nodes and every level of T has size less than κ, then T must have a path of size κ. K¨onig’s Lemma (Theorem 3.2) says that ℵ0 has the tree property. The next theorem shows the connection between weakly compact cardinals and cardinals with the tree property. Theorem 3.39. κ is weakly compact if and only if κ is strongly inaccessible and has the tree property. Pointers: Excellent proofs of this result can be found in the books of Drake (Theorems 3.5 and 3.7 in Chapter 7 of [80]), Jech (Lemma 29.6 in Chapter 5 of [168]), and Roitman (Theorem 36 in Chapter 7 of [241]). Theorem 3.39 does not characterize the smaller cardinals with the tree property. As we have already noted, ℵ0 has the tree property. However, ZFC proves that ℵ1 does not. There is a tree T such that |T | = ℵ1, the cardinality of each level of T is less than ℵ1, and T has no paths of size ℵ1. Such a tree is called an ℵ1Aronszajn tree, and stands as a counterexample to ℵ1 having the tree property. 3.8 Infinite Marriage Problems 327 The existence of an ℵ2-Aronszajn tree is deducible from GCH in ZFC. On the other hand, Silver has shown that from the existence of a weakly compact cardinal we can prove the consistency of ZFC and “ℵ2 has the tree property.” Mitchell and Silver have a number of other results pertaining to the tree property. Finally, using the ordered list of cardinals that appears in Section 3.6, if κ is the least strongly inaccessible cardinal, then κ is strictly less than the least weakly compact cardinal, so by Theorem 3.39, κ cannot have the tree property. Thus if κ is the least strongly inaccessible cardinal, then there is a κ-Aronszajn tree. Exercises 1. Prove that if κ → (κ)2 2. Prove that if κ → (κ)2 2, then κ → (κ)2 λ for every λ < κ. λ for each λ < κ, then κ → (κ)3 2. 3. Assuming GCH, show that if κ is the least weakly inaccessible cardinal, then there is a κ-Aronszajn tree. 4. Find a proof that there is an ℵ1-Aronszajn tree. (Hint: A library is a good place to look for proofs.) 3.8 Infinite Marriage Problems Infinite matching theory may seem rather mature and complete as it stands, but there are still fascinating unsolved problems. . . — Reinhard Diestel [75] We have considered the problem of matchmaking in the guise of graph matchings in Section 1.7, systems of distinct representatives in Section 1.7.2 and Section 3.4, and stable marriages in Section 2.9. Now we will study formulations of infinite marriage problems, expressed in some anthropocentric terminology. Suppose M is a set of men. For each man m ∈ M , let W (m) denote the women on his list of potential wives. For a set S ⊂ M , we will write W (S) = ∪m∈SW (m) for the combined lists of all the men in S. We will call the ordered pair (M, W ) a society. A society is espousable if there is a one-to-one function f : M → W (M ) such that for every m ∈ M we have f (m) ∈ W (m). We are requiring that f is an injection, so polygamy is disallowed. Every man must marry someone on his list, but some women may be left unmarried. Implicitly we assume that the collections of men and women are disjoint, so M ∩ W (M ) = ∅. Some readers may argue that this terminology is quaint or sexist. We use it in deference to earlier authors (e.g. [2]) and because it makes the concepts very concrete and clear. Technically any matching application could be substituted, such as callers and circuits, readers and books, or pigeons and single occupancy pigeon holes. Our goal is to determine exactly which societies are espousable. We can address certain situations by applying the theorems of various Halls. 328 3. Infinite Combinatorics and Graphs 3.8.1 Hall and Hall She made it perfectly plain that she was his . . . — Hall and Oates If we have some group of seven men whose combined lists contain only five women, we have no hope of finding a wife for every man. In general, given any society (M, W ) with a subpopulation S ⊂ M such that |S| > |W (S)|, we know that the society is not espousable. When M is finite, this condition is the only possible barrier to solving a marriage problem, as shown by the following theorem of Philip Hall [147]. (An alternate form of this theorem was published earlier by D. K¨onig [180].) Theorem 3.40. If (M, W ) is a society and |M | < ℵ0, then the following are equivalent: 1. For every S ⊂ M , |S| ≤ |W (S)|. 2. (M, W ) is espousable. Proof. Given a society (M, W ), construct the graph G consisting of a vertex for each person and an edge from each man to each women on his list. Thus the vertex set is M ∪ W (M ) and the set of edges is {(m, W (m)) | m ∈ M }. This graph is bipartite; separate the vertices by gender. If the cardinality condition in item 1 holds, then by Theorem 1.51 there is a matching of the men into the women, so (M, W ) is espousable. To prove the converse, suppose that (M, W ) is espousable and that f is the injection of M into W (M ) matching each man to his wife. Then for each S ⊂ M , f restricted to S is an injection of S into W (S), so by the definition of cardinality we must have |S| ≤ |W (S)|. The preceding theorem is usually viewed as a result about finite societies, but the only requirement is that the population of men is finite. The number of women could be anything (e.g. a woman for every real number) and the theorem still holds. Thus, as long as the number of men is finite, this theorem completely settles the question of which societies are espousable. If we allow an infinite number of men, problems may arise. By restricting ourselves to the case where each man has a finite list of women, we can use a theorem of Marshall Hall, Jr. [145] to settle the problem. Theorem 3.41. Suppose (M, W ) is a society and for every m ∈ M we have |W (m)| < ℵ0. Then the following are equivalent: 1. For every S ⊂ M , |S| ≤ |W (S)|. 2. (M, W ) is espousable. Proof. First, we will prove the theorem for countable sets of men using a result from a previous section. Given a society (M, W ) with |M | ≤ ℵ0, consider the family of sets defined by the formula T = {W (m) | m ∈ M }. Since |M | ≤ ℵ0, 3.8 Infinite Marriage Problems 329 we could index the members of T with natural numbers. Also, since each W (m) is finite, we have that T is a countable family of finite sets. By Theorem 3.16, T has a system of distinct representatives (SDR) if and only if the condition in item 1 holds. From the definition of an SDR, T has an SDR if and only if (M, W ) is espousable. Thus item 1 holds if and only if item 2 holds. Now we will prove the theorem for arbitrarily large sets of men. Our proof that item 1 implies item 2 will use the following compactness principle: “If T is a set of formulas and every finite subset of T has a model, then T has a model.” Just as in Section 3.6.2, if U is a model of T , then every object mentioned in formul
as of T will appear in U , and every formula of T will be true of the objects in U . Suppose that (M, W ) is a society satisfying item 1 in the theorem. For each m ∈ M , if W (m) = {w1, . . . , wn} is the set of women on m’s list, add the formula f (m) = w1 ∨ · · · ∨ f (m) = wn to T . For every pair m1, m2 ∈ M with m1 = m2, add the formula f (m1) = f (m2) to T . By the condition in item 1, every finite subset of T has a model. By the compactness principle, T has a model. Let f be the function in this model. Then f is a matching of the men into the women, as desired. The proof that item 2 implies item 1 is identical to that for Theorem 3.40. From the proof, it appears that Theorem 3.41 for countable M is just Theorem 3.16 with some of the terminology changed. Indeed, Theorem 3.41 for countable M could be added to the list of results in Theorem 3.17. Thus, in ZF we can prove that this marriage theorem for countable M is equivalent to K¨onig’s Lemma and also to the countable axiom of choice for finite sets (CACF). Even in axiom systems much weaker than ZF, a countable version of this marriage theorem can be shown to be equivalent to a weak version of K¨onig’s Lemma [162]. Hall’s [145] original proof of Theorem 3.41 for arbitrarily large sets of men uses Zorn’s Lemma, a statement equivalent to the full axiom of choice (AC). Our proof uses the compactness principle from logic, which is equivalent to the Prime Ideal Theorem (PIT). Since PIT is weaker than AC (see [167]), we can also conclude that working in ZF it is not possible to deduce AC from Theorem 3.41. It is not known whether or not PIT can be deduced from Theorem 3.41 in ZF. It may seem odd that we restrict the length of the lists of potential wives in Theorem 3.41. If some man has an infinite list, then he must not be very picky. On the surface, it seems like it should be easy to find him a wife. However, our intuition here is based on finite societies, and infinite societies (like infinite sets) are very peculiar. Consider the following situation. Let M = {m0, m1, . . . } be the men in our society and let Y = {w0, w1, . . . } be the women. Let W (m0) = Y and for j > 0, let W (mj) = {wj−1}. If S ⊂ M , then the structure of W (S) falls into two nice cases. If m0 ∈ S, then W (S) ⊃ W (m0) ⊃ Y , so W (S) = Y . If m0 /∈ S, then W (S) = {wj | mj+1 ∈ S}. In either case, |S| ≤ |W (S)|. Thus, the society (M, W ) satisfies item 1 in Theorem 3.41 and satisfies all the hypotheses of Theorem 3.41 except that |W (m0)| = ℵ0. However, this society is not espousable. By its construction, m1 must marry w0, m2 must marry w1, 330 3. Infinite Combinatorics and Graphs and so on. If m0 marries some wj, then mj+1 will be deprived of a wife. Thus, because m0 has an infinite list, item 1 of Theorem 3.41 is no longer sufficient to guarantee that the society is espousable. Exercises 1. Prove that if (M, W ) is any espousable society then for every S ⊂ M , |S| ≤ |W (S)|. (Hint: Since the society may have infinitely men or a man with an infinite list, neither Theorem 3.40 nor Theorem 3.41 applies directly. However, you could adapt part of a proof.) 2. Without using Theorem 3.17, prove in ZF that Theorem 3.41 for countable M implies CACF. 3. Without using Theorem 3.17, prove in ZF that Theorem 3.41 for countable M implies K¨onig’s Lemma. 4. Prove in ZF that Theorem 3.41 implies the axiom of choice for finite sets (ACF). 5. Consider the society containing men M = {m0, m1, . . . } and women Y = {w0, w1, . . . }, where W (m0) = Y and W (mj) = wj for j > 0. Is (M, W ) espousable? 6. Construct a society such that all the following hold: (a) W (m0) is infinite. (b) There are infinitely many women who are not on m0’s list. (c) For every finite S ⊂ M , |S| ≤ |W (S)|. (d) (M, W ) is not espousable. 7. Suppose (M, W ) is a society in which exactly one man has an infinite list and for all finite sets S ⊂ M , |S| < |W (S)|. (Note the strict inequality.) Is (M, W ) espousable? 3.8.2 Countably Many Men The squad may count off in a line or column formation. – Drill sergeant study guide In this subsection, we will examine four marriage theorems for the situation where the population of men is countable. We begin with the theorem of Damerell and Milner [66]. The statement of this theorem incorporates a margin function μω1, inspired by a conjecture of Nash-Williams [211]. Although the exact definition of μω1 is somewhat technical, the underlying notion is easy. Suppose (M, W ) is a society and let Y ⊂ W (M ) be some subset of the women. Build the set of all the men whose entire list lies within Y , so S = {m ∈ M | W (M ) ⊂ Y }. If Y 3.8 Infinite Marriage Problems 331 and S are finite, then |Y | − |S| indicates how many extra women Y contains. If |Y | − |S| is ever negative, then the society is not espousable. The margin function μω1 generalizes this notion of measuring the extra women in a set. We will define it precisely after we see how it is used in the following theorem of Damerell and Milner [66]. Theorem 3.42. If (M, W ) is a society and |M | ≤ ℵ0 then the following are equivalent: 1. For every Y ⊂ W (M ) we have μω1 (Y ) ≥ 0. 2. (M, W ) is espousable. In a moment, we will define μω1 and make some comments on the proof of the theorem. Before we do that, it is worth taking a minute to note how this theorem compares with those in the preceding and following subsections. First, in this theorem, each man may have any number of women on his list. This is a change from M. Hall’s Theorem 3.41 where each man was restricted to a finite number of women. On the other hand, Theorem 3.41 places no restriction on |M | and this theorem requires the set of men to be countable. This is not an idle restriction. In [66], Damerell and Milner provide an example of a society with an uncountable collection of men that satisfies item 1 of the theorem, but fails to be espousable. This example and a theorem for uncountable collections of men is given in Section 3.8.3. To clarify the statement of the theorem we must define μω1. To do this we need some ancillary definitions. Let (M, W ) be a society with |M | ≤ ℵ0. For a set Y ⊂ W (M ), a tower on Y is defined to be an infinite nested sequence of sets T = Tn | n < ω such that T0 ⊂ T1 ⊂ T2 ⊂ . . . and Y = ∪n<ωTn. Given a tower T on Y , let d(T ) be the number of men whose lists are subsets of Y but not subsets of any element in the tower. That is, d(T ) = |{m ∈ M | W (m) ⊂ Y ∧ ∀nW (m) ⊂ Tn}|. Let Z+ denote the extended integers, including the usual integers plus symbols for infinities, so Z+ = {. . . , −2, −1, 0, 1, 2, . . . } ∪ {−∞, ∞}. Now we can define μα for each ordinal α. In the case where α = 0, for Y ⊂ W (M ) define μ0(Y ) = |Y | − |{m ∈ M | W (m) ⊂ Y }| ∞ if |Y | < ℵ0 if |Y | ≥ ℵ0. The definition of the margin function for successor ordinals uses a special class of towers. Suppose that μα has been defined and that it maps subsets of W (M ) into Z+. For each Y ⊂ W (M ) let Aα(Y ) denote the collection of all towers T = Tn | n ∈ ω on Y satisfying both μα(T0) < ∞ and for all n < ω, μα(Tn) = μα(T0). Thus, Aα(Y ) consists of all towers on Y such that μα is constant and finite on the elements of the tower. 332 3. Infinite Combinatorics and Graphs With the formulation of Aα(Y ) in hand, we can complete the definition of the margin function. Suppose α = β + 1 and μβ and Aβ(Y ) have been defined. Then for each Y ⊂ W (M ) define μα by μα(Y ) = inf T ∈Aβ (Y )(μβ(T0) − d(T )) ∞ if Aβ(Y ) = ∅ if Aβ(Y ) = ∅. If α is a limit ordinal, and μβ is defined for all β < α, then define μα(Y ) = inf β<α μβ(Y ). In particular, μω1 (Y ) = inf β<ω1 μβ(Y ) where ω1 is the smallest uncountable ordinal. In light of the complexity of the construction of μω1 , it is not too surprising that the proof of Theorem 3.42 is beyond the scope of this book. However, we will make a few comments on the general structure of the proof and verify the theorem for a couple of societies. Theorem 3.42 states that a society with a countable number of men is espousable if and only if ∀Y ⊂ W (M ) μω1(Y ) ≥ 0. The proof that the society is espousable actually constructs the matching one man at a time. The condition on μω1 insures that the construction can proceed at each stage. The countability of M insures that the men can be counted off as m0, m1, m2, . . . so that the construction does not involve a limit stage. To prove the converse, the authors assume the existence of a matching and show that for each α < ω1 and each Y ⊂ W (M ) the inequality μα(Y ) ≥ 0 holds. This argument is carried out in a number of lemmas, largely proved by transfinite induction. These induction arguments have base cases, successor cases, and limit cases, mirroring the construction of μω1 . For full details, see [66]. As an aside, we should elaborate on this use of constructions and induction proofs indexed by ordinals. These proof techniques are referred to as transfinite recursion and transfinite induction. Both principles can be proved in ZFC. In the case of recursion, ZFC proves that given any formula θ(x, y) and any ordinal α, if for every x there is a unique y such that θ(x, y) holds, then there is a function f with domain dom(f ) = α such that for every β < α we have θ(f β, f (β)). (The notation f β denotes the function that is the same as f for inputs less than β and is undefined elsewhere. We call this the restriction of f to β.) For a proof of this transfinite recursion theorem, see [88]. In terms of the construction of our margin function, the transfinite recursion theorem asserts that there is a function f with domain ω1 + 1 such that for each α ≤ ω1, f (α) = μα. Thus, not only does μω1 exist, but a function encoding the entire construction of μω1 exists. The transfinite induction principle states that given an ordinal α and a formula θ(x), if both θ(0) and ∀β ≤ α((∀γ < β θ(γ)) → θ(β)), then ∀β ≤ α θ(β). Just as in regular induction, we can view θ(0) as a base case and the formula ∀β ≤ α((∀γ < β θ(γ)) → θ(β)) as an induction step. The proof of the induction step is often broken in
to cases where β is a successor ordinal and where β is a limit ordinal. Like the standard induction scheme, transfinite induction can be viewed 3.8 Infinite Marriage Problems 333 as a consequence of a least element principle. If θ(β) fails for some β ≤ α, then the set {β ≤ α | ¬θ(β)} exists. This set is well ordered, and thus has a least element β0. If β0 = 0 then the base case fails, while if β0 > 0 then the induction step fails. In this fashion, the existence of a least β0 proves the contrapositive of the transfinite induction priniciple. This concludes our aside on transfinite recursion and induction; we return to our discussion of Theorem 3.42. We will now verify Theorem 3.42 for two societies. We begin with the society from Subsection 3.8.1 that was not espousable. Example (M, W ). Let (M, W ) be the society in which M = {m0, m1, m2, . . . }, W (M ) = X = {w0, w1, w2, . . . }, W (m0) = X, and W (mj) = {wj−1} for each j > 0. As shown in Subsection 3.8.1, the society in Example (M, W ) is not espousable. Consequently, we should be able to find a set of women Y ⊂ W (M ) such that μω1 (Y ) < 0. To do this, we will need to calculate some values of μ0 and μ1, using the definitions following the statement of Theorem 3.42. If Y = {wi1 , . . . , wij } is a finite set of women, then the collection of all men m such that W (m) ⊂ Y is exactly {mi1+1, . . . , mij +1}. Because Y is finite and W (m0) is infinite, m0 is never included in such a list. Since μ0(Y ) is the cardinality of Y less the number of these men, μ0(Y ) = 0. On the other hand, if Y is infinite, then μ0(Y ) = ∞. Summarizing, μ0(Y ) = if |Y | < ℵ0 0 ∞ if |Y | ≥ ℵ0. Given μ0(Y ), we can calculate A0(Y ) for each set of women Y . When Y is finite, μ0 is constantly 0 on every subset of Y , so A0(Y ) will consist of all infinite nested sequences of subsets of Y that include Y . (Note that elements in the tower can be repeated.) If Y is infinite, A0(Y ) consists of all infinite nested sequences of finite subsets of Y that eventually contain every element of Y . With μ0 and A0(Y ) in hand, we are ready to calculate a value of μ1. Consider the tower T = Ti | i < ω defined by Ti = {wj | j ≤ i}. We know that T ∈ A0(W (M )). For each j > 0, W (mj) ⊂ Tj, so m0 is the only man satisfying both W (m0) ⊂ W (M ) and ∀nW (m0) ⊂ Tn. From the definition of d(T ), we have d(T ) = 1. Now μ1(W (M )) = (μ0(T 0) − d(T )) inf T ∈A0(W (M)) ≤ μ0(T0) − d(T ) = 0 − 1 = −1. 334 3. Infinite Combinatorics and Graphs Thus μ1(W (M )) < 0. It can be shown that whenever α < β, μβ(Y ) ≤ μα(Y ). (See the exercises.) Consequently, μω1(W (M )) ≤ μ1(W (M )) < 0, and the first item of Theorem 3.42 fails, verifying the theorem. To distinguish our next example from the work we have just completed, we will use boys and girls. Example (B, G). Let (B, G) be the society in which B = {b0, b1, b2, . . . }, G(B) = {g0, g1, g2, . . . }, G(b0) = {g0, g1}, and G(bj) = {gj} for each j > 0. It is easy to see that the map f (bi) = g(i) is a solution to this marriage problem. We should be able to show that μω1 (Y ) ≥ 0 for every possible set of girls Y . We begin by finding μ0(Y ). If we choose a finite set of girls Y that contains g0 but omits g1, then {m ∈ M | W (m) ⊂ Y } will consist of exactly those boys whose indices match the indices of the non-g0 girls of Y . In this case, g0 is “extra,” and μ0(Y ) = 1. For other finite Y , μ0(Y ) will always be 0. Summarizing, we have ⎧ ⎪⎨ μ0(Y ) = ⎪⎩ if |Y | < ℵ0 ∧ (g0 /∈ Y ∨ g1 ∈ Y ) if |Y | < ℵ0 ∧ g0 ∈ Y ∧ g1 /∈ Y 0 1 ∞ if |Y | ≥ ℵ0. Any sequence included in A0(Y ) must be an infinite nested sequence of finite subsets of Y whose union is Y . Additionally, to insure that for every n we have μ0(Tn) = μ0(T0), either we must have both g0 ∈ T0 and g1 /∈ Y , or we must have that g0 ∈ Tk implies g1 ∈ Tk for all k. In the first case μ(Tn) = 1 for all n, and in the second case μ(Tn) = 0 for all n. If W (m0) = {g0, g1} ⊂ Y , then W (m0) ⊂ Tn for some n. This implies that d(T ) = 0 for all T ∈ A0(Y ). Now we are ready to calculate μ1. If g0 ∈ Y and g1 /∈ Y , then μ0(T0) = 1 for all T ∈ A0(Y ). Since d(T ) = 0, we have μ1(Y ) = μ0(T0) − d(T ) = 1 in this case. On the other hand, if g0 /∈ Y or g1 ∈ Y then for every T ∈ A0(Y ), g0 ∈ Tk implies g1 ∈ Tk. In this case μ0(T0) = 0, yielding μ1(Y ) = μ0(T0) − d(T ) = 0 − 0 = 0. Summarizing, we have μ1(Y ) = 0 1 if g0 /∈ Y ∨ g1 ∈ Y if g0 ∈ Y ∧ g1 /∈ Y. We have shown that for all Y ⊂ G(B), μ1(Y ) ≥ 0. Furthermore, it is not too hard to see that for every Y , A0(Y ) = A1(Y ). Since d(T ) is always 0, it immediately follows that μ2(Y ) = μ1(Y ). An easy transfinite induction proves that μα(Y ) = μ1(Y ) for all α and Y . In particular, when α = ω1 we have μω1(Y ) = μ1(Y ) ≥ 0 for all Y , so the first item of Theorem 3.42 holds, verifying the theorem for this espousable society. 3.8 Infinite Marriage Problems 335 Of course, our two verifications do not constitute a valid proof, nor do they even provide a significant body of empirical evidence. However, they do reveal the structure of the margin functions, and the interaction between the margin functions and the matchings (or absence of matchings) in societies. After Damerell and Milner, other mathematicians devised necessary and sufficient conditions for the espousability of societies with countable sets of men. We will collect three statements of this sort below in Theorem 3.43. To unify their presentation, we will introduce the terminology of strings and admissibility as found in Wojciechowski [286]. The simplest form of admissibility is due to Podewski and Steffens [223]. The marriage problem (M, W ) is c-admissible if there is no subset J ⊂ M for which there is an element m ∈ M − J such that W (m) ⊂ W (J) and the society (J, W ) has a unique solution. Note that if such a J and m ∈ M − J exist, then the society (J ∪ {m}, W ) is not espousable. Thus a society is c-admissible if it avoids these egregiously solutionless subsocieties. The other two forms of admissibility use the following notion. A string in (M, W ) is a one-to-one function from an ordinal into M ∪ W (M ). We can have strings of men, strings of women, or mixed gender strings. A string f is saturated if no man precedes any woman on his list. That is, f is saturated if whenever f (β) = m, then W (m) ⊂ {f (α) | α < β}. Saturated strings are used in the definition of μ-admissibility introduced by Wojciechowski [286]. Define the function μ on strings f as follows. Suppose α is dom(f ) (the domain of f ). If α = 0, then let μ(f ) = 0. If α = β + 1, then define μ(f ) by μ(f ) = μ(f β) + 1 μ(f β) − 1 if f (β) ∈ W (M ) if f (β) ∈ M. If α is a limit, then define μ(f ) = lim inf β→α μ(fβ). We say that (M, W ) is μ-admissible if μ(f ) ≥ 0 for every saturated string of (M, W ). Informally, a saturated string is like a line of people. The margin function μ(f ) indicates how many spare women are in the line defined by f . If (M, W ) is μ-admissible, then the only way a line can have a negative number of spare women is if some man jumps in front of a woman on his list. Our third form of admissibility is due to Nash-Williams [212]. Suppose f is a string of women. Define q(f ) as follows. Suppose α = dom(f ). If α = 0, then define q(f ) = −|{m ∈ M | W (m) = ∅}|. In the following let ran(f ) denote the range of f and let f β denote the restriction of f to β. If α = β + 1, then define q(f ) = q(f β) − |{m ∈ M | W (m) ⊂ ran(f ) ∧ W (m) ⊂ ran(f β)}|. When α is a limit, define q(f ) = lim inf β→α q(f β)− |{m ∈ M | W (m) ⊂ ran(f ) ∧ ∀β < α W (m) ⊂ ran(f β)}|. 336 3. Infinite Combinatorics and Graphs We say that (M, W ) is q-admissible if q(f ) ≥ 0 for every string f of women. The construction of q parallels the definition of μω1, but substitutes strings for towers. This is Nash-Williams’ simplification of the concepts in Damerell and Milner’s work on his conjecture. With all this terminology, we can state Theorem 3.43, a sort of historical tour of marriage theorems for societies with countable populations of men. Theorem 3.43. If (M, W ) is a society and |M | ≤ ℵ0, then the following are equivalent: 1. (M, W ) is espousable. 2. (M, W ) is c-admissible. 3. (M, W ) is q-admissible. 4. (M, W ) is μ-admissible. Proofs of the equivalences above can be found in the papers of Podewski and Steffens [223] (for item 2), Nash-Williams [212] (for item 3), and Wojciechowski [286] (for item 4). Verifications of these marriage theorems for the previously analyzed examples are left as exercises. Exercises 1. Prove that for all Y , μα+1(Y ) ≤ μα(Y ). 2. Use transfinite induction to prove that for every pair of ordinals α and β, if α ≤ β then μβ(Y ) ≤ μα(Y ) for all Y . (Hint: Fix α, let β = α + γ and use induction on γ. Exercise 1 is the induction step.) 3. Prove directly that the society in Example (M, W ) is not c-admissible. 4. Prove directly that the society in Example (M, W ) is not q-admissible. 5. Prove directly that the society in Example (M, W ) is not μ-admissible. 6. Prove directly that the society in Example (B, G) is c-admissible. 7. Prove directly that the society in Example (B, G) is q-admissible. 8. Prove directly that the society in Example (B, G) is μ-admissible. 3.8.3 Uncountably Many Men If you can count the leaves of the trees, Or the foaming waves of the untamed seas, Then I will entrust to you alone To reckon the amours I have known. — Anacreontea, Ode 14 (translated by J. F. Davidson [67]) 3.8 Infinite Marriage Problems 337 The marriage theorems of the previous section allow each man an arbitrarily long list of prospective wives, but require that the set of men is countable. This is not an idle restriction. The theorems all fail for certain societies with uncountably many men. Consider the following example, taken from [66]. We use ω1 to denote the first uncountable ordinal and define the society (M, W ) by M = {mα | ω ≤ α < ω1}, W (M ) = {yα | α < ω1}, and ∀mα ∈ M W (mα) = {yβ | β < α}. Thus we have a man for every infinite ordinal less than ω1, a woman for every ordinal (infinite or finite
) less than ω1, and each man’s list consists of those women whose indices are strictly less than his own. Since mω is the man of lowest index (poor guy), he has the shortest list. Even he has an infinitely long list of potential wives. In fact, every man’s list contains exactly ℵ0 women. We will show that (M, W ) is not espousable. By way of contradiction, suppose that f : M → W (M ) is a one-to-one function. Beginning with any α such that ω ≤ α < ω1, build a sequence of men as follows. Start with mα. If f (mα) = yβ and β ≥ ω, add mβ to the left of mα. If f (mγ) = yα, add mγ to the right of mα. Since f maps men to women with smaller indices, we must have β < α < γ. Continue in this fashion, adding men to the right of the right end of the sequence and to the left of the left end of the sequence for as long as possible. Since the sequence to the left gives a descending sequence of ordinals, the sequence must have a left termination point. The only way for the sequence to terminate is if the last man is mapped to a woman with an index less than ω. Thus every sequence constructed in this fashion terminates on the left with a man married to some woman yk with k < ω. Because f is one-to-one, no two sequences can terminate with men married to the same woman, so each sequence terminates on the left with a man married to a unique woman yk with k < ω. This shows that there are countably many sequences. The sequence for any particular man mα could extend infinitely to the right. However, since there is no limit stage in the construction, the sequence to the right will have at most ℵ0 elements. Thus we have countably many sequences, each containing countably many men. Every man is in one of these sequences, so there are countably many men. However, we said that the set of men is M = {mα | ω ≤ α < ω1}, which is uncountable. This contradiction shows that the society (M, W ) is not espousable. If we could apply Theorem 3.43 here, then (M, W ) would not be c-admissible. However, (M, W ) is c-admissible, as the following argument shows. Suppose J ⊂ M is any subset of men such that the subsociety (J, W ) is espousable. Let f : J → W (J) be a one-to-one function espousing (J, W ). On the one hand, suppose that for some mα ∈ J, f (mα) = yβ and β + 1 < α. We can modify the solution f by setting f (mα) = yβ+1 and, if necessary, marrying the former husband of yβ+1 to yβ. In this case, f is not a unique solution to the marriage 338 3. Infinite Combinatorics and Graphs problem. On the other hand, if f (mα) = yβ always implies β + 1 ≥ α, then nobody is married to y0. Thus, we can modify f by marrying someone to y0. In either case, the solution of (J, W ) is not unique, so (M, W ) is c-admissible. Similar proofs could be used to show that (M, W ) is q-admissible, μ-admissible, and satisfies item 1 of Theorem 3.42. Thus none of the results of the previous section remain true when the hypothesis of the countability of M is removed from their statements. In [2] and [1], Aharoni, Nash-Williams, and Shelah present a marriage theorem that does allow uncountable populations of men. Unlike Theorem 3.41, there is no restriction on the lengths of the lists of the men. Thus the hypothesis for the statement is particularly brief. Here is the theorem. Theorem 3.44. Suppose (M, W ) is a society. The following are equivalent: 1. (M, W ) is espousable. 2. For every cardinal κ such that 0 < κ ≤ ℵ0 or κ is regular, there is no κ-obstruction in (M, W ). Since the proof of this theorem in [1] is twenty-five pages long, we will not replicate it here. However, to understand the statement of the theorem, we should unravel the definition of a κ-obstruction. This will require application of some of our knowledge of cardinal numbers. Item 2 above mentions finite cardinals, which are just natural numbers, and regular cardinals, which are defined in Section 3.5.3. Good examples of regular cardinals include ℵ0 and ℵ1. By contrast, ℵω is good example of a singular (i.e. not regular) cardinal. Every κ-obstruction turns out to be a subsociety of (M, W ), and some new notation will prove helpful. In this setting, it is easiest to identify (M, W ) with the bipartite graph with vertices in M and W (M ). Given some subset Δ of the vertices (people) in (M, W ), we can easily construct the subsociety (which we will also denote with Δ) corresponding to the subgraph of (M, W ) with vertices in Δ. We can also form (M, W ) − Δ, the society whose graph is the subgraph of (M, W ) on the vertices that do not appear in Δ. We say that Δ is a saturated subsociety of (M, W ) if whenever m ∈ Δ, W (m) ⊂ Δ. Our definition of κ-obstructions is a transfinite recursion with infinitely many base cases. Here are the base cases. Suppose that 0 < κ < ℵ0 or κ = ℵ0. We say that Δ is a κ-obstruction of (M, W ) if Δ is a saturated subsociety and there is a set L ⊂ M with |L| = κ such that Δ − L is espousable, but for every woman w ∈ Δ, the society Δ − (L ∪ {w}) is not espousable. Informally, if Δ is a κobstruction (for κ ≤ ℵ0), then L is a set of excess men preventing Δ from having an espousal. The requirement that Δ is saturated transfers the unespousability of Δ to the society (M, W ). Thus if (M, W ) has a κ-obstruction for κ ≤ ℵ0, then (M, W ) is not espousable. To define κ-obstructions for uncountable regular cardinals κ, we will need to review and introduce some set theoretic terminology. In Section 3.6.3 we said that a set C ⊂ κ is club (shorthand for closed and unbounded) if 3.8 Infinite Marriage Problems 339 • the limit of each sequence of elements in C is either κ or in C, and • ∀α ∈ κ ∃β ∈ C (α < β). We say that a set S ⊂ κ is stationary if for every club C ⊂ κ, we have S ∩ C = ∅. To use a topological metaphor, stationary sets meet every club set. Now we are ready for the inductive step in the definition of κ-obstructions of (M, W ). Suppose that κ is regular, and we have defined μ-obstructions for every μ < κ such that 0 < μ ≤ ℵ0 or μ is uncountable and regular. We say that a subsociety Δ of (M, W ) is a κ-obstruction of (M, W ) if there is a transfinite sequence Δαα<κ of disjoint subsocieties such that • Δ = ∪α<κΔα, • for each α < κ, either Δα is a single woman, or for some β < κ, the subsociety Δα is a β-obstruction in (M, W ) − ∪θ<αΔθ, and • the set of α < κ for which Δα is not a single woman is stationary. This completes the definition of κ-obstructions for all those cardinals κ such that 0 < κ ≤ ℵ0 or κ is regular. At the beginning of this section we showed that the society (M, W ) that has M = {mα | ω ≤ α < ω1} and W (mα) = {yβ | β < α} for all infinite α < ω1 is not espousable. In light of Theorem 3.44, this society must have a κ-obstruction for some κ that either satisfies 0 < κ ≤ ℵ0 or is a regular cardinal. In fact, we can find an ℵ1-obstruction for (M, W ). We define the ℵ1-obstruction for (M, W ) by applying transfinite recursion. Let Δ0 = {y0}. For each successor ordinal α + 1 < ℵ1, let Δα+1 = {yα+1}. Finally, if λ < ℵ1 is a limit ordinal, let Δλ = {mλ, mλ+1, yλ}. This defines a sequence Δαα<ℵ1 of disjoint subsocieties of (M, W ). Let Δ = ∪α<ℵ1 Δα. We must use the definition of a κ-obstruction to prove that Δ is an ℵ1-obstruction. For each α < ℵ1, either the subsociety Δα is a single woman or α is a limit. If α is a limit, then Δα = {mα, mα+1, yα}. Since yα is the only woman in (M, W ) − ∪θ<αΔθ with an index less than α + 1, Δα is a saturated subsociety of (M, W ) − ∪θ<αΔθ. Furthermore, the subsociety Δα − {mα} is espousable, but Δα − {mα, yα} is not. Thus if α is a limit, then Δα is a 1-obstruction of (M, W ) − ∪θ<αΔθ. Finally, the set of α < ℵ1 such that Δα is not a single woman is exactly the set S = {λ < ℵ1 | λ is a limit}, which is stationary. (This is an exercise.) This completes the verification that Δ is an ℵ1-obstruction of (M, W ). If we think of a society as a bipartite graph, then every κ-obstruction is a subgraph of the society. With this viewpoint, Theorem 3.44 states that the graph for a society has a matching of the men into the women if and only if it contains no subgraphs of a particular form. Thus, Theorem 3.44 is a “forbidden subgraph” characterization of all the espousable societies. 340 3. Infinite Combinatorics and Graphs Exercises 1. Prove that if κ is an uncountable regular cardinal, then the set of ordinals {λ < κ | λ is a limit} is stationary. 2. Prove that if a society (M, W ) has an ℵ0-obstruction, then it also has a 1-obstruction. 3. Suppose that (M, W ) is the society with M = {mα | α < ω}, W (mα+1) = {wα} for each α < ω, and W (m0) = {wα | α < ω}. Complete the following. (a) Find a 1-obstruction for (M, W ). (b) Prove that (M, W ) has no 2-obstructions. 4. Suppose that (M, W ) is the society with M = {mα | ω ≤ α < ω1}, W (M ) = {yα | α < ω1}, and ∀mα ∈ M W (mα) = {yβ | β < α}. Complete the following. (a) Prove that (M, W ) has no 1-obstruction. (b) Prove that (M, W ) has no ℵ0-obstruction. (Hint: You could do and apply Exercise 2.) (c) Prove that (M, W ) is μ-admissible. (d) If you survived part 4c, then prove that (M, W ) is p-admissible. 3.8.4 Espousable Cardinals It is easy to deduce from this that weakly compact cardinals are very large. . . — E. C. Milner [206] For the past two sections we have been modifying our marriage theorems in order to make them hold for larger and larger cardinals. This process has been pretty successful, resulting in Theorem 3.44 that can handle arbitrarily large societies. However, the statement of Theorem 3.44 is substantially more complicated than that of Marshall Hall Jr.’s Theorem 3.41. An alternative approach is to concoct a natural simple generalization of Theorem 3.41 and ask which cardinals satisfy it. This is the motivation for the following definition. 3.8 Infinite Marriage Problems 341 Definition. An infinite cardinal κ is espousable if every society (M, W ) that satisfies the following criteria is espousable. 1. |M | = κ, 2. ∀m ∈ M |W (m)| < κ, and 3. if M0 ⊂ M and |M0| < κ, then (M0, W ) is espousable. Informally, “κ is espousa
ble” means that a result very like Theorem 3.41 holds for all societies of size κ. There is some variation from the theorem. The third clause requires espousability of all small subsocieties where Theorem 3.41 just specifies that there is a sufficiently large number of women. This modification is necessary, since the unespousable uncountable society from the beginning of Section 3.8.3 satisfies the cardinality requirements from Theorem 3.41 and could be embedded in any uncountable society. From Theorem 3.41, we know that ℵ0 is espousable. The unespousable and uncountable society from the beginning of Section 3.8.3 shows that ℵ1 is not espousable. (You may wish to check the details of these claims as exercises.) Thus the espousable cardinals form a proper subclass of the class of all cardinals. The following two theorems of Shelah [252] give additional properties of espousable cardinals. Theorem 3.45. If κ is an uncountable espousable cardinal, then κ is a limit cardinal. Proof. It is easiest to show that if κ is an uncountable successor cardinal, then κ is not espousable. We will show that a particular uncountable successor cardinal, ℵ2, is not espousable, and leave the generalization of the argument as an exercise. Our goal is to show that ℵ2 is not espousable. We modify the example from the beginning of Section 3.8.3 as follows. Let M = {mα | ℵ1 ≤ α < ℵ2}, W (M ) = {yα | α < ℵ2}, and for each mα ∈ M , W (mα) = {yβ | β < α}. We must verify that (M, W ) satisfies all the criteria in the definition of espousable cardinal. The cardinality of M is ℵ2 and for each man mα, |W (mα)| = ℵ1 < ℵ2. Furthermore, if M0 ⊂ M and |M0| < ℵ2, then |M0| = ℵ1, so any bijection between M0 and {yα | α < ℵ1} is an espousal of the subsociety (M0, W ). Summarizing, (M, W ) satisfies all the criteria listed in the definition of espousable cardinals. However, the argument on page 337 can be adapted to show that (M, W ) is not espousable. Thus ℵ2 is not an espousable cardinal. Generalization of this argument to other successor cardinals is left as an exercise. Theorem 3.46. If κ is an uncountable espousable cardinal, then κ is regular. 342 3. Infinite Combinatorics and Graphs Proof. As in the preceding theorem’s proof, it is easiest to show that if κ is both uncountable and not regular then κ is not espousable. Again, we will prove the theorem for a particular case and leave the generalization as an exercise. Suppose that κ is ℵω. We know that ℵω is not regular because ∪α<ωℵα = ℵω. We will show that ℵω is not espousable by gluing together versions of the society from the end of Section 3.8.1. Let (M, W ) be the society defined by: M = {p} ∪ {mα | α < ℵω}, W (M ) = {wα | α < ℵω}, W (mα) = {wα} if α /∈ {ℵn | n ∈ ω}, W (mℵn ) = {wβ | ℵn ≤ β < ℵn+1}, and W (p) = {wℵn | n ∈ ω}. It is easy to verify that (M, W ) satisfies the first two criteria in the definition of an espousable cardinal. Suppose that M0 ⊂ M and |M0| < ℵω. If p /∈ M0 then matching each man to the woman with his index yields an espousal. If p ∈ M0, we must work a little harder. Find the least j with M0 ⊃ {mα | ℵj ≤ α < ℵj+1}, and let α0 be some ordinal in [ℵj, ℵj+1) such that mα0 /∈ M0. If we let f (p) = wℵj , f (mℵj ) = wα0 , and f (mβ) = wβ for all other β ∈ M0, then F is an espousal of the subsociety for M0. If ℵω was espousable, then (M, W ) would have an espousal. However, any assignment of a wife to man p leads to a contradiction. Thus ℵω is not an espousable cardinal. To generalize this argument to other nonregular cardinals, just replace ℵ0, ℵ1, . . . with any cofinal sequence witnessing that the cardinal under consideration is singular. On the basis of the preceding two theorems, we know that if κ is an uncountable espousable cardinal, then κ is an uncountable regular limit cardinal, and so κ is weakly inaccessible. Applying Theorem 3.35, ZFC cannot prove the existence of an uncountable espousable cardinal. However, the following theorem shows that espousable cardinals are not too high in our hierarchy of large cardinals. (Weakly compact cardinals are very large, but not too large.) Theorem 3.47. Every weakly compact cardinal is espousable. Sketch of proof. Suppose that κ is weakly compact and (M, W ) is a society that satisfies the criteria in the definition of espousable cardinals. Without any loss of generality, let M = {mα | α < κ}. Build a tree of height κ in which the nodes at level α of T are labeled with the names of women in W (mα), and each path through the tree is an initial segment of an espousal of (M, W ). Since κ is weakly compact, it is a regular strong limit cardinal. This can be used to prove that each level of T has size less than κ. Applying Theorem 3.39, use the tree property for κ to find a path through T of length κ. This path is the desired espousal of (M, W ). 3.8 Infinite Marriage Problems 343 We now have both upper and lower bounds on the size of the least uncountable espousable cardinal, but there are some obvious questions. Is every uncountable espousable cardinal a strong limit cardinal? Does every uncountable espousable cardinal have the tree property? Is every uncountable cardinal with the tree property espousable? At this writing, these questions appear to be open. Exercises 1. Show that ℵ0 is espousable. 2. Show that ℵ1 is not espousable. 3. Complete the proof of Theorem 3.45 by generalizing the argument to other successor cardinals. 4. Complete the proof of Theorem 3.46 by generalizing the argument to other singular cardinals. 5. Fill in the details of the proof of Theorem 3.47. 3.8.5 Perfect Matchings I actually found someone for me. — Whitney Houston A society is called symmetrically espousable if it has an espousal that maps the men onto the women. What a difference one word makes! Requiring the espousal to be onto insures that every person in the society will have a spouse, without regard to their gender. If we view societies as bipartite graphs, an onto espousal gives a perfect matching between the two sets of vertices. A bit more notation makes it easy to formulate symmetric marriage theorems. A symmetric society is a quadruple (M, W, W , M ) such that (M, W ) is a society consisting of the men and their lists, (W , M ) is a society consisting of the women and their lists, and the lists match appropriately. More precisely, we require that a woman is on a man’s list if and only if he is on her list, so w ∈ W (m) if and only if m ∈ M (w). We can now formulate and prove a symmetric version of Theorem 3.41. Theorem 3.48. Suppose (M, W, W , M ) is a symmetric society in which each person has a finite list. More formally, for every m ∈ M and w ∈ W , we have |W (m)| < ℵ0 and |M (w)| < ℵ0. Then the following are equivalent: 1. For every S ⊂ M , |S| ≤ |W (S)| and for every T ⊂ W , |T | ≤ |M (T )|. 2. (M, W, W , M ) is symmetrically espousable. Proof. To prove item 2 implies item 1, it suffices to note that if (M, W, W , M ) is symmetrically espousable, then (M, W ) and (W , M ) are espousable. Applying Theorem 3.41 twice yields item 1. 344 3. Infinite Combinatorics and Graphs To prove the converse assuming item 1, Theorem 3.41 says that the societies (M, W ) and (W , M ) have espousals. Thus we have one-to-one functions from the men into the women and from the women into the men. The statement of the Cantor–Bernstein Theorem (Theorem 3.20) says that we must have a bijection between the men and the women. This does not quite finish the proof, since an arbitrary bijection might not map a person to someone on their list. However, the proof of Theorem 3.20 shows that this bijection can be constructed using only values from the initial injections. In our setting, suppose f : M → W is an espousal of the men, g : W → M is an espousal of the women, and h : M → W is the bijection constructed as in the proof of Theorem 3.20. Then h(m) = w implies that either f (m) = w or g(w) = m. Thus, either w is on m’s list or m is on w’s list. By the symmetry of the society, each must be on the other’s list. Thus h is a one-to-one and onto map between the men and the women that matches each person with someone on their list. The preceding theorem and proof can be adapted to formulate and prove new symmetric versions of all of our marriage theorems. We leave these results as exercises. Exercises 1. Formulate and prove a symmetric version of the finite marriage theorem, Theorem 3.40. 2. Formulate and prove a symmetric version of the theorem of Damerell and Milner, Theorem 3.42. 3. Formulate and prove a symmetric version of the countable omnibus mar- riage theorem, Theorem 3.43. 4. Formulate and prove a symmetric version of the uncountable marriage the- orem, Theorem 3.44. 5. Define symmetrically espousable cardinals. Using your definition, is there a cardinal that is espousable but not symmetrically espousable? 3.9 Finite Combinatorics with Infinite Consequences Does mathematics need new axioms? — Solomon Feferman [104] In this section we will discuss a remarkable result due to H. Friedman [113]. Friedman has concocted a finite combinatorial statement that he calls Proposition B. Under the appropriate consistency assumptions, he shows the following: 3.9 Finite Combinatorics with Infinite Consequences 345 1. For each k ∈ ω, the axiom system consisting of ZFC plus “there is a k- subtle cardinal” cannot prove Proposition B. 2. The axiom system consisting of ZFC plus “for every k ∈ ω there is a k- subtle cardinal” can prove Proposition B. Thus, the use of large cardinals is required in the proof of the finite combinatorial statement of Proposition B. Proposition B is not simple, but it can be understood with a modest effort. We will start with the full statement, and then gradually define any mysterious terminology. Proposition B. For every k > 0 and p > 0, there is an integer n such that if {fX | X ⊂ [n]k} is any #-decreasing function assignment for [n]k, then we can find sets A and E satisfying • E is subset of {0, 1, 2, . . . , n} with p elements, • [E]k ⊂ A ⊂ [n]k, and • fA has no more than
kk regressive values on [E]k. In the statement of the proposition, p, n, and k represent natural numbers. Here, the notation [n]k denotes the set of all ordered k-tuples with coordinates in {0, 1, 2, . . . , n − 1}. If x is a k-tuple, then |x| is the maximum coordinate of x and min(x) is the minimum coordinate. For example, if x = (1, 3, 0), then |x| = 3 and min(x) = 0. If f is a function mapping k-tuples to k-tuples, we say that y is a regressive value for f on [E]k if for some x ∈ [E]k, y = f (x) and |y| < min(x). For example, if f (7, 6, 5) = (1, 3, 2), then (1, 3, 2) is a regressive value for f because 3 < 5. A single regressive value may have many witnesses. The function g : [8]3 → [8]3 defined by g(x, y, z) = (0, 0, 0) for all 0 ≤ x, y, z < 8 has only one regressive value, namely (0, 0, 0). A function assignment on [n]k assigns one function to each nonempty subset X ⊂ [n]k. The function assigned to X is required to map X to X, so we always have fX : X → X. We say that the function assignment {fX | X ⊂ [n]k} is #-decreasing if whenever A ⊂ [n]k and x ∈ [n]k, either • fA∪{x} and fA agree on all elements of A, or • there is a y such that |y| > |x| and |fA(y)| > |fA∪{x}(y)|. Some sense of the nature of #-decreasing function assignments can be gained from looking at a very small example. Suppose we set k = 1 and consider the possible function assignments for [2]1. Since we are required to set f{0}(0) = 0 and f{1}(1) = 1, every function assignment on [2]1 is completely determined by the values of f{0,1}. We will look at all four possible cases. Case 01: Suppose f{0,1}(0) = 0 and f{0,1}(1) = 1. Since f{0,1} extends both f{0} and f{1}, this is a #-decreasing function assignment. 346 3. Infinite Combinatorics and Graphs Case 00: Suppose f{0,1}(0) = 0 and f{0,1}(1) = 0. Since f{0,1} extends f{0} and f{1}(1) = 1 > 0 = f{1}∪{0}(1), this is also a #-decreasing function assignment. Case 10: Suppose f{0,1}(0) = 1 and f{0,1}(1) = 0. This is an acceptable function assignment, but it is not #-decreasing. If we let A = {0} and set x = 1, then fA∪{x}(0) = 1 = 0 = fA(0), so the first clause of the definition of #-decreasing fails. Because x = 1, there is no y ∈ A such that |y| > |x|, so the second clause fails also. Case 11: Suppose f{0,1}(0) = 1 and f{0,1}(1) = 1. This is an acceptable function assignment. Because f{0,1}(0) = 1, imitating the argument in the preceding case will show that this function assignment is not #-decreasing. In general, the second clause of the definition of #-decreasing function assignment forces the values of the functions to be pushed down. One might think that this would always lead to a proliferation of regressive values. But Proposition B asserts that if we start with a large enough domain, then even when the function assignment is #-decreasing there will be a function on a large subset that is not regressive at too many values. Proposition B is a remarkable statement. Perhaps it is too remarkable to be true. It is important to remember that proving the proposition inherently requires large cardinal assumptions that are well beyond the strength of the axioms of ZFC. Should we automatically tack these large cardinal axioms onto our collection of everyday set theory axioms? Feferman [104] would consider this rash. Does Friedman’s result offer novel insights into the consequences of assuming large cardinal axioms? Absolutely. Exercises 1. Let I denote the function assignment on [n]k defined by setting fA(x) = x for every A and every x ∈ A. Show that I is a #-decreasing function assignment. 2. Let M denote the function assignment on [n]1 defined by setting fA(x) = min(A) for every A and every x ∈ A. (a) Show that M is a #-decreasing function assignment. (b) If fA ∈ M , what is the maximum number of regressive values that fA can have? What is the maximum number of witnesses that a regressive value for fA can have? 3. Let S denote the function assignment on [n]1 defined by setting fA(x) = x min(A) if x < |A|, if x = |A|, for every A and every x ∈ A. Is S a #-decreasing function assignment? 3.10 k-critical Linear Orderings 347 4. Find a function assignment on [3]1 that is not #-decreasing. If you would like a challenge, find all of them. 3.10 k-critical Linear Orderings It appears that Feferman is using the word ‘need’ in a sense that requires discussion. — Harvey Friedman [105] In [114], H. Friedman reveals the connection between k-subtle cardinals and a very natural Ramsey-style property on linear orderings. These new results are not expressions of finite combinatorics like those of Section 3.9, but they have the advantage of requiring less terminology. Suppose that X, ≤ is a linear ordering. As you may recall from Section 3.5.2, this means that the relation ≤ is antisymmetric, transitive, and satisfies the trichotomy law. We say that X has no endpoints if it has neither a maximum nor a minimum element. The ordinal ω is certainly a linear ordering, with 0 as an endpoint. The integers are a familiar example of a linear ordering without endpoints, as are the rational numbers and the real numbers. Suppose that X, ≤ is a linear ordering without endpoints and that k > 0 is a natural number. We say that f : [X]k → X is a regressive function if for every increasing k-tuple x1 < x2 < · · · < xk, we have f (x1, x2, . . . , xk) < x1. A linear ordering is k-critical if for every regressive function f : [X]k → X there is a sequence of elements b1 < · · · < bk+1 such that f (b1, . . . , bk) = f (b2, . . . , bk+1). This is all the machinery that we need to state (some of) Friedman’s results! Here are two of his theorems. Theorem 3.49. For each nonzero k ∈ ω, ZFC proves that κ is the least cardinality of a (k + 1)-critical linear ordering if and only if κ is the least k-subtle cardinal. Theorem 3.50. ZFC proves that there is a k-critical linear ordering for every nonzero k ∈ ω if and only if there is a k-subtle cardinal for every nonzero k ∈ ω. For proofs of these theorems and many related results, see [114]. It is worth noting that Theorem 3.49 could be reformulated without using the word “least.” Working in ZFC, suppose there is a (k + 1)-critical linear ordering X. Let λ = |X|. Applying the axiom of separation we can form the subset S of those cardinals α ≤ λ such that there is a (k +1)-critical linear ordering Y with |Y | = α. Since S is a set of cardinals, it has a least element; call it κ. Then κ is the least cardinality of a (k+1)-critical linear ordering. Summarizing, if there is a (k+1)-critical linear ordering, then there is a least cardinality of a (k + 1)-critical linear ordering. The converse of this implication is obvious. A similar argument based on the definition of subtle cardinals shows that there is a k-subtle cardinal if and only if there is a least k-subtle cardinal. Consequently, Theorem 3.49 could be stated as “there is a (k + 1)-critical linear ordering if and only if there is a k-subtle cardinal.” 348 3. Infinite Combinatorics and Graphs Is it reasonable to assert that k-critical linear orderings exist? Familiar linear orderings like the integers, the rationals, and the reals, are much too small to be even 2-critical. (See the exercises.) The smallest 2-critical linear ordering must be larger than some weakly compact cardinal. On the other hand, the least Ramsey cardinal is larger than some k-critical linear ordering for every k. If we believe that k-subtle cardinals exist, then we must also accept the existence of k-critical linear orderings. If we reject the existence of weakly compact cardinals, then we must also reject the existence of k-critical linear orderings. The existence of these objects is independent of ZFC (assuming ZFC is consistent), so we are back to deciding whether or not to add new axioms. We can be certain about one thing. Friedman’s theorems give us a characterization of k-subtle cardinals that does not mention (n, κ)-sequences or club sets. This elegant description of k-subtle cardinals could be a help in discussions about their existence. Exercises 1. Let Z = {. . . , −2, −1, 0, 1, 2, . . . } denote the set of all integers and define f : Z → Z by f (x) = x − 1. Show that f is regressive. 2. Prove that Z is not 2-critical. (Hint: Problem 1 is useful.) 3. Let Q denote the rational numbers. Show that Q is not 2-critical. 4. Let R denote the real numbers. Show that R is not 2-critical. 5. Prove that no countable linear ordering with no endpoints is 2-critical. (Hint: Any such linear ordering has countably many pairs and also has a countable unbounded descending sequence. These can be used to build the needed regressive function.) 6. Suppose that κ ≥ ℵ0 and κ is regular. Prove that if L is a linear ordering of cardinality κ containing an unbounded descending sequence of size κ, then L is not 2-critical. 7. (This one is very challenging.) Without using Friedman’s theorem, try to prove that if κ is a Ramsey cardinal then there is a 2-critical linear ordering of size κ. 3.11 Points of Departure Where do you want to go today? This chapter can be summarized as a study of pigeonhole principles, K¨onig’s Lemma, and Ramsey’s Theorem and their connections to cardinal numbers. Our — Microsoft 3.11 Points of Departure 349 slightly obsessive focus on cardinals is not the only approach to studying infinite objects. In this section we take brief peeks at computability, reverse mathematics, and the analytical hierarchy. For each topic area, we outline an application to graph theory and combinatorics, and state an open question. The section closes with a list of Ramsey-style theorems and named trees. Computability We say that a function f : N → N is computable if there is a program written in C that given an input of n always halts with output f (n). Any programming language can be substituted for C. A set M ⊂ N is computable if its characteristic function χM is a computable function. The function χM is defined by setting χM (n) = 1 if n ∈ M and χM (n) = 0 if n /∈ M . Our definition extends in the obv
ious way to handle functions on Nk and subsets of Nk. The computable functions are sometimes called Turing computable functions or general recursive functions. The study of these functions is called computability theory or recursion theory. Good introductory texts include [31] and [259], and [120] is a survey of computability in graph theory and combinatorics. Every computable function has a program. We can think of this program as an integer; it certainly would be stored in a computer as a string of zeros and ones that could be thought of as a single big integer. We use {m}(n) = k as shorthand for saying that when the machine with code m receives input n, it halts with output k. We frequently refer to these codes as indices for computable functions. Not every subset of N is computable. For example, consider the set H = {m ∈ N | {m}(m) = 0}. To show that H is not computable, we consider χH and prove the following theorem. Theorem 3.51. χH is not computable. Proof. Suppose that χH is computable. Let m be the code for a program that computes χH . Then χH (m) = 0 ↔ {m}(m) = 0 ↔ m ∈ H ↔ χH (m) = 1. Since 0 = 1, χH is not computable. Because computer programs process in discrete steps, we can examine computations at various stages. We write {m}(n) ↓s if the program with index m and input n halts in fewer than s steps. We also write {m}(n) ↓ if the program eventually halts. It is easy to mechanically check whether a program halts in s steps, but impossible to mechanically determine which programs will eventually halt. Indeed, the set H is referred to as the solution to the self-halting problem. 350 3. Infinite Combinatorics and Graphs Using our extended shorthand, we can encode noncomputable sets like H in graph theory problems. For example, suppose we define a coloring F on [N]3 by the following rule. Let {i, j, k} be any three-element subset of N, assume that we have i < j < k, and let F (i, j, k) = red blue (∀m ≤ i) {m}(m) ↓j↔ {m}(m) ↓k, otherwise. Thus F (i, j, k) is red when for every machine with a code m ≤ i, we get the same information about whether or not {m}(m) halts by checking j steps as we do by checking k steps. If F (i, j, k) is blue, then for some m ≤ i the machine {m}(m) halts between step j and step k. By Ramsey’s Theorem, F must have an infinite monochromatic set; call it T = {t0, t1, t2, . . . } and assume that we have listed the elements in increasing order. No matter how we select three elements from T , applying F should always give us the same color. Since there are only finitely many machines with codes less than t0, we cannot have one of them stopping between ti steps and ti+1 steps for every i > 1. (Smell any pigeons?) Thus T must be a red monochromatic set. The elements of T are very handy for computing the set H. Pick any machine m. We know that m ≤ tm, and if {m}(m) ever halts, it must halt by step tm+1. To see this, suppose that {m}(m) halts at a later step k. Then tk+1 > k and F (tm, tm+1, tk+1) would be blue, contradicting the claim that T is a monochromatic red set. Thus, using χT as a subprogram, we could easily write a program that computes χH . Since χH is not computable, χT is not computable either, and we have proved the following theorem. Theorem 3.52. There is a computable coloring of [N]3 that has no infinite computable monochromatic set. Many other types of coloring problems lead to noncomputable sets. For example, there is a computable 2-regular 2-colorable graph with no computable 2-coloring. However, bumping up the size of our color palette can lead to computable colorings. Schmerl [248] proved that if G is a computable d-regular graph that is n-colorable, then G has a computable 2n − 1 coloring. Depending on the value of d, it may or may not be possible to find a computable coloring with fewer than 2n − 1 colors. For 2 ≤ n ≤ m ≤ 2n − 2, let D(n, m) be the least degree d such that there is a d-regular n-colorable graph with no recursive m coloring. Beyond a few bounds (see [120] and [248]), little is known about the values of D(n, m). For example, we know that 6 ≤ D(5, 5) ≤ 7, but the exact value of D(5, 5) is not known. Reverse Mathematics Reverse mathematics is a program of mathematical logic that was founded by H. Friedman (as in Section 3.9) and S. Simpson. The goal of the program is to measure the logical strength of mathematical theorems by proving that each one is equivalent to some statement in a hierarchy of axioms for second order arithmetic. 3.11 Points of Departure 351 These proofs are carried out in a weak base system, RCA0, which consists of PA with restricted induction plus a comprehension axiom that essentially asserts the existence of computable subsets of N. We refer to these systems as second order arithmetic because the formulas include variables for numbers and variables for sets of numbers. Simpson’s book [254] is a comprehensive source for information about reverse mathematics. A number of theorems about infinite graphs have been analyzed, including the following example. Theorem 3.53. RCA0 can prove that the following are equivalent: 1. Every 2-regular graph with no cycles of odd length is bipartite. 2. Weak K¨onig’s Lemma: Every infinite tree in which every node is labeled 0 or 1 contains an infinite path. Since a graph is bipartite if and only if it is 2-colorable, it is not hard to adapt the solution of Exercise 3 of Section 3.1 to prove that 2 implies 1. The proof that 1 implies 2 is less obvious, and the published proof uses an intermediate equivalent statement [162]. There are many open questions in reverse mathematics that are related to combinatorics and graph theory. For example, can RCA0 prove that Ramsey’s Theorem for pairs and two colors implies Weak K¨onig’s Lemma? It is known that the converse is independent of RCA0 and that Ramsey’s Theorem for triples and two colors implies a much stronger version of K¨onig’s Lemma. The Analytical Hierarchy Subsets of N that are definable by formulas of second order arithmetic are called analytical, and can be organized by the complexity of their defining formulas. The resulting hierarchy of sets is analogous (but not identical) to the hierarchy of projective sets studied by descriptive set theorists. Both [240] and [161] provide useful background for the study of the analytical hierarchy. 1-complete if it is Σ1 1-definable and every other Σ1 To state any results, we need some terminology. A set is Σ1 1-definable if it is definable by a formula containing no universal set quantifiers. We say that a set is Σ1 1-definable set is 1reducible to it. Here, B is 1-reducible to A if there is a computable one-to-one function f such that for all n, n ∈ B if and only if f (n) ∈ A. Na¨ıvely, each Σ1 1complete set embodies all the information content of every other Σ1 1-definable set. One interesting characteristic of these sets is that any defining formula for a Σ1 1-complete set must contain a set quantifier. Thus, no formula containing only quantifiers on numbers can possibly define a Σ1 1-complete set. An infinite graph G has a Hamiltonian path if there is a sequence of vertices v0, v1, v2, . . . such that each vertex of G appears exactly once in the list and vjvj+1 is an edge of G for each j ∈ N. An index for a computable graph is the code for the characteristic function of the edge and vertex sets for the graph. Using all this terminology, we can state the following theorem of Harel [153]. 352 3. Infinite Combinatorics and Graphs Theorem 3.54. The set of indices of computable graphs with Hamiltonian paths is Σ1 1-complete. For a similar problem, suppose we weight the edges of an infinite graph with rational numbers that sum to 1. Such a graph may or may not have a minimal spanning tree. Is the set of indices of computable graphs with minimal spanning trees a Σ1 1-complete set? This question was motivated by a related reverse mathematics result for directed graphs [57], and the answer was unknown when the first edition of this book was published. Since that time, Schmerl [249] has shown that the answer is no, the set of indices of computable graphs with minimal spanning trees can be defined by an arithmetical formula. Lists of Theorems and Trees There are a number of interesting Ramsey-style theorems that are worthy of exploration. Here is a list, with pointers to some good references. • Van der Waerden’s Theorem (and the related Szemer´edi’s Theorem) [136] • Hindman’s Theorem (and the related Folkman’s Theorem) [136] • Milliken’s Theorem [205] • Galvin–Prikry Theorem [119] • Erd˝os–Rado Theorem [168] Other good prospects for further study include special and regular Aronszajn trees, Suslin trees, and Kurepa trees, all appearing in [168] and [187]. 3.12 References His was a name to conjure with in certain circles. — E. Wallace, The Just Men of Cordova In this section we will name a few authors whose books will be helpful to those interested in the further study of infinite sets, graphs, and combinatorics. Many good introductory texts on axiomatic set theory are available. For example, the books of Enderton [88], Moschovakis [209], and Roitman [241] are all accessible and remarkably distinct. For a more technical approach, Drake [80] and Levy [187] are good choices. Jech’s encyclopedic text [168] is an invaluable reference (and a good read). Several books give extended treatments of some specific topics in this chapter. Devlin’s book [73] gives a comprehensive coverage of constructible sets. Large cardinals and partition cardinals play a central role in Drake’s text [80]. The Axiom of Choice is the title and subject of another nice book by Jech [167]. For a detailed treatment of cardinal and ordinal arithmetic, it is hard to beat Sierpi´nski’s old gem 3.12 References 353 [253]. It is very interesting to compare Sierpi´nski’s development with that of the ante-ZFC papers of Cantor, [47] and [48], both translated in [49]. Much of the historical content of the chapter was gleaned from van Heijenoort’s anthology [272] and Kanamori’s insig
htful article [173]. For the final word in many matters of logic, one can consult Kleene’s blue bible [176] or the more accessible text of Mendelson [201]. Finally, other treatments of infinite graphs and combinatorics can be found in the books of Ore [218] and Diestel [74]. References [1] [2] R. Aharoni, C. St. J. A. Nash-Williams, and S. Shelah, A general criterion for the existence of transversals, Proc. London Math. Soc. (3) 47 (1983), no. 1, 43–68. , Marriage in infinite societies, Progress in Graph Theory (Waterloo, ON, 1982) (J. Bondy and U. Murty, eds.), Academic Press, Toronto, ON, 1984, pp. 71–79. [3] M. Aigner, Graph Theory: A Development from the 4-Color Problem, BCS Associates, Moscow, ID, 1987. [4] [5] 2007. , Combinatorial Theory, Springer-Verlag, Berlin, 1997. , A Course in Enumeration, Grad. Texts in Math., vol. 238, Springer-Verlag, New York, [6] M. Aigner and G. M. Ziegler, Proofs from The Book, 3rd ed., Springer-Verlag, Berlin, 2004. [7] [8] [9] I. Anderson, Perfect matchings of a graph, J. Combin. Theory Ser. B 10 (1971), no. 3, 183–186. G. E. Andrews, Euler’s pentagonal number theorem, Math. Mag. 56 (1983), no. 5, 279–284. , The Theory of Partitions, Cambridge Univ. Press, Cambridge, 1998. [10] G. E. Andrews and K. Eriksson, Integer Partitions, Cambridge Univ. Press, Cambridge, 2004. [11] T. M. Apostol, Mathematical Analysis, 2nd ed., Addison-Wesley, Reading, MA, 1974. [12] K. Appel and W. Haken, Every planar map is four colorable, Illinois J. Math. 21 (1977), no. 3, 429–567. [13] D. Babi´c, D. J. Klein, J. von Knop, and N. Trinajsti´c, Combinatorial enumeration in chemistry, Chemical Modelling: Applications and Theory (A. Hinchliffe, ed.), Vol. 3, Royal Society of Chemistry, London, 2004, pp. 126–170. [14] M. Ba¨ıou and M. Balinski, Many-to-many matching: Stable polyandrous polygamy (or polyga- mous polyandry), Discrete Appl. Math. 101 (2000), no. 1, 1–12. [15] D. C. Banks, S. A. Linton, and P. Stockmeyer, Counting cases in substitope algorithms, IEEE Trans. Vis. Comput. Graphics 10 (2004), no. 4, 371–384. 356 References [16] D. C. Banks and P. Stockmeyer, DeBruijn counting for visualization algorithms, Mathematical Foundations of Scientific Visualization, Computer Graphics, and Massive Data Exploration (T. M¨oller, B. Hamann, and R. Russell, eds.), Math. Vis., Springer-Verlag, New York, 2009. To appear. [17] A.-L. Barab´asi, Linked, Perseus Publishing, Cambridge, MA, 2002. [18] [19] J. E. Baumgartner, Ineffability properties of cardinals I, Infinite and Finite Sets (Colloq., Keszthely, 1973; dedicated to P. Erd˝os on his 60th birthday), Vol. I (A. Hajnal, R. Rado, and V. S´os, eds.), Colloq. Math. Soc. J´anos Bolyai, vol. 10, North-Holland, Amsterdam, 1975, pp. 109–130. , Ineffability properties of cardinals II, Fifth Internat. Congr. Logic, Methodology and Philos. of Sci., Part I (Univ. Western Ontario, London, ON, 1975), Logic, Foundations of Mathematics and Computability Theory (R. Butts and J. Hintikka, eds.), Univ. Western Ontario Ser. Philos. Sci., vol. 9, Reidel, Dordrecht, 1977, pp. 87–106. [20] P. Bedrossian, Forbidden subgraph and minimum degree conditions for Hamiltonicity, Ph.D. Thesis, Memphis State Univ., 1991. [21] L. W. Beineke and R. J. Wilson (eds.), Graph Connections, Oxford Lecture Ser. Math. Appl., vol. 5, Oxford Univ. Press, New York, 1997. [22] A. T. Benjamin and J. J. Quinn, Proofs that Really Count: The Art of Combinatorial Proof, Dolciani Math. Exp., vol. 27, Math. Assoc. America, Washington, DC, 2003. [23] C. Berge, Two theorems in graph theory, Proc. Natl. Acad. Sci. USA 43 (1957), 842–844. [24] , Principles of Combinatorics, Math. Sci. Engrg., vol. 72, Academic Press, New York, 1971. [25] H. Bielak and M. M. Sysło, Peripheral vertices in graphs, Studia Sci. Math. Hungar. 18 (1983), no. 2-4, 269–275. [26] N. L. Biggs, E. K. Lloyd, and R. J. Wilson, Graph Theory: 1736–1936, Oxford Univ. Press, 1976. [27] G. D. Birkhoff and D. C. Lewis, Chromatic polynomials, Trans. Amer. Math. Soc. 60 (1946), no. 3, 355–451. [28] A. Bloch and G. P´olya, On the roots of certain algebraic equations, Proc. London Math. Soc. (2) 33 (1932), no. 1, 102–114. [29] B. Bollob´as, Modern Graph Theory, Grad. Texts in Math., vol. 184, Springer-Verlag, New York, 1998. [30] W. E. Bonnice, On convex polygons determined by a finite planar set, Amer. Math. Monthly 81 (1974), no. 7, 749–752. [31] G. S. Boolos and R. C. Jeffrey, Computability and Logic, 3rd ed., Cambridge Univ. Press, Cambridge, 1989. [32] E. Borel, Lec¸ons sur la Theorie des Fonctions, Gauthier-Villars et fils, Paris, 1898. [33] P. Borwein, Sylvester’s problem and Motzkin’s theorem for countable and compact sets, Proc. Amer. Math. Soc. 90 (1984), no. 4, 580–584. [34] P. Borwein and W. O. J. Moser, A survey of Sylvester’s problem and its generalizations, Aequa- tiones Math. 40 (1990), 111–135. [35] P. Borwein and M. J. Mossinghoff, Polynomials with height 1 and prescribed vanishing at 1, Experiment. Math. 9 (2000), no. 3, 425–433. [36] , Newman polynomials with prescribed vanishing and integer sets with distinct subset sums, Math. Comp. 72 (2003), no. 242, 787–800. References 357 [37] P. Brass, W. Moser, and J. Pach, Research Problems in Discrete Geometry, Springer-Verlag, New York, 2005. [38] I. Broere, M. Dorfling, J. E. Dunbar, and M. Frick, A path(ological) partition problem, Discuss. Math. Graph Theory 18 (1998), no. 1, 113–125. [39] H. Broersma and H. J. Veldman, Restrictions on induced subgraphs ensuring Hamiltonicity or pancyclicity of K1,3-free graphs, Contemporary Methods in Graph Theory (R. Bodendiek, ed.), BI Wissenschaftsverlag, Mannheim, 1990, pp. 181–194. [40] J. G. Broida and S. G. Williamson, A Comprehensive Introduction to Linear Algebra, AddisonWesley, Redwood City, CA, 1989. [41] R. L. Brooks, On colouring the nodes of a network, Proc. Cambridge Philos. Soc. 37 (1941), 194–197. [42] F. Buckley and F. Harary, Distance in Graphs, Addison-Wesley, Redwood City, CA, 1990. [43] F. Buckley and M. Lewinter, A Friendly Introduction to Graph Theory, Pearson Education, Upper Saddle River, NJ, 2003. [44] F. Buckley, Z. Miller, and P. J. Slater, On graphs containing a given graph as center, J. Graph Theory 5 (1981), no. 4, 427–434. [45] W. Burnside, Theory of Groups of Finite Order, Cambridge Univ. Press, London, 1897. 2nd ed., Cambridge Univ. Press, London, 1911, reprinted by Dover, New York, 1955. [46] S. A. Burr, Generalized Ramsey theory for graphs—A survey, Capital Conference on Graph Theory and Combinatorics (George Washington Univ., Washington, DC, 1973), Graphs and Combinatorics (R. A. Bari and F. Harary, eds.), Lecture Notes in Math., vol. 406, SpringerVerlag, Berlin, 1974, pp. 52–75. [47] G. Cantor, Beitr¨age zur Begr¨undung der transfiniten Mengenlehre, Math. Ann. 46 (1895), no. 4, 481–512; English transl., G. Cantor, Contributions to the Founding of the Theory of Transfinite Numbers (1955), 85-136. [48] , Beitr¨age zur Begr¨undung der transfiniten Mengenlehre II, Math. Ann. 49 (1897), no. 2, , Contributions to the Founding of the Theory of Transfinite 207–246; English transl., Numbers (1955), 137-201. [49] , Contributions to the Founding of the Theory of Transfinite Numbers, Dover, New York, 1955. Translated by P. E. B. Jourdain. [50] A. Cayley, A theorem on trees, Quart. J. Math. 23 (1889), 276–378. [51] D. Chakerian and D. Logothetti, Cube slices, pictorial triangles, and probability, Math. Mag. 64 (1991), no. 4, 219–241. [52] G. Chartrand and L. Lesniak, Graphs & Digraphs, 4th ed., Chapman & Hall, Boca Raton, FL, 2005. [53] V. Chv´atal, Tree-complete graph Ramsey numbers, J. Graph Theory 1 (1977), no. 1, 93. [54] V. Chv´atal and P. Erd˝os, A note on Hamiltonian circuits, Discrete Math. 2 (1972), no. 2, 111– 113. [55] V. Chv´atal and F. Harary, Generalized Ramsey theory for graphs III: Small off-diagonal num- bers, Pacific J. Math. 41 (1972), no. 2, 335–345. [56] J. Clark and D. A. Holton, A First Look at Graph Theory, World Scientific, Teaneck, NJ, 1991. [57] P. G. Clote and J. L. Hirst, Reverse mathematics of some topics from algorithmic graph theory, Fund. Math. 157 (1998), no. 1, 1–13. [58] P. J. Cohen, The independence of the continuum hypothesis, Proc. Natl. Acad. Sci. USA 50 (1963), 1143–1148. 358 References [59] , The independence of the continuum hypothesis II, Proc. Natl. Acad. Sci. USA 51 (1964), 105–110. [60] L. Comtet, Advanced Combinatorics: The Art of Finite and Infinite Expansions, D. Reidel, Dordrecht, 1974. [61] J. H. Conway and R. K. Guy, The Book of Numbers, Springer-Verlag, New York, 1996. [62] H. S. M. Coxeter, A problem of collinear points, Amer. Math. Monthly 55 (1948), no. 1, 26–28. [63] G. P. Csicsery (director), N is a Number: A Portrait of Paul Erd˝os, Zala Films, Oakland, CA, 1993. Documentary film. [64] [65] J. Csima and E. T. Sawyer, There exist 6n/13 ordinary points, Discrete Comput. Geom. 9 (1993), no. 2, 187–202. , The 6n/13 theorem revisited, Graph Theory, Combinatorics, and Algorithms: Proceedings of the Seventh Quadrennial International Conference on the Theory and Applications of Graphs (Western Michigan Univ., Kalamazoo, MI, 1992) (Y. Alavi and A. Schwenk, eds.), Wiley-Intersci. Publ., vol. 1, John Wiley & Sons, New York, 1995, pp. 235–249. [66] R. M. Damerell and E. C. Milner, Necessary and sufficient conditions for transversals of count- able set systems, J. Combin. Theory Ser. A 17 (1974), no. 3, 350–374. [67] J. F. Davidson, The Anacreontea & Principal Remains of Anacreon of Teos, in English verse, E. P. Dutton, New York, 1915. [68] N. G. de Bruijn, P´olya’s theory of counting, Applied Combinatorial Mathematics (E. F. Beck- enbach, ed.), John Wiley & Sons, New York, 1964, pp. 144–184. [69] [70] , Color patterns that are invariant under a given permutation of the colors, J. Combin. Theory 2 (1967), 418–421. , A survey of generalizations of P´olya’s enumeration theorem, Nieuw Arch. Wisk. (3) 19 (1971), 89–112. [71] S. de Wannemacker, T. Laffey, and R. Osburn, On a conjecture of Wilf, J
. Combin. Theory Ser. A 114 (2007), no. 7, 1332–1349. [72] W. Degen, Pigeonhole and choice principles, MLQ Math. Log. Q. 46 (2000), no. 3, 313–334. [73] K. J. Devlin, Constructibility, Perspect. Math. Logic, Springer-Verlag, Berlin, 1984. [74] R. Diestel, Graph Decompositions, Oxford Sci. Publ., Oxford Univ. Press, New York, 1990. [75] , Graph Theory, 3rd ed., Grad. Texts in Math., vol. 173, Springer-Verlag, Berlin, 2005. [76] E. W. Dijkstra, A computing scientist’s approach to a once-deep theorem of Sylvester’s (1988), 14 pp. Manuscript number EWD1016, available at the E. W. Dijkstra Archive, http://www.cs.utexas.edu/users/EWD. [77] G. A. Dirac, Some theorems on abstract graphs, Proc. London Math. Soc. (3) 2 (1952), no. 1, 69–81. [78] G. A. Dirac and S. Schuster, A theorem of Kuratowski, Indag. Math. 16 (1954), 343–348. Cor- rigendum, Indag. Math. 23 (1961), 360. [79] G. Dobi´nski, Summirung der Reihe (Arch. Math. Phys.) 61 (1877), 333–336. nm n! f¨ur m = 1, 2, 3, 4, 5, . . . [sic], Grunert Archiv [80] F. Drake, Set Theory: An Introduction to Large Cardinals, Stud. Logic Found. Math., vol. 76, Elsevier, Amsterdam, 1974. [81] D. Duffus, M. S. Jacobson, and R. J. Gould, Forbidden subgraphs and the Hamiltonian theme, The Theory and Applications of Graphs: Fourth International Conference (Western Michigan Univ., Kalamazoo, MI, 1980) (G. Chartrand, Y. Alavi, D. L. Goldsmith, L. Lesniak-Foster, and D. R. Lick, eds.), John Wiley & Sons, New York, 1981, pp. 297–316. References 359 [82] A. Dumitrescu, A remark on the Erd˝os-Szekeres theorem, Amer. Math. Monthly 112 (2005), no. 10, 921–924. [83] [84] J. E. Dunbar and M. Frick, Path kernels and partitions, J. Combin. Math. Combin. Comput. 31 (1999), 137–149. , The path partition conjecture is true for claw-free graphs, Discrete Math. 307 (2007), no. 11-12, 1285–1290. [85] A. W. F. Edwards, Pascal’s Arithmetical Triangle: The Story of a Mathematical Idea, Johns Hopkins Univ. Press, Baltimore, 2002. [86] J. Eeckhout, On the uniqueness of stable marriage matchings, Econom. Lett. 69 (2000), no. 1, 1–8. [87] E. Egerv´ary, Matrixok Kombinat´orius Tulajdons´agair´ol, Mat. Fiz. Lapok 38 (1931), 16–28. [88] H. B. Enderton, Elements of Set Theory, Academic Press, New York, 1977. [89] P. Erd˝os, Problem 4065, Amer. Math. Monthly 50 (1943), no. 1, 65. [90] P. Erd˝os, Some remarks on the theory of graphs, Bull. Amer. Math. Soc. 53 (1947), 292–294. [91] P. Erd˝os, Combinatorial problems in geometry and number theory, Relations Between Combinatorics and Other Parts of Mathematics (Ohio State Univ., Columbus, OH, 1978) (D. K. Ray-Chaudhuri, ed.), Proc. Sympos. Pure Math., vol. 34, Amer. Math. Soc., Providence, R.I., 1979, pp. 149–162. [92] , Some of my favorite problems and results, The Mathematics of Paul Erd˝os I (R. L. Graham and J. Neˇsetˇril, eds.), Algorithms Combin., vol. 13, Springer-Verlag, Berlin, 1997, pp. 47–67. [93] P. Erd˝os and G. Purdy, Extremal problems in combinatorial geometry, Handbook of Combinatorics (R. L. Graham, M. Gr¨otschel, and L. Lov´asz, eds.), Vol. 1, Elsevier Science, Amsterdam, and MIT Press, Cambridge, 1995, pp. 809–874. [94] P. Erd˝os and G. Szekeres, A combinatorial problem in geometry, Compositio Math. 2 (1935), 463–470; reprinted in I. Gessel and G.-C. Rota (eds.), Classic Problems in Combinatorics, Birkh¨auser, Boston, 1987. [95] , On some extremum problems in elementary geometry, Ann. Univ. Sci. Budapest. E¨otv¨os Sect. Math. 3–4 (1961), 53–62. [96] P. Erd˝os and A. Tarski, On families of mutually exclusive sets, Ann. of Math. (2) 44 (1943), no. 2, 315–329. [97] , On some problems involving inaccessible cardinals, Essays on the Foundations of Mathematics (Y. Bar-Hillel, E. Poznansik, M. Rabin, and A. Robinson, eds.), Magnes Press, Hebrew Univ., Jerusalem, 1961, pp. 50–82. [98] L. Euler, Solutio problematis ad geometriam situs pertinentis, Comment. Academiae Sci. I. Petropolitanae 8 (1736), 128–140. [99] , Demonstratio nonnullarum insignium proprietatum quibus solida hedris planis in- clusa sunt praedita, Novi Comm. Acad. Sci. Imp. Petropol 4 (1758), 140–160. [100] H. Eves, In Mathematical Circles, Prindle, Weber & Schmidt, Boston, 1969. [101] I. F´ary, On straight line representation of planar graphs, Acta Univ. Szeged. Sect. Sci. Math. 11 (1948), 229–233. [102] R. J. Faudree and R. J. Gould, Characterizing forbidden pairs for Hamiltonian properties, Discrete Math. 173 (1997), no. 1-3, 45–60. [103] T. Feder, Stable Networks and Product Graphs, Mem. Amer. Math. Soc., vol. 116, American Math. Soc., Providence, RI, 1995. 360 References [104] S. Feferman, Does mathematics need new axioms?, Amer. Math. Monthly 106 (1999), no. 2, 99–111. [105] S. Feferman, H. M. Friedman, P. Maddy, and J. R. Steel, Does mathematics need new axioms?, Bull. Symbolic Logic 6 (2000), no. 4, 401–446. [106] L. R. Foulds, Graph Theory Applications, Universitext, Springer-Verlag, New York, 1992. [107] A. Fraenkel, ¨Uber die Zermelosche Begr¨undung der Mengenlehre, Jahresber. Deutsch. Math.- Verein. 30 (1921), 97–98. 2nd section. [108] , Axiomatische Begr¨undung der transfiniten Kardinalzahlen I, Math. Z. 13 (1922), no. 1, 153–188. [109] , Der Begriff “definit” und die Unabh¨angigkeit des Auswahlsaxioms, Sitzungsberichte der Preussischen Akademie der Wissenschaften, Physikalisch-mathematische Klasse (1922), 253–257; English transl., J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931 (1967), 284-289. [110] , Zu den Grundlagen der Cantor-Zermeloschen Mengenlehre, Math. Ann. 86 (1922), no. 3-4, 230–237. [111] F. Franklin, Sur le d´eveloppement du produit infini (1 − x)(1 − x2)(1 − x3) · · · , C. R. Acad. Sci. Paris 82 (1881), 448–450. [112] G. Frege, ¨Uber die Begriffsschrift des Herrn Peano und meine eigene, Berichte ¨uber die Verhandlungen der K¨oniglich S¨achsischen Gesellschaft der Wissenschaften zu Leipzig, Mathematisch-physikalische Klasse 48 (1896), 361–378; English transl. in J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931 (1967). A translation of the “Summum bonum” quotation appears on p. 2. [113] H. M. Friedman, Finite functions and the necessary use of large cardinals, Ann. of Math. (2) 148 (1998), no. 3, 803–893. [114] , Subtle cardinals and linear orderings, Ann. Pure Appl. Logic 107 (2001), no. 1-3, 1–34. [115] F. G. Frobenius, ¨Uber die Congruenz nach einem aus zwei endlichen Gruppen gebildeten Doppelmodul, J. Reine Angew. Math. 101 (1887), 273–299; reprinted in F. G. Frobenius, Gesammelte Abhandlungen, Vol. 2, Springer-Verlag, Berlin, 1968. [116] S. Fujita, Symmetry and Combinatorial Enumeration in Chemistry, Springer-Verlag, Berlin, 1991. [117] D. Gale and L. S. Shapley, College admissions and the stability of marriage, Amer. Math. Monthly 69 (1962), no. 1, 9–15. [118] T. Gallai, Problem 4, Colloquium on Graph Theory (Tihany, Hungary, 1966) (P. Erd˝os and G. Katona, eds.), Academic Press, New York, 1968, pp. 362. [119] F. Galvin and K. Prikry, Borel sets and Ramsey’s theorem, J. Symbolic Logic 38 (1973), 193– 198. [120] W. Gasarch, A survey of recursive combinatorics, Handbook of Recursive Mathematics, Vol. 2 (Y. Ershov, S. Goncharov, A. Nerode, and J. Remmel, eds.), Stud. Logic Found. Math., vol. 139, North-Holland, Amsterdam, 1998, pp. 1041–1176. [121] T. Gerken, Empty convex hexagons in planar point sets, Discrete Comput. Geom. 39 (2008), no. 1-3, 239–272. [122] I. M. Gessel, The Smith College diploma problem, Amer. Math. Monthly 108 (2001), no. 1, 55–57. [123] I. Gessel and G.-C. Rota (eds.), Classic Papers in Combinatorics, Birkh¨auser, Boston, 1987. References 361 [124] K. G¨odel, ¨Uber formal unentscheidbare S¨atze der Principia Mathematica und verwandter Systeme I, Monatsh. Math. Phys. 38 (1931), no. 1, 173–198; English transl., K. G¨odel, Collected Works Vol. I (1986), 144–195. [125] , The consistency of the Axiom of Choice and the Generalized Continuum Hypothesis, Proc. Natl. Acad. Sci. USA 24 (1938), 556–557. Reprinted in K. G¨odel, Collected Works Vol. I, (S. Feferman, ed.), Oxford Univ. Press, New York, 1986, 26–27. [126] , Collected Works Vol. I (S. Feferman, ed.), Oxford Univ. Press, New York, 1986. [127] S. Goodman and S. Hedetniemi, Sufficient conditions for a graph to be Hamiltonian, J. Combin. Theory Ser. B 16 (1974), no. 2, 175–180. [128] R. J. Gould, Graph Theory, Benjamin Cummings, Menlo Park, CA, 1988. [129] , Advances on the Hamiltonian problem—A survey, Graphs Combin. 19 (2003), no. 1, 7–52. [130] R. J. Gould and M. S. Jacobson, Forbidden subgraphs and Hamiltonian properties of graphs, Discrete Math. 42 (1982), no. 2-3, 189–196. [131] R. L. Graham, M. Gr¨otschel, and L. Lov´asz (eds.), Handbook of Combinatorics, Vol. 1, Elsevier Science, Amsterdam, and MIT Press, Cambridge, 1995. [132] (ed.), Handbook of Combinatorics, Vol. 2, Elsevier Science, Amsterdam, and MIT Press, Cambridge, 1995. [133] R. L. Graham, D. E. Knuth, and O. Patashnik, Concrete Mathematics, 2nd ed., Addison-Wesley, Reading, MA, 1994. [134] R. L. Graham and J. Neˇsetˇril (eds.), The Mathematics of Paul Erd˝os I, Algorithms Combin., vol. 13, Springer-Verlag, Berlin, 1997. [135] (ed.), The Mathematics of Paul Erd˝os II, Algorithms Combin., vol. 14, Springer-Verlag, Berlin, 1997. [136] R. L. Graham, B. L. Rothschild, and J. H. Spencer, Ramsey Theory, 2nd ed., Wiley-Intersci. Ser. Discrete Math. Optim., John Wiley & Sons, New York, 1990. [137] J. Grantham, There are infinitely many Perrin pseudoprimes (2006), 11 pp. Preprint available at http://www.pseudoprime.com/pseudo. [138] A. Granville, Zaphod Beeblebrox’s brain and the fifty-ninth row of Pascal’s triangle, Amer. Math. Monthly 99 (1992), no. 4, 318–331. [139] J. Gross and J. Yellen, Graph Theory and its Applications, 2nd ed., Chapman & Hall, Boca Raton, FL, 2006. [140] J. Grossman, The Erd˝os Number Project, March 1, 2007. http://www.oakland.edu/enp. [141] B. Gr¨unbaum, Vertices missed by longest paths or circuits, J. Combin. Theory Ser. A 17 (1974),
no. 1, 31–38. [142] J. Guare, Six Degrees of Separation: A Play, Random House, New York, 1990. [143] D. Gusfield and R. W. Irving, The Stable Marriage Problem: Structure and Algorithms, MIT Press, Cambridge, MA, 1989. [144] H. Hadwiger and H. Debrunner, Combinatorial Geometry in the Plane, Holt, Rinehart & Win- ston, New York, 1964. Translated from the 1960 German edition by V. Klee. [145] M. Hall Jr., Distinct representatives of subsets, Bull. Amer. Math. Soc. 54 (1948), 922–926. [146] , Combinatorial Theory, 2nd ed., John Wiley & Sons, New York, 1983. [147] P. Hall, On representation of subsets, J. London Math. Soc. 10 (1935), 26–30. [148] F. Harary, Graph Theory, Addison-Wesley, Reading, MA, 1969. 362 References [149] F. Harary and E. M. Palmer, The power group enumeration theorem, J. Combin. Theory 1 (1966), 157–173. [150] , Graphical Enumeration, Academic Press, New York, 1973. [151] H. Harborth, Konvexe F¨unfecke in ebenen Punktmengen, Elem. Math. 33 (1978), no. 5, 116– 118. [152] G. H. Hardy and S. Ramanujan, Asymptotic formulae in combinatory analysis, Proc. London Math. Soc. (2) 17 (1918), no. 1, 75–115. [153] D. Harel, Hamiltonian paths in infinite graphs, Israel J. Math. 76 (1991), no. 3, 317–336. [154] J. M. Harris and M. J. Mossinghoff, Traceability in small claw-free graphs, Util. Math. 70 (2006), 263–271. [155] F. Hartogs, ¨Uber das Problem der Wohlordnung, Math. Ann. 76 (1915), no. 4, 438–443. [156] P. J. Heawood, Map-colour theorem, Quart. J. Math. 24 (1890), 332–339. [157] C. Henrion, Properties of subtle cardinals, J. Symbolic Logic 52 (1987), no. 4, 1005–1019. [158] J. Herman, R. Kuˇcera, and J. ˇSimˇsa, Counting and Configurations: Problems in Combinatorics, Arithmetic, and Geometry, CMS Books Math./Ouvrages Math. SMC, vol. 12, Springer-Verlag, New York, 2003. Translated from the 1997 Czech edition by K. Dilcher. [159] C. Hierholzer, Ueber die M¨oglichkeit, einen Linienzug ohne Wiederholung und ohne Unter- brechnung zu umfahren, Math. Ann. 6 (1873), 30–32. [160] D. Hilbert, ¨Uber das Unendliche, Math. Ann. 95 (1926), no. 1, 161–190; English transl., J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931 (1967), 367–392. [161] P. G. Hinman, Recursion-theoretic Hierarchies, Perspect. Math. Logic, Springer-Verlag, Berlin, 1978. [162] J. L. Hirst, Marriage theorems and reverse mathematics, Logic and Computation (Pittsburgh, PA, 1987) (W. Sieg, ed.), Contemp. Math., vol. 106, Amer. Math. Soc., Providence, RI, 1990, pp. 181–196. [163] P. Hoffman, The Man Who Loved Only Numbers, Hyperion, New York, 1998. [164] J. D. Horton, Sets with no empty convex 7-gons, Canad. Math. Bull. 26 (1983), no. 4, 482–484. [165] The Internet Movie Database, IMDb.com, Inc., 2008. http://www.imdb.com. [166] R. W. Irving, An efficient algorithm for the “stable roommates” problem, J. Algorithms 6 (1985), no. 4, 577–595. [167] T. J. Jech, The Axiom of Choice, Stud. Logic Found. Math., vol. 75, North-Holland, Amsterdam, 1973. [168] , Set Theory, 3rd ed., Springer Monogr. Math., Springer-Verlag, Berlin, 2003. [169] S. Johnson, A new proof of the Erd˝os-Szekeres convex k-gon result, J. Combin. Theory Ser. A 42 (1986), no. 2, 318–319. [170] C. Jordan, Sur les assemblages des lignes, J. Reine Angew. Math. 70 (1869), 185–190. [171] J. D. Kalbfleisch, J. G. Kalbfleisch, and R. G. Stanton, A combinatorial problem on convex n-gons, Proceedings of the Louisiana Conference on Combinatorics, Graph Theory and Computing (Louisiana State Univ., Baton Rouge, LA, 1970) (R. C. Mullin, K. B. Reid, and D. P. Roselle, eds.), Louisiana State Univ., Baton Rouge, LA, 1970, pp. 180–188. [172] J. G. Kalbfleisch and R. G. Stanton, On the maximum number of coplanar points containing no convex n-gons, Util. Math. 47 (1995), 235–245. [173] A. Kanamori, The mathematical development of set theory from Cantor to Cohen, Bull. Sym- bolic Logic 2 (1996), no. 1, 1–71. References 363 [174] A. B. Kempe, On the geographical problem of the four colors, Amer. J. Math. 2 (1879), no. 3, 193–200. [175] G. Kirchhoff, ¨Uber der Aufl¨osung der Gleichungen, auf welche man bei der Untersuchung der linearen Verteilung galvanischer Str¨ome gef¨urt wird, Ann. Phys. Chem. 72 (1847), 497–508. [176] S. C. Kleene, Introduction to Metamathematics, Van Nostrand, Princeton, NJ, 1952. Reprinted by North-Holland, Amsterdam, 1980. [177] D. E. Knuth, Two notes on notation, Amer. Math. Monthly 99 (1992), no. 5, 403–422. Adden- dum, Stirling numbers, 102 (1995), no. 6, 562. [178] , Stable Marriage and its Relation to other Combinatorial Problems, CRM Proc. Lec. Notes, vol. 10, Amer. Math. Soc., Providence, RI, 1997. [179] D. K¨onig, ¨Uber eine Schlussweise aus dem Endlichen ins Unendliche, Acta Litt. Acad. Sci. Hung. (Szeged) 3 (1927), 121–130. [180] D. K¨onig, Graphen und Matrizen, Math. Fiz. Lapok 38 (1931), 116–119. [181] J. K¨onig, Sur la theorie des ensembles, C. R. Acad. Paris 143 (1906), 110–112. [182] V. A. Koshelev, On the Erd˝os-Szekeres problem in combinatorial geometry, Electron. Notes Discrete Math. 29 (2007), 175–177. [183] J. B. Kruskal Jr., On the shortest spanning subtree of a graph and the traveling salesman prob- lem, Proc. Amer. Math. Soc. 7 (1956), no. 1, 48–50. [184] K. Kuratowski, Sur la notion del l’ordre dans la th´eorie des ensembles, Fund. Math. 2 (1921), 161-171. [185] , Sur le probl`eme des courbes gauches en topologie, Fund. Math. 15 (1930), 271–283. [186] N. J. Lennes, On the foundations of the theory of sets, Bull. Amer. Math. Soc. 28 (1922), no. 6, 300. Abstract from the 222nd reg. meeting of the Amer. Math. Soc. (Univ. Chicago, 1922). [187] A. Levy, Basic Set Theory, Springer-Verlag, Berlin, 1979. Reprinted by Dover, Mineola, NY, 2002. [188] M. Lewin, A new proof of a theorem of Erd˝os and Szekeres, Math. Gaz. 60 (1976), no. 412, 136–138. [189] L. Lov´asz, On decomposition of graphs, Studia Sci. Math. Hungar. 1 (1966), 237–238. [190] , Three short proofs in graph theory, J. Combin. Theory Ser. B 19 (1975), no. 3, 269– 271. [191] [192] ´E. Lucas, Th´eorie des fonctions num´eriques simplement p´eriodiques. Sections 1-5, Amer. J. , Combinatorial Problems and Exercises, 2nd ed., North-Holland, Amsterdam, 1993. Math. 1 (1878), no. 2, 184–196. [193] , Th´eorie des fonctions num´eriques simplement p´eriodiques. Sections 6-23, Amer. J. Math. 1 (1878), no. 3, 197–240. [194] , Th´eorie des fonctions num´eriques simplement p´eriodiques. Sections 24-30, Amer. J. Math. 1 (1878), no. 4, 289–321. [195] , R´ecr´eations Math´ematiques IV, Gauthiers-Villars et fils, Paris, 1894. [196] D. F. Manlove, R. W. Irving, K. Iwama, S. Miyazaki, and Y. Morita, Hard variants of stable marriage, Theoret. Comput. Sci. 276 (2002), no. 1-2, 261–279. [197] J.-L. Marichal and M. J. Mossinghoff, Slices, slabs, and sections of the unit hypercube, Online J. Anal. Comb. 3 (2008), Art. 1, 11 pp. [198] M. M. Matthews, Every 3-connected K1,3-free graph with fewer than 20 vertices is Hamilto- nian, Technical Report 82-004, Dept. Comp. Sci., Univ. South Carolina, 1982. 364 References [199] M. M. Matthews and D. P. Sumner, Hamiltonian results in K1,3-free graphs, J. Graph Theory 8 (1984), no. 1, 139–146. [200] J. Matouˇsek, Lectures on Discrete Geometry, Grad. Texts in Math., vol. 212, Springer-Verlag, New York, 2002. [201] E. Mendelson, Introduction to Mathematical Logic, 4th ed., Chapman & Hall, London, 1997. [202] K. Menger, Zur allgemenen Kurventheorie, Fund. Math. 10 (1927), 95–115. [203] E. P. Miles Jr., Generalized Fibonacci numbers and associated matrices, Amer. Math. Monthly 67 (1960), no. 8, 745–752. [204] S. Milgram, The small-world problem, Psychology Today 1 (1967), no. 1, 61–67. [205] K. R. Milliken, Ramsey’s theorem with sums or unions, J. Combin. Theory Ser. A 18 (1975), no. 3, 276–290. [206] E. C. Milner, Review of “Weakly compact cardinals: A combinatorial proof” by S. Shelah, MR 0550384 (81i:04009), Mathematical Reviews, Amer. Math. Soc., Providence, RI (1981). [207] D. Mirimanoff, Les antinomies de Russell et de Burali-Forti et le probl`eme fondamental de la th´eorie des ensembles, Enseign. Math. 19 (1917), 37–52. [208] W. Morris and V. Soltan, The Erd˝os-Szekeres problem on points in convex position—A survey, Bull. Amer. Math. Soc. (N.S.) 37 (2000), no. 4, 437–458. [209] Y. Moschovakis, Notes on Set Theory, 2nd ed., Undergrad. Texts Math., Springer-Verlag, New York, 2006. [210] C. Mulcahy, An ESPeriment with cards, Math Horizons (Feb. 2007), 10–12. [211] C. St. J. A. Nash-Williams, Which infinite set-systems have transversals?—A possible approach, Conference on Combinatorial Mathematics (Oxford Univ., 1972), Combinatorics (D. J. A. Welsh and D. R. Woodall, eds.), Inst. Math. Appl., Southend, 1972, pp. 237–253. [212] , Another criterion for marriage in denumerable societies, Cambridge Combinatorial Conference (Trinity College, 1977), Advances in Graph Theory (B. Bollob´as, ed.), Ann. Discrete Math., vol. 3, 1978, pp. 165–179. [213] P. M. Neumann, A lemma that is not Burnside’s, Math. Sci. 4 (1979), no. 2, 133–141. [214] J. R. Newman (ed.), The World of Mathematics, Vol. I–IV, Simon & Schuster, New York, 1956. Reprinted by Dover, Mineola, NY, 2003. [215] C. M. Nicol´as, The empty hexagon theorem, Discrete Comput. Geom. 38 (2007), no. 2, 389– 397. [216] A. Nijenhuis and H. S. Wilf, Combinatorial Algorithms, Academic Press, New York, 1975. [217] O. Ore, Note on Hamilton circuits, Amer. Math. Monthly 67 (1960), no. 1, 55. [218] , Theory of Graphs, Amer. Math. Soc. Colloq. Publ., vol. 38, Amer. Math. Soc., Provi- dence, RI, 1962. [219] M. Overmars, Finding sets of points without empty convex 6-gons, Discrete Comput. Geom. 29 (2003), no. 1, 153–158. [220] G. Peano, Super theorema de Cantor–Bernstein, Rend. Circ. Mat. Palermo 21 (1906), 136–143. [221] J. Petersen, Die Theorie der regul¨aren Graphen, Acta Math. 15 (1891), 193–220. [222] M. Petkovˇsek, H. S. Wilf, and D. Zeilberger, A = B, A K Peters, Wellesley, MA, 1996. [223] K.-P. Podewski and K. Steffens, Inj
ective choice functions for countable families, J. Combin. Theory Ser. B 21 (1976), no. 1, 40–46. [224] G. P´olya, Kombinatorische Anzahlbestimmungen f¨ur Gruppen, Graphen, und chemische Verbindungen, Acta Math. 68 (1937), 145–254; English transl. in G. P´olya and R. C. Read, Combinatorial Enumeration of Groups, Graphs, and Chemical Compounds (1987). References 365 [225] , On picture-writing, Amer. Math. Monthly 63 (1956), 689–697; reprinted in I. Gessel and G.-C. Rota (eds.), Classic Problems in Combinatorics, Birkh¨auser, Boston, 1987. [226] G. P´olya and R. C. Read, Combinatorial Enumeration of Groups, Graphs, and Chemical Com- pounds, Springer-Verlag, New York, 1987. [227] G. P´olya, R. E. Tarjan, and D. R. Woods, Notes on Introductory Combinatorics, Progr. Comput. Sci., vol. 4, Birkh¨auser, Boston, 1983. [228] R. C. Prim, Shortest connection networks and some generalizations, Bell Syst. Tech. J. 36 (1957), 1389–1401. [229] H. Pr¨ufer, Beweis eines Satzes ¨uber Permutationen, Arch. Math. Phys. 27 (1918), 742–744. [230] H. Rademacher, On the partition function p(n), Proc. London Math. Soc. (2) 43 (1937), 241– 254. [231] S. P. Radziszowski, Small Ramsey numbers, Electron. J. Combin. (August 1, 2006), 60 pp. Dynamic Survey 1, revision 11. [232] F. P. Ramsey, On a problem of formal logic, Proc. London Math. Soc. (2) 30 (1930), no. 1, 264–286; reprinted in I. Gessel and G.-C. Rota (eds.), Classic Problems in Combinatorics, Birkh¨auser, Boston, 1987. [233] J. H. Redfield, The theory of group-reduced distributions, Amer. J. Math. 49 (1927), no. 3, 433– 455. [234] P. Reynolds and B. Tjaden, The Oracle of Bacon at Virginia, 2008. http://oracleofbacon.org. [235] J. Riordan, An Introduction to Combinatorial Analysis, John Wiley & Sons, New York, 1958. Reprinted by Dover, Mineola, NY, 2002. [236] , Combinatorial Identities, John Wiley & Sons, New York, 1968. Reprinted by Krieger, Huntington, NY, 1979. [237] , A budget of rhyme scheme counts, Second International Conference on Combinatorial Mathematics (New York, 1978) (A. Gewirtz and L. V. Quintas, eds.), Ann. New York Acad. Sci., vol. 319, New York Acad. Sci., New York, 1979, pp. 455–465. [238] F. S. Roberts and B. Tesman, Applied Combinatorics, 2nd ed., Pearson Education, Upper Saddle River, NJ, 2005. [239] N. Robertson, D. Sanders, P. Seymour, and R. Thomas, The four-colour theorem, J. Combin. Theory Ser. B 70 (1997), no. 1, 2–44. [240] H. Rogers Jr., Theory of Recursive Functions and Effective Computability, 2nd ed., MIT Press, Cambridge, MA, 1987. [241] J. Roitman, Introduction to Modern Set Theory, Pure Appl. Math., John Wiley & Sons, New York, 1990. [242] J. Rosser, Extensions of some theorems of G¨odel and Church, J. Symbolic Logic 1 (1936), no. 3, 87–91. [243] G.-C. Rota (ed.), Studies in Combinatorics, MAA Stud. Math., vol. 17, Math. Assoc. America, Washington, DC, 1978. [244] B. Russell, On some difficulties in the theory of transfinite numbers and order types, Proc. London Math. Soc. (2) 4 (1906), 29–53; reprinted in B. Russell, Essays in Analysis (D. Lackey, ed.), George Braziller, New York, 1973. [245] Z. Ryj´aˇcek, On a closure concept in claw-free graphs, J. Combin. Theory Ser. B 70 (1997), no. 2, 217–224. [246] H. J. Ryser, Combinatorial Mathematics, Carus Math. Monogr., vol. 14, Math. Assoc. America, 1963. 366 References [247] B. Schechter, My Brain is Open, Simon & Schuster, New York, 1998. [248] J. H. Schmerl, Recursive colorings of graphs, Canad. J. Math. 32 (1980), no. 4, 821–830. [249] [250] W. Schmitz, ¨Uber l¨angste Wege und Kreise in Graphen, Rend. Sem. Mat. Univ. Padova 53 , Minimal spanning trees, Proc. Amer. Math. Soc. 132 (2004), no. 2, 333–340. (1975), 97–103. [251] I. Schur, ¨Uber die Kongruenz xm + ym ≡ zm (mod p), Jahresber. Deutsch. Math.-Verein. 25 (1916), 114–117. [252] S. Shelah, Notes on partition calculus, Infinite and Finite Sets (Colloq., Keszthely, 1973; dedicated to P. Erd˝os on his 60th birthday), Vol. III (J. Hajnal, R. Rado, and V. S´os, eds.), Colloq. Math. Soc. J´anos Bolyai, vol. 10, North-Holland, Amsterdam, 1975, pp. 1257–1276. [253] W. Sierpi´nski, Cardinal and Ordinal Numbers, 2nd ed., Monografie Matematyczne, vol. 34, Pa´nstowe Wydawnictwo Naukowe, Warsaw, 1965. [254] S. G. Simpson, Subsystems of Second Order Arithmetic, Perspect. Math. Logic, Springer- Verlag, Berlin, 1999. [255] T. Skolem, Einige Bemerkungen zur axiomatischen Begr¨undung der Mengenlehre, Matematikerkongressen i Helsingfors den 4–7 Juli 1922, Den femte skandinaviska matematikerkongressen, Redog¨orelse, Akademiska-Bokhandeln, Helsinki (1922), 217–232; English transl., J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931 (1967), 290–301. [256] , Two remarks on set theory, Math. Scand. 5 (1957), 40–46; reprinted in , Se- lected works in logic (J. Fenstad, ed.), Universitetsforlaget, Oslo, 1970. [257] N. J. A. Sloane, The On-Line Encyclopedia of Integer Sequences, AT&T Knowledge Ventures, 2007. http://www.research.att.com/∼njas/sequences. [258] N. J. A. Sloane and S. Plouffe, The Encyclopedia of Integer Sequences, Academic Press, San Diego, CA, 1995. [259] R. I. Soare, Recursively Enumerable Sets and Degrees, Perspect. Math. Logic, Springer-Verlag, Berlin, 1987. [260] R. P. Stanley, Generating functions, Studies in Combinatorics (G.-C. Rota, ed.), MAA Stud. Math., vol. 17, Math. Assoc. America, Washington, DC, 1978, pp. 100–141. [261] , Enumerative Combinatorics, Vol. 1, Cambridge Stud. Adv. Math., vol. 49, Cambridge Univ. Press, Cambridge, 1997. [262] , Enumerative Combinatorics, Vol. 2, Cambridge Stud. Adv. Math., vol. 62, Cambridge Univ. Press, Cambridge, 1999. [263] D. Stanton and D. White, Constructive Combinatorics, Undergrad. Texts Math., Springer- Verlag, New York, 1986. [264] R. Steinberg, Solution to problem 4065: Three point collinearity, Amer. Math. Monthly 51 (1944), no. 3, 169–171. [265] J. J. Sylvester, Questions for solution, problem 11851, Educational Times 46 (1893), 156. [266] G. Szekeres and L. Peters, Computer solution to the 17-point Erd˝os-Szekeres problem, ANZIAM J. 48 (2006), no. 2, 151–164. [267] R. Thomas, An update on the four-color theorem, Notices Amer. Math. Soc. 45 (1998), no. 7, 848–859. [268] G. T´oth and P. Valtr, The Erd˝os-Szekeres theorem: Upper bounds and related results, Combinatorial and Computational Geometry (J. E. Goodman, J. Pach, and E. Welzl, eds.), Math. Sci. Res. Inst. Publ., vol. 52, Cambridge Univ. Press, Cambridge, 2005, pp. 557–568. References 367 [269] W. T. Tutte, The factorization of linear graphs, J. London Math. Soc. 22 (1947), no. 2, 107–111. [270] V. R. R. Uppuluri and J. A. Carpenter, Numbers generated by the function exp(1 − ex), Fi- bonacci Quart. 7 (1969), no. 4, 437–448. [271] P. Valtr, On empty hexagons, Surveys on Discrete and Computational Geometry: Twenty Years Later (J. E. Goodman, J. Pach, and R. Pollack, eds.), Contemp. Math., vol. 453, Amer. Math. Soc., Providence, RI, 2008, pp. 433–442. [272] J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931, Harvard Univ. Press, Cambridge, MA, 1967. [273] J. H. van Lint and R. M. Wilson, A Course in Combinatorics, 2nd ed., Cambridge Univ. Press, Cambridge, 2001. [274] O. Veblen, An application of modular equations in analysis situs, Ann. of Math. 2 (1912/13), no. 14, 86–94. [275] J. Venn, Symbolic Logic, Macmillan, London, 1881. [276] J. von Neumann, Eine Axiomatisierung der Mengenlehre, J. Reine Angew. Math. 154 (1925), 34–56; English transl., J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931 (1967), 393-413. [277] K. Wagner, Bemerkungen zum Vierfarbenproblem, Jahresber. Deutsch. Math.-Verein. 46 (1936), 21–22. [278] H. Walther, ¨Uber die Nichtexistenz eines Knotenpunktes, durch den alle l¨angsten Wege eines Graphen gehen, J. Combin. Theory 6 (1969), 1–6. [279] H. Walther and H. J. Voss, ¨Uber Kreise in Graphen, VEB Deutscher Verlag der Wissenschaften, Berlin, 1974. [280] G. S. Warrington, Juggling probabilities, Amer. Math. Monthly 112 (2005), no. 2, 105–118. [281] D. B. West, Introduction to Graph Theory, 2nd ed., Prentice Hall, Upper Saddle River, NJ, 2000. [282] Western Maryland College Problems Group, Problem 11007, Amer. Math. Monthly 110 (2003), no. 4, 340. Solution, R. Tauraso, http://www.mat.uniroma2.it/∼tauraso/AMM/amm2003.html. [283] N. Wiener, A simplification of logic of relations, Proc. Cambridge Phil. Soc. 17 (1912-1914), 387–390. [284] H. S. Wilf, Generatingfunctionology, 3rd ed., A K Peters, Wellesley, MA, 2006. [285] R. Wilson, Four Colors Suffice, Princeton Univ. Press, Princeton, NJ, 2002. [286] J. Wojciechowski, A criterion for the existence of transversals of set systems, J. London Math. Soc. (2) 56 (1997), no. 3, 491–503. [287] J. Worpitzky, Studien ¨uber die Bernoullischen und Eulerischen Zahlen, J. Reine Angew. Math. 94 (1883), 203–232. [288] E. M. Wright, Burnside’s lemma: A historical note, J. Combin. Theory Ser. B 30 (1981), no. 1, 89–90. [289] Y. Yang, On a multiplicative partition function, Electron. J. Combin. 8 (2001), no. 1, R19, 14 pp. [290] T. Zamfirescu, On longest paths and circuits in graphs, Math. Scand. 38 (1976), no. 2, 211–239. [291] E. Zermelo, Beweis, daß jede Menge wohlgeordnet werden kann, Math. Ann. 59 (1904), no. 4, 514–516; English transl., J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931 (1967), 139–144. [292] , Neuer Beweis f¨ur die M¨oglichkeit einer Wohlordnung, Math. Ann. 65 (1908), no. 1, 107–128; English transl., J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931 (1967), 183–198. 368 References [293] , Untersuchungen ¨uber die Grundlagen der Mengenlehre I, Math. Ann. 65 (1908), no. 2, 261–281; English transl., J. van Heijenoort, From Frege to G¨odel. A Source Book in Mathematical Logic, 1879–1931 (1967), 199-215. Index Acquaintance Graph, 26 adjacency matrix, 22 of vertices, 5 Aharoni, Ron, 338 Aigner, Martin,
127, 277, 278 alephs, 308 ℵ0, ℵ1, . . . , 312 Alexander the Great, 52 Alice in Wonderland, 1 Alma, Alabama, 144, 148 Amarillo, Texas, 137 Anacreontea, 336 analytical sets, 351 Anastasia, 111 Anderson, Poul, 202 Andrews, George E., 225, 278 Anquetil, Jacques, 200 Anthony and Cleopatra, 83 anthracene, 207 anvil salesman, 51 Appel, Kenneth, 95 approximating irrationals, 153 Aragorn, 301 Arizona Republic, The, 150 Armstrong, Lance, 200 arrow notation, 287, 322 Arthur, King of the Britons, 191, 227 Atlantic Coast Conference, 4 average degree, 38, 80, 93 axiom of choice AC, 298 AC2, 298 ACF, 302 CAC, 302, 303 CACF, 302, 329 equivalences, 298–303, 317 PIT, 329 weak versions, 302–303 Zorn’s Lemma, 317 axioms of ZFC choice, 298 empty set, 292 extensionality, 292 infinity, 296 pairing, 293 power set, 294 regularity, 296 replacement, 296 separation, 294 370 Index union, 293 Bacon, Kevin game, 27 number, 27 person, 26, 27 Ba¨ıou, Mourad, 279 Balinski, Michel L., 279 Ballad, 102 ballots, 136 Banks, David C., 278 Barab´asi, Albert-L´aszl´o, 127 baseball pitchers, 154 Bedivere, Sir, 190, 191, 228 Beineke, Lowell W., 126 Bell numbers, 233, 237–239 complementary, 240, 279 Benjamin, Arthur T., 278 benzene, 206 Berge, Claude, 277 Berge’s Theorem, 104 Bernstein, Felix, 307 Theorem, see Cantor–Bernstein Bert and Ernie, 4 Bielak, Halina, 20 big one, the, 304, 305 Biggs, Norman L., 126 bijection, 192 binary sequence, 184 binomial coefficients, 133 absorption/extraction, 142, 170 addition, 138, 170 cancellation, 142, 170 expansion, 138 generalized, 168 hexagon identity, 143 negating upper index, 169 parallel summation, 143, 170 summing on upper index, 141 symmetry, 138 binomial theorem, 139 for factorial powers, 143 generalized, 168 bipartite graph, 13 complete, 13 Birkhoff, George, 97 Birkhoff Diamond, 87 Birkhoff–Lewis Reduction Theorem, 98 Blakley, George Robert, ix Bloch, Andr´e, 156 Bobet, Louision, 200 Bobo, Mississippi, 150 Bollob´as, B´ela, 126 Bond, James, 101 boots and socks, 298 Borwein, Peter B., 267, 278, 279 bound degree, 76 Boundin’, 209 box principle, 151 bracelets, 209, 213, 215 Brass, Peter, 267, 274, 279 bridge card game, 133 in a graph, 8, 10 in K¨onigsberg, 1, 52–54 Bridges, Robert, 30 Brooks’s Theorem, 90 Browning, Elizabeth Barrett, 248 Buckley, Fred, 126 buffet line, 162 Bug Tussle, Texas, 150 Burnside, Ambrose E., 196 Burnside, William, 199 lemma of, 199 burnt orange, 217 Burr, Stefan, 125 Butler, Samuel, 2 C++ variable names, 134 cafeteria, 177 Calverly, C. S., 102 Campbell, Thomas, 17 Candide, 292 Cantor, Georg, 290, 353 Cantor’s Theorem, 305 Cantor–Bernstein Theorem, 306 applications, 307–308, 312, 314, 316, 343 proof, 306, 316 carboxyl group, 207 cardinal, 311–312 color, 217 espousable, 341 large, 322 measurable, 323 Ramsey, 323, 326 regular, 313, 314 Richelieu, 322 singular, 313 strong limit, 322 strongly inaccessible, 322 subtle, 323, 345 weakly compact, 322, 324–326 weakly inaccessible, 320–322 carnival, 171 Carpenter, John A., 279 Carroll, Lewis, 1, 109 Cartesian product, 295, 300 Catalan numbers, 185–188 Cauchy–Binet Formula, 50 Cayley, Arthur, 43, 44 Cayley’s Tree Formula, 44 ceiling function (x), 153 center of a graph, 18, 19 of a tree, 36 Chakerian, Gulbank D., 279 changing money, 171–175 in 1875, 175 characteristic path length, 29 Chartrand, Gary, 126 Chava and Hodel, 250 chemistry, 32, 206–208 child vertex, 188 chromatic number, 86 bounds, 88–93 chromatic polynomial, 98, 159, 163 properties, 101 relation to Four Color Problem, 101 Chv´atal, V´aclav, 63, 124, 125 circuit, 6 Eulerian, 55 claw, 66, 69, 72 Index 371 clique number, 92 clustering coefficient of a graph, 29 of a vertex, 29 cofactor, 48 Coffey, Paul, 242 college admissions, 249, 263 color classes, 86 k-colorability of a graph, 86 coloring of edges, 116 of vertices, 86 k-coloring of a graph, 86 proper, 86 combinatorial geometry, 264 commemorative coins, 176, 177 complement, 11 complementary Bell numbers, see Bell numbers complete bipartite graph, 13 graph, 10 multipartite graph, 16 complete graph, 8 composition, 226 computability, 349 Comtet, Louis, 241, 277 concert hall, 242 Conehead, Connie, 304 connected component, 8 connected graph, 7 Connecticut Yankee in King Arthur’s Court, A, 227 connectives, 291 connectivity of a graph, 8 constructible universe (L), 320 convolution of two sequences, 186 Conway, John H., 279 Cooleemee, North Carolina, 150 countable sets, 305 countable union, 314 cover, 109 Cowell, Charlie (anvil salesman), 51 Coxeter, Harold Scott MacDonald, 265 372 Index k-critical graphs, 88 Csima, J´ozsef, 267 cube, 81 cut in a network, 110 capacity, 111 set, 8 vertex, 8, 10 cycle Hamiltonian, 60 index (of a group), 201 notation (for permutations), 192 the graph Cn, 12 within a graph, 6 Damerell, R. M., 331 de Bruijn, Nicolaas Govert, 278 enumeration formula, 212 de Wannemacker, Stefan, 240 Debrunner, Hans E., 279 deck of cards, 133 Dedekind finite, 303 degree average, 38, 80, 93 matrix, 48 of a vertex, 6 sequence, 6 DeMorgan, Augustus, 2, 94 Denver, John, 116 deranged twins, 163 derangements, 160–161, 163, 231 detour order, 67, 93 path, 67, 93 Devlin, Keith J., 352 diameter of a graph, 18 dice, six-sided, 200, 202, 206 Diestel, Reinhard, 126, 327, 353 difference operator, 137 digraph, see directed graph Dijkstra, Edsger Wybe, 265 Dirac, Gabriel Andrew, 62, 84 directed graph (digraph), 3 Dirichlet, Johann Peter Gustav Leje- une, 151, 153 Dirichlet’s approximation theorem, 153 disjointification, 303 Dissertatio de Arte Combinatoria, vii, 129 distance between vertices, 18 matrix, 25 Dobi´nski’s formula, 239 dodecahedron, 60, 81 Drake, Frank R., 352 Duffus, Dwight, 66 Dumas, Alexandre, 124 Dumitrescu, Adrian, 275 Dunbar, Jean, 72 eccentricity, 18 Edberg, Stefan, 231 edge, 2 deletion, 7 edge set, 5 edge cover, 109, see cover Edmonton Oilers, 242 Edwards, Anthony William Fairbank, 277 Eeckhout, Jan, 255 Ehrenfeucht, Andrzej, 276 Einstein, Albert, 97, 130 Ekai, Mumon, 304 empty graph, 11 product, 132 set (∅), 290, 299 axiom, see axioms of ZFC end vertices of a walk, 6 of an edge, 5 Enderton, Herbert B., 352 Epcot Center, 80 equivalence class, 197 relation, 197, 315 Erd˝os, Paul, 28, 30, 63, 116, 122, 123, 127, 152, 264, 270, 279, 280, 325 number, 28 Eriksson, Kimmo, 278 Euler, Leonhard and K¨onigsberg bridge problem, 1, 52–54 characterization of Eulerian graphs, 55 Formula (for planar graphs), 78, 81 losing sight, 78 Pentagonal Number Theorem, 222 ϕ function, 158, 162 Eulerian circuit, 55 graph, 55 numbers, 242–247 trail, 55 F´ary, Istv´an, 77 factorial, 132 falling factorial power, 132 Faudree, Ralph, 69 Feder, Tom´as, 279 Federer, Roger, 231 Feferman, Solomon, 344, 346 Ferrers diagram, see Young diagram Fezzik, 191 Fibonacci numbers, 177–179 generalized, 185 Fiddler on the Roof, 250 Filthy Frank, 4 finger, 304 finite set, 282 First Theorem of Graph Theory, 6 Five Color Theorem, 95 flags, 161 Flatliners, 26 Fleury’s algorithm, 59 floor function (x), 153 flow, 110 football American, 248 International Football Associa- tion, 135 Index 373 Laws of the Game, 135 forbidden subgraphs, 65 forest, 31 number of edges, 35 Foulds, Leslie R., 126 Four Color Problem, 2, 93 Four Color Theorem, 94 fractional part function ({x}), 153 Fraenkel, Abraham A., 290, 294, 296 Franklin, Benjamin, 277 Franklin, Fabian, 222 Frege, Gottlob, 290 Frick, Marietjie, 72 Friedman, Harvey M., 344, 347, 350 Frink, Orrin, 84 Frobenius, Ferdinand G., 199 From Russia with Love, 101 Frost, Robert, 5, 282 Fuhr, Grant, 242 Fujita, Shinsaku, 278 full house, 134 function assignment, 345 fusion, 283 G¨odel, Kurt F., 318 G¨odel’s Incompleteness Theorem First, 318–320 Second, 319–320 Galahad, Sir, 191 Gale, David, 250, 279 Gale–Shapley algorithm, 250 Gallai, Tibor, 68, 265 Gateless Gate, The, 304 Gawain, Sir, 191 Gekko, Gordon, 88 general position, 270 generating function, 164 exponential, 238 geometry of position, 54 George of the Jungle, 324 Gerken, Tobias, 277 Gessel, Ira M., 279, 280 Gibson, William, 308 Gilbert, Sir William S., 137 Giving Tree, The, 34 374 Index Goodman, Seymour, 65 Gould, Ronald J., viii, 62, 66, 69, 126 Graham, Ronald L., 127, 171, 277, Gretzky, Wayne, 242 Gross, Jonathon L., 126 Grossman, Jerry, 28 group 278, 280 Grand Slam matches, 231 Grant, Cary, 166 Grant, Ulysses S., 196 Grantham, Jon, 181 Granville, Andrew, 277 graph bipartite, 13 center, 18 clique number, 92 clustering coefficient, 29 complement, 11 complete, 8, 10 bipartite, 13 multipartite, 16 connected, 7 connectivity, 8 critical, 88 definition, 2 diameter, 18 directed, 3 empty, 11 Eulerian, 55 Hamiltonian, 60 infinite, 4 isomporphic pairs, 15 kth power, 21 line, 16, 64, 66, 67, 70, 93 matching, 104 order, 5 periphery, 18 planar, 74 radius, 18 Ramsey theory, 124 regular, 11 self-centered, 21 size, 5 traceable, 61 weighted, 39 Great Gatsby, The, allusion to, 260 greedy algorithm, 88 abelian, 191 alternating, 194 cyclic, 193 definition, 191 dihedral, 193 generated by an element, 193 symmetric, 192 Gr¨unwald, Tibor, 265 Guare, John, 26 Guinness, Alec, 30 gurus, 157 Gusfield, Dan, 279 Guthrie, Francis, 94 Guy, Richard K., 279 Hadwiger, Hugo, 279 Haken, Wolfgang, 95 Hall, Daryl and Oates, John, 328 Hall, Monty, 104, 105 Hall, Philip, 105, 328 Hall Jr., Marshall, 277, 328 Hall’s Theorem, 105, 328 corollary for regular graphs, 112 halting problem, 349 hamburgers, 170 Hamilton, Al, 242 Hamilton, Sir William Rowan, 61, 94 Hamiltonian cycle, 60 graph, 60 path, 60, 351 handshakes, 190 Hanoi, Tower of, 181 Harary, Frank, 124, 126, 278 Harborth, Heiko, 277 Hardy, Godfrey H., 224 harey problem, 177 harmonic mean, 155 Harris, Priscilla, viii Harris, Sophie, viii Harris, Will allusion to, vi Harry Potter and the Prisoner of Azk- aban, 27 Heawood, Percy, 94, 95 Hedetniemi, Stephen, 19, 65 Heine–Borel Theorem, 285 heliotrope, 209, 217 Herman, Jiˇr´ı, 279 Hierholzer, Carl, 55 Hierholzer’s algorithm, 57 Higgledy-Piggledy, 2 Hilbert, David, 281, 290 Hinault, Bernard, 200 Hirst, the other Prof., ix Hitchcock, Alfred, 166 Hoffma
n, Paul, 127 Hollywood Graph, 27 hopscotch, 181 Horton, Joseph D., 277 Houston, Whitney, 343 humuhumunukunukuapua’a, 150 hungry fraternity brother, 235 math major, 177 Hunting of the Snark, The, 109 hydroxyl group, 206 hypergraph, 4 ichthyologists, 150 icosahedron, 81 Icosian Game, The, 60 incidence matrix, 48 of vertex and edge, 5 independence number, 63, 93 independent set of vertices, 63 independent zeros, 111 induced subgraph, 12 Indurain, Miguel, 200 infinite set, 282 injective function, 192 Internet Movie Database, 27 intersecting detour paths, 67 intersection, 294 Index 375 invariant set, 198 Irish Blessing, An, 10 irrational numbers, 153 Irving, Robert W., 279 isomer, 206 isomorphism, 15 Jacobson, Michael S., 66 Jech, Thomas J., 352 Jefferson, Thomas, 176 jelly beans, 170 JFK, 27 Johnson, Scott, 275 Just Men of Cordova, The, 352 Kalbfleisch, James G., 274 Kanamori, Akihiro, 353 Kelly, Leroy M., 265 Kempe, Alfred, 94, 95 killer rabbits, 177 Kirchhoff, Gustav, 47, 48 Klee Jr., Victor L., 264, 279 Kleene, Stephen C., 318, 353 Klein, Esther, 264, 270 knights of the round table, 227–228 Knuth, Donald E., ix, 171, 255, 277– 279 K¨onig, D´enes, 284, 328 K¨onig, Julius, 284, 307 K¨onig–Egerv´ary Theorem, 109 K¨onig’s Lemma, 283, 302, 326, 351 K¨onigsberg Bridge Problem, 1, 52– 54 Kruskal’s algorithm, 40–42 Kuˇcera, Radan, 279 Kuratowski, Kazimierz, 83, 84 Kuratowski’s Theorem, 84 Kurri, Jari, 242 L, constructible universe, 320 Laffey, Thomas, 240 Lancelot, Sir, 228 lapis lazuli, 201, 203, 214 Last of the Mohicans, The, allusion to, 260 376 Index lauwiliwilinukunuku’oi’oi, 150 lavender, 217 lazy professor, 160, 163 leaf, 31 number in tree, 35 tea, 34 Leaves of Grass, 181 Lehrer, Tom, 312 Leibniz, Gottfried Wilhelm, vii, 129 LeMond, Greg, 200 length, 6 Leonardo of Pisa, 177 Lesniak, Linda, 126 Levy, Azriel, 352 Lewinter, Marty, 126 Lewis and Clark expedition, 176 Liar, Liar, 67 limerick, 236 Lincoln, Abraham, 176, 177 line graph, 16, 64, 66, 67, 70, 93 linear ordering, 309 k-critical, 347 Linton, Stephen A., 278 Lloyd, E. Keith, 126 Logothetti, David E., 279 London Snow, 30 Longfellow, Henry W., 38, 285 Looney Tunes, 265 lottery Florida Fantasy 5, 144 Florida Lotto, 144 Lotto Texas, 133, 137, 141 repetition allowed, 171 Rhode Island Wild Money, 137 Texas Two Step, 136 Virginia Win For Life, 144 Lov´asz, L´aszl´o, 72, 90, 277 Love’s Labour’s Lost, 74 Lucas, ´Edouard, 181 numbers, 180 Makai, Endre, 274 Man in black, 297 Marichal, Jean-Luc, 279 Mark, gospel of, 171 maroon, 217 marriage infinite sets, 327–344 Secrets of a Successful, 218 stable, see stable marriage matching, 102 graph, 104 M -alternating path, 104 M -augmenting path, 104 many-to-many, 264 many-to-one, 263 maximal, 102 maximum, 102 perfect, 102, 111, 343 saturated edges, 102 stable, 248 optimal, 252 pessimal, 253 strongly stable, 259 super-stable, 259 weakly stable, 259 Mathematical Collaboration Graph, 28 Matouˇsek, Jiˇr´ı, 275, 279 Matrix Tree Theorem, 48 Matrix, The, 21 Matthews, Manton, 70 Matthews and Sumner’s Conjecture, 69 Max Flow Min Cut Theorem, 111 maximal planar graph, 80 maximum degree, 6 McEnroe, John, 231 McPeake, Sharon, viii Meade, George G., 196 Meeks, Randy, v Mendelson, Elliott, 353 Menger’s Theorem, 110 Merckx, Eddy, 200 Merry Wives of Windsor, The, 217 Messier, Mark, 242 methyl group, 206 metric, 17 Mih´ok, Peter, 72 Miles Jr., Ernest P., 278 Milgram, Stanley, 26 Milner, Eric C., 331, 340 Milton, John, 320 minimum degree, 6 minimum weight spanning trees, 39– 42 Moby Dick, allusion to, 260 model of ZFC, 321 Moe, Larry, and Curly, 87 Mona Lisa Overdrive, 308 monotonic subsequences, 152 Montagues, Capulets, and Hatfields, 73 Monticello, 176 Monty Python and the Holy Grail, 168, 190 Morris Jr., Walter D., 275, 279 Moschovakis, Yiannis, 352 Moser, William O. J., 267, 274, 279 Mossinghoff, Alexandra allusion to, vi Mossinghoff, Amanda allusion to, ix Mossinghoff, Kristine, ix Mossinghoff, Michael J., 278, 279 Mulcahy, Colm, 278 multigraph, 3 multinomial coefficients, 144–149 analogue of Vandermonde’s con- volution, 150 addition, 146 expansion, 145 symmetry, 145 multinomial theorem, 147, 167 for factorial powers, 149 multiset, 147 Music Man, The, 51 N is a Number, 30 naphthalene, 206 naphthol, 206 Nash-Williams, Crispin St. John Al- vah, 335, 338 Nastase, Ilie, 231 National Basketball Association, 135 Index 377 National Resident Matching Program, 249 necklaces, 191, 198–203 neighborhood closed, of a vertex, 6 of a set, 6 open, of a vertex, 5 Neˇsetˇril, Jaroslav, 280 neurotic running back, 248 Nicol´as, Carlos M., 277 Night of the Lepus, 177 Nijenhuis, Albert, 277 North American Numbering Plan, 131 North by Northwest, 166 occupancy problems, 217–218 Oconomowoc, Wisconsin, 150 octahedron, 81, 217 ogre and ogress, 255, 258 Oldman, Gary, 27 oppos ites attract, 209, 213, 215 orbit, 198 order of a graph, 5 ordinal, 309–312, 317 ordinary line, 265 Ore, Oystein, 63, 353 Osburn, Robert, 240 Othello, 237 Overmars, Mark, 277 Pach, Janos, 267, 274, 279 Padovan sequence, 180 Palmer, Edgar M., 278 Pangloss, 292 paradise Cantor’s, 290 Lost, 320 tasting, 292 parent vertex, 188 partite set, 13 τ -partitionable graphs, 71 partitions, 175, 218–225 conjugate, 221 distinct parts, 221, 225 Pascal, Blaise, 80, 139 378 Index pyramid of, 146 triangle of, 139 Patashnik, Oren, 171, 277, 278 path closed, 6 Hamiltonian, 60, 351 the graph Pn, 12 within a graph, 6 Path Partition Conjecture, 71 pattern inventory, 203 Peano Arithmetic (PA), 318 Pearl, The, allusion to, 260 Pens´ees, 80 pentagonal number, 226 Percival, Sir, 191, 228 perfect matching, 102, 111 in regular graphs, 114 periphery of a graph, 18, 20 permutation, 132 as function, 191 even and odd, 194 Perrin sequence, 180 Peters, Lindsay, 274 Petersen, Julius, 114, 115 Petersen graph, 64, 87, 115 Petersen’s Theorem, 115 Petkovˇsek, Marko, 277 phenomenology exam, 135 Phoenix, Arizona, 150, 151 phone numbers, 131 pigeonhole principle finite, 118, 150–152, 154, 281, 312 infinite, 282, 313 ultimate, 313 variations, 318 ping-pong balls, 148, 235 pipe organ, 242, 244 Pirates of Penzance, The, 137 planar graph, 74 maximal, 80 straight line representation, 77 planar representation, 74 Pleasures of Hope, The, 17 Pliny the Younger, 31 Plouffe, Simon, 188, 279 Podewski, Klaus-Peter, 335 poker card game, 133, 136, 162 chips, 148, 169, 218, 219 multiple decks, 167, 169 two decks, 166–167 P´olya, George, 156, 171, 190, 277, 278, 280 enumeration formula, 203 polyhedra, 80 Poor Richard’s Almanack, 277 power set (P), 290, 299 axiom, see axioms of ZFC Pr¨ufer sequence, 51 Prim’s algorithm, 43 prime numbers, 159, 163 Princess Bride, The, 191, 297 Princess Fiona, 255 Princess Leia, 93 principle of inclusion and exclusion, 158 generalization, 163 product rule, 131 proverbial alien, 118 Pr¨ufer, Heinz, 44 pseudograph, 3 Purdy, George B., 279 quantifiers, 291 Quinn, Jennifer J., 278 Rademacher, Hans, 224 radius of a graph, 18 Radziszowski, Stanisław P., 127 Ramanujan, Srinivasa, 224 Ramsey, Frank P., 116, 271, 280, 287 Ramsey numbers classical, 116 known bounds, 123, 273 known values, 122 graph, 124 Ramsey’s Theorem failure at ℵ1, 324 finite, 272, 286, 288 hypergraphs, 272, 275 infinite, 287 pairs, 286, 351 triples, 289, 351 variations, 352 ransom note, 176 Read, Ronald C., 278 Redfield, J. Howard, 278 region, 75 registrar, 162 regressive value, 345 regular graph, 11 polyhedra, 81 relatively prime, 158 relief agency, 208, 216 restaurant gourmet, 162 steakhouse, 162 restriction, 332 Return of the King, The, 301 reverse mathematics, 350 Reynolds, Patrick, 27 rhodonite, 201, 203, 214 rhyming schemes, 236, 240, 279 ridgeline, 190 Riordan, John, 277, 279 rising factorial power, 132 Roberts, Fred S., 126 Robertson, Neil, 95 Robin Hood, 126 Roitman, Judith, viii, 352 Romeo and Juliet, 73 rose quartz, 201, 203, 214 Rota, Gian-Carlo, 129, 279, 280 Rothschild, Bruce L., 127 round tables, 191, 197, 199, 227, 229 Russell, Bertrand, 295, 298 Ryj´aˇcek, Zdenˇek, 70 Ryser, Herbert J., 277 Sadie Hawkins dance, 254 Sanders, Daniel, 95 Sawyer, Eric T., 267 Schechter, Bruce, 127 Index 379 Schl¨omilch, Oskar X., 241 Schmitz, Werner, 69 Schr¨oder, see Cantor–Bernstein Schubfachprinzip, 151 Schur, Issai, 276 Schuster, Seymour, 84 Scream 2, v SDR, 107, 301, 327 version of Hall’s Theorem, 107 self-centered graph, 21 separated set, 268 separating set, 110 Seuss, Dr., 85 Seymour, Paul, 95 Shakespeare, William, 73, 74, 83, 164, 217, 237 characters, 257 Shapley, Lloyd S., 250, 279 Shelah, Saharon, 338, 341 Shin, Jae-Il, viii Shrek 2, 255 Sierpi´nski, Wacław, 352 Σ1 1-complete sets, 351 Silverstein, Shel, 34 Simpson, Homer, 218 Simpson, Stephen G., 350 ˇSimˇsa, Jarom´ır, 279 six degrees of separation, 26 size of a graph, 5 Skolem, Thoralf, 290, 294, 296 Sloane, Neil James Alexander, 188, 279 small world networks, 28 Smith, Paul, 84 soccer team, 135 socks, 161 Soltan, Valeriu P., 275, 279 Song of Hiawatha, The, 285 sonnet, 236 Sonnets from the Portuguese, 248 Soso, Mississippi, 150 Sound of Trees, The, 282 space cruiser, 200 spanning tree, 39 counting, 43 380 Index of minimum weight, 39–42 problem of, 265–267 Spencer, Joel H., 127 stabilizer, 198 stable enrollment, 264 stable marriage algorithm, 250 main theorem, 252 problem, 248–262 with indifference, 259–261 with sets of different sizes, 261– 262 with unacceptable partners, 256– 259 stable roommates, 249, 279 staircase, 189 Stanley, Richard P., 188, 203, 277, 278 Stanton, Dennis, 277 Stanton, Ralph Gordon, 274 star, 34 Star Wars, 93 stationary set, 339 Steffens, Karsten, 335 Stirling cycle numbers, 227–230 set numbers, 231–235 Stockmeyer, Paul, 278 strikeouts, 154 stump, 31 subdivision of a graph, 84, 85 of an edge, 84 of Verona, 73 subgraph, 12 forbidden, 65 induced, 12 subgroup, 193 Sullivan, Sir Arthur S., 137 sum rule, 131 Sumner, David, 70 surjective function, 192 Sweet 16, 32 Sylvester James Joseph, 265 Looney Tunes cat, 265 system of distinct representatives, see SDR Sysło, Maciej, 20 Szekeres, George, 122, 152
, 264, 274, 279, 280 Tarjan, Robert E., 277 Tarski, Alfred, 325 Tarsy, Michael, 275 tennis, 231 termination argument, 265 Tesman, Barry, 126 tetrahedron, 81 tetramethylnaphthalene, 206 tetraphenylmethane, 208 Texas cities, 137, 150, 249, 254 lottery, see lottery thistle, 217 Thomas, Robin, 95 Thompson, Emma, 27 Thornhill, Roger, 166 Three Musketeers, The, 322 Thys, Philippe, 200 Tolkein, J. R. R., 301 Tour de France, 200 trace of a square matrix, 25 traceable graph, 61 trail, 6 closed, 6 Eulerian, 55 Trait´e du Triangle Arithm´etique, 139 transfinite induction, 332 recursion, 332 transitive set, 309, 316 transposition, 194 tree, 30, 283 Aronszajn, 326 as a model, 31–32 as a subgraph, 36 binary decision, 32 characterization, 35, 38, 42 definition, 31 in chemistry, 32 in probability, 31 in programming, 32 labeled, 43 labels, 283, 284 named, 352 number of edges, 34 palm, 34 property, 326 rooted, 188 small, 31 spanning, 39, 352 strictly binary, 188 triangulation, 189 tribonacci numbers, 184 trimethylanthracene, 207 trinomial coefficients, 150 triphenylamine, 207 Tristram, Sir, 191, 228 Tutte’s Theorem, 112 Twain, Mark, 227 twig, 31 Typee, allusion to, 260 typesetter’s comfort, 290 Tyson, Mike, 150, 151 Unalaska, Alaska, 150 union, 290, 299 axiom, see axioms of ZFC United Nations, 135 universal set, 295 Uppuluri, V. R. Rao, 279 Urban Legend, 18 van Heijenoort, Jean, 353 van Lint, Jacobus H., 277 Vandermonde’s convolution, 142, 150 Veblen, Oswald, 55 Venn, John, 156 Venn diagram, 157 vertex, 2 cut set, 8 deletion, 7 vertex set, 5 vexillologist, 161 Index 381 Village Blacksmith, The, 38 Vizzini, 297 volleyball tournament, 184 Voyage Round the World, A, 60 Wagner, Klaus, 77 walk, 6 Walla Walla, Washington, 150 Wallace, Edgar, 352 Wall Street, 88 Walther, Hansjoachim, 68 Warrington, Gregory S., 279 Washington, George, 177 weakly ordered rankings, 259 weight function, 39 weighted graph, 39 well-ordering, 309–311 West, Douglas B., 126 White, Dennis, 277 Whitman, Walt, 181 Wilf, Herbert S., 240, 277, 278 Wilson, Richard M., 277 Wilson, Robin J., 126 Winter’s Tale, The, 164 wisteria, 217 Wojciechowski, Jerzy, 335 Woods, Donald R., 277 Worpitzky’s identity, 247 Yang, Yifan, 240 Yellen, Jay, 126 Young diagram, 220 Zamfirescu, Tudor, 68 Zeilberger, Doron, 277 Zermelo, Ernst, 290, 311 ZF and ZFC, 292 ZFC, 290 axioms, see axioms of ZFC limitations, 318, 320, 344 Ziegler, G¨unter M., 278 zodiac sign, 170 Zorn’s Lemma, 311, 317
= 0 − δS δx + ˙x · d dt ∂L ∂ ˙x + ¨x · ˙x · d dt ∂L ∂ ˙x ∂L ∂ ˙x So we have If ∂L ∂t = 0, then d dt L − ˙x · ∂L ∂ ˙x = ∂L ∂t . ˙x · ∂L ∂ ˙x − L = E for some constant E. For example, for one particle, E = m| ˙x|2 − 1 2 m| ˙x|2 + V = T + V = total energy. Example. Consider a central force field F = −∇V , where V = V (r) is independent of time. We use spherical polar coordinates (r, θ, φ), where x = r sin θ cos φ y = r sin θ sin φ z = r cos θ. So So T = 1 2 m| ˙x|2 = m 1 2 ˙r2 + r2( ˙θ2 + sin2 θ ˙φ2) L = 1 2 m ˙r2 + 1 2 mr2 ˙θ2 + sin2 θ ˙φ2 − V (r). We’ll use the fact that motion is planar (a consequence of angular momentum conservation). So wlog θ = π 2 . Then L = 1 2 m ˙r2 + 1 2 mr2 ˙φ2 − V (r). 25 3 Hamilton’s principle IB Variational Principles Then the Euler Lagrange equations give m¨r − mr ˙φ2 + V (r) = 0 mr2 ˙φ = 0. d dt From the second equation, we see that r2 ˙φ = h is a constant (angular momentum per unit mass). Then ˙φ = h/r2. So If we let m¨r − mh2 r3 + V (r) = 0. Veff = V (r) + mh2 2r2 be the effective potential, then we have m¨r = −V eff (r). For example, in a gravitational field, V (r) = − GM r . Then Veff = m − GM r + . h2 2r2 3.2 The Hamiltonian In 1833, Hamilton took Lagrangian mechanics further and formulated Hamiltonian mechanics. The idea is to abandon ˙x and use the conjugate momentum p = ∂L ∂ ˙x instead. Of course, this involves taking the Legendre transform of the Lagrangian to obtain the Hamiltonian. Definition (Hamiltonian). The Hamiltonian of a system is the Legendre transform of the Lagrangian: H(x, p) = p · ˙x − L(x, ˙x), where ˙x is a function of p that is the solution to p = ∂L ∂ ˙x . p is the conjugate momentum of x. The space containing the variables x, p is known as the phase space. Since the Legendre transform is its self-inverse, the Lagrangian is the Legendre transform of the Hamiltonian with respect to p. So with L = p · ˙x − H(x, p) ˙x = ∂H ∂p . Hence we can write the action using the Hamiltonian as S[x, p] = (p · ˙x − H(x, p)) dt. 26 3 Hamilton’s principle IB Variational Principles This is the phase-space form of the action. The Euler-Lagrange equations for these are ˙x = , ˙p = − ∂H ∂p ∂H ∂x Using the Hamiltonian, the Euler-Lagrange equations put x and p on a much more equal footing, and the equations are more symmetric. There are also many useful concepts arising from the Hamiltonian, which are explored much in-depth in the II Classical Dynamics course. So what does the Hamiltonian look like? Consider the case of a single particle. The Lagrangian is given by L = 1 2 m| ˙x|2 − V (x, t). Then the conjugate momentum is p = ∂L ∂ ˙x = m ˙x, which happens to coincide with the usual definition of the momentum. However, the conjugate momentum is often something more interesting when we use generalized coordinates. For example, in polar coordinates, the conjugate momentum of the angle is the angular momentum. Substituting this into the Hamiltonian, we obtain H(x, pp|2 + V. = 1 2m 2 p m + V (x, t) So H is the total energy, but expressed in terms of x, p, not x, ˙x. 3.3 Symmetries and Noether’s theorem Given F [x] = β α f (x, ˙x, t) dt, suppose we change variables by the transformation t → t∗(t) and x → x∗(t∗). Then we have a new independent variable and a new function. This gives F [x] → F ∗[x∗] = β∗ α∗ f (x∗, ˙x∗, t∗) dt∗ with α∗ = t∗(α) and β∗ = t∗(β). There are some transformations that are particularly interesting: Definition (Symmetry). If F ∗[x∗] = F [x] for all x, α and β, then the transformation ∗ is a symmetry. This transformation could be a translation of time, space, or a rotation, or even more fancy stuff. The exact symmetries F has depends on the form of f . For example, if f only depends on the magnitudes of x, ˙x and t, then rotation of space will be a symmetry. 27 3 Hamilton’s principle IB Variational Principles Example. (i) Consider the transformation t → t and x → x + ε for some small ε. Then F ∗[x∗] = β α f (x + ε, ˙x, t) dx = β α f (x, ˙x, t) + ε ∂f ∂x dx by the chain rule. Hence this transformation is a symmetry if ∂f However, we also know that if ∂f ∂x = 0. ∂x = 0, then we have the first integral ∂f ∂ ˙x = 0. d dt So ∂f ∂ ˙x is a conserved quantity. (ii) Consider the transformation t → t − ε. For the sake of sanity, we will also transform x → x∗ such that x∗(t∗) = x(t). Then F ∗[x∗] = β α f (x, ˙x, t − ε) dt = β α f (x, ˙x, t) − ε ∂f ∂t dt. Hence this is a symmetry if ∂f We also know that if ∂f ∂t = 0. ∂t = 0 is true, then we obtain the first integral d dt f − ˙x ∂f ∂ ˙x = 0 So we have a conserved quantity f − ˙x ∂f ∂ ˙x . We see that for each simple symmetry we have above, we can obtain a first integral, which then gives a constant of motion. Noether’s theorem is a powerful generalization of this. Theorem (Noether’s theorem). For every continuous symmetry of F [x], the solutions (i.e. the stationary points of F [x]) will have a corresponding conserved quantity. What does “continuous symmetry” mean? Intuitively, it is a symmetry we can do “a bit of”. For example, rotation is a continuous symmetry, since we can do a bit of rotation. However, reflection is not, since we cannot reflect by “a bit”. We either reflect or we do not. Note that continuity is essential. For example, if f is quadratic in x and ˙x, then x → −x will be a symmetry. But since it is not continuous, there won’t be a conserved quantity. Since the theorem requires a continuous symmetry, we can just consider infinitesimally small symmetries and ignore second-order terms. Almost every equation will have some O(ε2) that we will not write out. We will consider symmetries that involve only the x variable. Up to first order, we can write the symmetry as t → t, x(t) → x(t) + εh(t), 28 3 Hamilton’s principle IB Variational Principles for some h(t) representing the symmetry transformation (and ε a small number). By saying that this transformation is a symmetry, it means that when we pick ε to be any (small) constant number, the functional F [x] does not change, i.e. δF = 0. On the other hand, since x(t) is a stationary point of F [x], we know that if ε is non-constant but vanishes at the end-points, then δF = 0 as well. We will combine these two information to find a conserved quantity of the system. For the moment, we do not assume anything about ε and see what happens to F [x]. Under the transformation, the change in F [x] is given by δF = f (x + εh, ˙x + ε ˙h + ˙εh, t) − f (x, ˙x, t) dt εh + ε ˙h + ˙εh dt ∂f ∂ ˙x = = ∂f ∂x ∂f ∂x ε ∂f ∂ ˙x ∂f ∂ ˙x h + ˙h dt + ∂f ∂ ˙x ˙ε h dt. First consider the case where ε is a constant. Then the second integral vanishes. So we obtain ε This requires that Hence we know that ∂f ∂x h + ˙h ∂f ∂ ˙x dt = 0 ∂f ∂x h + ∂f ∂ ˙x ˙h = 0 δF = ∂f ∂ ˙x ˙ε h dt. Then consider a variable ε that is non-constant but vanishes at end-points. Then we know that since x is a solution, we must have δF = 0. So we get ∂f ∂ ˙x ˙ε h dt = 0. We can integrate by parts to obtain ε d dt ∂f ∂ ˙x h dt = 0. for any ε that vanishes at end-points. Hence we must have d dt ∂f ∂ ˙x h = 0. So ∂f ∂ ˙x h is a conserved quantity. Obviously, not all symmetries just involve the x variable. For example, we might have a time translation t → t − ε. However, we can encode this as a transformation of the x variable only, as x(t) → x(t − ε). In general, to find the conserved quantity associated with the symmetry x(t) → x(t) + εh(t), we find the change δF assuming that ε is a function of time as opposed to a constant. Then the coefficient of ˙ε is the conserved quantity. 29 3 Hamilton’s principle IB Variational Principles Example. We can apply this to Hamiltonian mechanics. The motion of the particle is the stationary point of S[x, p] = (p · ˙x − H(x, p)) dt, where H = 1 2m |p|2 + V (x). (i) First consider the case where there is no potential. Since the action depends only on ˙x (or p) and not x itself, it is invariant under the translation x → x + ε, p → p. For general ε that can vary with time, we have p · ( ˙x + ˙ε) − H(p) − p · ˙x − H(p) p · ˙ε dt. δS = = dt Hence p (the momentum) is a constant of motion. (ii) If the potential has no time-dependence, then the system is invariant under time translation. We’ll skip the tedious computations and just state that time translation invariance implies conservation of H itself, which is the energy. (iii) The above two results can also be obtained directly from first integrals of the Euler-Lagrange equation. However, we can do something cooler. Suppose that we have a potential V (|x|) that only depends on radius. Then this has a rotational symmetry. Choose any favorite axis of rotational symmetry ω, and make the rotation x → x + εω × x p → p + εω × p, Then our rotation does not affect the radius |x| and momentum |p|. So the Hamiltonian H(x, p) is unaffected. Noting that ω × p · ˙x = 0, we have δS = = = = = (x + εω × x) − p · ˙x dt (εω × x) dt p · p · d dt d dt p · ω × (εx) dt d dt (p · [ω × ( ˙εx + ε ˙x)]) dt ( ˙εp · (ω × x) + εp · (ω × ˙x)) dt 30 3 Hamilton’s principle IB Variational Principles Since p is parallel to ˙x, we are left with = = ( ˙εp · (ω × x)) dt ˙εω · (x × p) dt. So ω · (x × p) is a constant of motion. Since this is true for all ω, L = x × p must be a constant of motion, and this is the angular momentum. 31 4 Multivariate calculus of variations IB Variational Principles 4 Multivariate calculus of variations So far, the function x(t) we are varying is just a function of a single variable t. What if we have a more complicated function to consider? We will consider the most general case y(x1, · · · , xm) ∈ Rn that maps Rm → Rn (we can also view this as n different functions that map Rm → R). The functional will be a multiple integral of the form F [y] = · · · f (y, ∇y, x1, · · · , xm) dx1 · · · dxm, where ∇y is the second-rank tensor defined as ∇y = ∂y ∂x1 , · · · , . ∂y ∂xm In this case, instead of attempting to come up with some complicated generalized Euler-Lagrange equation, it is often a better idea to directly consider variations δy of y. This is best illustrated by example. Example
(Minimal surfaces in E3). This is a natural generalization of geodesics. A minimal surface is a surface of least area subject to some boundary conditions. Suppose that (x, y) are good coordinates for a surface S, where (x, y) takes values in the domain D ⊆ R2. Then the surface is defined by z = h(x, y), where h is the height function. When possible, we will denote partial differentiation by suffices, i.e. hx = ∂h ∂x . Then the area is given by A[h] = D 1 + h2 x + h2 y dA. Consider a variation of h(x, y): h → h + δh(x, y). Then A[h + δh] = D 1 + (hx + (δh)x)2 + (hy + (δh)y)2 dA = A[h] +   D hx(δh)x + hy(δh)y 1 + h2 x + h2 y  + O(δh2)  dA We integrate by parts to obtain δA = −  δh  ∂ ∂x D   hx 1 + h2 x + h2 y   +   ∂ ∂y hy 1 + h2 x + h2 y     dA + O(δh2) plus some boundary terms. So our minimal surface will satisfy   ∂ ∂x hx 1 + h2 x + h2 y   +   ∂ ∂y hy 1 + h2 x + h2 y   = 0 Simplifying, we have (1 + h2 y)hxx + (1 + h2 x)hyy − 2hxhyhxy = 0. 32 4 Multivariate calculus of variations IB Variational Principles This is a non-linear 2nd-order PDE, the minimal-surface equation. While it is difficult to come up with a fully general solution to this PDE, we can consider some special cases. – There is an obvious solution h(x, y) = Ax + By + C, since the equation involves second-derivatives and this function is linear. This represents a plane. – If |∇h|2 1, then h2 x and h2 y are small. So we have or hyy + hyy = 0, ∇2h = 0. So we end up with the Laplace equation. Hence harmonic functions are (approximately) minimal-area. – We might want a cylindrically-symmetric solution, i.e. h(x, y) = z(r), where r = x2 + y2. Then we are left with an ordinary differential equation rz + z + z3 = 0. z = A−1 cosh(Ar) + B, The general solution is a catenoid. Alternatively, to obtain this,this we can substitute h(x, y) = z(r) into A[h] to get A[z] = 2π r1 + (h(r))2 dr, and we can apply the Euler-Lagrange equation. Example (Small amplitude oscillations of uniform string). Suppose we have a string with uniform constant mass density ρ with uniform tension T . y Suppose we pull the line between x = 0 and x = a with some tension T . Then we set it into motion such that the amplitude is given by y(x; t). Then the kinetic energy is T = 1 2 a 0 ρv2 dx = ρ 2 a 0 ˙y2 dx. The potential energy is the tension times the length. So y)2 dx = (T a) + a 0 1 2 T (y2) dx. 33 4 Multivariate calculus of variations IB Variational Principles Note that y is the derivative wrt x while ˙y is the derivative wrt time. The T a term can be seen as the ground-state energy. It is the energy initially stored if there is no oscillation. Since this constant term doesn’t affect where the stationary points lie, we will ignore it. Then the action is given by 1 2 T (y)2 ρ ˙y2 − S[y] = dx dt a 1 2 0 We apply Hamilton’s principle which says that we need δS[y] = 0. We have δS[y] = a 0 ρ ˙y ∂ ∂t δy − T y ∂ ∂x δy dx dt. Integrate by parts to obtain δS[y] = a 0 δy(ρ¨y − T y) dx dt + boundary term. Assuming that the boundary term vanishes, we will need ¨y − v2y = 0, where v2 = T /ρ. This is the wave equation in two dimensions. Note that this is a linear PDE, which is a simplification resulting from our assuming the oscillation is small. The general solution to the wave equation is y(x, t) = f+(x − vt) + f−(x + vt), which is a superposition of a wave travelling rightwards and a wave travelling leftwards. Example (Maxwell’s equations). It is possible to obtain Maxwell’s equations from an action principle, where we define a Lagrangian for the electromagnetic field. Note that this is the Lagrangian for the field itself, and there is a separate Lagrangian for particles moving in a field. We have to first define several quantities. First we have the charges: ρ represents the electric charge density and J represents the electric current density. Then we have the potentials: φ is the electric scalar potential and A is the magnetic vector potential. Finally the fields: E = −∇φ − ˙A is the electric field, and B = ∇ × A is the magnetic field. We pick convenient units where c = ε0 = µ0 = 1. With these concepts in mind, the Lagrangian is given by S[A, φ] = 1 2 (|E|2 − |B|2) + A · J − φρ dV dt Varying A and φ by δA and δφ respectively, we have δS = −E · ∇δφ + ∂ ∂t δA − B · ∇ × δA + δA · J − ρδφ dV dt. 34 4 Multivariate calculus of variations IB Variational Principles Integrate by parts to obtain δS = δA · ( ˙E − ∇ × B + J) + δφ(∇ · E − ρ) dV dt. Since the coefficients have to be 0, we must have ∇ × B = J + ˙E, ∇ · E = ρ. Also, the definitions of E and B immediately give ∇ · B = 0, ∇ × E = − ˙B. These four equations are Maxwell’s equations. 35 5 The second variation IB Variational Principles 5 The second variation 5.1 The second variation So far, we have only looked at the “first derivatives” of functionals. We can identify stationary points, but we don’t know if it is a maximum, minimum or a saddle. To distinguish between these, we have to look at the “second derivatives”, or the second variation. Suppose x(t) = x0(t) is a solution of δF [x] δy(x) = 0, i.e. F [x] is stationary at y = y0. To determine what type of stationary point it is, we need to expand F [x + δx] to second order in δx. For convenience, let δx(t) = εξ(t) with constant ε 1. We will also only consider functionals of the form F [x] = β α f (x, ˙x, t) dt with fixed-end boundary conditions, i.e. ξ(α) = ξ(β) = 0. We will use both dots ( ˙x) and dashes (x) to denote derivatives. We consider a variation x → x + δx and expand the integrand to obtain f (x + εξ, ˙x + ε ˙ξ, t) − f (x, ˙x, t) ∂f ∂ ˙x ∂f ∂x ε2 2 + ˙ξ = ε + ξ ξ2 ∂2f ∂x2 + 2ξ ˙ξ ∂2f ∂x∂ ˙x + ˙ξ2 ∂2f ∂ ˙x2 + O(ε3) Noting that 2ξ ˙ξ = (ξ2) and integrating by parts, we obtain = εξ ∂f ∂x − d dt ∂f ∂ ˙x + ε2 2 ξ2 ∂2f ∂x2 − d dt ∂2f ∂x∂ ˙x + ˙ξ2 ∂f ∂ ˙x2 . plus some boundary terms which vanish. So F [x + εξ] − F [x] = β α εξ ∂f ∂x − d dt ∂f ∂ ˙x dt + ε2 2 δ2F [x, ξ] + O(ε3), where δ2F [x, ξ] = β α ξ2 ∂2f ∂x2 − d dt ∂2f ∂x∂ ˙x + ˙ξ2 ∂2f ∂ ˙x2 dt is a functional of both x(t) and ξ(t). This is analogous to the term δxT H(x)δx appearing in the expansion of a regular function f (x). In the case of normal functions, if H(x) is positive, f (x) is convex for all x, and the stationary point is hence a global minimum. A similar result holds for functionals. In this case, if δ2F [x, ξ] > 0 for all non-zero ξ and all allowed x, then a solution x0(t) of δF δx = 0 is an absolute minimum. 36 5 The second variation IB Variational Principles Example (Geodesics in the plane). We previously shown that a straight line is a stationary point for the curve-length functional, but we didn’t show it is in fact the shortest distance! Maybe it is a maximum, and we can get the shortest distance by routing to the moon and back. Recall that f = 1 + (y)2. Then ∂f ∂y = 0, ∂f ∂y = y 1 + (y)2 , ∂2f ∂y2 = 1 1 + (y)2 3 , with the other second derivatives zero. So we have δ2F [y, ξ] = β α ˙ξ2 (1 + (y)2)3/2 dx > 0 So if we have a stationary function satisfying the boundary conditions, it is an absolute minimum. Since the straight line is a stationary function, it is indeed the minimum. However, not all functions are convex[citation needed]. We can still ask whether a solution x0(t) of the Euler-Lagrange equation is a local minimum. For these, we need to consider δ2F [x0, ξ] = β α (ρ(t) ˙ξ2 + σ(t)ξ2) dt, where ρ(t) = ∂2f ∂ ˙x2 x=x0 , σ(t) = ∂2f ∂x2 − d dt ∂2f ∂x∂ ˙x . x=x0 This is of the same form as the Sturm-Liouville problem. For x0 to minimize F [x] locally, we need δ2F [x0, ξ] > 0. A necessary condition for this is ρ(t) ≥ 0, which is the Legendre condition. The intuition behind this necessary condition is as follows: suppose that ρ(t) is negative in some interval I ⊆ [α, β]. Then we can find a ξ(t) that makes δ2F [x0, ξ] negative. We simply have to make ξ zero outside I, and small but crazily oscillating inside I. Then inside I, ˙x2 wiill be very large while ξ2 is kept tiny. So we can make δ2F [y, ξ] arbitrarily negative. Turning the intuition into a formal proof is not difficult but is tedious and will be omitted. However, this is not a sufficient condition. Even if we had a strict inequality ρ(t) > 0 for all α < t < β, it is still not sufficient. Of course, a sufficient (but not necessary) condition is ρ(t) > 0, σ(t) ≥ 0, but this is not too interesting. Example. In the Branchistochrone problem, we have T [x] ∝ β α 1 + ˙x2 x dt. 37 5 The second variation IB Variational Principles Then ρ(t) = σ(t) = ∂2f ∂ ˙x2 x0 > 0 1 2x2x(1 + ˙x2) > 0. So the cycloid does minimize the time T . 5.2 Jacobi condition for local minima of F [x] Legendre tried to prove that ρ > 0 is a sufficient condition for δ2F > 0. This is known as the strong Legendre condition. However, he obviously failed, since it is indeed not a sufficient condition. Yet, it turns out that he was close. Before we get to the actual sufficient condition, we first try to understand why thinking ρ > 0 is sufficient isn’t as crazy as it first sounds. If ρ > 0 and σ < 0, we would want to create a negative δ2F [x0, ξ] by choosing ξ to be large but slowly varying. Then we will have a very negative σ(t)ξ2 while a small positive ρ(t) ˙ξ2. The problem is that ξ has to be 0 at the end points α and β. For ξ to take a large value, it must reach the value from 0, and this requires some variation of ξ, thereby inducing some ˙ξ. This is not a problem if α and β are far apart - we simply slowly climb up to a large value of ξ and then slowly rappel back down, maintaining a low ˙ξ throughout the process. However, it is not unreasonable to assume that as we make the distance β − α smaller and smaller, eventually all ξ will lead to a positive δ2F [x0, ξ], since we cannot reach large values of ξ without having large ˙ξ. It turns out that the intuition is correct. As long as α and β are sufficiently close, δ2F [x0, ξ] will be positive. The derivation of this result is, however, rather roundabout, involving a number of algebraic tricks. For a solution x0 to the Euler Lagrange equation, we have δ2F [x0, ξ] = β α
ρ(t) ˙ξ2 + σ(t)ξ2 dt, where ρ(t) = ∂2f ∂ ˙x2 x=x0 , σ(t) = ∂2f ∂x2 − d dt ∂2f ∂x∂ ˙x . x=x0 Assume ρ(t) > 0 for α < t < β (the strong Legendre condition) and assume boundary conditions ξ(α) = ξ(β) = 0. When is this sufficient for δ2F > 0? First of all, notice that for any smooth function w(x), we have 0 = β α (wξ2) dt since this is a total derivative and evaluates to wξ(α) − wξ(β) = 0. So we have 0 = β α (2wξ ˙ξ + ˙wξ2) dt. 38 5 The second variation IB Variational Principles This allows us to rewrite δ2F as δ2F = β α ρ ˙ξ2 + 2wξ ˙ξ + (σ + ˙w)ξ2 dt. Now complete the square in ξ and ˙ξ. So δ2F = β α ρ ˙w − ξ2 dt w2 ρ This is non-negative if w2 = ρ(σ + ˙w). (∗) So as long as we can find a solution to this equation, we know that δ2F is non-negative. Could it be that δ2F = 0? Turns out not. If it were, then ˙ξ = − w ρ ξ. We can solve this to obtain ξ(x) = C exp − x α w(s) ρ(s) ds . We know that ξ(α) = 0. But ξ(α) = Ce0. So C = 0. Hence equality holds only for ξ = 0. So all we need to do is to find a solution to (∗), and we are sure that δ2F > 0. Note that this is non-linear in w. We can convert this into a linear equation by defining w in terms of a new function u by w = −ρ ˙u/u. Then (∗) becomes 2 ˙u u ρ = σ − ρ ˙u u = σ − (ρ ˙u) u + ρ 2 . ˙u u We see that the left and right terms cancel. So we have −(ρ ˙u) + σu = 0. This is the Jacobi accessory equation, a second-order linear ODE. There is a caveat here. Not every solution u will do. Recall that u is used to produce w via w = −ρ ˙u/u. Hence within [α, β], we cannot have u = 0 since we cannot divide by zero. If we can find a non-zero u(x) satisfying the Jacobi accessory equation, then δ2F > 0 for ξ = 0, and hence y0 is a local minimum of F . A suitable solution will always exists for sufficiently small β − α, but may not exist if β − α is too large, as stated at the beginning of the chapter. Example (Geodesics on unit sphere). For any curve C on the sphere, we have L = C dθ2 + sin2 θ dφ2. If θ is a good parameter of the curve, then L[φ] = θ2 θ1 1 + sin2 θ(φ)2 dθ. 39 5 The second variation IB Variational Principles Alternatively, if φ is a good parameter, we have L[θ] = φ2 φ1 (θ)2 + sin2 θ dφ. We will look at the second case. We have So f (θ, θ) = (θ)2 + sin2 θ. ∂f ∂θ = sin θ cos θ (θ)2 + sin2 θ , ∂f ∂θ = θ . (θ)2 + sin2 θ Since ∂f ∂φ = 0, we have the first integral const = f − θ ∂f ∂θ = sin2 θ (θ)2 + sin2 θ So a solution is c sin2 θ = (θ)2 + sin2 θ. Here we need c ≥ 1 for the equation to make sense. We will consider the case where c = 1 (in fact, we can show that we can always orient our axes such that c = 1). This occurs when θ = 0, i.e. θ is a constant. Then our first integral gives sin2 θ = sin θ. So sin θ = 1 and θ = π/2. This corresponds to a curve on the equator. (we ignore the case sin θ = 0 that gives θ = 0, which is a rather silly solution) There are two equatorial solutions to the Euler-Lagrange equations. Which, if any, minimizes L[θ]? We have and ∂2f ∂(θ)2 θ=π/2 = 1 ∂2f ∂θ∂θ = −1, ∂2 ∂θ∂θ = 0. So ρ(x) = 1 and σ(x) = −1. So δ2F = φ2 φ1 ((ξ)2 − ξ2) dφ. 40 5 The second variation IB Variational Principles The Jacobi accessory equation is u + u = 0. So the general solution is u ∝ sin φ − γ cos φ. This is equal to zero if tan φ = γ. Looking at the graph of tan φ, we see that tan has a zero every π radians. Hence if the domain φ2 − φ1 is greater than π (i.e. we go the long way from the first point to the second), it will always contain some values for which tan φ is zero. So we cannot conclude that the longer path is a local minimum (it is obviously not a global minimum, by definition of longer) (we also cannot conclude that it is not a local minimum, since we tested with a sufficient and not necessary condition). On the other hand, if φ2 − φ1 is less than π, then we will be able to pick a γ such that u is non-zero in the domain. 41
x x 3.2 Linear Maps Definition (Domain, codomain and image of map). Consider sets A and B and mapping T : A → B such that each x ∈ A is mapped into a unique x = T (x) ∈ B. A is the domain of T and B is the co-domain of T . Typically, we have T : Rn → Rm or T : Cn → Cm. Definition (Linear map). Let V, W be real (or complex) vector spaces, and T : V → W . Then T is a linear map if (i) T (a + b) = T (a) + T (b) for all a, b ∈ V . (ii) T (λa) = λT (a) for all λ ∈ R (or C). Equivalently, we have T (λa + µb) = λT (a) + µT (b). Example. (i) Consider a translation T : R3 → R3 with T (x) = x + a for some fixed, given a. This is not a linear map since T (λx + µy) = λx + µy + (λ + µ)a. (ii) Rotation, reflection and projection are linear transformations. Definition (Image and kernel of map). The image of a map f : U → V is the subset of V {f (u) : u ∈ U }. The kernel is the subset of U {u ∈ U : f (u) = 0}. Example. 25 3 Linear maps IA Vectors and Matrices (i) Consider S : R3 → R2 with S(x, y, z) = (x + y, 2x − z). Simple yet tedious algebra shows that this is linear. Now consider the effect of S on the standard basis. S(1, 0, 0) = (1, 2), S(0, 1, 0) = (1, 0) and S(0, 0, 1) = (0, −1). Clearly these are linearly dependent, but they do span the whole of R2. We can say S(R3) = R2. So the image is R2. Now solve S(x, y, z) = 0. We need x + y = 0 and 2x − z = 0. Thus x = (x, −x, 2x), i.e. it is parallel to (1, −1, 2). So the set {λ(1, −1, 2) : λ ∈ R} is the kernel of S. (ii) Consider a rotation in R3. The kernel is the zero vector and the image is R3. (iii) Consider a projection of x onto a plane with normal ˆn. The image is the plane itself, and the kernel is any vector parallel to ˆn Theorem. Consider a linear map f : U → V , where U, V are vector spaces. Then im(f ) is a subspace of V , and ker(f ) is a subspace of U . Proof. Both are non-empty since f (0) = 0. If x, y ∈ im(f ), then ∃a, b ∈ U such that x = f (a), y = f (b). Then λx + µy = λf (a) + µf (b) = f (λa + µb). Now λa + µb ∈ U since U is a vector space, so there is an element in U that maps to λx + µy. So λx + µy ∈ im(f ) and im(f ) is a subspace of V . Suppose x, y ∈ ker(f ), i.e. f (x) = f (y) = 0. Then f (λx + µy) = λf (x) + µf (y) = λ0 + µ0 = 0. Therefore λx + µy ∈ ker(f ). 3.3 Rank and nullity Definition (Rank of linear map). The rank of a linear map f : U → V , denoted by r(f ), is the dimension of the image of f . Definition (Nullity of linear map). The nullity of f , denoted n(f ) is the dimension of the kernel of f . Example. For the projection onto a plane in R3, the image is the whole plane and the rank is 2. The kernel is a line so the nullity is 1. Theorem (Rank-nullity theorem). For a linear map f : U → V , r(f ) + n(f ) = dim(U ). Proof. (Non-examinable) Write dim(U ) = n and n(f ) = m. If m = n, then f is the zero map, and the proof is trivial, since r(f ) = 0. Otherwise, assume m < n. Suppose {e1, e2, · · · , em} is a basis of ker f , Extend this to a basis of the whole of U to get {e1, e2, · · · , em, em+1, · · · , en}. To prove the theorem, we need to prove that {f (em+1), f (em+2), · · · f (en)} is a basis of im(f ). (i) First show that it spans im(f ). Take y ∈ im(f ). Thus ∃x ∈ U such that y = f (x). Then y = f (α1e1 + α2e2 + · · · + αnen), since e1, · · · en is a basis of U . Thus y = α1f (e1) + α2f (e2) + · · · + αmf (em) + αm+1f (em+1) + · · · + αnf (en). 26 3 Linear maps IA Vectors and Matrices The first m terms map to 0, since e1, · · · em is the basis of the kernel of f . Thus y = αm+1f (em+1) + · · · + αnf (en). (ii) To show that they are linearly independent, suppose αm+1f (em+1) + · · · + αnf (en) = 0. Then f (αm+1em+1 + · · · + αnen) = 0. Thus αm+1em+1 + · · · + αnen ∈ ker(f ). Since {e1, · · · , em} span ker(f ), there exist some α1, α2, · · · αm such that αm+1em+1 + · · · + αnen = α1e1 + · · · + αmem. But e1 · · · en is a basis of U and are linearly independent. So αi = 0 for all i. Then the only solution to the equation αm+1f (em+1) + · · · + αnf (en) = 0 is αi = 0, and they are linearly independent by definition. Example. Calculate the kernel and image of f : R3 → R3, defined by f (x, y, z) = (x + y + z, 2x − y + 5z, x + 2z). First find the kernel: we’ve got the system of equations: x + y + z = 0 2x − y + 5z = 0 x + 2z = 0 Note that the first and second equation add to give 3x+6z = 0, which is identical to the third. Then using the first and third equation, we have y = −x − z = z. So the kernel is any vector in the form (−2z, z, z) and is the span of (−2, 1, 1). To find the image, extend the basis of ker(f ) to a basis of the whole of R3: {(−2, 1, 1), (0, 1, 0), (0, 0, 1)}. Apply f to this basis to obtain (0, 0, 0), (1, −1, 0) and (1, 5, 2). From the proof of the rank-nullity theorem, we know that f (0, 1, 0) and f (0, 0, 1) is a basis of the image. To get the standard form of the image, we know that the normal to the plane is parallel to (1, −1, 0) × (1, 5, 2) (1, 1, −3). Since 0 ∈ im(f ), the equation of the plane is x + y − 3z = 0. 3.4 Matrices In the examples above, we have represented our linear maps by some object R such that x i = Rijxj. We call R the matrix for the linear map. In general, let α : Rn → Rm be a linear map, and x = α(x). Let {ei} be a basis of Rn. Then x = xjej for some xj. Then we get So we get that x = α(xjej) = xjα(ej). x i = [α(ej)]ixj. 27 3 Linear maps IA Vectors and Matrices We now define Aij = [α(ej)]i. Then x i = Aijxj. We write A = {Aij} =    A11 ... Am1 · · · A1n ... Aij · · · Amn    Here Aij is the entry in the ith row of the jth column. We say that A is an m × n matrix, and write x = Ax. We see that the columns of the matrix are the images of the standard basis vectors under the mapping α. Example. 3.4.1 Examples (i) In R2, consider a reflection in a line with an angle θ to the x axis. We know that ˆi → cos 2θˆi + sin 2θˆj , with ˆj → − cos 2θˆj + sin 2θˆi. Then the matrix is cos 2θ sin 2θ sin 2θ − cos 2θ . (ii) In R3, as we’ve previously seen, a rotation by θ about the z axis is given by R =   cos θ − sin θ cos θ sin θ 0 0   0 0 1 (iii) In R3, a reflection in plane with normal ˆn is given by Rij = δij − 2ˆni ˆnj. Written as a matrix, we have   1 − 2ˆn2 1 − 2ˆn2 −2ˆn2 ˆn1 −2ˆn3 ˆn1 −2ˆn3 ˆn2 1 −2ˆn1 ˆn2 −2ˆn1 ˆn3 2 −2ˆn2 ˆn3 1 − 2ˆn2 3   (iv) Dilation (“stretching”) α : R3 → R3 is given by a map (x, y, z) → (λx, µy, νz) for some λ, µ, ν. The matrix is   v) Shear: Consider S : R3 → R3 that sheers in the x direction: y sheer in x direction x x x 28 3 Linear maps IA Vectors and Matrices We have (x, y, z) → (x + λy, y, z). Then .4.2 Matrix Algebra This part is mostly on a whole lot of definitions, saying what we can do with matrices and classifying them into different types. Definition (Addition of matrices). Consider two linear maps α, β : Rn → Rm. The sum of α and β is defined by (α + β)(x) = α(x) + β(x) In terms of the matrix, we have or (A + B)ijxj = Aijxj + Bijxj, (A + B)ij = Aij + Bij. Definition (Scalar multiplication of matrices). Define (λα)x = λ[α(x)]. So (λA)ij = λAij. Definition (Matrix multiplication). Consider maps α : R → Rn and β : Rn → Rm. The composition is βα : R → Rm. Take x ∈ R → x ∈ Rm. Then x = (BA)x = Bx, where x = Ax. Using suffix notation, we have i = (Bx)i = bikx x k = BikAkjxj. But x i = (BA)ijxj. So (BA)ij = BikAkj. Generally, an m × n matrix multiplied by an n × matrix gives an m × matrix. (BA)ij is given by the ith row of B dotted with the jth column of A. Note that the number of columns of B has to be equal to the number of rows of A for multiplication to be defined. If = m as well, then both BA and AB make sense, but AB = BA in general. In fact, they don’t even have to have the same dimensions. Also, since function composition is associative, we get A(BC) = (AB)C. Definition (Transpose of matrix). If A is an m × n matrix, the transpose AT is an n × m matrix defined by (AT )ij = Aji. Proposition. (i) (AT )T = A. (ii) If x is a column vector      x1 x2 ... xn      , xT is a row vector (x1 x2 · · · xn). 29 3 Linear maps IA Vectors and Matrices (iii) (AB)T = BT AT since (AB)T = (BT )ik(AT )kj = (BT AT )ij. ij = (AB)ji = AjkBki = BkiAjk Definition (Hermitian conjugate). Define A† = (AT )∗. Similarly, (AB)† = B†A†. Definition (Symmetric matrix). A matrix is symmetric if AT = A. Definition (Hermitian matrix). A matrix is Hermitian if A† = A. (The diagonal of a Hermitian matrix must be real). Definition (Anti/skew symmetric matrix). A matrix is anti-symmetric or skew symmetric if AT = −A. The diagonals are all zero. Definition (Skew-Hermitian matrix). A matrix is skew-Hermitian if A† = −A. The diagonals are pure imaginary. Definition (Trace of matrix). The trace of an n × n matrix A is the sum of the diagonal. tr(A) = Aii. Example. Consider the reflection matrix Rij = δij − 2ˆni ˆnj. We have tr(A) = Rii = 3 − 2ˆn · ˆn = 3 − 2 = 1. Proposition. tr(BC) = tr(CB) Proof. tr(BC) = BikCki = CkiBik = (CB)kk = tr(CB) Definition (Identity matrix). I = δij. 3.4.3 Decomposition of an n × n matrix Any n × n matrix B can be split as a sum of symmetric and antisymmetric parts. Write Bij = 1 2 + (Bij + Bji) Sij . (Bij − Bji) Aij 1 2 We have Sij = Sji, so S is symmetric, while Aji = −Aij, and A is antisymmetric. So B = S + A. Furthermore , we can decompose S into an isotropic part (a scalar multiple of the identity) plus a trace-less part (i.e. sum of diagonal = 0). Write Sij = 1 tr(S)δij n isotropic part + (Sij − 1 tr(S)δij) n Tij . We have tr(T ) = Tii = Sii − 1 Putting all these together, 1 2 tr(B)I + B = 1 n n tr(S)δii = tr(S) − 1 n tr(S)(n) = 0. (B + BT ) − tr(B)I + 1 n 1 2 (B − BT ). In three dimensions, we can write the antisymmetric part A in terms of a single vector: we have A =   a −b 0 c −a 0 0 b −c   30 3 Linear maps IA Vectors and Matrices and we can consider εijkωk =   0 −ω3 ω2 −ω1 ω3 −ω2 ω1 0 0   So if we have ω = (c, b, a), then Aij = εijkωk. This decomposition can be useful in certain physical applications. For example, if the matrix represents the stress of a system, different part
s of the decomposition will correspond to different types of stresses. 3.4.4 Matrix inverse Definition (Inverse of matrix). Consider an m × n matrix A and n × m matrices B and C. If BA = I, then we say B is the left inverse of A. If AC = I, then we say C is the right inverse of A. If A is square (n × n), then B = B(AC) = (BA)C = C, i.e. the left and right inverses coincide. Both are denoted by A−1, the inverse of A. Therefore we have AA−1 = A−1A = I. Note that not all square matrices have inverses. For example, the zero matrix clearly has no inverse. Definition (Invertible matrix). If A has an inverse, then A is invertible. Proposition. (AB)−1 = B−1A−1 Proof. (B−1A−1)(AB) = B−1(A−1A)B = B−1B = I. Definition (Orthogonal and unitary matrices). A real n×n matrix is orthogonal if AT A = AAT = I, i.e. AT = A−1. A complex n × n matrix is unitary if U †U = U U † = I, i.e. U † = U −1. Note that an orthogonal matrix A satisfies Aik(AT kj) = δij, i.e. AikAjk = δij. We can see this as saying “the scalar product of two distinct rows is 0, and the scalar product of a row with itself is 1”. Alternatively, the rows (and columns — by considering AT ) of an orthogonal matrix form an orthonormal set. Similarly, for a unitary matrix, UikU † kj = δij, i.e. uiku∗ jk = u∗ ikujk = δij. i.e. the rows are orthonormal, using the definition of complex scalar product. Example. (i) The reflection in a plane is an orthogonal matrix. Since Rij = δij − 2ninj, We have RikRjk = (δik − 2nink)(δjk − 2njnk) = δikδjk − 2δjknink − 2δiknjnk + 2ninknjnk = δij − 2ninj − 2njni + 4ninj(nknk) = δij 31 3 Linear maps IA Vectors and Matrices (ii) The rotation is an orthogonal matrix. We could multiply out using suffix notation, but it would be cumbersome to do so. Alternatively, denote rotation matrix by θ about ˆn as R(θ, ˆn). Clearly, R(θ, ˆn)−1 = R(−θ, ˆn). We have Rij(−θ, ˆn) = (cos θ)δij + ninj(1 − cos θ) + εijknk sin θ = (cos θ)δji + njni(1 − cos θ) − εjiknk sin θ = Rji(θ, ˆn) In other words, R(−θ, ˆn) = R(θ, ˆn)T . So R(θ, ˆn)−1 = R(θ, ˆn)T . 3.5 Determinants Consider a linear map α : R3 → R3. The standard basis e1, e2, e3 is mapped to e 1, e i = Aei. Thus the unit cube formed by e1, e2, e3 is mapped to the parallelepiped with volume 3 with e 2, e [e 1, e 2, e 2)j(e 3] = εijk(e 1)i(e = εijkAi (e1) δ1 3)k Ajm (e2)m δ2m Akn (e3)n δ3n We call this the determinant and write as = εijkAi1Aj2Ak3 det(A) = A11 A12 A13 A21 A22 A23 A31 A32 A33 3.5.1 Permutations To define the determinant for square matrices of arbitrary size, we first have to consider permutations. Definition (Permutation). A permutation of a set S is a bijection ε : S → S. Notation. Consider the set Sn of all permutations of 1, 2, 3, · · · , n. Sn contains n! elements. Consider ρ ∈ Sn with i → ρ(i). We write (n) . ρ(1) ρ(2) Definition (Fixed point). A fixed point of ρ is a k such that ρ(k) = k. e.g. in 1 4 , 3 is the fixed point. By convention, we can omit the fixed point 2 3 4 1 3 2 and write as 1 4 . 2 4 1 2 Definition (Disjoint permutation). Two permutations are disjoint if numbers = moved by one are fixed by the other, and vice versa. e.g , and the two cycles on the right hand side are disjoint. Disjoint permutations commute, but in general non-disjoint permutations do not. 32 3 Linear maps IA Vectors and Matrices Definition (Transposition and k-cycle). and we can simply write (2 6). is a 2-cycle or a transposition, is a 3-cycle, and we can simply write (1 5 4). (1 is mapped to 5; 5 is mapped to 4; 4 is mapped to 1) Proposition. Any q-cycle can be written as a product of 2-cycles. Proof. (1 2 3 · · · n) = (1 2)(2 3)(3 4) · · · (n − 1 n). Definition (Sign of permutation). The sign of a permutation ε(ρ) is (−1)r, where r is the number of 2-cycles when ρ is written as a product of 2-cycles. If ε(ρ) = +1, it is an even permutation. Otherwise, it is an odd permutation. Note that ε(ρσ) = ε(ρ)ε(σ) and ε(ρ−1) = ε(ρ). The proof that this is well-defined can be found in IA Groups. Definition (Levi-Civita symbol). The Levi-Civita symbol is defined by εj1j2···jn =   +1 −1  0 if j1j2j3 · · · jn is an even permutation of 1, 2, · · · n if it is an odd permutation if any 2 of them are equal Clearly, ερ(1)ρ(2)···ρ(n) = ε(ρ). Definition (Determinant). The determinant of an n × n matrix A is defined as: or equivalently, Proposition. det(A) = σ∈Sn ε(σ)Aσ(1)1Aσ(2)2 · · · Aσ(n)n, det(A) = εj1j2···jn Aj11Aj22 · · · Ajnn. a b d c = ad − bc 3.5.2 Properties of determinants Proposition. det(A) = det(AT ). Proof. Take a single term Aσ(1)1Aσ(2)2 · · · Aσ(n)n and let ρ be another permutation in Sn. We have Aσ(1)1Aσ(2)2 · · · Aσ(n)n = Aσ(ρ(1))ρ(1)Aσ(ρ(2))ρ(2) · · · Aσ(ρ(n))ρ(n) since the right hand side is just re-ordering the order of multiplication. Choose ρ = σ−1 and note that ε(σ) = ε(ρ). Then det(A) = ρ∈Sn ε(ρ)A1ρ(1)A2ρ(2) · · · Anρ(n) = det(AT ). Proposition. If matrix B is formed by multiplying every element in a single row of A by a scalar λ, then det(B) = λ det(A). Consequently, det(λA) = λn det(A). 33 3 Linear maps IA Vectors and Matrices Proof. Each term in the sum is multiplied by λ, so the whole sum is multiplied by λn. Proposition. If 2 rows (or 2 columns) of A are identical, the determinant is 0. Proof. wlog, suppose columns 1 and 2 are the same. Then det(A) = σ∈Sn ε(σ)Aσ(1)1Aσ(2)2 · · · Aσ(n)n. Now write an arbitrary σ in the form σ = ρ(1 2). Then ε(σ) = ε(ρ)ε((1 2)) = −ε(ρ). So det(A) = −ε(ρ)Aρ(2)1Aρ(1)2Aρ(3)3 · · · Aρ(n)n. ρ∈Sn But columns 1 and 2 are identical, so Aρ(2)1 = Aρ(2)2 and Aρ(1)2 = Aρ(1)1. So det(A) = − det(A) and det(A) = 0. Proposition. If 2 rows or 2 columns of a matrix are linearly dependent, then the determinant is zero. Proof. Suppose in A, (column r) + λ(column s) = 0. Define Bij = Aij Aij + λAis j = r j = r . Then det(B) = det(A) + λ det(matrix with column r = column s) = det(A). Then we can see that the rth column of B is all zeroes. So each term in the sum contains one zero and det(A) = det(B) = 0. Even if we don’t have linearly dependent rows or columns, we can still run the exact same proof as above, and still get that det(B) = det(A). Linear dependence is only required to show that det(B) = 0. So in general, we can add a linear multiple of a column (or row) onto another column (or row) without changing the determinant. Proposition. Given a matrix A, if B is a matrix obtained by adding a multiple of a column (or row) of A to another column (or row) of A, then det A = det B. Corollary. Swapping two rows or columns of a matrix negates the determinant. Proof. We do the column case only. Let A = (a1 · · · ai · · · aj · · · an). Then det(a1 · · · ai · · · aj · · · an) = det(a1 · · · ai + aj · · · aj · · · an) = det(a1 · · · ai + aj · · · aj − (ai + aj) · · · an) = det(a1 · · · ai + aj · · · − ai · · · an) = det(a1 · · · aj · · · − ai · · · an) = − det(a1 · · · aj · · · ai · · · an) Alternatively, we can prove this from the definition directly, using the fact that the sign of a transposition is −1 (and that the sign is multiplicative). Proposition. det(AB) = det(A) det(B). 34 3 Linear maps IA Vectors and Matrices Proof. First note that σ ε(σ)Aσ(1)ρ(1)Aσ(2)ρ(2) = ε(ρ) det(A), i.e. swapping columns (or rows) an even/odd number of times gives a factor ±1 respectively. We can prove this by writing σ = µρ. Now det AB = = = σ ε(σ)(AB)σ(1)1(AB)σ(2)2 · · · (AB)σ(n)n n ε(σ) Aσ(1)k1Bk11 · · · Aσ(n)knBknn σ k1,k2,··· ,kn Bk11 · · · Bknn k1,··· ,kn σ ε(σ)Aσ(1)k1Aσ(2)k2 · · · Aσ(n)kn S Now consider the many different S’s. If in S, two of k1 and kn are equal, then S is a determinant of a matrix with two columns the same, i.e. S = 0. So we only have to consider the sum over distinct kis. Thus the kis are are a permutation of 1, · · · n, say ki = ρ(i). Then we can write det AB = = ρ ρ Bρ(1)1 · · · Bρ(n)n σ ε(σ)Aσ(1)ρ(1) · · · Aσ(n)ρ(n) Bρ(1)1 · · · Bρ(n)n(ε(ρ) det A) = det A ρ ε(ρ)Bρ(1)1 · · · Bρ(n)n = det A det B Corollary. If A is orthogonal, det A = ±1. Proof. AAT = I det AAT = det I det A det AT = 1 (det A)2 = 1 det A = ±1 Corollary. If U is unitary, | det U | = 1. Proof. We have det U † = (det U T )∗ = det(U )∗. Since U U † = I, we have det(U ) det(U )∗ = 1. Proposition. In R3, orthogonal matrices represent either a rotation (det = 1) or a reflection (det = −1). 3.5.3 Minors and Cofactors Definition (Minor and cofactor). For an n × n matrix A, define Aij to be the (n − 1) × (n − 1) matrix in which row i and column j of A have been removed. The minor of the ijth element of A is Mij = det Aij The cofactor of the ijth element of A is ∆ij = (−1)i+jMij. 35 3 Linear maps IA Vectors and Matrices Notation. We use ¯ to denote a symbol which has been missed out of a natural sequence. Example. 1, 2, 3, 5 = 1, 2, 3, ¯4, 5. The significance of these definitions is that we can use them to provide a systematic way of evaluating determinants. We will also use them to find inverses of matrices. Theorem (Laplace expansion formula). For any particular fixed i, det A = n j=1 Aji∆ji. Proof. det A = n ji=1 Ajii n j1,··· ,ji,···jn εj1j2···jn Aj11Aj22 · · · Ajii · · · Ajnn Let σ ∈ Sn be the permutation which moves ji to the ith position, and leave everything else in its natural order, i.e ji · · · · · · ji − 1 ji − 2 ji ji − 1 ji + 1 ji + 1 · · · n · · · n if ji > i, and similarly for other cases. To perform this permutation, |i − ji| transpositions are made. So ε(σ) = (−1)i−ji . Now consider the permutation ρ ∈ Sn ρ = 1 j1 · · · · · · · · · ¯ji ¯ji · · · · · · n jn · · · The composition ρσ reorders (1, · · · , n) to (j1, j2, · · · , jn). So ε(ρσ) = εj1···jn = ε(ρ)ε(σ) = (−1)i−ji εj1···¯ji···jn . Hence the original equation becomes det A = = = = n ji=1 n ji=1 n Ajii j1···¯ji···jn (−1)i−jiεj1···¯ji···jn Aj11 · · · Ajii · · · Ajnn Ajii(−1)i−jiMjii Ajii∆jii ji=1 n Aji∆ji j=1 Example. det . We can pick the first row and have det (2 − 0) − 4(3 − 2) + 2(0 − 4) = −8. 36 3 Linear maps IA Vectors and Matrices Alternatively, we can pick the second column and have det A = −4 3 2 = −4(3 − 2) + 2(2 − 48. In practical terms, we use a combination of properties o
f determinants with a sensible choice of i to evaluate det(A). Example. Consider 1 a a2 b2 b 1 c2 c 1 . Row 1 - row 2 gives 0 a − b a2 − b2 1 1 b2 c2 b c = (a − b b2 c2 . Do row 2 - row 3. We obtain (a − b)(b − c c2 c . Row 1 - row 2 gives (a − b)(b − c)(a − c c2 = (a − b)(b − c)(a − c). 37 4 Matrices and linear equations IA Vectors and Matrices 4 Matrices and linear equations 4.1 Simple example, 2 × 2 Consider the system of equations A11x1 + A12x2 = d1 A21x1 + A22x2 = d2. (a) (b) We can write this as Ax = d. If we do (a)×A22−(b)×A12 and similarly the other way round, we obtain (A11A22 − A12A21)x1 = A22d1 − A12d2 x2 = A11d2 − A21d1 (A11A22 − A12A21) det A Dividing by det A and writing in matrix form, we have d1 d2 A22 −A12 −A21 A11 1 det A x1 x2 = On the other hand, given the equation Ax = d, if A−1 exists, then by multiplying both sides on the left by A−1, we obtain x = A−1d. Hence, we have constructed A−1 in the 2 × 2 case, and shown that the condition for its existence is det A = 0, with A−1 = 1 det A A22 −A12 −A21 A11 4.2 Inverse of an n × n matrix For larger matrices, the formula for the inverse is similar, but slightly more complicated (and costly to evaluate). The key to finding the inverse is the following: Lemma. Aik∆jk = δij det A. Proof. If i = j, then consider an n × n matrix B, which is identical to A except the jth row is replaced by the ith row of A. So ∆jk of B = ∆jk of A, since ∆jk does not depend on the elements in row j. Since B has a duplicate row, we know that 0 = det B = Bjk∆jk = Aik∆jk. n n If i = j, then the expression is det A by the Laplace expansion formula. k=1 k=1 Theorem. If det A = 0, then A−1 exists and is given by (A−1)ij = ∆ji det A . 38 4 Matrices and linear equations IA Vectors and Matrices Proof. So A−1A = I. (A−1)ikAkj = ∆ki det A Akj = δij det A det A = δij. The other direction is easy to prove. If det A = 0, then it has no inverse, since for any matrix B, det AB = 0, and hence AB cannot be the identity. Example. Consider the shear matrix Sλ =   The cofactors are  1 λ 0 0 1 0 1 0 0 . We have det Sλ = 1. ∆11 = 1 ∆12 = 0 ∆13 = 0 ∆21 − λ ∆22 = 1 ∆23 = 0 ∆31 = 0 ∆32 = 0 ∆33 = 1 So S−1 λ =  1 −λ 0 0 1 0  1 0 0  . How many arithmetic operations are involved in calculating the inverse of an n × n matrix? We just count multiplication operations since they are the most time-consuming. Suppose that calculating det A takes fn multiplications. This involves n (n − 1) × (n − 1) determinants, and you need n more multiplications to put them together. So fn = nfn−1 + n. So fn = O(n!) (in fact fn ≈ (1 + e)n!). To find the inverse, we need to calculate n2 cofactors. Each is a n − 1 determinant, and each takes O((n−1)!). So the time complexity is O(n2(n−1)!) = O(n · n!). This is incredibly slow. Hence while it is theoretically possible to solve systems of linear equations by inverting a matrix, sane people do not do so in general. Instead, we develop certain better methods to solve the equations. In fact, the “usual” method people use to solve equations by hand only has complexity O(n3), which is a much better complexity. 4.3 Homogeneous and inhomogeneous equations Consider Ax = b where A is an n × n matrix, x and b are n × 1 column vectors. Definition (Homogeneous equation). If b = 0, then the system is homogeneous. Otherwise, it’s inhomogeneous. Suppose det A = 0. Then there is a unique solution x = A−1b (x = 0 for homogeneous). How can we understand this result? Recall that det A = 0 means that the columns of A are linearly independent. The columns are the images of the standard basis, e i are linearly independent and form a basis of Rn. Therefore the image is the whole of Rn. This automatically ensures that b is in the image, i.e. there is a solution. i = Aei. So det A = 0 means that e To show that there is exactly one solution, suppose x and x are both solutions. Then Ax = Ax = b. So A(x − x) = 0. So x − x is in the kernel of A. But since the rank of A is n, by the rank-nullity theorem, the nullity is 0. So the kernel is trivial. So x − x = 0, i.e. x = x. 39 4 Matrices and linear equations IA Vectors and Matrices 4.3.1 Gaussian elimination Consider a general solution A11x1 + A12x2 + · · · + A1nxn = d1 A21x1 + A22x2 + · · · + A2nxn = d2 ... Am1x1 + Am2x2 + · · · + Amnxn = dm So we have m equations and n unknowns. Assume A11 = 0 (if not, we can re-order the equations). We can use the first equation to eliminate x1 from the remaining (m − 1) equations. Then use the second equation to eliminate x2 from the remaining (m − 2) equations (if anything goes wrong, just re-order until things work). Repeat. We are left with A11x1 + A12x2 + A13x3 + · · · + A1nxn = d1 A(2) 22 x2 + A(2) 23 x3 + · · · + A(2) 2n xn = d2 ... rn xn = dr A(r) rr xr + · · · + A(r) 0 = d(r) r+1 ... 0 = d(r) m Here A(i) ii to the “version number” of the coefficient, e.g. A(2) coefficient of x2 in the second row. = 0 (which we can achieve by re-ordering), and the superfix (i) refers 22 is the second version of the Let’s consider the different possibilities: (i) r < m and at least one of d(r) r+1, · · · d(r) m = 0. Then a contradiction is reached. The system is inconsistent and has no solution. We say it is overdetermined. Example. Consider the system This becomes 3x1 + 2x2 + x3 = 3 6x1 + 3x2 + 3x3 = 0 6x1 + 2x2 + 4x3 = 6 3x1 + 2x2 + x3 = 3 0 − x2 + x3 = −6 0 − 2x2 + 2x3 = 0 40 4 Matrices and linear equations IA Vectors and Matrices And then 3x1 + 2x2 + x3 = 3 0 − x2 + x3 = −6 0 = 12 We have d(3) 3 = 12 = 0 and there is no solution. (ii) If r = n ≤ m, and all d(r) is a unique solution for xn = d(n) n /A(n) substitution. This system is determined. r+i = 0. Then from the nth equation, there nn , and hence for all xi by back Example. This becomes 2x1 + 5x2 = 2 4x1 + 3x2 = 11 2x1 + 5x2 = 2 −7x2 = 7 So x2 = −1 and thus x1 = 7/2. (iii) If r < n and d(r) r+i = 0, then xr+1, · · · xn can be freely chosen, and there are infinitely many solutions. System is under-determined. e.g. Which gives x1 + x2 = 1 2x1 + 2x2 = 2 x1 + x2 = 1 0 = 0 So x1 = 1 − x2 is a solution for any x2. In the n = m case, there are O(n3) operations involved, which is much less than inverting the matrix. So this is an efficient way of solving equations. This is also be related to the determinant. Consider the case where m = n and A is square. Since row operations do not change the determinant and swapping rows give a factor of (−1). So det A = (−1)k A11 A12 A(2) 22 ... 0 0 ... This determinant is an upper triangular one (all elements below diagonal are 0) and the determinant is the product of its diagonal elements. · · · A1n · · · A(n) 2n ... ... · · · A(n) rn · · · 0 ... ... · · · · · · · · · · · · ... . . . · · · A(r) rr 0 · · · ... ... 0 ... 0 0 ... Hence if r < n (and d(r) i = 0 for i > r), then we have case (ii) and the det A = 0. If r = n, then det A = (−1)kA11A(2) 22 · · · A(n) nn = 0. 41 4 Matrices and linear equations IA Vectors and Matrices 4.4 Matrix rank Consider a linear map α : Rn → Rm. Recall the rank r(α) is the dimension of the image. Suppose that the matrix A is associated with the linear map. We also call r(A) the rank of A. Recall that if the standard basis is e1, · · · en, then Ae1, · · · , Aen span the image (but not necessarily linearly independent). Further, Ae1, · · · , Aen are the columns of the matrix A. Hence r(A) is the number of linearly independent columns. Definition (Column and row rank of linear map). The column rank of a matrix is the maximum number of linearly independent columns. The row rank of a matrix is the maximum number of linearly independent rows. Theorem. The column rank and row rank are equal for any m × n matrix. Proof. Let r be the row rank of A. Write the biggest set of linearly independent rows as vT k = (vk1, vk2, · · · , vkn) for k = 1, 2, · · · , r. r or in component form vT 2 , · · · vT 1 , vT Now denote the ith row of A as rT Note that every row of A can be written as a linear combination of the v’s. (If ri cannot be written as a linear combination of the v’s, then it is independent of the v’s and v is not the maximum collection of linearly independent rows) Write i = (Ai1, Ai2, · · · Ain). r rT i = CikvT k . For some coefficients Cik with 1 ≤ i ≤ m and 1 ≤ k ≤ r. Now the elements of A are k=1 Aij = (ri)T j = r k=1 Cik(vk)j, or      = r k=1 vkj      A1j A2j ... Amj           C1k C2k ... Cmk So every column of A can be written as a linear combination of the r column vectors ck. Then the column rank of A ≤ r, the row rank of A. Apply the same argument to AT to see that the row rank is ≤ the column rank. 4.5 Homogeneous problem Ax = 0 We restrict our attention to the square case, i.e. number of unknowns = number of equations. Here A is an n × n matrix. We want to solve Ax = 0. First of all, if det A = 0, then A−1 exists and x−1 = A−10 = 0, which is the unique solution. Hence if Ax = 0 with x = 0, then det A = 0. 42 4 Matrices and linear equations IA Vectors and Matrices 4.5.1 Geometrical interpretation We consider a 3 × 3 matrix A =     rT 1 rT 2 rT 3 Ax = 0 means that ri · x = 0 for all i. Each equation ri · x = 0 represents a plane through the origin. So the solution is the intersection of the three planes. There are three possibilities: (i) If det A = [r1, r2, r3] = 0, span{r1, r2, r3} = R3 and thus r(A) = 3. By the rank-nullity theorem, n(A) = 0 and the kernel is {0}. So x = 0 is the unique solution. (ii) If det A = 0, then dim(span{r1, r2, r3}) = 1 or 2. (a) If rank = 2, wlog assume r1, r2 are linearly independent. So x lies on the intersection of two planes x · r1 = 0 and x · r2 = 0, which is the line {x ∈ R3 : x = λr1 × r2} (Since x lies on the intersection of the two planes, it has to be normal to the normals of both planes). All such points on this line also satisfy x · r3 = 0 since r3 is a linear combination of r1 and r2. The kernel is a line, n(A) = 1. (b) If rank = 1, then r1, r2, r3 are parallel. So x·r1 = 0 ⇒ x·r2 = x·r3 = 0. So all x that satisfy x · r1 = 0 are in the kernel, and th
e kernel now is a plane. n(A) = 2. (We also have the trivial case where r(A) = 0, we have the zero mapping and the kernel is R3) 4.5.2 Linear mapping view of Ax = 0 In the general case, consider a linear map α : Rn → Rn x → x = Ax. The kernel k(A) = {x ∈ Rn : Ax = 0} has dimension n(A). (i) If n(A) = 0, then A(e1), A(e2), · · · , A(en) is a linearly independent set, and r(A) = n. (ii) If n(A) > 0, then the image is not the whole of Rn. Let {ui}, i = 1, · · · , n(A) be a basis of the kernel, i.e. so given any solution to Ax = 0, x = n(A) i=1 λiui for some λi. Extend {ui} to be a basis of Rn by introducing extra vectors ui for i = n(A) + 1, · · · , n. The vectors A(ui) for i = n(A) + 1, · · · , n form a basis of the image. 4.6 General solution of Ax = d Finally consider the general equation Ax = d, where A is an n × n matrix and x, d are n × 1 column vectors. We can separate into two main cases. (i) det(A) = 0. So A−1 exists and n(A) = 0, r(A) = n. Then for any d ∈ Rn, a unique solution must exists and it is x = A−1d. 43 4 Matrices and linear equations IA Vectors and Matrices (ii) det(A) = 0. Then A−1 does not exist, and n(A) > 0, r(A) < n. So the image of A is not the whole of Rn. (a) If d ∈ im A, then there is no solution (by definition of the image) (b) If d ∈ im A, then by definition there exists at least one x such that Ax = d. The general solution of Ax = d can be written as x = x0 +y, where x0 is a particular solution (i.e. Ax0 = d), and y is any vector in ker A (i.e. Ay = 0). (cf. Isomorphism theorem) If n(A) = 0, then y = 0 only, and then the solution is unique (i.e. case (i)). If n(A) > 0 , then {ui}, i = 1, · · · , n(A) is a basis of the kernel. Hence n(A) y = µjuj, so j=1 x = x0 + n(A) j=1 µjuj for any µj, i.e. there are infinitely many solutions. Example. 1 1 a 1 x1 x2 1 b = We have det A = 1 − a. If a = 1, then A−1 exists and 1 −1 1 A−a = . Then If a = 1, then a + b . Ax = x1 + x2 x1 + x2 = (x1 + x2) 1 1 . So im A = span 1 1 and ker A = span 1 b 1 −1 ∈ im A. . If b = 1, then 1 b ∈ im A and there is no solution. If b = 1, then 1 0 We find a particular solution of . So The general solution is x = 1 0 + λ 1 −1 . Example. Find the general solution of    We have det A = (a − b)2(2a + b). If a = b and b = −2a, then the inverse exists and there is a unique solution for any c. Otherwise, the possible cases are 44 4 Matrices and linear equations IA Vectors and Matrices (i) a = b, b = −2a. So a = 0. The kernel is the plane x + y + z = 0 which is span      −1 0 1 We extend this basis to R3 by adding  So the image is the span of   1 1 . Hence if c = 1, then  1 in the image and there is no solution. If c = 1, then a particular solution  is not     1 0 .  0    1 a 0 0 is   and the general solution is 1 0 1 (ii) If a = b and b = −2a, then a = 0. The kernel satisfies x + y − 2z = 0 −2x + y + z = 0 x − 2y + z = 0 This can be solved to give x = y = z, and the kernel is span       1 1  1    . We   to form a basis of R3. So the image is the span of   and  0 0  1  1 0  0    . −2 1 1  ,  add   1 −2 1  If   1 c  is in the image, then 2 1 1 Then the only solution is µ = 0, λ = 1, c = −2. Thus there is no solution if c = −2, and when c = −2, pick a particular solution  solution is  and the general (iii) If a = b and b = −2a, then a = b = 0 and ker A = R3. So there is no solution for any c. 45 5 Eigenvalues and eigenvectors IA Vectors and Matrices 5 Eigenvalues and eigenvectors Given a matrix A, an eigenvector is a vector x that satisfies Ax = λx for some λ. We call λ the associated eigenvalue. In some sense, these vectors are not modified by the matrix, and are just scaled up by the matrix. We will look at the properties of eigenvectors and eigenvalues, and see their importance in diagonalizing matrices. 5.1 Preliminaries and definitions Theorem (Fundamental theorem of algebra). Let p(z) be a polynomial of degree m ≥ 1, i.e. p(z) = m cjzj, where cj ∈ C and cm = 0. j=0 Then p(z) = 0 has precisely m (not necessarily distinct) roots in the complex plane, accounting for multiplicity. Note that we have the disclaimer “accounting for multiplicity”. For example, x2 − 2x + 1 = 0 has only one distinct root, 1, but we say that this root has multiplicity 2, and is thus counted twice. Formally, multiplicity is defined as follows: Definition (Multiplicity of root). The root z = ω has multiplicity k if (z − ω)k is a factor of p(z) but (z − ω)k+1 is not. Example. Let p(z) = z3 − z2 − z + 1 = (z − 1)2(z + 1). So p(z) = 0 has roots 1, 1, −1, where z = 1 has multiplicity 2. Definition (Eigenvector and eigenvalue). Let α : Cn → Cn be a linear map with associated matrix A. Then x = 0 is an eigenvector of A if Ax = λx for some λ. λ is the associated eigenvalue. This means that the direction of the eigenvector is preserved by the mapping, but is scaled up by λ. There is a rather easy way of finding eigenvalues: Theorem. λ is an eigenvalue of A iff det(A − λI) = 0. Proof. (⇒) Suppose that λ is an eigenvalue and x is the associated eigenvector. We can rearrange the equation in the definition above to and thus (A − λI)x = 0 x ∈ ker(A − λI) But x = 0. So ker(A − λI) is non-trivial and det(A − λI) = 0. The (⇐) direction is similar. 46 5 Eigenvalues and eigenvectors IA Vectors and Matrices Definition (Characteristic equation of matrix). The characteristic equation of A is det(A − λI) = 0. Definition (Characteristic polynomial of matrix). The characteristic polynomial of A is pA(λ) = det(A − λI). From the definition of the determinant, pA(λ) = det(A − λI) = εj1j2···jn(Aj11 − λδj11) · · · (Ajnn − λδjnn) = c0 + c1λ + · · · + cnλn for some constants c0, · · · , cn. From this, we see that (i) pA(λ) has degree n and has n roots. So an n × n matrix has n eigenvalues (accounting for multiplicity). (ii) If A is real, then all ci ∈ R. So eigenvalues are either real or come in complex conjugate pairs. (iii) cn = (−1)n and cn−1 = (−1)n−1(A11 + A22 + · · · + Ann) = (−1)n−1 tr(A). But cn−1 is the sum of roots, i.e. cn−1 = (−1)n−1(λ1 + λ2 + · · · λn), so tr(A) = λ1 + λ2 + · · · + λn. Finally, c0 = pA(0) = det(A). Also c0 is the product of all roots, i.e. c0 = λ1λ2 · · · λn. So det A = λ1λ2 · · · λn. The kernel of the matrix A − λI is the set {x : Ax = λx}. This is a vector subspace because the kernel of any map is always a subspace. Definition (Eigenspace). The eigenspace denoted by Eλ is the kernel of the matrix A − λI, i.e. the set of eigenvectors with eigenvalue λ. Definition (Algebraic multiplicity of eigenvalue). The algebraic multiplicity M (λ) or Mλ of an eigenvalue λ is the multiplicity of λ in pA(λ) = 0. By the fundamental theorem of algebra, M (λ) = n. λ If M (λ) > 1, then the eigenvalue is degenerate. Definition (Geometric multiplicity of eigenvalue). The geometric multiplicity m(λ) or mλ of an eigenvalue λ is the dimension of the eigenspace, i.e. the maximum number of linearly independent eigenvectors with eigenvalue λ. Definition (Defect of eigenvalue). The defect ∆λ of eigenvalue λ is ∆λ = M (λ) − m(λ). It can be proven that ∆λ ≥ 0, i.e. the geometric multiplicity is never greater than the algebraic multiplicity. 47 5 Eigenvalues and eigenvectors IA Vectors and Matrices 5.2 Linearly independent eigenvectors Theorem. Suppose n×n matrix A has distinct eigenvalues λ1, λ2, · · · , λn. Then the corresponding eigenvectors x1, x2, · · · , xn are linearly independent. Proof. Proof by contradiction: Suppose x1, x2, · · · , xn are linearly dependent. Then we can find non-zero constants di for i = 1, 2, · · · , r, such that d1x1 + d2x2 + · · · + drxr = 0. Suppose that this is the shortest non-trivial linear combination that gives 0 (we may need to re-order xi). Now apply (A − λ1I) to the whole equation to obtain d1(λ1 − λ1)x1 + d2(λ2 − λ1)x2 + · · · + dr(λr − λ1)xr = 0. We know that the first term is 0, while the others are not (since we assumed λi = λj for i = j). So d2(λ2 − λ1)x2 + · · · + dr(λr − λ1)xr = 0, and we have found a shorter linear combination that gives 0. Contradiction. Example. (i) A = 0 1 −1 0 . Then pA(λ) = λ2 + 1 = 0. So λ1 = i and λ2 = −i. To solve (A − λ1I)x = 0, we obtain So we obtain −i 1 −1 −i x1 x2 = 0. x1 x2 1 i = to be an eigenvector. Clearly any scalar multiple of but still in the same eigenspace Ei = span Solving (A − λ2I)x = 0 gives 1 i x1 x2 1 −i . = So E−i = span 1 −i . 1 i is also a solution, Note that M (±i) = m(±i) = 1, so ∆±i = 0. Also note that the two eigenvectors are linearly independent and form a basis of C2. (ii) Consider   A = −2 2 −1 −2 2 −3 1 −6 0   48 5 Eigenvalues and eigenvectors IA Vectors and Matrices Then det(A − λI) = 0 gives 45 + 21λ − λ2 − λ3. So λ1 = 5, λ2 = λ3 = −3. The eigenvector with eigenvalue 5 is x =     1 2 −1 We can find that the eigenvectors with eigenvalue −3 are x =   −2x2 + 3x3 x2 x3   for any x2, x3. This gives two linearly independent eigenvectors, say     , −2 1 0   3 0 .  1 So M (5) = m(5) = 1 and M (−3) = m(−3) = 2, and there is no defect for both of them. Note that these three eigenvectors form a basis of C3. (iii) Let A =   −3 −1 −1 −3 −2 −2  1 1  0 Then 0 = pA(λ) = −(λ + 2)4. So λ = −2, −2, −2. To find the eigenvectors, we have (A + 2I)x =   −1 −1 −1 −1 −2 −2   1 1  2   x1 x2 x3  = 0 The general solution is thus x1 + x2 − x3 = 0, and the general solution is thus x = . The eigenspace E−2 = span    x1 x2 x1 + x2           . Hence M (−2) = 3 and m(−2) = 2. Thus the defect ∆−2 = 1. So the eigenvectors do not form a basis of C3. (iv) Consider the reflection R in the plane with normal n. Clearly Rn = −n. The eigenvalue is −1 and the eigenvector is n. Then E1 = span{n}. So M (−1) = m(−1) = 1. If p is any vector in the plane, Rp = p. So this has an eigenvalue of 1 and eigenvectors being any vector in the plane. So M (1) = m(1) = 2. So the eigenvectors form a basis of R3. (v) Consider a rotation R by θ about n. Since Rn = n, we have an eigenvalue of 1 and eigenspace E1 = span{n}. We know that there are no other real eig
envalues since rotation changes the direction of any other vector. The other eigenvalues turn out to be e±iθ. If θ = 0, there are 3 distinct eigenvalues and the eigenvectors form a basis of C3. 49 5 Eigenvalues and eigenvectors IA Vectors and Matrices (vi) Consider a shear 1 µ 0 1 The characteristic equation is (1 − λ)2 = 0 and λ = 1. The eigenvectors A = . We have M (1) = 2 and m(1) = 1. So corresponding to λ = 1 is x = ∆1 = 1. 1 0 If n × n matrix A has n distinct eigenvalues, and hence has n linearly independent eigenvectors v1, v2, · · · vn, then with respect to this eigenvector basis, A is diagonal. In this basis, v1 = (1, 0, · · · , 0) etc. We know that Avi = λivi (no summation). So the image of the ith basis vector is λi times the ith basis. Since the columns of A are simply the images of the basis,      λ1 0 ... 0 0 λ2 ... ... . . . · · · λn The fact that A can be diagonalized by changing the basis is an important observation. We will now look at how we can change bases and see how we can make use of this. 5.3 Transformation matrices How do the components of a vector or a matrix change when we change the basis? Let {e1, e2, · · · , en} and {˜e1, ˜e2, · · · , ˜en} be 2 different bases of Rn or Cn. Then we can write n Pijei ˜ej = i=1 i.e. Pij is the ith component of ˜ej with respect to the basis {e1, e2, · · · , en}. Note that the sum is made as Pijei, not Pijej. This is different from the formula for matrix multiplication. Matrix P has as its columns the vectors ˜ej relative to {e1, e2, · · · , en}. So P = ( ˜e1 ˜e2 · · · ˜en) and Similarly, we can write P (ei) = ˜ei ei = n k=1 Qki ˜ek with Q = (e1 e2 · · · en). Substituting this into the equation for ˜ej, we have n n Qki ˜ek Pij ˜ej = i=1 n k=1 k=1 n ˜ek i=1 = QkiPij 50 5 Eigenvalues and eigenvectors IA Vectors and Matrices But ˜e1, ˜e2, · · · , ˜en are linearly independent, so this is only possible if n i=1 QkiPij = δkj, which is just a fancy way of saying QP = I, or Q = P −1. 5.3.1 Transformation law for vectors With respect to basis {ei}, u = n n i=1 uiei. With respect to basis { ˜ei}, u = i=1 ˜ui ˜ei. Note that this is the same vector u but has different components with respect to different bases. Using the transformation matrix above for the basis, we have u = n ˜uj n j=1 i=1 Pijei n =   n i=1 j=1  Pij ˜uj  ei By comparison, we know that ui = n j=1 Pij ˜uj Theorem. Denote vector as u with respect to {ei} and ˜u with respect to { ˜ei}. Then u = P ˜u and ˜u = P −1u Example. Take the first basis as {e1 = (1, 0), e2 = (0, 1)} and the second as { ˜e1 = (1, 1), ˜e2 = (−1, 1)}. So ˜e1 = e1 + e2 and ˜e2 = −e1 + e2. We have P = 1 −1 1 1 . Then for an arbitrary vector u, we have u = u1e1 + u2e2 1 2 = u1 ( ˜e1 − ˜e2) + u2 1 2 ( ˜e1 + ˜e2) = 1 2 (u1 + u2) ˜e1 + 1 2 (−u1 + u2) ˜e2. Alternatively, using the formula above, we obtain ˜u = P −1u 1 1 −1 2 1 2 (u1 + u2) 1 2 (−u1 + u2) Which agrees with the above direct expansion. u1 1 u2 1 = = 51 5 Eigenvalues and eigenvectors IA Vectors and Matrices 5.3.2 Transformation law for matrix Consider a linear map α : Cn → Cn with associated n × n matrix A. We have u = α(u) = Au. Denote u and u as being with respect to basis {ei} (i.e. same basis in both spaces), and ˜u, ˜u with respect to { ˜ei}. Using what we’ve got above, we have u = Au P ˜u = AP ˜u ˜u = P −1AP ˜u = ˜A˜u So Theorem. ˜A = P −1AP Example. Consider the shear Sλ =   with respect to the standard basis. Choose a new set of basis vectors by rotating by θ about the e3 axis: ˜e1 = cos θe1 + sin θe2 ˜e2 = − sin θe1 + cos θe2 ˜e3 = e3 So we have P =   cos θ − sin θ cos θ sin θ 0 0  0  , P −1 = 0 1   cos θ − sin θ 0 Now use the basis transformation laws to obtain  ˜Sλ =  1 + λ sin θ cos θ −λ sin2 θ 0 λ cos2 θ 1 − λ sin θ cos θ 0 sin θ cos Clearly this is much more complicated than our original basis. This shows that choosing a sensible basis is important. More generally, given α : Cm → Cn, given x ∈ Cm, x ∈ Cn with x = Ax. We know that A is an n × m matrix. Suppose Cm has a basis {ei} and Cn has a basis {fi}. Now change bases to { ˜ei} and {˜fi}. We know that x = P ˜x with P being an m × m matrix, with x = R˜x with R being an n × n matrix. Combining both of these, we have Therefore ˜A = R−1AP . R˜x = AP ˜x ˜x = R−1AP ˜x 52 5 Eigenvalues and eigenvectors IA Vectors and Matrices Example. Consider α : R3 → R2, with respect to the standard bases in both spaces, A = 2 1 3 6 4 3 Use a new basis 2 1 change matrix in R3 is simply I, while 1 5 , in R2 and keep the standard basis in R3. The basis R = 2 1 1 5 , R−1 = 5 −1 2 −1 1 9 is the transformation matrix for R2. So 2 2 1 1 5 1 5 −1 2 ˜A = − 17/9 2/9 We can alternatively do it this way: we know that ˜f1 = we know that 2 1 , ˜f2 = 1 5 Then ˜e1 = e1 → 2f1 + f2 = f1 ˜e2 = e2 → 3f1 + 6f2 = ˜f1 + ˜f2 ˜e3 = e3 → 4f1 + 3f2 = 17 9 ˜f1 + 2 9 ˜f2 and we can construct the matrix correspondingly. 5.4 Similar matrices Definition (Similar matrices). Two n × n matrices A and B are similar if there exists an invertible matrix P such that B = P −1AP, i.e. they represent the same map under different bases. Alternatively, using the language from IA Groups, we say that they are in the same conjugacy class. Proposition. Similar matrices have the following properties: (i) Similar matrices have the same determinant. (ii) Similar matrices have the same trace. (iii) Similar matrices have the same characteristic polynomial. Note that (iii) implies (i) and (ii) since the determinant and trace are the coefficients of the characteristic polynomial 53 5 Eigenvalues and eigenvectors IA Vectors and Matrices Proof. They are proven as follows: (i) det B = det(P −1AP ) = (det A)(det P )−1(det P ) = det A (ii) (iii) tr B = Bii = P −1 ij AjkPki = AjkPkiP −1 ij = Ajk(P P −1)kj = Ajkδkj = Ajj = tr A pB(λ) = det(B − λI) = det(P −1AP − λI) = det(P −1AP − λP −1IP ) = det(P −1(A − λI)P ) = det(A − λI) = pA(λ) 5.5 Diagonalizable matrices Definition (Diagonalizable matrices). An n × n matrix A is diagonalizable if it is similar to a diagonal matrix. We showed above that this is equivalent to saying the eigenvectors form a basis of Cn. The requirement that matrix A has n distinct eigenvalues is a sufficient condition for diagonalizability as shown above. However, it is not necessary. Consider the second example in Section 5.2, A =   −2 2 −1 −2 2 −3 1 −6 0   We found three linear eigenvectors ˜e1 =   , ˜e2 =  1 2  1   , ˜e3 =   − If we let then P =  1 −2 1   , 2 −3 6 4 5 2 so A is diagonalizable. 0 5 0 −3 0 0 0 0 −3   , ˜A = P −1AP =   54 5 Eigenvalues and eigenvectors IA Vectors and Matrices Theorem. Let λ1, λ2, · · · , λr, with r ≤ n be the distinct eigenvalues of A. Let B1, B2, · · · Br be the bases of the eigenspaces Eλ1 , Eλ2 , · · · , Eλr correspondingly. Then the set B = Bi is linearly independent. r i=1 This is similar to the proof we had for the case where the eigenvalues are distinct. However, we are going to do it much concisely, and the actual meat of the proof is actually just a single line. Proof. Write B1 = {x(1) larly for all Bi. 1 , x(1) 2 , · · · x(1) m(λ1)}. Then m(λ1) = dim(Eλ1), and simi- Consider the following general linear combination of all elements in B. Con- sider the equation r m(λi) i=1 j=1 αijx(i) j = 0. The first sum is summing over all eigenspaces, and the second sum sums over the basis vectors in Bi. Now apply the matrix (A − λkI) k=1,2,··· , ¯K,··· ,r to the above sum, for some arbitrary K. We obtain m(λK ) j=1   αKj (λK − λk)   x(K) j = 0. k=1,2,··· , ¯K,··· ,r Since the x(K) K was arbitrary, all αij must be zero. So B is linearly independent. are linearly independent (BK is a basis), αKj = 0 for all j. Since j Proposition. A is diagonalizable iff all its eigenvalues have zero defect. 5.6 Canonical (Jordan normal) form Given a matrix A, if its eigenvalues all have non-zero defect, then we can find a basis in which it is diagonal. However, if some eigenvalue does have defect, we can still put it into an almost-diagonal form. This is known as the Jordan normal form. Theorem. Any 2 × 2 complex matrix A is similar to exactly one of λ1 λ2 Proof. For each case: (i) If A has two distinct eigenvalues, then eigenvectors are linearly independent. Then we can use P formed from eigenvectors as its columns 55 5 Eigenvalues and eigenvectors IA Vectors and Matrices (ii) If λ1 = λ2 = λ and dim Eλ = 2, then write Eλ = span{u, v}, with u, v linearly independent. Now use {u, v} as a new basis of C2 and ˜A = P −1AP = = λI λ 0 0 λ Note that since P −1AP = λI, we have A = P (λI)P −1 = λI. So A is isotropic, i.e. the same with respect to any basis. (iii) If λ1 = λ2 = λ and dim(Eλ) = 1, then Eλ = span{v}. Now choose basis of C2 as {v, w}, where w ∈ C2 \ Eλ. We know that Aw ∈ C2. So Aw = αv + βw. Hence, if we change basis to {v, w}, then ˜A = P −1AP = . λ α 0 β However, A and ˜A both have eigenvalue λ with algebraic multiplicity 2. So we must have β = λ. To make α = 1, let u = ( ˜A − λI)w. We know u = 0 since w is not in the eigenspace. Then 0 α 0 0 ( ˜A − λI)u = ( ˜A − λI)2w = 0 α 0 0 w = 0. So u is an eigenvector of ˜A with eigenvalue λ. We have u = ˜Aw − λw. So ˜Aw = u + λw. Change basis to {u, w}. Then A with respect to this basis is λ 1 0 λ . This is a two-stage process: P sends basis to {v, w} and then matrix Q sends to basis {u, w}. So the similarity transformation is Q−1(P −1AP )Q = (P Q)−1A(P Q). Proposition. (Without proof) The canonical form, or Jordan normal form, exists for any n × n matrix A. Specifically, there exists a similarity transform such that A is similar to a matrix to ˜A that satisfies the following properties: (i) ˜Aαα = λα, i.e. the diagonal composes of the eigenvalues. (ii) ˜Aα,α+1 = 0 or 1. (iii) ˜Aij = 0 otherwise. The actual theorem is actually stronger than this, and the Jordan normal form satisfies some additional properties in addition to the above. However, we shall not go into details, and this is left for the IB Linear Algebra course. Example. Let A =   −3 −1 −1 −3 −2 −2   1 1 0 The eigenvalues
are −2, −2, −2 and the eigenvectors are w =   1 0 . Write u = (A − λI)w =  0   −1 −1 −1 −1 −2 − 56   1 0 . Pick  1 . Note that    ,  −1 1 0  −1 −1 −2   5 Eigenvalues and eigenvectors IA Vectors and Matrices Au = −2u. We also have Aw = u − 2w. Form a basis {u, w, v}, where v is another eigenvector linearly independent from u, say Now change to this basis with P = form is P −1AP =   −2 1 0 −2 0 0 0 0 −2     −1 −1 −2 1 0 0 1 0 1   .  1 0  1 . Then the Jordan normal 5.7 Cayley-Hamilton Theorem Theorem (Cayley-Hamilton theorem). Every n × n complex matrix satisfies its own characteristic equation. Proof. We will only prove for diagonalizable matrices here. So suppose for our matrix A, there is some P such that D = diag(λ1, λ2, · · · , λn) = P −1AP . Note that Di = (P −1AP )(P −1AP ) · · · (P −1AP ) = P −1AiP. Hence pD(D) = pD(P −1AP ) = P −1[pD(A)]P. Since similar matrices have the same characteristic polynomial. So pA(D) = P −1[pA(A)]P. However, we also know that Di = diag(λi 1, λi 2, · · · λi n). So pA(D) = diag(pA(λ1), pA(λ2), · · · , pA(λn)) = diag(0, 0, · · · , 0) since the eigenvalues are roots of pA(λ) = 0. So 0 = pA(D) = P −1pA(A)P and thus pA(A) = 0. There are a few things to note. (i) If A−1 exists, then A−1pA(A) = A−1(c0 + c1A + c2A2 + · · · + cnAn) = 0. So c0A−1 + c1 + c2A + · · · + cnAn−1. Since A−1 exists, c0 = ± det A = 0. So −1 c0 So we can calculate A−1 from positive powers of A. (c1 + c2A + · · · + cnAn−1). A−1 = (ii) We can define matrix exponentiation by eA = I + A + 1 2! A2 + · · · + 1 n! An + · · · . It is a fact that this always converges. 57 5 Eigenvalues and eigenvectors IA Vectors and Matrices If A is diagonalizable with P with D = P −1AP = diag(λ1, λ2, · · · , λn), then P −1eAP = P −1IP + P −1AP + 1 2! P −1A2P + · · · = I + D + 1 2! = diag(eλ1 , eλ2, · · · eλn ) D2 + · · · So eA = P [diag(eλ1, eλ2 , · · · , eλn )]P −1. (iii) For 2 × 2 matrices which are similar to B = λ 1 0 λ We see that the characteristic polynomial pB(z) = det(B − zI) = (λ − z)2. Then pB(B) = (λI − B)2 = 2 0 −1 0 0 0 0 = 0 0 . Since we have proved for the diagonalizable matrices above, we now know that any 2 × 2 matrix satisfies Cayley-Hamilton theorem. In IB Linear Algebra, we will prove the Cayley Hamilton theorem properly for all matrices without assuming diagonalizability. 5.8 Eigenvalues and eigenvectors of a Hermitian matrix 5.8.1 Eigenvalues and eigenvectors Theorem. The eigenvalues of a Hermitian matrix H are real. Proof. Suppose that H has eigenvalue λ with eigenvector v = 0. Then We pre-multiply by v†, a 1 × n row vector, to obtain Hv = λv. v†Hv = λv†v (∗) We take the Hermitian conjugate of both sides. The left hand side is (v†Hv)† = v†H †v = v†Hv since H is Hermitian. The right hand side is So we have (λv†v)† = λ∗v†v v†Hv = λ∗v†v. From (∗), we know that λv†v = λ∗v†v. Since v = 0, we know that v†v = v · v = 0. So λ = λ∗ and λ is real. Theorem. The eigenvectors of a Hermitian matrix H corresponding to distinct eigenvalues are orthogonal. 58 5 Eigenvalues and eigenvectors IA Vectors and Matrices Proof. Let Hvi = λivi Hvj = λjvj. Pre-multiply (i) by v† j to obtain j Hvi = λiv† v† j vi. Pre-multiply (ii) by v† i and take the Hermitian conjugate to obtain Equating (iii) and (iv) yields j Hvi = λjv† v† j vi. (i) (ii) (iii) (iv) λiv† j vi = λjv† j vi. Since λi = λj, we must have v† orthogonal. j vi = 0. So their inner product is zero and are So we know that if a Hermitian matrix has n distinct eigenvalues, then the eigenvectors form an orthonormal basis. However, if there are degenerate eigenvalues, it is more difficult, and requires the Gram-Schmidt process. 5.8.2 Gram-Schmidt orthogonalization (non-examinable) Suppose we have a set B = {w1, w2, · · · , wr} of linearly independent vectors. We want to find an orthogonal set ˜B = {v1, v2, · · · , vr}. Define the projection of w onto v by Pv(w) = v|w v|v v. Now construct ˜B iteratively: (i) v1 = w1 (ii) v2 = w2 − Pv1 (w) Then we get that v1 | v2 = v1 | w2 − v1|w2 v1|v1 v1 | v1 = 0 (iii) v3 = w3 − Pv1 (w3) − Pv2(w3) ... (iv) (v) vr = wr − r−1 j=1 Pvj (wr) At each step, we subtract out the components of vi that belong to the space of {v1, · · · , vk−1}. This ensures that all the vectors are orthogonal. Finally, we normalize each basis vector individually to obtain an orthonormal basis. 59 5 Eigenvalues and eigenvectors IA Vectors and Matrices 5.8.3 Unitary transformation Suppose U is the transformation between one orthonormal basis and a new orthonormal basis {u1, u2, · · · , un}, i.e. ui | uj = δij. Then      (u1)1 (u1)2 ... (u1)n (u2)1 (u2)2 ... (u2)un)1 (un)2 ... (un)n U = Then kiUkj (U †U )ij = (U †)ikUkj = U ∗ = (ui)∗ = ui | uj = δij k(uj)k So U is a unitary matrix. 5.8.4 Diagonalization of n × n Hermitian matrices Theorem. An n × n Hermitian matrix has precisely n orthogonal eigenvectors. Proof. (Non-examinable) Let λ1, λ2, · · · , λr be the distinct eigenvalues of H (r ≤ n), with a set of corresponding orthonormal eigenvectors B = {v1, v2, · · · , vr}. Extend to a basis of the whole of Cn B = {v1, v2, · · · , vr, w1, w2, · · · , wn−r} Now use Gram-Schmidt to create an orthonormal basis Now write ˜B = {v1, v2, · · · , vr, u1, u2, · · · , un−r}. P =   ↑ ↑ v1 v2 ↓ ↓ ↑ ↑ · · · vr u1 ↓ ↓ ↑ · · · un−r ↓   We have shown above that this is a unitary matrix, i.e. P −1 = P †. So if we change basis, we have P −1HP = P †HP =               λ1 0 ... 0 0 0 ... 0 0 λ2 ... 0 0 0 ... 0 · · · 0 · · · 0 ... . . . · · · λr 0 · · · 0 · · · ... ... 0 · · · 0 0 ... 0 c11 c21 ... cn−r,1 0 0 ... 0 c12 c22 ... cn−r, c1,n−r c2,n−r ... cn−r,n−r 60 5 Eigenvalues and eigenvectors IA Vectors and Matrices Here C is an (n − r) × (n − r) Hermitian matrix. The eigenvalues of C are also eigenvalues of H because det(H − λI) = det(P †HP − λI) = (λ1 − λ) · · · (λr − λ) det(C − λI). So the eigenvalues of C are the eigenvalues of H. We can keep repeating the process on C until we finish all rows. For example, if the eigenvalues of C are all distinct, there are n − r orthonormal eigenvectors wj (for j = r + 1, · · · , n) of C. Let             ↑ ↑ wr+1 wr+2 ↓ ↓ ↑ · · · wn ↓ with other entries 0. (where we have a r × r identity matrix block on the top left corner and a (n − r) × (n − r) with columns formed by wj) Since the columns of Q are orthonormal, Q is unitary. So Q†P †HP Q = diag(λ1, λ2, · · · , λr, λr+1, · · · , λn), where the first r λs are distinct and the remaining ones are copies of previous ones. The n linearly-independent eigenvectors are the columns of P Q. So it now follows that H is diagonalizable via transformation U (= P Q). U is a unitary matrix because P and Q are. We have D = U †HU H = U DU † Note that a real symmetric matrix S is a special case of Hermitian matrices. So we have D = QT SQ S = QDQT Example. Find the orthogonal matrix which diagonalizes the following real symmetric matrix: S = with β = 0 ∈ R. 1 β β 1 We find the eigenvalues by solving the characteristic equation: det(S−λI) = 0, and obtain λ = 1 ± β. 1 √ 2 The corresponding eigenvectors satisfy (S − λI)x = 0, which gives x = 1 ±1 We change the basis from the standard basis to 1 (which is just a rotation by π/4). The transformation matrix is Q = S = QDQT with D = diag(1, −1) √ √ 1/ 1/ 61 1/ 2 2 −1/ √ 2 √ 2 . Then we know that 5 Eigenvalues and eigenvectors IA Vectors and Matrices 5.8.5 Normal matrices We have seen that the eigenvalues and eigenvectors of Hermitian matrices satisfy some nice properties. More generally, we can define the following: Definition (Normal matrix). A normal matrix as a matrix that commutes with its own Hermitian conjugate, i.e. N N † = N †N Hermitian, real symmetric, skew-Hermitian, real anti-symmetric, orthogonal, unitary matrices are all special cases of normal matrices. It can be shown that: Proposition. (i) If λ is an eigenvalue of N , then λ∗ is an eigenvalue of N †. (ii) The eigenvectors of distinct eigenvalues are orthogonal. (iii) A normal matrix can always be diagonalized with an orthonormal basis of eigenvectors. 62 6 Quadratic forms and conics IA Vectors and Matrices 6 Quadratic forms and conics We want to study quantities like x2 2. For example, conic sections generally take this form. The common characteristic of these is that each term has degree 2. Consequently, we can write it in the form x†Ax for some matrix A. 1 + 2x1x2 + 4x2 2 and 3x2 1 + x2 Definition (Sesquilinear, Hermitian and quadratic forms). A sesquilinear form is a quantity F = x†Ax = x∗ i Aijxj. If A is Hermitian, then F is a Hermitian form. If A is real symmetric, then F is a quadratic form. Theorem. Hermitian forms are real. Proof. (x†Hx)∗ = (x†Hx)† = x†H †x = x†Hx. So (x†Hx)∗ = x†Hx and it is real. We know that any Hermitian matrix can be diagonalized with a unitary transformation. So F (x) = x†Hx = x†U DU †x. Write x = U †x. So F = (x)†Dx, where D = diag(λ1, · · · , λn). We know that x is the vector x relative to the eigenvector basis. So F (x) = n i=1 λi|x i|2 The eigenvectors are known as the principal axes. Example. Take F = 2x2 − 4xy + 5y2 = xT Sx, where x = 2 −2 5 −2 . x y and S = Note that we can always choose the matrix to be symmetric. This is since for any antisymmetric A, we have x†Ax = 0. So we can just take the symmetric part. 2 1 , 1 √ 5 1 −2 . The eigenvalues are 1, 6 with corresponding eigenvectors Now change basis with Q = 1 √ 5 2 1 1 −2 Then x = QT x = 1√ 5 2x + y x − 2y So F = c is an ellipse. . Then F = (x)2 + 6(y)2. 1 √ 5 6.1 Quadrics and conics 6.1.1 Quadrics Definition (Quadric). A quadric is an n-dimensional surface defined by the zero of a real quadratic polynomial, i.e. xT Ax + bT x + c = 0, where A is a real n × n matrix, x, b are n-dimensional column vectors and c is a constant scalar. 63 6 Quadratic forms and conics IA Vectors and Matrices As noted in example, anti-symmetric matrix has xT Ax = 0, so for any A, we can split it into symmetric and anti-symmetric parts, and just retain the symmetric part S = (A + AT )/2. So we can have xT Sx +
bT x + c = 0 with S symmetric. Since S is real and symmetric, we can diagonalize it using S = QDQT with D diagonal. We write x = QT x and b = QT b. So we have (x)T Dx + (b)T x + c = 0. If S is invertible, i.e. with no zero eigenvalues, then write x = x + 1 2 D−1b which shifts the origin to eliminate the linear term (b)T x and finally have (dropping the prime superfixes) xT Dx = k. So through two transformations, we have ended up with a simple quadratic form. 6.1.2 Conic sections (n = 2) From the equation above, we obtain λ1x2 1 + λ2x2 2 = k. We have the following cases: (i) λ1λ2 > 0: we have ellipses with axes coinciding with eigenvectors of S. (We require sgn(k) = sgn(λ1, λ2), or else we would have no solutions at all) (ii) λ1λ2 < 0: say λ1 = k/a2 > 0, λ2 = −k/b2 < 0. So we obtain x2 1 a2 − x2 2 b2 = 1, which is a hyperbola. (iii) λ1λ2 = 0: Say λ2 = 0, λ1 = 0. Note that in this case, our symmetric matrix S is not invertible and we cannot shift our origin using as above. From our initial equation, we have λ1(x 1)2 + b 1x 1 + b 2x 2 + c = 0. We perform the coordinate transform (which is simply completing the square!) 2λ1 c b 2 − 1)2 (b 4λ1b 2 to remove the x 1 and constant term. Dropping the primes, we have λ1x2 1 + b2x2 = 0, 64 6 Quadratic forms and conics IA Vectors and Matrices which is a parabola. Note that above we assumed b 0. If we solve this quadratic for x (and x2 can be any value). So we have 0, 1 or 2 straight lines. 1 +c = 1, we obtain 0, 1 or 2 solutions for x1 2 = 0, we have λ1(x 2 = 0. If b 1)2 +b 1x These are known as conic sections. As you will see in IA Dynamics and Relativity, this are the trajectories of planets under the influence of gravity. 6.2 Focus-directrix property Conic sections can be defined in a different way, in terms of Definition (Conic sections). The eccentricity and scale are properties of a conic section that satisfy the following: Let the foci of a conic section be (±ae, 0) and the directrices be x = ±a/e. A conic section is the set of points whose distance from focus is e× distance from directrix which is closer to that of focus (unless e = 1, where we take the distance to the other directrix). Now consider the different cases of e: (i) e < 1. By definition, y x = a/e (x, y) ae O x (x − ae)2 + y2 = e − x a e x2 a2 + y2 a2(1 − e2) = 1 Which is an ellipse with semi-major axis a and semi-minor axis a (if e = 0, then we have a circle) √ 1 − e2. (ii) e > 1. So 65 6 Quadratic forms and conics IA Vectors and Matrices y x = a/e (x, y) ae x O (x − ae)2 + y2 = e x − a e x2 a2 − y2 a2(e2 − 1) = 1 and we have a hyperbola. (iii) e = 1: Then x = a y O (x, y) a x (x − a)2 + y2 = (x + 1) y2 = 4ax and we have a parabola. Conics also work in polar coordinates. We introduce a new parameter l such that l/e is the distance from the focus to the directrix. So l = a|1 − e2|. 66 6 Quadratic forms and conics IA Vectors and Matrices We use polar coordinates (r, θ) centered on a focus. So the focus-directrix property is r = e l e − r cos θ r = l 1 + e cos θ We see that r → ∞ if θ → cos−1(−1/e), which is only possible if e ≥ 1, i.e. hyperbola or parabola. But ellipses have e < 1. So r is bounded, as expected. 67 7 Transformation groups IA Vectors and Matrices 7 Transformation groups We have previously seen that orthogonal matrices are used to transform between orthonormal bases. Alternatively, we can see them as transformations of space itself that preserve distances, which is something we will prove shortly. Using this as the definition of an orthogonal matrix, we see that our definition of orthogonal matrices is dependent on our choice of the notion of distance, or metric. In special relativity, we will need to use a different metric, which will lead to the Lorentz matrices, the matrices that conserve distances in special relativity. We will have a brief look at these as well. 7.1 Groups of orthogonal matrices Proposition. The set of all n × n orthogonal matrices P forms a group under matrix multiplication. Proof. 0. If P, Q are orthogonal, then consider R = P Q. RRT = (P Q)(P Q)T = P (QQT )P T = P P T = I. So R is orthogonal. 1. I satisfies II T = I. So I is orthogonal and is an identity of the group. 2. Inverse: if P is orthogonal, then P −1 = P T by definition, which is also orthogonal. 3. Matrix multiplication is associative since function composition is associative. Definition (Orthogonal group). The orthogonal group O(n) is the group of orthogonal matrices. Definition (Special orthogonal group). The special orthogonal group is the subgroup of O(n) that consists of all orthogonal matrices with determinant 1. In general, we can show that any matrix in O(2) is of the form cos θ − sin θ cos θ sin θ or cos θ sin θ sin θ − cos θ 7.2 Length preserving matrices Theorem. Let P ∈ O(n). Then the following are equivalent: (i) P is orthogonal (ii) |P x| = |x| (iii) (P x)T (P y) = xT y, i.e. (P x) · (P y) = x · y. (iv) If (v1, v2, · · · , vn) are orthonormal, so are (P v1, P v2, · · · , P vn) (v) The columns of P are orthonormal. Proof. We do them one by one: 68 7 Transformation groups IA Vectors and Matrices (i) ⇒ (ii): |P x|2 = (P x)T (P x) = xT P T P x = xT x = |x|2 (ii) ⇒ (iii): |P (x + y)|2 = |x + y|2. The right hand side is (xT + yT )(x + y) = xT x + yT y + yT x + xT y = |x|2 + |y|2 + 2xT y. Similarly, the left hand side is |P x + P y|2 = |P x|2 + |P y| + 2(P x)T P y = |x|2 + |y|2 + 2(P x)T P y. So (P x)T P y = xT y. (iii) ⇒ (iv): (P vi)T P vj = vT i vj = δij. So P vi’s are also orthonormal. (iv) ⇒ (v): Take the vi’s to be the standard basis. So the columns of P , being P ei, are orthonormal. (v) ⇒ (i): The columns of P are orthonormal. Then (P P T )ij = PikPjk = (Pi) · (Pj) = δij, viewing Pi as the ith column of P . So P P T = I. Therefore the set of length-preserving matrices is precisely O(n). 7.3 Lorentz transformations Consider the Minkowski 1 + 1 dimension spacetime (i.e. 1 space dimension and 1 time dimension) Definition (Minkowski inner product). The Minkowski inner product of 2 vectors x and y is where Then x | y = x1y1 − x2y2. x | y = xT Jy, J = 1 0 0 −1 This is to be compared to the usual Euclidean inner product of x, y ∈ R2, given by x | y = xT y = xT Iy = x1y1 + x2y2. Definition (Preservation of inner product). A transformation matrix M preserves the Minkowski inner product if for all x, y. x|y = M x|M y We know that xT Jy = (M x)T JM y = xT M T JM y. Since this has to be true for all x and y, we must have J = M T JM. We can show that M takes the form of Hα = cosh α sinh α sinh α cosh α or Kα/2 = cosh α − sinh α sinh α − cosh α 69 7 Transformation groups IA Vectors and Matrices where Hα is a hyperbolic rotation, and Kα/2 is a hyperbolic reflection. This is technically all matrices that preserve the metric, since these only include matrices with M11 > 0. In physics, these are the matrices we want, since M11 < 0 corresponds to inverting time, which is frowned upon. Definition (Lorentz matrix). A Lorentz matrix or a Lorentz boost is a matrix in the form Bv = √ 1 1 − v2 1 v . v 1 Here |v| < 1, where we have chosen units in which the speed of light is equal to 1. We have Bv = Htanh−1 v Definition (Lorentz group). The Lorentz group is a group of all Lorentz matrices under matrix multiplication. It is easy to prove that this is a group. For the closure axiom, we have Bv1Bv2 = Bv3, where v3 = tanh(tanh−1 v1 + tanh−1 v2) = v1 + v2 1 + v1v2 The set of all Bv is a group of transformations which preserve the Minkowski inner product. 70
). We write r(u, v) for the point labelled by (u, v). Example. Let S be part of a sphere of radius a with 0 ≤ θ ≤ α. α We can then label the points on the spheres by the angles θ, ϕ, with r(θ, ϕ) = (a cos ϕ sin θ, a sin θ sin ϕ, a cos θ) = aer. We restrict the values of θ, ϕ by 0 ≤ θ ≤ α, 0 ≤ ϕ ≤ 2π, so that each point is only covered once. Note that to specify a surface, in addition to the function r, we also have to specify what values of (u, v) we are allowed to take. This corresponds to a region D of allowed values of u and v. When we do integrals with these surfaces, these will become the bounds of integration. When we have such a parametrization r, we would want to make sure this indeed gives us a two-dimensional surface. For example, the following two parametrizations would both be bad: r(u, v) = u, r(u, v) = u + v. The idea is that r has to depend on both u and v, and in “different ways”. More precisely, when we vary the coordinates (u, v), the point r will change accordingly. By the chain rule, this is given by δr = ∂r ∂u δu + ∂r ∂v δv + o(δu, δv). Then ∂r respectively. What we want is for them to point in different directions. ∂v are tangent vectors to curves on S with v and u constant δu and ∂r Definition (Regular parametrization). A parametrization is regular if for all u, v, ∂r ∂u ∂r ∂v × = 0, i.e. there are always two independent tangent directions. 27 4 Surfaces and surface integrals IA Vector Calculus The parametrizations we use will all be regular. Given a surface, how could we, say, find its area? We can use our parametrization. Suppose points on the surface are given by r(u, v) for (u, v) ∈ D. If we want to find the area of D itself, we would simply integrate D du dv. However, we are just using u and v as arbitrary labels for points in the surface, and one unit of area in D does not correspond to one unit of area in S. Instead, suppose we produce a small rectangle in D by changing u and v by small δu, δv. In D, this corresponds to a rectangle with vertices (u, v), (u + δu, v), (u, v + δv), (u + δu, v + δv), and spans an area δuδv. In the surface S, these small changes δu, δv correspond to changes ∂r ∂v δv, and these span a vector area of ∂u δu and ∂r ∂r ∂v δuδv = n δS. δS = ∂r ∂u × Note that the order of u, v gives the choice of the sign of the unit normal. The actual area is then given by δS = ∂r ∂u × ∂r ∂v δu δv. Making these into differentials instead of deltas, we have Proposition. The vector area element is The scalar area element is dS = ∂r ∂u × ∂r ∂v du dv. dS = ∂r ∂u × ∂r ∂v du dv. By summing and taking limits, the area of S is S dS = D ∂r ∂u × ∂r ∂v du dv. Example. Consider again the part of the sphere of radius a with 0 ≤ θ ≤ α. Then we have So we find α r(θ, ϕ) = (a cos ϕ sin θ, a sin θ sin ϕ, a cos θ) = aer. ∂r ∂θ = aeθ. 28 4 Surfaces and surface integrals IA Vector Calculus Similarly, we have Then So ∂r ∂ϕ = a sin θeϕ. ∂r ∂θ × ∂r ∂ϕ = a2 sin θ er. dS = a2 sin θ dθ dϕ. Our bounds are 0 ≤ θ ≤ α, 0 ≤ ϕ ≤ 2π. Then the area is 2π α 0 0 a2 sin θ dθ dϕ = 2πa2(1 − cos α). 4.3 Surface integral of vector fields Just computing the area of a surface would be boring. Suppose we have a surface S parametrized by r(u, v), where (u, v) takes values in D. We would like to ask how much “stuff” is passing through S, where the flow of stuff is given by a vector field F(r). We might attempt to use the integral D |F| dS. However, this doesn’t work. For example, if all the flow is tangential to the surface, then nothing is really passing through the surface, but |F| is non-zero, so we get a non-zero integral. Instead, what we should do is to consider the component of F that is normal to the surface S, i.e. parallel to its normal. Definition (Surface integral). The surface integral or flux of a vector field F(r) over S is defined by S F(r) · dS = S F(r) · n dS = D F(r(u, v)) · ∂r ∂u × ∂r ∂v du dv. Intuitively, this is the total amount of F passing through S. For example, if F is the electric field, the flux is the amount of electric field passing through a surface. For a given orientation, the integral F·dS is independent of the parametrization. Changing orientation is equivalent to changing the sign of n, which is in turn equivalent to changing the order of u and v in the definition of S, which is also equivalent to changing the sign of the flux integral. Example. Consider a sphere of radius a, r(θ, ϕ). Then ∂r ∂θ = aeθ, ∂r ∂ϕ = a sin θeϕ. The vector area element is dS = a2 sin θer dθ dϕ, 29 4 Surfaces and surface integrals IA Vector Calculus taking the outward normal n = er = r/a. Suppose we want to calculate the fluid flux through the surface. The velocity field u(r) of a fluid gives the motion of a small volume of fluid r. Assume that u depends smoothly on r (and t). For any small area δS, on a surface S, the volume of fluid crossing it in time δt is u · δS δt. u δt n δS So the amount of flow of u over at time δt through S is δt S u · dS. So S u · dS is the rate of volume crossing S. For example, let u = (−x, 0, z) and S be the section of a sphere of radius a with 0 ≤ ϕ ≤ 2π and 0 ≤ θ ≤ α. Then with So Therefore S dS = a2 sin θn dϕ dθ, n = r a = 1 a (x, y, z). n · u = 1 a (−x2 + z2) = a(− sin2 θ cos2 ϕ + cos2 θ). α 2π u · dS = a3 sin θ[(cos2 θ − 1) cos2 ϕ + cos2 θ] dϕ dθ 0 α 0 α 0 = = 0 a3 sin θ[π(cos2θ − 1) + 2π cos2 θ] dθ a3π(3 cos3 θ − 1) sin θ dθ = πa3[cosθ − cos3 θ]α 0 = πa3 cos α sin2 α. What happens when we change parametrization? Let r(u, v) and r(˜u, ˜v) be two regular parametrizations for the surface. By the chain rule, So ∂r ∂u ∂r ∂v = = ∂r ∂ ˜u ∂r ∂ ˜u ∂ ˜u ∂u ∂ ˜u ∂v + + ∂r ∂˜v ∂r ∂˜v ∂˜v ∂u ∂˜v ∂v ∂r ∂u × ∂r ∂v = ∂(˜u, ˜v) ∂(u, v) ∂r ∂ ˜u × ∂r ∂˜v 30 4 Surfaces and surface integrals IA Vector Calculus where ∂(˜u,˜v) Since ∂(u,v) is the Jacobian. d˜u d˜v = ∂(˜u, ˜v) ∂(u, v) du dv, We recover the formula dS = ∂r ∂u × ∂r ∂v du dv = ∂r ∂ ˜u × ∂r ∂˜v d˜u d˜v. Similarly, we have dS = ∂r ∂u × ∂r ∂v du dv = ∂r ∂ ˜u × ∂r ∂˜v d˜u d˜v. provided (u, v) and (˜u, ˜v) have the same orientation. 4.4 Change of variables in R2 and R3 revisited In this section, we derive our change of variable formulae in a slightly different way. Change of variable formula in R2 We first derive the 2D change of variable formula from the 3D surface integral formula. Consider a subset S of the plane R2 parametrized by r(x(u, v), y(u, v)). We can embed it to R3 as r(x(u, v), y(u, v), 0). Then ∂r ∂u × ∂r ∂v = (0, 0, J), with J being the Jacobian. Therefore S f (r) dS = D f (r(u, v)) ∂r ∂u × ∂r ∂v du dv = D f (r(u, v))|J| du dv, and we recover the formula for changing variables in R2. Change of variable formula in R3 In R3, suppose we have a volume parametrised by r(u, v, w). Then δr = ∂r ∂u δu + ∂r ∂v δv + ∂r ∂w δw + o(δu, δv, δw). Then the cuboid δu, δv, δw in u, v, w space is mapped to a parallelopiped of volume δV = δu · δv × δw = |J| δu δv δw. ∂r ∂u ∂r ∂v ∂r ∂w So dV = |J| du dv dw. 31 5 Geometry of curves and surfaces IA Vector Calculus 5 Geometry of curves and surfaces Let r(s) be a curve parametrized by arclength s. Since t(s) = dr ds is a unit vector, t · t = 1. Differentiating yields t · t = 0. So t is a normal to the curve if t = 0. We define the following: Definition (Principal normal and curvature). Write t = κn, where n is a unit vector and κ > 0. Then n(s) is called the principal normal and κ(s) is called the curvature. Note that we must be differentiating against s, not any other parametrization! If the curve is given in another parametrization, we can either change the parametrization or use the chain rule. We take a curve that can Taylor expanded around s = 0. Then r(s) = r(0) + sr(0) + 1 2 s2r(0) + O(s3). We know that r = t and r = t. So we have r(s) = r(0) + st(0) + 1 2 κ(0)s2n + O(s3). How can we interpret κ as the curvature? Suppose we want to approximate the curve near r(0) by a circle. We would expect a more “curved” curve would be approximated by a circle of smaller radius. So κ should be inversely proportional to the radius of the circle. In fact, we will show that κ = 1/a, where a is the radius of the best-fit circle. Consider the vector equation for a circle passing through r(0) with radius a in the plane defined by t and n. a n θ r(0) t Then the equation of the circle is r = r(0) + a(1 − cos θ)n + a sin θt. We can expand this to obtain r = r(0) + aθt + 1 2 θ2an + o(θ3). Since the arclength s = aθ, we obtain r = r(0) + st + 1 2 1 a s2n + O(s3). As promised, κ = 1/a, for a the radius of the circle of best fit. 32 5 Geometry of curves and surfaces IA Vector Calculus Definition (Radius of curvature). The radius of curvature of a curve at a point r(s) is 1/κ(s). Since we are in 3D, given t(s) and n(s), there is another normal to the curve. We can add a third normal to generate an orthonormal basis. Definition (Binormal). The binormal of a curve is b = t × n. We can define the torsion similar to the curvature, but with the binormal instead of the tangent.1 Definition (Torsion). Let b = −τ n. Then τ is the torsion. Note that this makes sense, since b is both perpendicular to t and b, and hence must be in the same direction as n. (, so b is perpendicular to t; and . So b is perpendicular to b). The geometry of the curve is encoded in how this basis (t, n, b) changes along it. This can be specified by two scalar functions of arc length — the curvature κ(s) and the torsion τ (s) (which determines what the curve looks like to third order in its Taylor expansions and how the curve lifts out of the t, r plane). Surfaces and intrinsic geometry* We can study the geometry of surfaces through curves which lie on them. At a given point P at a surface S with normal n, consider a plane containing n. The intersection of the plane with the surface yields a curve on the surface through P . This curve has a curvature κ at P . If we choose different planes containing n, we end up with different curves of different curvature. Then we define the following: Definition (Principal curvature). The principal curvatures of a surface at P are the minimum and maximum possible
curvature of a curve through P , denoted κmin and κmax respectively. Definition (Gaussian curvature). The Gaussian curvature of a surface at a point P is K = κminκmax. Theorem (Theorema Egregium). K is intrinsic to the surface S. It can be expressed in terms of lengths, angles etc. which are measured entirely on the surface. So K can be defined on an arbitrary surface without embedding it on a higher dimension surface. The is the start of intrinsic geometry: if we embed a surface in Euclidean space, we can determine lengths, angles etc on it. But we don’t have to do so — we can “live in ” the surface and do geometry in it without an embedding. For example, we can consider a geodesic triangle D on a surface S. It consists of three geodesics: shortest curves between two points. Let θi be the interior angles of the triangle (defined by using scalar products of tangent vectors). Then 1This was not taught in lectures, but there is a question on the example sheet about the torsion, so I might as well include it here. 33 5 Geometry of curves and surfaces IA Vector Calculus Theorem (Gauss-Bonnet theorem). θ1 + θ2 + θ3 = π + D K dA, integrating over the area of the triangle. 34 6 Div, Grad, Curl and ∇ IA Vector Calculus 6 Div, Grad, Curl and ∇ 6.1 Div, Grad, Curl and ∇ Recalled that ∇f is given by (∇f )i = ∂f ∂xi the scalar field f by applying ∇ = ei . We can regard this as obtained from ∂ ∂xi for cartesian coordinates xi and orthonormal basis ei, where ei are orthonormal and right-handed, i.e. ei × ej = εijkek (it is left handed if ei × ej = −εijkek). We can alternatively write this as ∂ ∂x ∇ = , ∂ ∂y , ∂ ∂z . ∇ (nabla or del ) is both an operator and a vector. We can apply it to a vector field F(r) = Fi(r)ei using the scalar or vector product. Definition (Divergence). The divergence or div of F is ∇ · F = ∂Fi ∂xi = ∂F1 ∂x1 + ∂F2 ∂x2 + ∂F3 ∂x3 . Definition (Curl). The curl of F is ∇ × F = εijk ∂Fk ∂xj ei = e1 e2 e3 ∂ ∂ ∂ ∂x ∂y ∂z Fx Fy Fz Example. Let F = (xez, y2 sin x, xyz). Then ∇ · F = ∂ ∂x xez + ∂ ∂y y2 sin x + ∂ ∂z xyz = ez + 2y sin x + xy. and ∇ × F = ˆi (xyz) − ∂ ∂y ∂ ∂z ∂ ∂x + ˆj + ˆk (y2 sin x) (xyz) ∂ ∂z ∂ ∂x (xez) + (y2 sin x) − (xez) ∂ ∂y = (xz, xez − yz, y2 cos x). Note that ∇ is an operator, so ordering is important. For example, F · ∇ = Fi ∂ ∂xi is a scalar differential operator, and F × ∇ = ekεijkFi ∂ ∂xj is a vector differential operator. 35 6 Div, Grad, Curl and ∇ IA Vector Calculus Proposition. Let f, g be scalar functions, F, G be vector functions, and µ, λ be constants. Then ∇(λf + µg) = λ∇f + µ∇g ∇ · (λF + µG) = λ∇ · F + µ∇ · G ∇ × (λF + µG) = λ∇ × F + µ∇ × G. Note that Grad and Div can be analogously defined in any dimension n, but curl is specific to n = 3 because it uses the vector product. Example. Consider rα with r = |r|. We know that r = xiei. So r2 = xixi. Therefore 2r ∂r ∂xj = 2xj, or So Also, and ∂r ∂xi = xi r . ∇rα = ei ∂ ∂xi (rα) = eiαrα−1 ∂r ∂xi = αrα−2r. ∇ · r = ∂xi ∂xi = 3. ∇ × r = ekεijk ∂xj ∂xi = 0. Proposition. We have the following Leibnitz properties: ∇(f g) = (∇f )g + f (∇g) ∇ · (f F) = (∇f ) · F + f (∇ · F) ∇ × (f F) = (∇f ) × F + f (∇ × F) ∇(F · G) = F × (∇ × G) + G × (∇ × F) + (F · ∇)G + (G · ∇)F ∇ × (F × G) = F(∇ · G) − G(∇ · F) + (G · ∇)F − (F · ∇)G ∇ · (F × G) = (∇ × F) · G − F · (∇ × G) which can be proven by brute-forcing with suffix notation and summation convention. There is absolutely no point in memorizing these (at least the last three). They can be derived when needed via suffix notation. Example. ∇ · (rαr) = (∇rα)r + rα∇ · r = (αrα−2r) · r + rα(3) = (α + 3)rα ∇ × (rαr) = (∇(rα)) × r + rα(∇ × r) = αrα−2r × r = 0 36 6 Div, Grad, Curl and ∇ IA Vector Calculus 6.2 Second-order derivatives We have Proposition. ∇ × (∇f ) = 0 ∇ · (∇ × F) = 0 Proof. Expand out using suffix notation, noting that εijk ∂2f ∂xi∂xj = 0. since if, say, k = 3, then εijk ∂2f ∂xi∂xj = ∂2f ∂x1∂x2 − ∂2f ∂x2∂x1 = 0. The converse of each result holds for fields defined in all of R3: Proposition. If F is defined in all of R3, then ∇ × F = 0 ⇒ F = ∇f for some f . Definition (Conservative/irrotational field and scalar potential). If F = ∇f , then f is the scalar potential. We say F is conservative or irrotational. Similarly, Proposition. If H is defined over all of R3 and ∇ · H = 0, then H = ∇ × A for some A. Definition (Solenoidal field and vector potential). If H = ∇ × A, A is the vector potential and H is said to be solenoidal. Not that is is true only if F or H is defined on all of R3. Definition (Laplacian operator). The Laplacian operator is defined by ∇2 = ∇ · ∇ = ∂2 ∂xi∂xi = ∂2 ∂x2 1 + ∂2 ∂x2 2 + . ∂2 ∂x3 3 This operation is defined on both scalar and vector fields — on a scalar field, ∇2f = ∇ · (∇f ), whereas on a vector field, ∇2A = ∇(∇ · A) − ∇ × (∇ × A). 37 7 Integral theorems IA Vector Calculus 7 Integral theorems 7.1 Statement and examples There are three big integral theorems, known as Green’s theorem, Stoke’s theorem and Gauss’ theorem. There are all generalizations of the fundamental theorem of calculus in some sense. In particular, they all say that an n dimensional integral of a derivative is equivalent to an n − 1 dimensional integral of the original function. We will first state all three theorems with some simple applications. In the next section, we will see that the three integral theorems are so closely related that it’s easiest to show their equivalence first, and then prove just one of them. 7.1.1 Green’s theorem (in the plane) Theorem (Green’s theorem). For smooth functions P (x, y), Q(x, y) and A a bounded region in the (x, y) plane with boundary ∂A = C, A ∂Q ∂x − ∂P ∂y dA = C (P dx + Q dy). Here C is assumed to be piecewise smooth, non-intersecting closed curve, traversed anti-clockwise. Example. Let Q = xy2 and P = x2y. If C is the parabola y2 = 4ax and the line x = a, both with −2a ≤ y ≤ 2a, then Green’s theorem says A (y2 − x2) dA = C x2 dx + xy2 dy. From example sheet 1, each side gives 104 105 a4. Example. Let A be a rectangle confined by 0 ≤ x ≤ a and 0 ≤ y ≤ b. y b A a x Then Green’s theorem follows directly from the fundamental theorem of calculus in 1D. We first consider the first term of Green’s theorem: − ∂P ∂y dA = = = − ∂P ∂y dy dx [−P (x, b) + P (x, 0)] dx a b 0 0 a 0 C P dx 38 7 Integral theorems IA Vector Calculus Note that we can convert the 1D integral in the second-to-last line to a line integral around the curve C, since the P (x, 0) and P (x, b) terms give the horizontal part of C, and the lack of dy term means that the integral is nil when integrating the vertical parts. Similarly, ∂Q ∂x A dA = Q dy. C Combining them gives Green’s theorem. Green’s theorem also holds for a bounded region A, where the boundary ∂A consists of disconnected components (each piecewise smooth, non-intersecting and closed) with anti-clockwise orientation on the exterior, and clockwise on the interior boundary, e.g. The orientation of the curve comes from imagining the surface as: and take the limit as the gap shrinks to 0. 7.1.2 Stokes’ theorem Theorem (Stokes’ theorem). For a smooth vector field F(r), S ∇ × F · dS = ∂S F · dr, where S is a smooth, bounded surface and ∂S is a piecewise smooth boundary of S. The direction of the line integral is as follows: If we walk along C with n facing up, then the surface is on your left. It also holds if ∂S is a collection of disconnected piecewise smooth closed curves, with the orientation determined in the same way as Green’s theorem. 39 7 Integral theorems IA Vector Calculus Example. Let S be the section of a sphere of radius a with 0 ≤ θ ≤ α. In spherical coordinates, dS = a2 sin θer dθ dϕ. Let F = (0, xz, 0). Then ∇ × F = (−x, 0, z). We have previously shown that S ∇ × F · dS = πa3 cos α sin2 α. Our boundary ∂C is r(ϕ) = a(sin α cos ϕ, sin α sin ϕ, cos α). The right hand side of Stokes’ is C F · dr = 2π 0 a sin α cos ϕ x a cos α z a sin α cos ϕ dϕ dy = a3 sin2 α cos α 2π cos2 ϕ dϕ 0 = πa3 sin2 α cos α. So they agree. 7.1.3 Divergence/Gauss theorem Theorem (Divergence/Gauss theorem). For a smooth vector field F(r), V ∇ · F dV = ∂V F · dS, where V is a bounded volume with boundary ∂V , a piecewise smooth, closed surface, with outward normal n. Example. Consider a hemisphere. S1 S2 V is a solid hemisphere x2 + y2 + z2 ≤ a2, z ≥ 0, and ∂V = S1 + S2, the hemisphere and the disc at the bottom. Take F = (0, 0, z + a) and ∇ · F = 1. Then V ∇ · F dV = 2 3 πa3, the volume of the hemisphere. 40 7 Integral theorems IA Vector Calculus On S1, Then Then F · dS = 1 a dS = n dS = 1 a (x, y, z) dS. z(z + a) dS = cos θa(cos θ + 1) a2 sin θ dθ dϕ dS . S1 F · dS = a3 2π dϕ π/2 0 0 sin θ(cos2 θ + cos θ) dθ cos3 θ − 1 2 cos2 θ π/2 0 = 2πa3 −1 3 = 5 3 πa3. On S2, dS = n dS = −(0, 0, 1) dS. Then F · dS = −a dS. So S2 F · dS = −πa3. So F · dS + F · dS = S1 in accordance with Gauss’ theorem. S2 − 1 5 3 πa3 = 2 3 πa3, 7.2 Relating and proving integral theorems We will first show the following two equivalences: – Stokes’ theorem ⇔ Green’s theorem – 2D divergence theorem ⇔ Greens’ theorem Then we prove the 2D version of divergence theorem directly to show that all of the above hold. A sketch of the proof of the 3D version of divergence theorem will be provided, because it is simply a generalization of the 2D version, except that the extra dimension makes the notation tedious and difficult to follow. Proposition. Stokes’ theorem ⇒ Green’s theorem Proof. Stokes’ theorem talks about 3D surfaces and Green’s theorem is about 2D regions. So given a region A on the (x, y) plane, we pretend that there is a third dimension and apply Stokes’ theorem to derive Green’s theorem. Let A be a region in the (x, y) plane with boundary C = ∂A, parametrised by arc length, (x(s), y(s), 0). Then the tangent to C is t = dx ds , dy ds , 0 . Given any P (x, y) and Q(x, y), we can consider the vector field F = (P, Q, 0), 41 7 Integral theorems IA Vector Calculus So ∇ × F = 0, 0, ∂Q ∂x − ∂P ∂y . Then the left hand side of Stokes is C F · dr = C F · t ds = C P dx + Q dy, and the right hand side is A (∇ × F) · ˆk dA = A ∂Q ∂x − ∂
P ∂y dA. Proposition. Green’s theorem ⇒ Stokes’ theorem. Proof. Green’s theorem describes a 2D region, while Stokes’ theorem describes a 3D surface r(u, v). Hence to use Green’s to derive Stokes’ we need find some 2D thing to act on. The natural choice is the parameter space, u, v. Consider a parametrised surface S = r(u, v) corresponding to the region A in the u, v plane. Write the boundary as ∂A = (u(t), v(t)). Then ∂S = r(u(t), v(t)). We want to prove given ∂S F · dr = Fu du + Fv dv = S ∂A Doing some pattern-matching, we want A (∇ × F) · dS ∂Fv ∂u − ∂Fu ∂v dA. F · dr = Fu du + Fv dv for some Fu and Fv. By the chain rule, we know that So we choose dr = ∂r ∂u du + ∂r ∂v dv. Fu = F · ∂r ∂u , Fv = F · ∂r ∂v . This choice matches the left hand sides of the two equations. To match the right, recall that (∇ × F) · dS = (∇ × F) · ∂r ∂u × ∂r ∂v du dv. Therefore, for the right hand sides to match, we want ∂Fv ∂u − ∂Fu ∂v = (∇ × F) · ∂r ∂u × . ∂r ∂v (∗) Fortunately, this is true. Unfortunately, the proof involves complicated suffix notation and summation convention: ∂Fv ∂u = ∂ ∂u F · ∂r ∂v = ∂ ∂u Fi ∂xi ∂v = ∂Fi ∂xj ∂xj ∂u ∂xi ∂v + Fi ∂xi ∂u∂v . 42 7 Integral theorems IA Vector Calculus Similarly, ∂Fu ∂u = ∂ ∂u F · ∂r ∂u = ∂ ∂u Fj ∂xj ∂u = ∂Fj ∂xi ∂xi ∂v ∂xj ∂u + Fi ∂xi ∂u∂v . So ∂Fv ∂u − ∂Fu ∂v = ∂xj ∂u ∂xi ∂v ∂Fi ∂xj − ∂Fj ∂xi . This is the left hand side of (∗). The right hand side of (∗) is (∇ × F) · ∂r ∂u × ∂r ∂v = εijk ∂Fj ∂xi εkpq ∂xp ∂u ∂xq ∂v ∂Fj ∂xi ∂xi ∂u ∂xp ∂u ∂xj ∂v . ∂xq ∂v = (δipδjq − δiqδjp) = ∂Fj ∂xi − ∂Fi ∂xj So they match. Therefore, given our choice of Fu and Fv, Green’s theorem translates to Stokes’ theorem. Proposition. Greens theorem ⇔ 2D divergence theorem. Proof. The 2D divergence theorem states that A (∇ · G) dA = ∂A G · n ds. with an outward normal n. Write G as (Q, −P ). Then ∇ · G = ∂Q ∂x − ∂P ∂y . Around the curve r(s) = (x(s), y(s)), t(s) = (x(s), y(s)). Then the normal, being tangent to t, is n(s) = (y(s), −x(s)) (check that it points outwards!). So G · n = P dx ds + Q dy ds . Then we can expand out the integrals to obtain C G · n ds = C P dx + Q dy, and (∇ · G) dA = ∂Q ∂x − ∂P ∂y dA. A Now 2D version of Gauss’ theorem says the two LHS are the equal, and Green’s theorem says the two RHS are equal. So the result follows. A Proposition. 2D divergence theorem. A (∇ · G) dA = C=∂A G · n ds. 43 7 Integral theorems IA Vector Calculus Proof. For the sake of simplicity, we assume that G only has a vertical component, noting that the same proof works for purely horizontal G, and an arbitrary G is just a linear combination of the two. Furthermore, we assume that A is a simple, convex shape. A more complicated shape can be cut into smaller simple regions, and we can apply the simple case to each of the small regions. Suppose G = G(x, y)ˆj. Then ∇ · G = ∂G ∂y . Then A ∇ · G dA = X Yx dy dx. ∂G ∂y Now we divide A into an upper and lower part, with boundaries C+ = y+(x) and C− = y−(x) respectively. Since I cannot draw, A will be pictured as a circle, but the proof is valid for any simple convex shape. y Yx C+ C− dy x We see that the boundary of Yx at any specific x is given by y−(x) and y+(x). Hence by the Fundamental theorem of Calculus, Yx ∂G ∂y dy = y+(x) y−(x) ∂G ∂y dy = G(x, y+(x)) − G(x, y−(x)). To compute the full area integral, we want to integrate over all x. However, the divergence theorem talks in terms of ds, not dx. So we need to find some way to relate ds and dx. If we move a distance δs, the change in x is δs cos θ, where θ is the angle between the tangent and the horizontal. But θ is also the angle between the normal and the vertical. So cos θ = n · ˆj. Therefore dx = ˆj · n ds. In particular, G dx = Gˆj · n ds = G · n ds, since G = Gˆj. However, at C−, n points downwards, so n · ˆj happens to be negative. So, actually, at C−, dx = −G · n ds. 44 7 Integral theorems IA Vector Calculus Therefore, our full integral is A ∇ · G dA = dY dx ∂G ∂y yx X X C+ = = = G(x, y+(x)) − G(x, y−(x)) dx G · n ds + C− G · n ds G · n ds. C To prove the 3D version, we again consider F = F (x, y, z)ˆk, a purely vertical vector field. Then V ∇ · F dV = D Zxy dz dA. ∂F ∂z Again, split S = ∂V into the top and bottom parts S+ and S− (ie the parts with ˆk · n ≥ 0 and ˆk · n < 0), and parametrize by z+(x, y) and z−(x, y). Then the integral becomes V ∇ · F dV = D (F (x, y, z+) − F (x, y, z−)) dA = S F · n dS. 45 8 Some applications of integral theorems IA Vector Calculus 8 Some applications of integral theorems 8.1 Integral expressions for div and curl We can use these theorems to come up with alternative definitions of the div and curl. The advantage of these alternative definitions is that they do not require a choice of coordinate axes. They also better describe how we should interpret div and curl. Gauss’ theorem for F in a small volume V containing r0 gives ∂V F · dS = V ∇ · F dV ≈ (∇ · F)(r0) vol(V ). We take the limit as V → 0 to obtain Proposition. (∇ · F)(r0) = lim diam(V )→1 1 vol(V ) ∂V F · dS, where the limit is taken over volumes containing the point r0. Similarly, Stokes’ theorem gives, for A a surface containing the point r0, ∂A F · dr = A (∇ × F) · n dA ≈ n · (∇ × F)(r0) area(A). So Proposition. n · (∇ × F)(r0) = lim diam(A)→0 1 area(A) ∂A F · dr, where the limit is taken over all surfaces A containing r0 with normal n. These are coordinate-independent definitions of div and curl. Example. Suppose u is a velocity field of fluid flow. Then S u · dS is the rate of which fluid crosses S. Taking V to be the volume occupied by a fixed quantity of fluid material, we have Then, at r0, ˙V = ∂V u · dS ∇ · u = lim V →0 ˙V V , the relative rate of change of volume. For example, if u(r) = αr (ie fluid flowing out of origin), then ∇ · u = 3α, which increases at a constant rate everywhere. 46 8 Some applications of integral theorems IA Vector Calculus Alternatively, take a planar area A to be a disc of radius a. Then u · dr = ∂A ∂A u · t ds = 2πa × average of u · t around the circumference. (u · t is the component of u which is tangential to the boundary) We define the quantity ω = 1 a This is the local angular velocity of the current. As a → 0, 1 a → ∞, but the average of u · t will also decrease since a smooth field is less “twirly” if you look closer. So ω tends to some finite value as a → 0. We have × (average of u · t). ∂A u · dr = 2πa2ω. Recall that n · ∇ × u = lim A→0 1 πa2 ∂A u · dr = 2ω, ie twice the local angular velocity. For example, if you have a washing machine rotating at a rate of ω, Then the velocity u = ω × r. Then the curl is which is twice the angular velocity. ∇ × (ω × r) = 2ω, 8.2 Conservative fields and scalar products Definition (Conservative field). A vector field F is conservative if (i) F = ∇f for some scalar field f ; or (ii) C F · dr is independent of C, for fixed end points and orientation; or (iii) ∇ × F = 0. In R3, all three formulations are equivalent. We have previously shown (i) ⇒ (ii) since C F · dr = f (b) − f (a). We have also shown that (i) ⇒ (iii) since ∇ × (∇f ) = 0. So we want to show that (iii) ⇒ (ii) and (ii) ⇒ (i) Proposition. If (iii) ∇ × F = 0, then (ii) C F · dr is independent of C. Proof. Given F(r) satisfying ∇ × F = 0, let C and ˜C be any two curves from a to b. 47 8 Some applications of integral theorems IA Vector Calculus C b ˜C a If S is any surface with boundary ∂S = C − ˜C, By Stokes’ theorem, S ∇ × F · dS = ∂S F · dr = C F · dr − ˜C F · dr. But ∇ × F = 0. So F · dr − or C C F · dr = ˜C F · dr. ˜C F · dr = 0, C F · dr is independent of C for fixed end points and Proposition. If (ii) orientation, then (i) F = ∇f for some scalar field f . Proof. We fix a and define f (r) = C F(r) · dr for any curve from a to r. Assuming (ii), f is well-defined. For small changes r to r + δr, there is a small extension of C by δC. Then f (r + δr) = F(r) · dr C+δC = C F · dr + δC F · dr = f (r) + F(r) · δr + o(δr). So δf = f (r + δr) − f (r) = F(r) · δr + o(δr). But the definition of grad is exactly δf = ∇f · δr + o(δr). So we have F = ∇f . Note that these results assume F is defined on the whole of R3. It also works of F is defined on a simply connected domain D, ie a subspace of R3 without holes. By definition, this means that any two curves C, ˜C with fixed end points can be smoothly deformed into one another (alternatively, any loop can be shrunk into a point). If we have a smooth transformation from C to ˜C, the process sweeps out a surface bounded by C and ˜C. This is required by the proof that (iii) ⇒ (ii). If D is not simply connected, then we obtain a multi-valued f (r) on D in general (for the proof (ii) ⇒ (i)). However, we can choose to restrict to a subset D0 ⊆ D such that f (r) is single-valued on D0. 48 8 Some applications of integral theorems IA Vector Calculus Example. Take F = −y x2 + y2 , x x2 + y2 , 0 . This obeys ∇ × F = 0, and is defined on D = R3 \ {z-axis}, which is not simply-connected. We can also write where F = ∇f, f = tan−1 y x . which is multi-valued. If we integrate it about the closed loop x2 + y2 = 1, z = 0, i.e. a circle about the z axis, the integral gives 2π, as opposed to the expected 0 for a conservative force. This shows that the simply-connected-domain criterion is important! However f can be single-valued if we restrict it to D0 = R3 − {half-plane x ≥ 0, y = 0}, which is simply-connected. (Draw and check!) Any closed curve we can draw in this area will have an integral of 0 (the circle mentioned above will no longer be closed!). 8.3 Conservation laws Definition (Conservation equation). Suppose we are interested in a quantity Q. Let ρ(r, t) be the amount of stuff per unit volume and j(r, t) be the flow rate of the quantity (eg if Q is charge, j is the current density). The conservation equation is ∂ρ ∂t + ∇ · j = 0. This is stronger than the claim that the total amount of Q in the universe is fixed. It says that Q cannot just disappear here and appear elsewhere. It must continuously flow out. In particular, let V be a fixed time-independent volume with boundary S = ∂V . Then Q(t)
= V ρ(r, t) dV Then the rate of change of amount of Q in V is dQ dt = ∂ρ ∂t V dV = − ∇ · j dV = − V S j · ds. by divergence theorem. So this states that the rate of change of the quantity Q in V is the flux of the stuff flowing out of the surface. ie Q cannot just disappear but must smoothly flow out. In particular, if V is the whole universe (ie R3), and j → 0 sufficiently rapidly as |r| → ∞, then we calculate the total amount of Q in the universe by taking V to be a solid sphere of radius R, and take the limit as R → ∞. Then the surface integral → 0, and the equation states that dQ dt = 0, 49 8 Some applications of integral theorems IA Vector Calculus Example. If ρ(r, t) is the charge density (i.e. ρδV is the amount of charge in a small volume δV ), then Q(t) is the total charge in V . j(r, t) is the electric current density. So j · dS is the charge flowing through δS per unit time. Example. Let j = ρu with u being the velocity field. Then (ρu δt) · δS is equal to the mass of fluid crossing δS in time δt. So dQ dt = − S j · dS does indeed imply the conservation of mass. The conservation equation in this case is ∂ρ ∂t + ∇ · (ρu) = 0 For the case where ρ is constant and uniform (i.e. independent of r and t), we get that ∇ · u = 0. We say that the fluid is incompressible. 50 9 Orthogonal curvilinear coordinates IA Vector Calculus 9 Orthogonal curvilinear coordinates 9.1 Line, area and volume elements In this chapter, we study funny coordinate systems. A coordinate system is, roughly speaking, a way to specify a point in space by a set of (usually 3) numbers. We can think of this as a function r(u, v, w). By the chain rule, we have dr = ∂r ∂u du + ∂r ∂v dv + ∂r ∂w dw For a good parametrization, ∂r ∂u ∂r ∂v · × ∂r ∂w = 0, ∂u , ∂r i.e. ∂r ∂w are linearly independent. These vectors are tangent to the curves parametrized by u, v, w respectively when the other two are being fixed. ∂v and ∂r Even better, they should be orthogonal: Definition (Orthogonal curvilinear coordinates). u, v, w are orthogonal curvilinear if the tangent vectors are orthogonal. We can then set ∂r ∂u = hueu, ∂r ∂v = hvev, ∂r ∂w = hwew, with hu, hv, hw > 0 and eu, ev, ew form an orthonormal right-handed basis (i.e. eu × ev = ew). Then dr = hueu du + hvev dv + hwew dw, and hu, hv, hw determine the changes in length along each orthogonal direction resulting from changes in u, v, w. Note that clearly by definition, we have hu = ∂r ∂u . Example. (i) In cartesian coordinates, r(x, y, z) = xˆi + yˆj + zˆk. Then hx = hy = hz = 1, and ex = ˆi, ey = ˆj and ez = ˆk. (ii) In cylindrical polars, r(ρ, ϕ, z) = ρ[cos ϕˆi + sin ϕˆj] + zˆk. Then hρ = hz = 1, and The basis vectors eρ, eϕ, ez are as in section 1. ∂r ∂ϕ hϕ = = |(−ρ sin ϕ, ρ sin ϕ, 0)| = ρ. (iii) In spherical polars, r(r, θ, ϕ) = r(cos ϕ sin θˆi + sin θ sin ϕˆj + cos θˆk). Then hr = 1, hθ = r and hϕ = r sin θ. 51 9 Orthogonal curvilinear coordinates IA Vector Calculus Consider a surface with w constant and parametrised by u and v. The vector area element is dS = ∂r ∂u × ∂r ∂v du dv = hueu × hvev du dv = huhvew du dv. We interpret this as δS having a small rectangle with sides approximately huδu and hvδv. The volume element is dV = ∂r ∂u ∂r ∂v · × ∂r ∂w du dv dw = huhvhw du dv dw, i.e. a small cuboid with sides huδu, hvδv and hwδw respectively. 9.2 Grad, Div and Curl Consider f (r(u, v, w)) and compare df = ∂f ∂u du + ∂f ∂v dv + ∂f ∂w dw, with df = (∇f ) · dr. Since we know that dr = ∂r ∂u du + ∂r ∂v dv + ∂r ∂w dw = hueu du + hvev dv + hwew dv, we can compare the terms to know that Proposition. ∇f = 1 hu ∂f ∂u eu + 1 hv ∂f ∂v ev + 1 hw ∂f ∂w ew. Example. Take f = r sin θ cos ϕ in spherical polars. Then ∇f = sin θ cos ϕ er + 1 r = cos ϕ(sin θ er + cos θ eθ) − sin ϕ eϕ. (r cos θ cos ϕ) eθ + 1 r sin θ (−r sin θ sin ϕ) eϕ Then we know that the differential operator is Proposition. ∇ = 1 hu eu ∂ ∂u + 1 hv ev ∂ ∂v + 1 hw ew ∂ ∂w . We can apply this to a vector field using scalar or vector products to obtain F = Fueu + Fvev + Fwew Proposition. ∇ × F = 1 hvhw (hwFw) − (hvFv) ∂ ∂w eu + two similar terms ∂ ∂v = 1 huhvhw hueu ∂ ∂u hvev ∂ ∂v huFu hvFv hwFw hwew ∂ ∂w and ∇ · F = 1 huhvhw ∂ ∂u (hvhwFu) + two similar terms . 52 9 Orthogonal curvilinear coordinates IA Vector Calculus There are several ways to obtain these formulae. We can Proof. (non-examinable) (i) Apply ∇· or ∇× and differentiate the basis vectors explicitly. (ii) First, apply ∇· or ∇×, but calculate the result by writing F in terms of ∇u, ∇v and ∇w in a suitable way. Then use ∇×∇f = 0 and ∇·(∇×f ) = 0. (iii) Use the integral expressions for div and curl. Recall that n · ∇ × F = lim A→0 1 A ∂A F · dr. So to calculate the curl, we first find the ew component. Consider an area with W fixed and change u by δu and v by δv. Then this has an area of huhvδuδv with normal ew. Let C be its boundary. v δv C u δu We then integrate around the curve C. We split the curve C up into 4 parts (corresponding to the four sides), and take linear approximations by assuming F and h are constant when moving through each horizontal/vertical segment. C F · dr ≈ Fu(u, v)hu(u, v) δu + Fv(u + δu, v)hv(u + δu, v) δu − Fu(u, v + δv)hu(u, v + δv) δu − Fv(u, v)hv(u, v) δv (huFu) hvFv − δuδv. ≈ ∂ ∂u ∂ ∂v Divide by the area and take the limit as area → 0, we obtain (huFu) F · dr = hvFv − . 1 huhv ∂ ∂u lim A→0 1 A C ∂ ∂v So, by the integral definition of divergence, ew · ∇ × F = 1 huhv ∂ ∂u (hvFv) − (huFu) , ∂ ∂v and similarly for other components. Example. Let A = 1 We can find the divergence similarly. r tan θ reθ ∂ ∂θ 0 r sin θeϕ ∂ ∂ϕ r sin θ · 1 1 r2 sin θ er ∂ ∂r 0 r tan θ 2 ∇ × A = 2 eϕ in spherical polars. Then = er r2 sin θ ∂ ∂θ sin θ tan θ 2 = 1 r2 er. 53 10 Gauss’ Law and Poisson’s equation IA Vector Calculus 10 Gauss’ Law and Poisson’s equation 10.1 Laws of gravitation Consider a distribution of mass producing a gravitational force F on a point mass m at r. The total force is a sum of contributions from each part of the mass distribution, and is proportional to m. Write F = mg(r), Definition (Gravitational field). g(r) is the gravitational field, acceleration due to gravity, or force per unit mass. The gravitational field is conservative, ie C g · dr = 0. This means that if you walk around the place and return to the same position, the total work done is 0 and you did not gain energy, i.e. gravitational potential energy is conserved. Gauss’ law tells us what this gravitational field looks like: Law (Gauss’ law for gravitation). Given any volume V bounded by closed surface S, g · dS = −4πGM, where G is Newton’s gravitational constant, and M is the total mass contained in V . S These equations determine g(r) from a mass distribution. Example. We can obtain Newton’s law of gravitation from Gauss’ law together with an assumption about symmetry. Consider a total mass M distributed with a spherical symmetry about the origin O, with all the mass contained within some radius r = a. By spherical symmetry, we have g(r) = g(r)ˆr. Consider Gauss’ law with S being a sphere of radius r = R > a. Then ˆn = ˆr. So S g · dS = g(R)ˆr · ˆr dS = S g(R)dS = 4πR2g(R). By Gauss’ law, we obtain So for R > a. 4πR2g(R) = −4πGM. g(R) = − GM R2 Therefore the gravitational force on a mass m at r is F(r) = − GM m r2 ˆr. If we take the limit as a → 0, we get a point mass M at the origin. Then we recover Newton’s law of gravitation for point masses. 54 10 Gauss’ Law and Poisson’s equation IA Vector Calculus The condition theorem as C g · dr = 0 for any closed C can be re-written by Stoke’s S ∇ × g · dS = 0, where S is bounded by the closed curve C. This is true for arbitrary S. So ∇ × g = 0. In our example above, ∇ × g = 0 due to spherical symmetry. But here we showed that it is true for all cases. Note that we exploited symmetry to solve Gauss’ law. However, if the mass distribution is not sufficiently symmetrical, Gauss’ law in integral form can be difficult to use. But we can rewrite it in differential form. Suppose M = V ρ(r) dV, where ρ is the mass density. Then by Gauss’ theorem S g · dS = −4πGM ⇒ V ∇ · g dV = V −4πGρ dV. Since this is true for all V , we must have Law (Gauss’ Law for gravitation in differential form). ∇ · g = −4πGρ. Since ∇ × g = 0, we can introduce a gravitational potential ϕ(r) with g = −∇ϕ. Then Gauss’ Law becomes In the example with spherical symmetry, we can solve that ∇2ϕ = 4πGρ. ϕ(r) = − GM r for r > a. 10.2 Laws of electrostatics Consider a distribution of electric charge at rest. They produce a force on a charge q, at rest at r, which is proportional to q. Definition (Electric field). The force produced by electric charges on another charge q is F = qE(r), where E(r) is the electric field, or force per unit charge. Again, this is conservative. So C E · dr = 0 for any closed curve C. It also obeys 55 10 Gauss’ Law and Poisson’s equation IA Vector Calculus Law (Gauss’ law for electrostatic forces). S E · dS = Q ε0 , where ε0 is the permittivity of free space, or electric constant. Then we can write it in differential form, as in the gravitational case. Law (Gauss’ law for electrostatic forces in differential form). ∇ · E = ρ ε0 . Assuming constant (or no) magnetic field, we have ∇ × E = 0. So we can write E = −∇ϕ. Definition (Electrostatic potential). If we write E = −∇ϕ, then ϕ is the electrostatic potential, and ∇2ϕ = ρ ε0 . Example. Take a spherically symmetric charge distribution about O with total charge Q. Suppose all charge is contained within a radius r = a. Then similar to the gravitational case, we have and E(r) = Qˆr 4πε0r2 , ϕ(r) = −Q 4πε0r . As a → 0, we get point charges. From E, we can recover Coulomb’s law for the force on another charge q at r: F = qE = qQˆr 4πε0r2 . Example (Line charge). Consider an infinite line with uniform charge density per unit length σ. We use cylindrical polar coordinates: z E r = x2 + y2 56 10 Gauss’ Law and Poisson’s equation IA Vector Calculus By symmetry, the field is radial, i.e. E(r) = E(r)ˆr. Pick S to be a cylinder of length L and radius r. We know that the end c
aps do not contribute to the flux since the field lines are perpendicular to the normal. Also, the curved surface has area 2πrL. Then by Gauss’ law in integral form, So S E · dS = E(r)2πrL = σL ε0 . E(r) = σ 2πε0r ˆr. Note that the field varies as 1/r, not 1/r2. Intuitively, this is because we have one more dimension of “stuff” compared to the point charge, so the field does not drop as fast. 10.3 Poisson’s Equation and Laplace’s equation Definition (Poisson’s equation). The Poisson’s equation is where ρ is given and ϕ(r) is to be solved. ∇2ϕ = −ρ, This is the form of the equations for gravity and electrostatics, with −4πGρ and ρ/ε0 in place of ρ respectively. When ρ = 0, we get Definition (Laplace’s equation). Laplace’s equation is ∇2ϕ = 0. One example is irrotational and incompressible fluid flow: if the velocity is u(r), then irrotationality gives u = ∇ϕ for some velocity potential ϕ. Since it is incompressible, ∇ · u = 0 (cf. previous chapters). So ∇2ϕ = 0. The expressions for ∇2 can be found in non-Cartesian coordinates, but are a bit complicated. We’re concerned here mainly with cases exhibiting spherical or cylindrical i.e. when ϕ(r) has spherical or symmetry (use r for radial coordinate here). cylindrical symmetry. Write ϕ = ϕ(r). Then ∇ϕ = ϕ(r)ˆr. Then Laplace’s equation ∇2ϕ = 0 becomes an ordinary differential equation. – For spherical symmetry, using the chain rule, we have ∇2ϕ = ϕ + 2 r ϕ = 1 r2 (r2ϕ) = 0. Then the general solution is ϕ = A r + B. 57 10 Gauss’ Law and Poisson’s equation IA Vector Calculus – For cylindrical symmetry, with r2 = x2 1 + x2 2, we have ∇2ϕ = ϕ + 1 r ϕ = 1 r (rϕ) = 0. Then ϕ = A ln r + B. Then solutions to Poisson’s equations can be obtained in a similar way, i.e. by integrating the differential equations directly, or by adding particular integrals to the solutions above. For example, for a spherically symmetric solution of ∇2ϕ = −ρ0, with ρ0 constant, recall that ∇2rα = α(α + 1)rα−2. Taking α = 2, we find the particular integral ϕ = − ρ0 6 r2, So the general solution with spherical symmetry and constant ρ0 is ϕ(r) = A r + B − 1 6 ρ0r2. To determine A, B, we must specify boundary conditions. If ϕ is defined on all of R3, we often require ϕ → 0 as |r| → ∞. If ϕ is defined on a bounded volume V , then there are two kinds of common boundary conditions on ∂V : – Specify ϕ on ∂V — a Dirichlet condition – Specify n · ∇ϕ (sometimes written as ∂ϕ ∂n ): a Neumann condition. (n is the outward normal on ∂V ). The type of boundary conditions we get depends on the physical content of the problem. For example, specifying ∂ϕ ∂n corresponds to specifying the normal component of g or E. We can also specify different boundary conditions on different boundary components. Example. We might have a spherically symmetric distribution with constant ρ0, defined in a ≤ r ≤ b, with ϕ(a) = 0 and ∂ϕ ∂n (b) = 0. Then the general solution is ϕ(r) = A r + B − 1 6 ρ0r2. We apply the first boundary condition to obtain A a + B − 1 6 ρ0a2 = 0. The second boundary condition gives n · ∇ϕ = − A b2 − 1 3 ρ0b = 0. These conditions give A = − 1 3 ρ0b3, B = 1 5 ρ0a2 + 1 3 ρ0 b3 a . 58 10 Gauss’ Law and Poisson’s equation IA Vector Calculus Example. We might also be interested with spherically symmetric solution with ∇2ϕ = −ρ0 0 r ≤ a r > a with ϕ non-singular at r = 0 and ϕ(r) → 0 as r → ∞, and ϕ, ϕ continuous at r = a. This models the gravitational potential on a uniform planet. Then the general solution from above is ϕ = A 6 ρ0r2 . Since ϕ is non-singular at r = 0, we have A = 0. Since ϕ → 0 as r → ∞, D = 0. So ϕ = 6 ρ0r2 . This is the gravitational potential inside and outside a planet of constant density ρ0 and radius a. We want ϕ and ϕ to be continuous at r = a. So we have B + 1 6 4πρ0Ga2 = C a 4 3 πGρ0a = − C a2 . The second equation gives C = −GM . Substituting that into the first equation to find B, we get ϕ(r) = Since g = −ϕ, we have 2 − 3 r a GM 2a − GM r r ≤ a r > a g(r) = − GM r a3 − GM r r ≤ a r > a We can plot the potential energy: ϕ(r) r = a We can also plot −g(r), the inward acceleration: −g(r) r = a 59 r r 10 Gauss’ Law and Poisson’s equation IA Vector Calculus Alternatively, we can apply Gauss’ Law for a flux of g = g(r)er out of S, a sphere of radius R. For R ≤ a, S g · dS = 4πR2g(R) = −4πGM 3 R a So g(R) = − GM R a3 . For R ≥ a, we can simply apply Newton’s law of gravitation. In general, even if the problem has nothing to do with gravitation or electrostatics, if we want to solve ∇2ϕ = −ρ with ρ and ϕ sufficiently symmetric, we can consider the flux of ∇ϕ out of a surface S = ∂V : S ∇ϕ · dS = − V ρ dV, by divergence theorem. This is called the Gauss Flux method. 60 11 Laplace’s and Poisson’s equations IA Vector Calculus 11 Laplace’s and Poisson’s equations 11.1 Uniqueness theorems Theorem. Consider ∇2ϕ = −ρ for some ρ(r) on a bounded volume V with S = ∂V being a closed surface, with an outward normal n. Suppose ϕ satisfies either (i) Dirichlet condition, ϕ(r) = f (r) on S (ii) Neumann condition ∂ϕ(r) ∂n = n · ∇ϕ = g(r) on S. where f, g are given. Then (i) ϕ(r) is unique (ii) ϕ(r) is unique up to a constant. This theorem is practically important - if you find a solution by any magical means, you know it is the only solution (up to a constant). Since the proof of the cases of the two different boundary conditions are very similar, they will be proved together. When the proof is broken down into (i) and (ii), it refers to the specific cases of each boundary condition. Proof. Let ϕ1(r) and ϕ2(r) satisfy Poisson’s equation, each obeying the boundary conditions (N) or (D). Then Ψ(r) = ϕ2(r) − ϕ1(r) satisfies ∇2Ψ = 0 on V by linearity, and (i) Ψ = 0 on S; or (ii) ∂Ψ ∂n = 0 on S. Combining these two together, we know that Ψ ∂Ψ the divergence theorem, ∂n = 0 on the surface. So using But So V ∇ · (Ψ∇Ψ) dV = S (Ψ∇Ψ) · dS = 0. ∇ · (Ψ∇Ψ) = (∇Ψ) · (∇Ψ) + Ψ ∇2Ψ =0 = |(∇Ψ)|2. V |∇Ψ|2 dV = 0. Since |∇Ψ|2 ≥ 0, the integral can only vanish if |∇Ψ| = 0. So ∇Ψ = 0. So Ψ = c, a constant on V . So (i) Ψ = 0 on S ⇒ c = 0. So ϕ1 = ϕ2 on V . (ii) ϕ2(r) = ϕ1(r) + C, as claimed. 61 11 Laplace’s and Poisson’s equations IA Vector Calculus We’ve proven uniqueness. How about existence? It turns out it isn’t difficult to craft a boundary condition in which there are no solutions. For example, if we have ∇2ϕ = −ρ on V with the condition ∂ϕ ∂n = g, then by the divergence theorem, V ∇2ϕ dV = ∂S ∂ϕ ∂n dS. Using Poisson’s equation and the boundary conditions, we have V ρ dV + ∂V g dS = 0 So if ρ and g don’t satisfy this equation, then we can’t have any solutions. The theorem can be similarly proved and stated for regions in R2, R3, · · · , by using the definitions of grad, div and the divergence theorem. The result also extends to unbounded domains. To prove it, we can take a sphere of radius R and impose the boundary conditions |Ψ(r)| = O(1/R) or | ∂Ψ ∂n (r)| = O(1/R2) as R → ∞. Then we just take the relevant limits to complete the proof. Similar results also apply to related equations and different kinds of boundary conditions, eg D or N on different parts of the boundary. But we have to analyse these case by case and see if the proof still applies. The proof uses a special case of the result Proposition (Green’s first identity). S (u∇v) · dS = V (∇u) · (∇v) dV + V u∇2v dV, By swapping u and v around and subtracting the equations, we have Proposition (Green’s second identity). S (u∇v − v∇u) · dS = V (u∇2v − v∇2u) dV. These are sometimes useful, but can be easily deduced from the divergence theorem when needed. 11.2 Laplace’s equation and harmonic functions Definition (Harmonic function). A harmonic function is a solution to Laplace’s equation ∇2ϕ = 0. These have some very special properties. 11.2.1 The mean value property Proposition (Mean value property). Suppose ϕ(r) is harmonic on region V containing a solid sphere defined by |r − a| ≤ R, with boundary SR = |r − a| = R, for some R. Define ¯ϕ(R) = Then ϕ(a) = ¯ϕ(R). 1 4πR2 SR ϕ(r) dS. 62 11 Laplace’s and Poisson’s equations IA Vector Calculus In words, this says that the value at the center of a sphere is the average of the values on the surface on the sphere. Proof. Note that ¯ϕ(R) → ϕ(a) as R → 0. We take spherical coordinates (u, θ, χ) centered on r = a. The scalar element (when u = R) on SR is dS = R2 sin θ dθ dχ. So dS R2 is independent of R. Write ¯ϕ(R) = 1 4π ϕ dS R2 . Differentiate this with respect to R, noting that dS/R2 is independent of R. Then we obtain d dR ¯ϕ(R) = 1 4πR2 ∂ϕ ∂u u=R dS But on SR. So ∂ϕ ∂u = eu · ∇ϕ = n · ∇ϕ = ∂ϕ ∂n d dR ¯ϕ(R) = 1 4πR2 SR ∇ϕ · dS = 1 4πR2 VR ∇2ϕ dV = 0 by divergence theorem. So ¯ϕ(R) does not depend on R, and the result follows. 11.2.2 The maximum (or minimum) principle In this section, we will talk about maxima of functions. It should be clear that the results also hold for minima. Definition (Local maximum). We say that ϕ(r) has a local maximum at a if for some ε > 0, ϕ(r) < ϕ(a) when 0 < |r − a| < ε. Proposition (Maximum principle). If a function ϕ is harmonic on a region V , then ϕ cannot have a maximum at an interior point of a of V . Proof. Suppose that ϕ had a local maximum at a in the interior. Then there is an ε such that for any r such that 0 < |r − a| < ε, we have ϕ(r) < ϕ(a). Note that if there is an ε that works, then any smaller ε will work. Pick an ε sufficiently small such that the region |r − a| < ε lies within V (possible since a lies in the interior of V ). Then for any r such that |r − a| = ε, we have ϕ(r) < ϕ(a). ¯ϕ(ε) = 1 4πR2 SR ϕ(r) dS < ϕ(a), which contradicts the mean value property. We can understand this by performing a local analysis of stationary points by differentiation. Suppose at r = a, we have ∇ϕ = 0. Let the eigenvalues of the Hessian matrix Hij = ∂2 be λi. But since ϕ is harmonic, we have ∇2ϕ = 0, ∂xi∂xj 63 11 Laplace’s and Poisson’s equations IA Vector Calculus ∂2ϕ ∂xi∂xi i.e. sum of eigenvalues. So λi = 0. = Hii = 0. But Hii is the trace of the Hessian matrix, which is the Recall that a maximum or minimum occurs when all eigenvalues h
ave the same sign. This clearly cannot happen if the sum is 0. Therefore we can only have saddle points. (note we ignored the case where all λi = 0, where this analysis is inconclusive) 11.3 Integral solutions of Poisson’s equations 11.3.1 Statement and informal derivation We want to find a solution to Poisson’s equations. We start with a discrete case, and try to generalize it to a continuous case. If there is a single point source of strength λ at a, the potential ϕ is ϕ = λ 4π 1 |r − a| . (we have λ = −4πGM for gravitation and Q/ε0 for electrostatics) If we have many sources λα at positions rα, the potential is a sum of terms ϕ(r) = α 1 4π λα |r − rα| . If we have infinitely many of them, having a distribution of ρ(r) with ρ(r) dV being the contribution from a small volume at position r. It would be reasonable to guess that the solution is what we obtain by replacing the sum with an integral: Proposition. The solution to Poisson’s equation ∇2ϕ = −ρ, with boundary conditions |ϕ(r)| = O(1/|r|) and |∇ϕ(r)| = O(1/|r|2), is ϕ(r) = 1 4π V ρ(r) |r − r| dV For ρ(r) non-zero everywhere, but suitably well-behaved as |r| → ∞, we can also take V = R3. Example. Suppose ∇2ϕ = −ρ0 0 |r| ≤ a |r| > a. Fix r and introduce polar coordinates r, θ, χ for r. We take the θ = 0 direction to be the direction along the line from r to r. Then We have We also have ϕ(r) = 1 4π V ρ0 |r − r| dV . dV = r2 sin θ dr dθ dχ. |r − r| = r2 + r2 − 2rr cos θ 64 11 Laplace’s and Poisson’s equations IA Vector Calculus by the cosine rule (c2 = a2 + b2 − 2ab cos C). So a π dr dθ 2π dχ √ ρ0r2 sin θ r2 + r2 − 2rr cos θ θ=π 0 0 r2 + r2 − rr cos θ θ=0 ϕ(r) = = = = 1 4π ρ0 2 ρ0 2 ρ0 2 0 a 0 a 0 a 0 dr r2 rr dr r r dr r r (|r + r| + |r − r|) 2r 2r r > r r < r If r > a, then r > r always. So ϕ(r) = ρ0 a 0 r2 r dr = r0a3 3r . If r < a, then the integral splits into two parts: ϕ(r) = ρ0 r 0 dr r2 r + a r = ρ0 − drr 1 6 r2 + . a2 2 11.3.2 Point sources and δ-functions* Recall that Ψ = λ 4π|r − a| is our potential for a point source. When r = a, we have ∇Ψ = − λ 4π r − a |r − a|3 , ∇2Ψ = 0. What about when r = a? Ψ is singular at this point, but can we say anything about ∇2Ψ? For any sphere with center a, we have S ∇Ψ · dS = −λ. By the divergence theorem, we have ∇2Ψ dV = −λ. for V being a solid sphere with ∂V = S. Since ∇2Ψ is zero at any point r = a, we must have ∇2Ψ = −λδ(r − a), where δ is the 3d delta function, which satisfies V f (r)δ(r − a) dV = f (a) for any volume containing a. 65 11 Laplace’s and Poisson’s equations IA Vector Calculus In short, we have ∇2 1 |r − r| = −4πδ(r − r). Using these, we can verify that the integral solution of Poisson’s equation we obtained previously is correct: ∇2Ψ(r) = ∇2 1 4π V ρ(r) |r − r| dV = V 1 4π ρ(r)∇2 1 |r − r| dV = − ρ(r)δ(r − r) dV V = −ρ(r), as required. 66 12 Maxwell’s equations IA Vector Calculus 12 Maxwell’s equations 12.1 Laws of electromagnetism Maxwell’s equations are a set of four equations that describe the behaviours of electromagnetism. Together with the Lorentz force law, these describe all we know about (classical) electromagnetism. All other results we know are simply mathematical consequences of these equations. It is thus important to understand the mathematical properties of these equations. To begin with, there are two fields that govern electromagnetism, known as the electric and magnetic field. These are denoted by E(r, t) and B(r, t) respectively. To understand electromagnetism, we need to understand how these fields are formed, and how these fields affect charged particles. The second is rather straightforward, and is given by the Lorentz force law. Law (Lorentz force law). A point charge q experiences a force of F = q(E + ˙r × B). The dynamics of the field itself is governed by Maxwell’s equations. To state the equations, we need to introduce two more concepts. Definition (Charge and current density). ρ(r, t) is the charge density, defined as the charge per unit volume. j(r, t) is the current density, defined as the electric current per unit area of cross section. Then Maxwell’s equations say Law (Maxwell’s equations). ∇ · E = ρ ε0 ∇ · − µ0ε0 ∂B ∂t ∂E ∂t = 0 = µ0j, where ε0 is the electric constant (permittivity of free space) and µ0 is the magnetic constant (permeability of free space), which are constants determined experimentally. We can quickly derive some properties we know from these four equations. The conservation of electric charge comes from taking the divergence of the last equation. ∇ · (∇ × B) =0 −µ0ε0 = µ0∇ · j. (∇ · E) =ρ/ε0 ∂ ∂t So ∂ρ ∂t + ∇ · j = 0. 67 12 Maxwell’s equations IA Vector Calculus We can also take the volume integral of the first equation to obtain V ∇ · E dV = 1 ε0 V ρ dV = Q ε0 . By the divergence theorem, we have S E · dS = Q ε0 , which is Gauss’ law for electric fields We can integrate the second equation to obtain S B · dS = 0. This roughly states that there are no “magnetic charges”. The remaining Maxwell’s equations also have integral forms. For example, C=∂S E · dr = S ∇ × E dS = − d dt S B · dS, where the first equality is from from Stoke’s theorem. This says that a changing magnetic field produces a current. 12.2 Static charges and steady currents If ρ, j, E, B are all independent of time, E and B are no longer linked. We can solve the equations for electric fields: ∇ · E = ρ/ε0 ∇ × E = 0 Second equation gives E = −∇ϕ. Substituting into first gives ∇2ϕ = −ρ/ε0. The equations for the magnetic field are ∇ · B = 0 ∇ × B = µ0j First equation gives B = ∇ × A for some vector potential A. But the vector potential is not well-defined. Making the transformation A → A + ∇χ(x) produces the same B, since ∇ × (∇χ) = 0. So choose χ such that ∇ · A = 0. Then ∇2A = ∇(∇ · A =0 ) − ∇ × (∇ × A B ) = −µ0j. In summary, we have Electrostatics Magnetostatics ∇ · E = ρ/ε0 ∇ × E = 0 ∇2ϕ = −ρ/ε0 ε0 sets the scale of electrostatic effects, e.g. the Coulomb force ∇ · B = 0 ∇ × B = µ0j ∇2A = −µ0j. µ0 sets the scale of magnetic effects, e.g. force between two wires with currents. 68 12 Maxwell’s equations IA Vector Calculus 12.3 Electromagnetic waves Consider Maxwell’s equations in empty space, i.e. ρ = 0, j = 0. Then Maxwell’s equations give ∇2E = ∇(∇ · E) − ∇ × (∇ × E) = ∇ × ∂B ∂t = ∂ ∂t (∇ × B) = µ0ε0 ∂2E ∂2t . Define c = 1√ µ0ε0 . Then the equation gives ∇2 − 1 c2 ∂2 ∂t2 E = 0. This is the wave equation describing propagation with speed c. Similarly, we can obtain ∇2 − 1 c2 ∂2 ∂t2 B = 0. So Maxwell’s equations predict that there exists electromagnetic waves in free space, which move with speed c = 1√ ≈ 3.00 × 108 m s−1, which is the speed of light! Maxwell then concluded that light is electromagnetic waves! ε0µ0 69 13 Tensors and tensor fields IA Vector Calculus 13 Tensors and tensor fields 13.1 Definition There are two ways we can think of a vector in R3. We can either interpret it as a “point” in space, or we can view it simply as a list of three numbers. However, the list of three numbers is simply a representation of the vector with respect to some particular basis. When we change basis, in order to represent the same point, we will need to use a different list of three numbers. In particular, when we perform a rotation by Rip, the new components of the vector is given by v i = Ripvp. Similarly, we can imagine a matrix as either a linear transformation or an array of 9 numbers. Again, when we change basis, in order to represent the same transformation, we will need a different array of numbers. This time, the transformation is given by A ij = RipRjqApq. We can think about this from another angle. To define an arbitrary quantity Aij, we can always just write down 9 numbers and be done with it. Moreover, we can write down a different set of numbers in a different basis. For example, we can define Aij = δij in our favorite basis, but Aij = 0 in all other bases. We can do so because we have the power of the pen. However, for this Aij to represent something physically meaningful, i.e. an actual linear transformation, we have to make sure that the components of Aij transform sensibly under a basis transformation. By “sensibly”, we mean that it has to follow the transformation rule A ij = RipRjqApq. For example, the Aij we defined in the previous paragraph does not transform sensibly. While it is something we can define and write down, it does not correspond to anything meaningful. The things that transform sensibly are known as tensors. For example, vectors and matrices (that transform according to the usual change-of-basis rules) are tensors, but that Aij is not. In general, tensors are allowed to have an arbitrary number of indices. In order for a quantity Tij···k to be a tensor, we require it to transform according to T ij···k = RipRjq · · · RkrTpq···r, which is an obvious generalization of the rules for vectors and matrices. Definition (Tensor). A tensor of rank n has components Tij···k (with n indices) with respect to each basis {ei} or coordinate system {xi}, and satisfies the following rule of change of basis: T ij···k = RipRjq · · · RkrTpq···r. Example. – A tensor T of rank 0 doesn’t transform under change of basis, and is a scalar. 70 13 Tensors and tensor fields IA Vector Calculus – A tensor T of rank 1 transforms under T i = RipTp. This is a vector. – A tensor T of rank 2 transforms under T ij = RipRjqTpq. This is a matrix. Example. (i) If u, v, · · · w are n vectors, then Tij···k = uivj · · · wk defines a tensor of rank n. To check this, we check the tensor transformation rule. We do the case for n = 2 for simplicity of expression, and it should be clear that this can be trivially extended to arbitrary n: ij = u T iv j = (Ripup)(Rjqvq) = RipRjq(upvq) = RipRjqTpq Then linear combinations of such expressions are also tensors, e.g. Tij = uivj + aibj for any u, v, a, b. (ii) δij and εijk are tensors of rank 2 and 3 respectively — with the special property that their components are unchanged with respect to the basis coordinate: δ ij = RipRjqδpq = RipRjp = δij, since RipRjp = (RRT )ij = Iij. Also ε ijk = Ri
pRjqRkrεpqr = (det R)εijk = εijk, using results from Vectors and Matrices. (iii) (Physical example) In some substances, an applied electric field E gives rise to a current density j, according to the linear relation ji = εijEj, where εij is the conductivity tensor. Note that this relation entails that the resulting current need not be in the same direction as the electric field. This might happen if the substance has special crystallographic directions that favours electric currents. However, if the substance is isotropic, we have εij = σδij for some σ. In this case, the current is parallel to the field. 13.2 Tensor algebra Definition (Tensor addition). Tensors T and S of the same rank can be added ; T + S is also a tensor of the same rank, defined as (T + S)ij···k = Tij···k + Sij···k. in any coordinate system. To check that this is a tensor, we check the transformation rule. Again, we only show for n = 2: (T + S) ij = T ij + S ij = RipRjqTpq + RipRjqSpq = (RipRjq)(Tpq + Spq). 71 13 Tensors and tensor fields IA Vector Calculus Definition (Scalar multiplication). A tensor T of rank n can be multiplied by a scalar α. αT is a tensor of the same rank, defined by (αT )ij = αTij. It is trivial to check that the resulting object is indeed a tensor. Definition (Tensor product). Let T be a tensor of rank n and S be a tensor of rank m. The tensor product T ⊗ S is a tensor of rank n + m defined by (T ⊗ S)x1x2···xny1y2···ym = Tx1x2···xn Sy1y2···yn . It is trivial to show that this is a tensor. We can similarly define tensor products for any (positive integer) number of tensors, e.g. for n vectors u, v · · · , w, we can define by Tij···k = uivj · · · wk, as defined in the example in the beginning of the chapter. Definition (Tensor contraction). For a tensor T of rank n with components Tijp···q, we can contract on the indices i, j to obtain a new tensor of rank n − 2: Sp···q = δijTijp···q = Tiip···q Note that we don’t have to always contract on the first two indices. We can contract any pair we like. To check that contraction produces a tensor, we take the ranks 2 Tij example. ii = RipRiqTpq = δpqTpq = Contracting, we get Tii ,a rank-0 scalar. We have T Tpp = Tii, since R is an orthogonal matrix. If we view Tij as a matrix, then the contraction is simply the trace of the matrix. So our result above says that the trace is invariant under basis transformations — as we already know in IA Vectors and Matrices. Note that our usual matrix product can be formed by first applying a tensor product to obtain MijNpq, then contract with δjp to obtain MijNjq. 13.3 Symmetric and antisymmetric tensors Definition (Symmetric and anti-symmetric tensors). A tensor T of rank n is symmetric in the indices i, j if it obeys It is anti-symmetric if Tijp···q = Tjip···q. Tijp···q = −Tjip···q. Again, a tensor can be symmetric or anti-symmetric in any pair of indices, not just the first two. 72 13 Tensors and tensor fields IA Vector Calculus This is a property that holds in any coordinate systems, if it holds in one, since kr...s = RkiRjRrp · · · RsqTijp···q = ±RkiRjRrp · · · RsqTjip···q = ±T T kr···s as required. Definition (Totally symmetric and anti-symmetric tensors). A tensor is totally (anti-)symmetric if it is (anti-)symmetric in every pair of indices. Example. δij = δji is totally symmetric, while εijk = −εjik is totally antisymmetric. There are totally symmetric tensors of arbitrary rank n. But in R3, – Any totally antisymmetric tensor of rank 3 is λεijk for some scalar λ. – There are no totally antisymmetric tensors of rank greater than 3, except for the trivial tensor with all components 0. Proof: exercise (hint: pigeonhole principle) 13.4 Tensors, multi-linear maps and the quotient rule Tensors as multi-linear maps In Vectors and Matrices, we know that matrices are linear maps. We will prove an analogous fact for tensors. Definition (Multilinear map). A map T that maps n vectors a, b, · · · , c to R is multi-linear if it is linear in each of the vectors a, b, · · · , c individually. We will show that a tensor T of rank n is a equivalent to a multi-linear map from n vectors a, b, · · · , c to R defined by T (a, b, · · · , c) = Tij···kaibj · · · ck. To show that tensors are equivalent to multi-linear maps, we have to show the following: (i) Defining a map with a tensor makes sense, i.e. the expression Tij···kaibj · · · ck is the same regardless of the basis chosen; (ii) While it is always possible to write a multi-linear map as Tij···kaibj · · · ck, we have to show that Tij···k is indeed a tensor, i.e. transform according to the tensor transformation rules. To show the first property, just note that the Tij···kaibj · · · ck is a tensor product (followed by contraction), which retains tensor-ness. So it is also a tensor. In particular, it is a rank 0 tensor, i.e. a scalar, which is independent of the basis. To show the second property, assuming that T is a multi-linear map, it must be independent of the basis, so Tij···kaibj · · · ck = T ij···ka ib j · · · c k. 73 13 Tensors and tensor fields IA Vector Calculus p = Rpivi by tensor transformation rules, multiplying both sides by Rpi Since v gives vi = Rpiv p. Substituting in gives Tij···k(Rpia p)(Rqjb q) · · · (Rkrc r) = T pq···ra pb q · · · c r. Since this is true for all a, b, · · · c, we must have Tij···kRpiRqj · · · Rrk = T pq···r Hence Tij···k obeys the tensor transformation rule, and is a tensor. This shows that there is a one-to-one correspondence between tensors of rank n and multi-linear maps. This gives a way of thinking about tensors independent of any coordinate system or choice of basis, and the tensor transformation rule emerges naturally. Note that the above is exactly what we did with linear maps and matrices. The quotient rule If Ti · · · j n p · · · q m is a tensor of rank n + m, and up···q is a tensor of rank m then vi,···j = Ti···jp···qup···q is a tensor of rank n, since it is a tensor product of T and u, followed by contraction. The converse is also true: Proposition (Quotient rule). Suppose that Ti···jp···q is an array defined in each coordinate system, and that vi···j = Ti···jp···qup···q is also a tensor for any tensor up···q. Then Ti···jp···q is also a tensor. Note that we have previously seen the special case of n = m = 1, which says that linear maps are tensors. Proof. We can check the tensor transformation rule directly. However, we can reuse the result above to save some writing. Consider the special form up···q = cp · · · dq for any vectors c, · · · d. By assumption, is a tensor. Then vi···j = Ti···jp···qcp · · · dq vi···jai · · · bj = Ti···jp···qai · · · bjcp · · · dq is a scalar for any vectors a, · · · , b, c, · · · , d. Since Ti···jp···qai · · · bjcp · · · dq is a scalar and hence gives the same result in every coordinate system, Ti···jp···q is a multi-linear map. So Ti···jp···q is a tensor. 13.5 Tensor calculus Tensor fields and derivatives Just as with scalars or vectors, we can define tensor fields: 74 13 Tensors and tensor fields IA Vector Calculus Definition (Tensor field). A tensor field is a tensor at each point in space Tij···k(x), which can also be written as Tij···k(x). We assume that the fields are smooth so they can be differentiated any number of times ∂ ∂xp · · · ∂ ∂xq Tij···k, except for where things obviously fail, e.g. for where T is not defined. We now claim: Proposition. is a tensor of rank n + m. ∂ ∂xp ∂ ∂xq · · · m , Tij · · · k n (∗) ∂ ∂xp Proof. To show this, it suffices to show that satisfies the tensor transformation rules for rank 1 tensors (i.e. it is something like a rank 1 tensor). Then by the exact same argument we used to show that tensor products preserve tensorness, we can show that the (∗) is a tensor. (we cannot use the result of tensor products directly, since this is not exactly a product. But the exact same proof works!) Since x i = Riqxq, we have ∂x i ∂xp = Rip. (noting that ∂xp ∂xq = δpq). Similarly, ∂xq ∂x i = Riq. Note that Rip, Riq are constant matrices. Hence by the chain rule, ∂ ∂x i = ∂xq ∂x i ∂ ∂xq = Riq ∂ ∂xq . So ∂ ∂xp obeys the vector transformation rule. So done. Integrals and the tensor divergence theorem It is also straightforward to do integrals. Since we can sum tensors and take limits, the definition of a tensor-valued integral is straightforward. For example, V Tij···k(x) dV is a tensor of the same rank as Tij···k (think of the integral as the limit of a sum). For a physical example, recall our discussion of the flux of quantities for a fluid with velocity u(x) through a surface element — assume a uniform density ρ. The flux of volume is u · nδs = ujnjδS. So the flux of mass is ρujnjδS. Then the flux of the ith component of momentum is ρuiujnjδS = TijnjkδS 75 13 Tensors and tensor fields IA Vector Calculus (mass times velocity), where Tij = ρuiuj. Then the flux through the surface S is S Tijnj dS. It is easy to generalize the divergence theorem from vectors to tensors. We can then use it to discuss conservation laws for tensor quantities. Let V be a volume bounded by a surface S = ∂V and Tij···k be a smooth tensor field. Then Theorem (Divergence theorem for tensors). S Tij···kn dS = V ∂ ∂x (Tij···k) dV, with n being an outward pointing normal. The regular divergence theorem is the case where T has one index and is a vector field. Proof. Apply the usual divergence theorem to the vector field v defined by v = aibj · · · ckTij···k, where a, b, · · · , c are fixed constant vectors. Then and ∇ · v = ∂v ∂x = aibj · · · ck ∂ ∂x Tij···k, n · v = nv = aibj · · · ckTij···kn. Since a, b, · · · , c are arbitrary, therefore they can be eliminated, and the tensor divergence theorem follows. 76 14 Tensors of rank 2 IA Vector Calculus 14 Tensors of rank 2 14.1 Decomposition of a second-rank tensor This decomposition might look arbitrary at first sight, but as time goes on, you will find that it is actually very useful in your future career (at least, the lecturer claims so). Any second rank tensor can be written as a sum of its symmetric and anti-symmetric parts Tij = Sij
+ Aij, where Sij = 1 2 (Tij + Tji), Aij = 1 2 (Tij − Tji). Here Tij has 9 independent components, whereas Sij and Aij have 6 and 3 independent components, since they must be of the form (SijAija −b −c 0   . The symmetric part can be be further reduced to a traceless part plus an isotropic (i.e. multiple of δij) part: Sij = Pij + δijQ, 1 3 where Q = Sii is the trace of Sij and Pij = Pji = Sij − 1 Pij has 5 independent components while Q has 1. 3 δijQ is traceless. Then Since the antisymmetric part has 3 independent components, just like a usual vector, we should be able to write Ai in terms of a single vector. In fact, we can write the antisymmetric part as Aij = εijkBk for some vector B. To figure out what this B is, we multiply by εij on both sides and use some magic algebra to obtain Bk = 1 2 εijkAij = 1 2 εijkTij, where the last equality is from the fact that only antisymmetric parts contribute to the sum. Then (Aij) =   0 −B3 B2 −B1 B3 −B2 B1 0 0   To summarize, Tij = Pij + εijkBk + 1 3 δijQ, where Bk = 1 2 εpqjTpq, Q = Tkk and Pij = Pji = Tij +Tji 2 − 1 3 δijQ. 77 14 Tensors of rank 2 IA Vector Calculus Example. The derivative of a vector field Fi(r) is a tensor Tij = ∂Fi ∂xj field. Our decomposition given above has the symmetric traceless piece , a tensor Pij = 1 2 ∂Fi ∂xj + ∂Fj ∂xi − 1 3 δij ∂Fk ∂xk = 1 2 ∂Fi ∂xj + ∂Fj ∂xi − 1 3 δij∇ · F, an antisymmetric piece Aij = εijkBk, where and trace Bk = 1 2 εijk ∂Fi ∂xj = − 1 2 (∇ × F)k. Q = ∂Fk ∂xk = ∇ · F. Hence a complete description involves a scalar ∇ · F, a vector ∇ × F, and a symmetric traceless tensor Pij. 14.2 The inertia tensor Consider masses mα with positions rα, all rotating with angular velocity ω about 0. So the velocities are vα = ω × rα. The total angular momentum is L = = = α α α rα × mαvα mαrα × (ω × rα) mα(|rα|2ω − (rα · ω)rα). by vector identities. In components, we have Li = Iijωj, where Definition (Inertia tensor). The inertia tensor is Iij = α mα[|rα|2δij − (rα)i(rα)j]. For a rigid body occupying volume V with mass density ρ(r), we replace the sum with an integral to obtain Iij = V ρ(r)(xkxkδij − xixj) dV. By inspection, I is a symmetric tensor. Example. Consider a rotating cylinder with uniform density ρ0. The total mass is 2πa2ρ0. 78 14 Tensors of rank 2 IA Vector Calculus x3 a 2 x1 x2 Use cylindrical polar coordinates: x1 = r cos θ x2 = r sin θ x3 = x3 dV = r dr dθ dx3 We have I33 = V = ρ0 ρ0(x2 1 + x2 2) dV a 2π r2(r dr dθ dx2) 0 0 = ρ0 · 2π · 2 = ε0πa4. Similarly, we have − r4 4 a 0 ρ0(x2 2 + x2 3) dV I11 = V = ρ0 = ρ0 = ρ0 = ρ0 a 2π 0 a 0 2π 0 a 0 2π − r r 0 0 2πa · 2 3 a2 = ρ0πa2 (r2 sin2 θ + x2 3)r dr dθ dx3 r2 sin2 θ [x3] − + x3 3 3 − dθ dr r2 sin2 θ2 + 3 2 3 2π 0 dθ dr sin2 θ r2 dr By symmetry, the result for I22 is the same. 79 14 Tensors of rank 2 IA Vector Calculus How about the off-diagonal elements? I13 = − ρ0x1x3 dV V a = −ρ0 2π 0 − 0 = 0 r2 cos θx3 dr dx3 dθ Since 2π 0 the non-zero components are dθ cos θ = 0. Similarly, the other off-diagonal elements are all 0. So I33 = 1 2 M a2 a2 4 + 2 3 I11 = I22 = M In the particular case where = a 3 2 , we have Iij = 1 2 ma2δij. So in this case, √ L = 1 2 M a2ω for rotation about any axis. 14.3 Diagonalization of a symmetric second rank tensor Recall that using matrix notation, T = (Tij), T = (T ij), R = (Rij), and the tensor transformation rule T ij = RipRjqTpq becomes T = RT RT = RT R−1. If T is symmetric, it can be diagonalized by such an orthogonal transformation. This means that there exists a basis of orthonormal eigenvectors e1, e2, e3 for T with real eigenvalues λ1, λ2, λ3 respectively. The directions defined by e1, e2, e3 are the principal axes for T , and the tensor is diagonal in Cartesian coordinates along these axes. This applies to any symmetric rank-2 tensor. For the special case of the inertia tensor, the eigenvalues are called the principal moments of inertia. As exemplified in the previous example, we can often guess the correct principal axes for Iij based on the symmetries of the body. With the axes we chose, Iij was found to be diagonal by direct calculation. 80 15 Invariant and isotropic tensors IA Vector Calculus 15 Invariant and isotropic tensors 15.1 Definitions and classification results Definition (Invariant and isotropic tensor). A tensor T is invariant under a particular rotation R if T ij···k = RipRjq · · · RkrTpq···r = Tij···k, i.e. every component is unchanged under the rotation. A tensor T which is invariant under every rotation is isotropic, i.e. the same in every direction. Example. The inertia tensor of a sphere is isotropic by symmetry. δij and εijk are also isotropic tensors. This ensures that the component definitions of the scalar and vector products a·b = aibjδij and (a×b)i = εijkajbk are independent of the Cartesian coordinate system. Isotropic tensors in R3 can be classified: Theorem. (i) There are no isotropic tensors of rank 1, except the zero tensor. (ii) The most general rank 2 isotropic tensor is Tij = αδij for some scalar α. (iii) The most general rank 3 isotropic tensor is Tijk = βεijk for some scalar β. (iv) All isotropic tensors of higher rank are obtained by combining δij and εijk using tensor products, contractions, and linear combinations. We will provide a sketch of the proof: Proof. We analyze conditions for invariance under specific rotations through π or π/2 about coordinate axes. (i) Suppose Ti is rank-1 isotropic. Consider a rotation about x3 through π: (Rij) =   −1 0 0 −1 0 0  0 0  . 1 We want T1 = RipTp = R11T1 = −T1. So T1 = 0. Similarly, T2 = 0. By consider a rotation about, say x1, we have T3 = 0. (ii) Suppose Tij is rank-2 isotropic. Consider (Rij) =   0 − which is a rotation through π/2 about the x3 axis. Then T13 = R1pR3qTpq = R12R33T23 = T23 81 15 Invariant and isotropic tensors IA Vector Calculus and T23 = R2pR3qTpq = R21R33T13 = −T13 So T13 = T23 = 0. Similarly, we have T31 = T32 = 0. We also have T11 = R1pR1qTpq = R12R12T22 = T22. So T11 = T22. By picking a rotation about a different axis, we have T21 = T12 and T22 = T33. Hence Tij = αδij. (iii) Suppose that Tijk is rank-3 isotropic. Using the rotation by π about the x3 axis, we have T133 = R1pR3qR3rTpqr = −T133. So T133 = 0. We also have T111 = R1pR1qR1rTpqr = −T111. So T111 = 0. We have similar results for π rotations about other axes and other choices of indices. Then we can show that Tijk = 0 unless all i, j, k are distinct. Now consider (Rij) =   0 − rotation about x3 through π/2. Then T123 = R1pR2qR3rTpqr = R12R21R33T213 = −T213. So T123 = −T213. Along with similar results for other indices and axes of rotation, we find that Tijk is totally antisymmetric, and Tijk = βεijk for some β. Example. The most general isotropic tensor of rank 4 is Tijk = αδijδk + βδikδj + γδiδjk for some scalars α, β, γ. There are no other independent combinations. (we might think we can write a rank-4 isotropic tensor in terms of εijk, like εijpεkp, but this is just δikδj − δiδjk. It turns out that anything you write with εijk can be written in terms of δij instead) 15.2 Application to invariant integrals We have the following very useful theorem. It might seem a bit odd and arbitrary at first sight — if so, read the example below first (after reading the statement of the theorem), and things will make sense! 82 15 Invariant and isotropic tensors IA Vector Calculus Theorem. Let Tij···k = V f (x)xixj · · · xk dV. where f (x) is a scalar function and V is some volume. Given a rotation Rij, consider an active transformation: x = xiei is mapped i = Rijxi, i.e. we map the components but not the basis, and to x = x iei with x V is mapped to V . Suppose that under this active transformation, (i) f (x) = f (x), (ii) V = V (e.g. if V is all of space or a sphere). Then Tij···k is invariant under the rotation. Proof. First note that the Jacobian of the transformation R is 1, since it is i = Ripxp ⇒ ∂x simply the determinant of R (x = Rip), which is by definition 1. So dV = dV . Then we have i ∂xp f (x)x ix j · · · x k dV f (x)x ix j · · · x k dV using (i) f (x)x ix j · · · x k dV using (ii) RipRjq · · · RkrTpq···r = = = = V V V V = Tij···k. f (x)xixj · · · xk dV since xi and x i are dummy The result is particularly useful if (i) and (ii) hold for any rotation R, in which case Tij···k is isotropic. Example. Let Tij = V xixj dV, with V being a solid sphere of |r| < a. Our result applies with f = 1, which, being a constant, is clearly invariant under rotations. Also the solid sphere is invariant under any rotation. So T must be isotropic. But the only rank 2 isotropic tensor is αδij. Hence we must have Tij = αδij, and all we have to do is to determine the scalar α. Taking the trace, we have Tii = 3α = V xixi dV = 4π a 0 r2 · r2 dr = 4 5 πa5. So Tij = 4 15 πa5δij. 83 15 Invariant and isotropic tensors IA Vector Calculus Normally if we are only interested in the i = j case, we just claim that Tij = 0 by saying “by symmetry, it is 0”. But now we can do it (more) rigorously! There is a closely related result for the inertia tensor of a solid sphere of 3 πa3ρ0. constant density ρ0, or of mass M = 4 Recall that Iij = V ρ0(xkxkδij − xixj) dV. We see that Iij is isotropic (since we have just shown that xixj dV is isotropic, and xkxkδij is also isotropic). Let Iij = βδij. Then Iij = ρ0(xkxkδij − xixj) dV V = ρ0 δij V xkxk dV − xixj dV V = ρ0 (δijTkk − Tij) 4 15 πa5δij − 4 5 = ρ0 πa5δij = = ρ0πa5δij 8 15 2 M a2δij. 5 84
(1, 2) + (3, 4, 5) = (1, 2, 3, 4, 5). While this notation might give a valid expression in some computer languages, it is not standard mathematical notation, and we will not use it in this book. In general, it is very important to distinguish between mathematical notation for vectors (which we use) and the syntax of specific computer languages or software packages for manipulating vectors. 1.3 Scalar-vector multiplication 15 Figure 1.9 Average monthly rainfall in inches measured in downtown Los Angeles and San Francisco International Airport, and their sum. Averages are 30-year averages (1981–2010). 1.3 Scalar-vector multiplication Another operation is scalar multiplication or scalar-vector multiplication, in which a vector is multiplied by a scalar (i.e., number), which is done by multiplying every element of the vector by the scalar. Scalar multiplication is denoted by juxtaposition, typically with the scalar on the left, as in  2 18 12 − − − Scalar-vector multiplication can also be written with the scalar on the right, as in   1 9 6    (1.5) =    . 1.5 13.5 9 The meaning is the same: It is the vector obtained by multiplying each element by the scalar. A similar notation is a/2, where a is a vector, meaning (1/2)a. The scalar-vector product ( a. Note that 0 a = 0 (where the left-hand zero is the scalar zero, and the right-hand zero is a vector zero of the same size as a). 1)a is written simply as − − Properties. By definition, we have αa = aα, for any scalar α and any vector a. This is called the commutative property of scalar-vector multiplication; it means that scalar-vector multiplication can be written in either order. 12345678910111202468kRainfall(inches)LosAngelesSanFranciscoSum 16 1 Vectors Scalar multiplication obeys several other laws that are easy to figure out from the definition. For example, it satisfies the associative property: If a is a vector and β and γ are scalars, we have (βγ)a = β(γa). On the left-hand side we see scalar-scalar multiplication (βγ) and scalar-vector multiplication; on the right-hand side we see two scalar-vector products. As a consequence, we can write the vector above as βγa, since it does not matter whether we interpret this as β(γa) or (βγ)a. The associative property holds also when we denote scalar-vector multiplication with the scalar on the right. For example, we have β(γa) = (βa)γ, and consequently we can write both as βaγ. As a convention, however, this vector is normally written as βγa or as (βγ)a. If a is a vector and β, γ are scalars, then (β + γ)a = βa + γa. (This is the left-distributive property of scalar-vector multiplication.) Scalar multiplication, like ordinary multiplication, has higher precedence in equations than vector addition, so the right-hand side here, βa+γa, means (βa)+(γa). It is useful to identify the symbols appearing in this formula above. The + symbol on the left is addition of scalars, while the + symbol on the right denotes vector addition. When scalar multiplication is written with the scalar on the right, we have the right-distributive property: a(β + γ) = aβ + aγ. Scalar-vector multiplication also satisfies another version of the right-distributive property: β(a + b) = βa + βb for any scalar β and any n-vectors a and b. In this equation, both of the + symbols refer to the addition of n-vectors. Examples. • • • Displacements. When a vector a represents a displacement, and β > 0, βa is a displacement in the same direction of a, with its magnitude scaled by β. When β < 0, βa represents a displacement in the opposite direction of a, with magnitude scaled by . This is illustrated in figure 1.10. | β | Materials requirements. Suppose the n-vector q is the bill of materials for producing one unit of some product, i.e., qi is the amount of raw material required to produce one unit of product. To produce α units of the product will then require raw materials given by αq. (Here we assume that α 0.) ≥ Audio scaling. If a is a vector representing an audio signal, the scalar-vector product βa is perceived as the same audio signal, but changed in volume 1/2), βa β (loudness) by the factor | is perceived as the same audio signal, but quieter. . For example, when β = 1/2 (or β = − | 1.3 Scalar-vector multiplication 17 Figure 1.10 The vector 0.75a represents the displacement in the direction of the displacement a, with magnitude scaled by 0.75; ( 1.5)a represents the displacement in the opposite direction, with magnitude scaled by 1.5. − Linear combinations. n-vector If a1, . . . , am are n-vectors, and β1, . . . , βm are scalars, the · · · is called a linear combination of the vectors a1, . . . , an. The scalars β1, . . . , βm are called the coefficients of the linear combination. β1a1 + + βmam Linear combination of unit vectors. We can write any n-vector b as a linear combination of the standard unit vectors, as b = b1e1 + + bnen. · · · (1.1) In this equation bi is the ith entry of b (i.e., a scalar), and ei is the ith unit vector. In the linear combination of e1, . . . , en given in (1.1), the coefficients are the entries of the vector b. A specific example is   · · · · · · Special linear combinations. Some linear combinations of the vectors a1, . . . , am have special names. For example, the linear combination with β1 = = βm = 1, + am, is the sum of the vectors, and the linear combination with given by a1 + + am), is the average of the vectors. β1 = = βm = 1/m, given by (1/m)(a1 + When the coefficients sum to one, i.e., β1 + + βm = 1, the linear combination is called an affine combination. When the coefficients in an affine combination are nonnegative, it is called a convex combination, a mixture, or a weighted average. The coefficients in an affine or convex combination are sometimes given as percentages, which add up to 100%. · · · · · · · · · a0.75a−1.5a 18 1 Vectors Figure 1.11 Left. Two 2-vectors a1 and a2. Right. The linear combination b = 0.75a1 + 1.5a2. Examples. • • • • Displacements. When the vectors represent displacements, a linear combination is the sum of the scaled displacements. This is illustrated in figure 1.11. Audio mixing. When a1, . . . , am are vectors representing audio signals (over the same period of time, for example, simultaneously recorded), they are called tracks. The linear combination β1a1 + + βmam is perceived as a mixture (also called a mix ) of the audio tracks, with relative loudness given by . A producer in a studio, or a sound engineer at a live show, βm| | chooses values of β1, . . . , βm to give a good balance between the different instruments, vocals, and drums. β1| | , . . . , · · · Cash flow replication. Suppose that c1, . . . , cm are vectors that represent cash flows, such as particular types of loans or investments. The linear combination + βmcm represents another cash flow. We say that the cash f = β1c1 + flow f has been replicated by the (linear combination of the) original cash 1.1, 0) represents a $1 loan from flows c1, . . . , cm. As an example, c1 = (1, period 1 to period 2 with 10% interest, and c2 = (0, 1, 1.1) represents a $1 loan from period 2 to period 3 with 10% interest. The linear combination · · · − − d = c1 + 1.1c2 = (1, 0, 1.21) − represents a two period loan of $1 in period 1, with compounded 10% interest. Here we have replicated a two period loan from two one period loans. − Line and segment. When a and b are different n-vectors, the affine combiθ)a + θb, where θ is a scalar, describes a point on the line nation c = (1 1, c is a convex combination of a θ passing through a and b. When 0 and b, and is said to lie on the segment between a and b. For n = 2 and n = 3, with the vectors representing coordinates of 2-D or 3-D points, this agrees with the usual geometric notion of line and segment. But we can also talk about the line passing through two vectors of dimension 100. This is illustrated in figure 1.12. ≤ ≤ a1a20.75a11.5a2b 1.4 Inner product 19 Figure 1.12 The affine combination (1 θ)a + θb for different values of θ. These points are on the line passing through a and b; for θ between 0 and 1, the points are on the line segment between a and b. − 1.4 Inner product The (standard) inner product (also called dot product) of two n-vectors is defined as the scalar aT b = a1b1 + a2b2 + + anbn, · · · the sum of the products of corresponding entries. (The origin of the superscript ‘T’ in the inner product notation aT b will be explained in chapter 6.) Some other notations for the inner product (that we will not use in this book) are , (a, b), and a b. (In the notation used in this book, (a, b) denotes a stacked vector of length 2n.) As you might guess, there is also a vector outer product, which we 10.1. As a specific example of the inner product, we have will encounter later, in a)(1) + (2)(0) + (2)( 3) = 7. − − 1 0 3 − When n = 1, the inner product reduces to the usual product of two numbers. Properties. The inner product satisfies some simple properties that are easily verified from the definition. If a, b, and c are vectors of the same size, and γ is a scalar, we have the following. Commutativity. aT b = bT a. The order of the two vector arguments in the inner product does not matter. Associativity with scalar multiplication. (γa)T b = γ(aT b), so we can write both as γaT b. Distributivity with vector addition. (a + b)T c = aT c + bT c. The inner product can be distributed across vector addition. • • • These can be combined to obtain other identities, such as aT (γb) = γ(aT b), or aT (b + γc) = aT b + γaT c. As another useful example, we have, for any vectors a, b, c, d of the same size, (a + b)T (c + d) = aT c + aT d + bT c + bT d. abθ=0.4θ=1.2θ=−0.4 20 1 Vectors This formula expresses an inner product on the left-hand side as a sum of four inner products on the right-hand side, and is analogous to expanding a product of sums in algebra. Note that on the left-hand side, the two addition symbols refer to vector addition, whereas on the right-hand side, the three addition symbols refer to scalar (number) addition. Gen
eral examples. • • • • • Unit vector. eT unit vector gives (or ‘picks out’) the ith element a. i a = ai. The inner product of a vector with the ith standard Sum. 1T a = a1 + ones gives the sum of the elements of the vector. · · · + an. The inner product of a vector with the vector of Average. (1/n)T a = (a1 + + an)/n. The inner product of an n-vector with the vector 1/n gives the average or mean of the elements of the vector. The average of the entries of a vector is denoted by avg(x). The Greek letter µ is a traditional symbol used to denote the average or mean. · · · Sum of squares. aT a = a2 · · · itself gives the sum of the squares of the elements of the vector. n. The inner product of a vector with + a2 1 + Selective sum. Let b be a vector all of whose entries are either 0 or 1. Then bT a is the sum of the elements in a for which bi = 1. Block vectors. blocks have the same sizes (in which case we say they conform), then we have If the vectors a and b are block vectors, and the corresponding aT b =  T         a1 ... ak b1 ... bk    = aT 1 b1 + + aT k bk. · · · The inner product of block vectors is the sum of the inner products of the blocks. Applications. The inner product is useful in many applications, a few of which we list here. • Co-occurrence. If a and b are n-vectors that describe occurrence, i.e., each of their elements is either 0 or 1, then aT b gives the total number of indices for which ai and bi are both one, that is, the total number of co-occurrences. If we interpret the vectors a and b as describing subsets of n objects, then aT b gives the number of objects in the intersection of the two subsets. This is illustrated in figure 1.13, for two subsets A and B of 7 objects, labeled 1, . . . , 7, with corresponding occurrence vectors a = (0, 1, 1, 1, 1, 1, 1), b = (1, 0, 1, 0, 1, 0, 0). Here we have aT b = 2, which is the number of objects in both A and B (i.e., objects 3 and 5). 1.4 Inner product 21 • • • • • Figure 1.13 Two sets A and B, containing seven objects. Weights, features, and score. When the vector f represents a set of features of an object, and w is a vector of the same size (often called a weight vector ), the inner product wT f is the sum of the feature values, scaled (or weighted) by the weights, and is sometimes called a score. For example, if the features are associated with a loan applicant (e.g., age, income, . . . ), we might interpret s = wT f as a credit score. In this example we can interpret wi as the weight given to feature i in forming the score. Price-quantity. If p represents a vector of prices of n goods, and q is a vector of quantities of the n goods (say, the bill of materials for a product), then their inner product pT q is the total cost of the goods given by the vector q. Speed-time. A vehicle travels over n segments with constant speed in each segment. Suppose the n-vector s gives the speed in the segments, and the n-vector t gives the times taken to traverse the segments. Then sT t is the total distance traveled. Probability and expected values. Suppose the n-vector p has nonnegative entries that sum to one, so it describes a set of proportions among n items, or a set of probabilities of n outcomes, one of which must occur. Suppose f is another n-vector, where we interpret fi as the value of some quantity if outcome i occurs. Then f T p gives the expected value or mean of the quantity, under the probabilities (or fractions) given by p. Polynomial evaluation. Suppose the n-vector c represents the coefficients of a polynomial p of degree n 1 or less: − p(x) = c1 + c2x + + cn 1xn − · · · 2 + cnxn − 1. − Let t be a number, and let z = (1, t, t2, . . . , tn 1) be the n-vector of powers of t. Then cT z = p(t), the value of the polynomial p at the point t. So the inner product of a polynomial coefficient vector and vector of powers of a number evaluates the polynomial at the number. − AB1234567 22 1 Vectors • Discounted total. Let c be an n-vector representing a cash flow, with ci the cash received (when ci > 0) in period i. Let d be the n-vector defined as d = (1, 1/(1 + r), . . . , 1/(1 + r)n − 1), where r ≥ 0 is an interest rate. Then dT c = c1 + c2/(1 + r) + + cn/(1 + r)n 1 − · · · is the discounted total of the cash flow, i.e., its net present value (NPV), with interest rate r. • Portfolio value. Suppose s is an n-vector representing the holdings in shares of a portfolio of n different assets, with negative values meaning short positions. If p is an n-vector giving the prices of the assets, then pT s is the total (or net) value of the portfolio. • Portfolio return. Suppose r is the vector of (fractional) returns of n assets over some time period, i.e., the asset relative price changes ri = pinitial pfinal i i − pinitial i , i = 1, . . . , n, i i and pfinal where pinitial are the (positive) prices of asset i at the beginning and end of the investment period. If h is an n-vector giving our portfolio, with hi denoting the dollar value of asset i held, then the inner product rT h is the total return of the portfolio, in dollars, over the period. If w represents the fractional (dollar) holdings of our portfolio, then rT w gives the total return of the portfolio. For example, if rT w = 0.09, then our portfolio return is 9%. If we had invested $10000 initially, we would have earned $900. • Document sentiment analysis. Suppose the n-vector x represents the histogram of word occurrences in a document, from a dictionary of n words. Each word in the dictionary is assigned to one of three sentiment categories: Positive, Negative, and Neutral. The list of positive words might include ‘nice’ and ‘superb’; the list of negative words might include ‘bad’ and ‘terrible’. Neutral words are those that are neither positive nor negative. We encode the word categories as an n-vector w, with wi = 1 if word i is positive, with wi = 1 if word i is negative, and wi = 0 if word i is neutral. The number wT x gives a (crude) measure of the sentiment of the document. − 1.5 Complexity of vector computations Computer representation of numbers and vectors. Real numbers are stored in computers using floating point format, which represents a real number using a block of 64 bits (0s and 1s), or 8 bytes (groups of 8 bits). Each of the 264 possible sequences of bits corresponds to a specific real number. The floating point numbers 1.5 Complexity of vector computations 23 span a very wide range of values, and are very closely spaced, so numbers that arise in applications can be approximated as floating point numbers to an accuracy of around 10 digits, which is good enough for almost all practical applications. Integers are stored in a more compact format, and are represented exactly. Vectors are stored as arrays of floating point numbers (or integers, when the entries are all integers). Storing an n-vector requires 8n bytes to store. Current memory and storage devices, with capacities measured in many gigabytes (109 bytes), can easily store vectors with dimensions in the millions or billions. Sparse vectors are stored in a more efficient way that keeps track of indices and values of the nonzero entries. Floating point operations. When computers carry out addition, subtraction, multiplication, division, or other arithmetic operations on numbers represented in floating point format, the result is rounded to the nearest floating point number. These operations are called floating point operations. The very small error in the computed result is called (floating point) round-off error. In most applications, these very small errors have no practical effect. Floating point round-off errors, and methods to mitigate their effect, are studied in a field called numerical analysis. In this book we will not consider floating point round-off error, but you should be aware that it exists. For example, when a computer evaluates the left-hand and right-hand sides of a mathematical identity, you should not be surprised if the two numbers are not equal. They should, however, be very close. Flop counts and complexity. So far we have seen only a few vector operations, like scalar multiplication, vector addition, and the inner product. How quickly these operations can be carried out by a computer depends very much on the computer hardware and software, and the size of the vector. A very rough estimate of the time required to carry out some computation, such as an inner product, can be found by counting the total number of floating point operations, or FLOPs. This term is in such common use that the acronym is now written in lower case letters, as flops, and the speed with which a computer can carry out flops is expressed in Gflop/s (gigaflops per second, i.e., billions of flops per second). Typical current values are in the range of 1–10 Gflop/s, but this can vary by several orders of magnitude. The actual time it takes a computer to carry out some computation depends on many other factors beyond the total number of flops required, so time estimates based on counting flops are very crude, and are not meant to be more accurate than a factor of ten or so. For this reason, gross approximations (such as ignoring a factor of 2) can be used when counting the flops required in a computation. The complexity of an operation is the number of flops required to carry it out, as a function of the size or sizes of the input to the operation. Usually the complexity is highly simplified, dropping terms that are small or negligible (compared to other terms) when the sizes of the inputs are large. In theoretical computer science, the term ‘complexity’ is used in a different way, to mean the number of flops of the best method to carry out the computation, i.e., the one that requires the fewest flops. In this book, we use the term complexity to mean the number of flops required by a specific method. 24 1 Vectors · · · + xnyn of two n-vectors takes 2n Complexity of vector operations. Scalar-vector multiplication ax, where x is an n-vector, requires n multiplications, i.e., a
xi for i = 1, . . . , n. Vector addition x + y of two n-vectors takes n additions, i.e., xi + yi for i = 1, . . . , n. Computing the inner product xT y = x1y1 + 1 flops, n scalar 1 scalar additions. So scalar multiplication, vector addition, multiplications and n and the inner product of n-vectors require n, n, and 2n 1 flops, respectively. We only need an estimate, so we simplify the last to 2n flops, and say that the complexity of scalar multiplication, vector addition, and the inner product of nvectors is n, n, and 2n flops, respectively. We can guess that a 1 Gflop/s computer can compute the inner product of two vectors of size one million in around one thousandth of a second, but we should not be surprised if the actual time differs by a factor of 10 from this value. − − − The order of the computation is obtained by ignoring any constant that multiplies a power of the dimension. So we say that the three vector operations scalar multiplication, vector addition, and inner product have order n. Ignoring the factor of 2 dropped in the actual complexity of the inner product is reasonable, since we do not expect flop counts to predict the running time with an accuracy better than a factor of 2. The order is useful in understanding how the time to execute the computation will scale when the size of the operands changes. An order n computation should take around 10 times longer to carry out its computation on an input that is 10 times bigger. nnz(x), nnz(y) } { Complexity of sparse vector operations. If x is sparse, then computing ax requires nnz(x) flops. If x and y are sparse, computing x + y requires no more than min flops (since no arithmetic operations are required to compute (x + y)i when either xi or yi is zero). If the sparsity patterns of x and y do not overlap (intersect), then zero flops are needed to compute x + y. The inner product calculation is similar: computing xT y requires no more than 2 min nnz(x), nnz(y) } { flops. When the sparsity patterns of x and y do not overlap, computing xT y requires zero flops, since xT y = 0 in this case. Exercises Exercises 25 1.1 Vector equations. Determine whether each of the equations below is true, false, or contains bad notation (and therefore does not make sense). (a) (b) 1 2 1 1 2 1 = (1, 2, 1). = 1, 2, 1 . (c) (1, (2, 1)) = ((1, 2), 1). 1.2 Vector notation. Which of the following expressions uses correct notation? When the expression does make sense, give its length. In the following, a and b are 10-vectors, and c is a 20-vector. (a) a + b c3:12. − (b) (a, b, c3:13). (c) 2a + c. (d) (a, 1) + (c1, b). (e) ((a, b), a). (f) [ a b ] + 4c. (g) + 4c. a b 1.3 Overloading. Which of the following expressions uses correct notation? If the notation is correct, is it also unambiguous? Assume that a is a 10-vector and b is a 20-vector. (a) b = (0, a). (b) a = (0, b). (c) b = (0, a, 0). (d) a = 0 = b. 1.4 Periodic energy usage. The 168-vector w gives the hourly electricity consumption of a manufacturing plant, starting on Sunday midnight to 1AM, over one week, in MWh (megawatt-hours). The consumption pattern is the same each day, i.e., it is 24-periodic, which means that wt+24 = wt for t = 1, . . . , 144. Let d be the 24-vector that gives the energy consumption over one day, starting at midnight. (a) Use vector notation to express w in terms of d. (b) Use vector notation to express d in terms of w. 1.5 Interpreting sparsity. Suppose the n-vector x is sparse, i.e., has only a few nonzero entries. Give a short sentence or two explaining what this means in each of the following contexts. (a) x represents the daily cash flow of some business over n days. (b) x represents the annual dollar value purchases by a customer of n products or ser- vices. (c) x represents a portfolio, say, the dollar value holdings of n stocks. (d) x represents a bill of materials for a project, i.e., the amounts of n materials needed. (e) x represents a monochrome image, i.e., the brightness values of n pixels. (f) x is the daily rainfall in a location over one year. 26 1 Vectors − 1)-vector d given by d = (x2 1.6 Vector of differences. Suppose x is an n-vector. The associated vector of differences is the (n 1). Express d in terms of x − using vector operations (e.g., slicing notation, sum, difference, linear combinations, inner product). The difference vector has a simple interpretation when x represents a time series. For example, if x gives the daily value of some quantity, d gives the day-to-day changes in the quantity. x2, . . . , xn x1, x3 xn − − − 1.7 Transforming between two encodings for Boolean vectors. A Boolean n-vector is one for which all entries are either 0 or 1. Such vectors are used to encode whether each of n conditions holds, with ai = 1 meaning that condition i holds. Another common encoding of the same information uses the two values 1 and +1 for the entries. For example the Boolean vector (0, 1, 1, 0) would be written using this alternative encoding 1). Suppose that x is a Boolean vector with entries that are 0 or 1, and as ( y is a vector encoding the same information using the values 1 and +1. Express y in terms of x using vector notation. Also, express x in terms of y using vector notation. 1, +1, +1, − − − − 1.8 Profit and sales vectors. A company sells n different products or items. The n-vector p gives the profit, in dollars per unit, for each of the n items. (The entries of p are typically positive, but a few items might have negative entries. These items are called loss leaders, and are used to increase customer engagement in the hope that the customer will make other, profitable purchases.) The n-vector s gives the total sales of each of the items, over some period (such as a month), i.e., si is the total number of units of item i sold. (These are also typically nonnegative, but negative entries can be used to reflect items that were purchased in a previous time period and returned in this one.) Express the total profit in terms of p and s using vector notation. 1.9 Symptoms vector. A 20-vector s records whether each of 20 different symptoms is present in a medical patient, with si = 1 meaning the patient has the symptom and si = 0 meaning she does not. Express the following using vector notation. (a) The total number of symptoms the patient has. (b) The patient exhibits five out of the first ten symptoms. 1.10 Total score from course record. The record for each student in a class is given as a 10vector r, where r1, . . . , r8 are the grades for the 8 homework assignments, each on a 0–10 scale, r9 is the midterm exam grade on a 0–120 scale, and r10 is final exam score on a 0–160 scale. The student’s total course score s, on a 0–100 scale, is based 25% on the homework, 35% on the midterm exam, and 40% on the final exam. Express s in the form s = wT r. (That is, determine the 10-vector w.) You can give the coefficients of w to 4 digits after the decimal point. 1.11 Word count and word count histogram vectors. Suppose the n-vector w is the word count vector associated with a document and a dictionary of n words. For simplicity we will assume that all words in the document appear in the dictionary. (a) What is 1T w? (b) What does w282 = 0 mean? (c) Let h be the n-vector that gives the histogram of the word counts, i.e., hi is the fraction of the words in the document that are word i. Use vector notation to express h in terms of w. (You can assume that the document contains at least one word.) 1.12 Total cash value. An international company holds cash in five currencies: USD (US dollar), RMB (Chinese yuan), EUR (euro), GBP (British pound), and JPY (Japanese yen), in amounts given by the 5-vector c. For example, c2 gives the number of RMB held. Negative entries in c represent liabilities or amounts owed. Express the total (net) value of the cash in USD, using vector notation. Be sure to give the size and define the entries of any vectors that you introduce in your solution. Your solution can refer to currency exchange rates. Exercises 27 1.13 Average age in a population. Suppose the 100-vector x represents the distribution of ages 1 year olds, for i = 1, . . . , 100. = 0, and that there is no one in the population over age 99.) in some population of people, with xi being the number of i (You can assume that x Find expressions, using vector notation, for the following quantities. − (a) The total number of people in the population. (b) The total number of people in the population age 65 and over. (c) The average age of the population. (You can use ordinary division of numbers in your expression.) 1.14 Industry or sector exposure. Consider a set of n assets or stocks that we invest in. Let f be an n-vector that encodes whether each asset is in some specific industry or sector, e.g., pharmaceuticals or consumer electronics. Specifically, we take fi = 1 if asset i is in the sector, and fi = 0 if it is not. Let the n-vector h denote a portfolio, with hi the dollar value held in asset i (with negative meaning a short position). The inner product f T h is called the (dollar value) exposure of our portfolio to the sector. It gives the net dollar value of the portfolio that is invested in assets from the sector. A portfolio h is called neutral (to a sector or industry) if f T h = 0. A portfolio h is called long only if each entry is nonnegative, i.e., hi means the portfolio does not include any short positions. What does it mean if a long-only portfolio is neutral to a sector, say, pharmaceuticals? Your answer should be in simple English, but you should back up your conclusion with an argument. 0 for each i. This ≥ 1.15 Cheapest supplier. You must buy n raw materials in quantities given by the n-vector q, where qi is the amount of raw material i that you must buy. A set of K potential suppliers offer the raw materials at prices given by the n-vectors p1, . . . , pK . (Note that pk is an n-vector; (pk)i is the price that supplier k charges per unit of raw material i.) We will assume that all quantities and prices are
positive. If you must choose just one supplier, how would you do it? Your answer should use vector notation. A (highly paid) consultant tells you that you might do better (i.e., get a better total cost) by splitting your order into two, by choosing two suppliers and ordering (1/2)q (i.e., half the quantities) from each of the two. He argues that having a diversity of suppliers is better. Is he right? If so, explain how to find the two suppliers you would use to fill half the order. 1.16 Inner product of nonnegative vectors. A vector is called nonnegative if all its entries are nonnegative. (a) Explain why the inner product of two nonnegative vectors is nonnegative. (b) Suppose the inner product of two nonnegative vectors is zero. What can you say about them? Your answer should be in terms of their respective sparsity patterns, i.e., which entries are zero and nonzero. 1.17 Linear combinations of cash flows. We consider cash flow vectors over T time periods, with a positive entry meaning a payment received, and negative meaning a payment made. A (unit) single period loan, at time period t, is the T -vector lt that corresponds to a payment received of $1 in period t and a payment made of $(1 + r) in period t + 1, with all other payments zero. Here r > 0 is the interest rate (over one period). Let c be a $1 T − period 1, $(1 + r)T zero. Express c as a linear combination of single period loans. 1 period loan, starting at period 1. This means that $1 is received in 1) are − 1 is paid in period T , and all other payments (i.e., c2, . . . , cT − 1.18 Linear combinations of linear combinations. Suppose that each of the vectors b1, . . . , bk is a linear combination of the vectors a1, . . . , am, and c is a linear combination of b1, . . . , bk. Then c is a linear combination of a1, . . . , am. Show this for the case with m = k = 2. (Showing it in general is not much more difficult, but the notation gets more complicated.) 28 1 Vectors 1.19 Auto-regressive model. Suppose that z1, z2, . . . is a time series, with the number zt giving the value in period or time t. For example zt could be the gross sales at a particular store on day t. An auto-regressive (AR) model is used to predict zt+1 from the previous M values, zt, zt 1, . . . , zt M +1: − − ˆzt+1 = (zt, zt 1, . . . , zt − M +1)T β, − t = M, M + 1, . . . . Here ˆzt+1 denotes the AR model’s prediction of zt+1, M is the memory length of the AR model, and the M -vector β is the AR model coefficient vector. For this problem we will assume that the time period is daily, and M = 10. Thus, the AR model predicts tomorrow’s value, given the values over the last 10 days. For each of the following cases, give a short interpretation or description of the AR model in English, without referring to mathematical concepts like vectors, inner product, and so on. You can use words like ‘yesterday’ or ‘today’. (a) β (b) β (c) β (d) β ≈ ≈ ≈ ≈ e1. 2e1 e6. e2. − 0.5e1 + 0.5e2. 1.20 How many bytes does it take to store 100 vectors of length 105? How many flops does it take to form a linear combination of them (with 100 nonzero coefficients)? About how long would this take on a computer capable of carrying out 1 Gflop/s? Chapter 2 Linear functions In this chapter we introduce linear and affine functions, and describe some common settings where they arise, including regression models. 2.1 Linear functions Function notation. The notation f : Rn R means that f is a function that maps real n-vectors to real numbers, i.e., it is a scalar-valued function of n-vectors. If x is an n-vector, then f (x), which is a scalar, denotes the value of the function f at x. (In the notation f (x), x is referred to as the argument of the function.) We can also interpret f as a function of n scalar arguments, the entries of the vector argument, in which case we write f (x) as → f (x) = f (x1, x2, . . . , xn). Here we refer to x1, . . . , xn as the arguments of f . We sometimes say that f is real-valued, or scalar-valued, to emphasize that f (x) is a real number or scalar. To describe a function f : Rn Rn. For example, we can define a function f : R4 R, we have to specify what its value is for any R by → possible argument x ∈ → f (x) = x1 + x2 − x2 4 for any 4-vector x. In words, we might describe f as the sum of the first two elements of its argument, minus the square of the last entry of the argument. (This particular function does not depend on the third element of its argument.) Sometimes we introduce a function without formally assigning a symbol for it, by directly giving a formula for its value in terms of its arguments, or describing how to find its value from its arguments. An example is the sum function, whose value is x1 + + xn. We can give a name to the value of the function, as in · · · y = x1 + + xn, and say that y is a function of x, in this case, the sum of its entries. · · · Many functions are not given by formulas or equations. As an example, suppose R is the function that gives the lift (vertical upward force) on a particular f : R3 → 30 2 Linear functions airplane, as a function of the 3-vector x, where x1 is the angle of attack of the airplane (i.e., the angle between the airplane body and its direction of motion), x2 is its air speed, and x3 is the air density. The inner product function. Suppose a is an n-vector. We can define a scalarvalued function f of n-vectors, given by f (x) = aT x = a1x1 + a2x2 + + anxn · · · (2.1) for any n-vector x. This function gives the inner product of its n-vector argument x with some (fixed) n-vector a. We can also think of f as forming a weighted sum of the elements of x; the elements of a give the weights used in forming the weighted sum. Superposition and linearity. The inner product function f defined in (2.1) satisfies the property f (αx + βy) = aT (αx + βy) = aT (αx) + aT (βy) = α(aT x) + β(aT y) = αf (x) + βf (y) for all n-vectors x, y, and all scalars α, β. This property is called superposition. A function that satisfies the superposition property is called linear. We have just shown that the inner product with a fixed vector is a linear function. The superposition equality f (αx + βy) = αf (x) + βf (y) (2.2) looks deceptively simple; it is easy to read it as just a re-arrangement of the parentheses and the order of a few terms. But in fact it says a lot. On the left-hand side, the term αx + βy involves scalar-vector multiplication and vector addition. On the right-hand side, αf (x) + βf (y) involves ordinary scalar multiplication and scalar addition. If a function f is linear, superposition extends to linear combinations of any number of vectors, and not just linear combinations of two vectors: We have f (α1x1 + · · · + αkxk) = α1f (x1) + + αkf (xk), · · · for any n vectors x1, . . . , xk, and any scalars α1, . . . , αk. (This more general k-term form of superposition reduces to the two-term form given above when k = 2.) To see this, we note that f (α1x1 + · · · + αkxk) = α1f (x1) + f (α2x2 + · · · + αkxk) = α1f (x1) + α2f (x2) + f (α3x3 + ... = α1f (x1) + + αkf (xk). · · · + αkxk) · · · 2.1 Linear functions 31 In the first line here, we apply (two-term) superposition to the argument · · · and in the other lines we apply this recursively. α1x1 + (1)(α2x2 + + αkxk), The superposition equality (2.2) is sometimes broken down into two properties, one involving the scalar-vector product and one involving vector addition in the argument. A function f : Rn R is linear if it satisfies the following two properties. → Homogeneity. For any n-vector x and any scalar α, f (αx) = αf (x). Additivity. For any n-vectors x and y, f (x + y) = f (x) + f (y). • • Homogeneity states that scaling the (vector) argument is the same as scaling the function value; additivity says that adding (vector) arguments is the same as adding the function values. Inner product representation of a linear function. We saw above that a function defined as the inner product of its argument with some fixed vector is linear. The converse is also true: If a function is linear, then it can be expressed as the inner product of its argument with some fixed vector. Suppose f is a scalar-valued function of n-vectors, and is linear, i.e., (2.2) holds for all n-vectors x, y, and all scalars α, β. Then there is an n-vector a such that f (x) = aT x for all x. We call aT x the inner product representation of f . To see this, we use the identity (1.1) to express an arbitrary n-vector x as x = x1e1 + · · · + xnen. If f is linear, then by multi-term superposition we have f (x) = f (x1e1 + = x1f (e1) + = aT x, · · · · · · + xnen) + xnf (en) with a = (f (e1), f (e2), . . . , f (en)). The formula just derived, f (x) = x1f (e1) + x2f (e2) + + xnf (en) · · · (2.3) which holds for any linear scalar-valued function f , has several interesting implications. Suppose, for example, that the linear function f is given as a subroutine (or a physical system) that computes (or results in the output) f (x) when we give the argument (or input) x. Once we have found f (e1), . . . , f (en), by n calls to the subroutine (or n experiments), we can predict (or simulate) what f (x) will be, for any vector x, using the formula (2.3). The representation of a linear function f as f (x) = aT x is unique, which means that there is only one vector a for which f (x) = aT x holds for all x. To see this, suppose that we have f (x) = aT x for all x, and also f (x) = bT x for all x. Taking x = ei, we have f (ei) = aT ei = ai, using the formula f (x) = aT x. Using the formula f (x) = bT x, we have f (ei) = bT ei = bi. These two numbers must be the same, so we have ai = bi. Repeating this argument for i = 1, . . . , n, we conclude that the corresponding elements in a and b are the same, so a = b. 32 2 Linear functions Examples. • • Average. The mean or average value of an n-vector is defined as f (x) = (x1 + x2 + + xn)/n, · · · and is denoted avg(x) (and sometimes x). The average of a vector is a linear function. It can be expressed as avg(x) = aT x with a = (1/n, . . .
, 1/n) = 1/n. Maximum. The maximum element of an n-vector x, f (x) = max , x1, . . . , xn} { is not a linear function (except when n = 1). We can show this by a coun1, 1), α = 1/2, β = 1/2. terexample for n = 2. Take x = (1, Then 1), y = ( − − f (αx + βy) = 0 = αf (x) + βf (y) = 1. Affine functions. A linear function plus a constant is called an affine function. A function f : Rn R is affine if and only if it can be expressed as f (x) = aT x + b for some n-vector a and scalar b, which is sometimes called the offset. For example, the function on 3-vectors defined by → f (x) = 2.3 2x1 + 1.3x2 − − 1). x3, is affine, with b = 2.3, a = ( 2, 1.3, − − Any affine scalar-valued function satisfies the following variation on the super- position property: f (αx + βy) = αf (x) + βf (y), for all n-vectors x, y, and all scalars α, β that satisfy α+β = 1. For linear functions, superposition holds for any coefficients α and β; for affine functions, it holds when the coefficients sum to one (i.e., when the argument is an affine combination). To see that the restricted superposition property holds for an affine function f (x) = aT x + b, we note that, for any vectors x, y and scalars α and β that satisfy α + β = 1, f (αx + βy) = aT (αx + βy) + b = αaT x + βaT y + (α + β)b = α(aT x + b) + β(aT y + b) = αf (x) + βf (y). (In the second line we use α + β = 1.) This restricted superposition property for affine functions is useful in showing that a function f is not affine: We find vectors x, y, and numbers α and β with α + β = 1, and verify that f (αx + βy) = αf (x) + βf (y). This shows that f cannot be affine. As an example, we verified above that superposition does not hold for the maximum function (with n > 1); the coefficients in our counterexample are α = β = 1/2, which sum to one, which allows us to conclude that the maximum function is not affine. 2.1 Linear functions 33 Figure 2.1 Left. The function f is linear. Right. The function g is affine, but not linear. The converse is also true: Any scalar-valued function that satisfies the restricted superposition property is affine. An analog of the formula (2.3) is f (x) = f (0) + x1 (f (e1) f (0)) + − · · · + xn (f (en) f (0)) , − (2.4) which holds when f is affine, and x is any n-vector. (See exercise 2.7.) This formula shows that for an affine function, once we know the n + 1 numbers f (0), f (e1), . . . , f (en), we can predict (or reconstruct or evaluate) f (x) for any n-vector x. It also shows how the vector a and constant b in the representation f (x) = aT x + b can be found from the function f : ai = f (ei) − In some contexts affine functions are called linear. For example, when x is a scalar, the function f defined as f (x) = αx + β is sometimes referred to as a linear function of x, perhaps because its graph is a line. But when β = 0, f is not a linear function of x, in the standard mathematical sense; it is an affine function of x. In this book we will distinguish between linear and affine functions. Two simple examples are shown in figure 2.1. f (0), and b = f (0). A civil engineering example. Many scalar-valued functions that arise in science and engineering are well approximated by linear or affine functions. As a typical example, consider a steel structure like a bridge, and let w be an n-vector that gives the weight of the load on the bridge in n specific locations, in metric tons. These loads will cause the bridge to deform (move and change shape) slightly. Let s denote the distance that a specific point on the bridge sags, in millimeters, due to the load w. This is shown in figure 2.2. For weights the bridge is designed to handle, the sag is very well approximated as a linear function s = f (x). This function can be expressed as an inner product, s = cT w, for some n-vector c. From + cnwn, we see that c1w1 is the amount of the sag that the equation s = c1w1 + is due to the weight w1, and similarly for the other weights. The coefficients ci, which have units of mm/ton, are called compliances, and give the sensitivity of the sag with respect to loads applied at the n locations. · · · The vector c can be computed by (numerically) solving a partial differential equation, given the detailed design of the bridge and the mechanical properties of xf(x)xg(x) 34 2 Linear functions Figure 2.2 A bridge with weights w1, w2, w3 applied in 3 locations. These weights cause the bridge to sag in the middle, by an amount s. (The sag is exaggerated in this diagram.) w1w2w3s 2.2 Taylor approximation 35 w1 w2 w3 Measured sag Predicted sag .5 1.5 1.1 0.8 0.3 1.2 0.12 0.31 0.26 0.481 0.736 — — — 0.479 0.740 Table 2.1 Loadings on a bridge (first three columns), the associated measured sag at a certain point (fourth column), and the predicted sag using the linear model constructed from the first three experiments (fifth column). the steel used to construct it. This is always done during the design of a bridge. The vector c can also be measured once the bridge is built, using the formula (2.3). We apply the load w = e1, which means that we place a one ton load at the first load position on the bridge, with no load at the other positions. We can then measure the sag, which is c1. We repeat this experiment, moving the one ton load to positions 2, 3, . . . , n, which gives us the coefficients c2, . . . , cn. At this point we have the vector c, so we can now predict what the sag will be with any other loading. To check our measurements (and linearity of the sag function) we might measure the sag under other more complicated loadings, and in each case compare our prediction (i.e., cT w) with the actual measured sag. Table 2.1 shows what the results of these experiments might look like, with each row representing an experiment (i.e., placing the loads and measuring the sag). In the last two rows we compare the measured sag and the predicted sag, using the linear function with coefficients found in the first three experiments. 2.2 Taylor approximation In many applications, scalar-valued functions of n variables, or relations between n variables and a scalar one, can be approximated as linear or affine functions. In these cases we sometimes refer to the linear or affine function relating the variables and the scalar variable as a model, to remind us that the relation is only an approximation, and not exact. Differential calculus gives us an organized way to find an approximate affine R is differentiable, which means that its parC.1). Let z be an n-vector. The (first-order) Taylor model. Suppose that f : Rn tial derivatives exist (see approximation of f near (or at) the point z is the function ˆf (x) of x defined as → § ˆf (x) = f (z) + ∂f ∂x1 (z)(x1 − z1) + + · · · ∂f ∂xn (z)(xn − zn), where ∂f (z) denotes the partial derivative of f with respect to its ith argument, ∂xi evaluated at the n-vector z. The hat appearing over f on the left-hand side is 36 2 Linear functions a common notational hint that it is an approximation of the function f . approximation is named after the mathematician Brook Taylor.) (The The first-order Taylor approximation ˆf (x) is a very good approximation of f (x) when all xi are near the associated zi. Sometimes ˆf is written with a second vector argument, as ˆf (x; z), to show the point z at which the approximation is developed. The first term in the Taylor approximation is a constant; the other terms can be interpreted as the contributions to the (approximate) change in the function value (from f (z)) due to the changes in the components of x (from z). Evidently ˆf is an affine function of x. (It is sometimes called the linear approximation of f near z, even though it is in general affine, and not linear.) It can be written compactly using inner product notation as f (z)T (x ˆf (x) = f (z) + (2.5) z), ∇ − where ∇ f (z) is an n-vector, the gradient of f (at the point z), f (z) = ∇    ∂f ∂x1 (z) ... ∂f ∂xn (z)    . (2.6) − The first term in the Taylor approximation (2.5) is the constant f (z), the value of the function when x = z. The second term is the inner product of the gradient of f at z and the deviation or perturbation of x from z, i.e., x z. We can express the first-order Taylor approximation as a linear function plus a constant, ˆf (x) = but the form (2.5) is perhaps easier to interpret. f (z)T x + (f (z) ∇ − ∇ f (z)T z), The first-order Taylor approximation gives us an organized way to construct an affine approximation of a function f : Rn R, near a given point z, when there is a formula or equation that describes f , and it is differentiable. A simple example, for n = 1, is shown in figure 2.3. Over the full x-axis scale shown, the Taylor approximation ˆf does not give a good approximation of the function f . But for x near z, the Taylor approximation is very good. → Example. Consider the function f : R2 x1), → which is not linear or affine. To find the Taylor approximation ˆf near the point z = (1, 2), we take partial derivatives to obtain R given by f (x) = x1 + exp(x2 − 1 f (z) = ∇ z1) exp(z2 − z1) − exp(z2 − , which evaluates to ( z = (1, 2) is then − 1.7183, 2.7183) at z = (1, 2). The Taylor approximation at ˆf (x) = 3.7183 + ( 1.7183, 2.7183)T (x = 3.7183 − 1.7183(x1 − − (1, 2)) − 1) + 2.7183(x2 − ˆf (x) | 2). Table 2.2 shows f (x) and ˆf (x), and the approximation error , for some | values of x relatively near z. We can see that ˆf is indeed a very good approximation of f , especially when x is near z. f (x) − 2.2 Taylor approximation 37 Figure 2.3 A function f of one variable, and the first-order Taylor approximation ˆf (x) = f (z) + f (z)(x z) at z. − x (1.00, 2.00) (0.96, 1.98) (1.10, 2.11) (0.85, 2.05) (1.25, 2.41) f (x) 3.7183 3.7332 3.8456 4.1701 4.4399 | ˆf (x) 3.7183 3.7326 3.8455 4.1119 4.4032 ˆf (x) f (x) | − 0.0000 0.0005 0.0001 0.0582 0.0367 Table 2.2 Some values of x (first column), the function value f (x) (second column), the Taylor approximation ˆf (x) (third column), and the error (fourth column). zˆf(x)f(x) 38 2 Linear functions 2.3 Regression model In this section we describe a very commonly used affine function, especially when
the n-vector x represents a feature vector. The affine function of x given by ˆy = xT β + v, (2.7) where β is an n-vector and v is a scalar, is called a regression model. In this context, the entries of x are called the regressors, and ˆy is called the prediction, since the regression model is typically an approximation or prediction of some true value y, which is called the dependent variable, outcome, or label. The vector β is called the weight vector or coefficient vector, and the scalar v is called the offset or intercept in the regression model. Together, β and v are called the parameters in the regression model. (We will see in chapter 13 how the parameters in a regression model can be estimated or guessed, based on some past or known observations of the feature vector x and the associated outcome y.) The symbol ˆy is used in the regression model to emphasize that it is an estimate or prediction of some outcome y. The entries in the weight vector have a simple interpretation: βi is the amount by which ˆy increases (if βi > 0) when feature i increases by one (with all other features the same). If βi is small, the prediction ˆy doesn’t depend too strongly on feature i. The offset v is the value of ˆy when all features have the value 0. The regression model is very interpretable when all of the features are Boolean, i.e., have values that are either 0 or 1, which occurs when the features represent which of two outcomes holds. As a simple example consider a regression model for the lifespan of a person in some group, with x1 = 0 if the person is female (x1 = 1 if male), x2 = 1 if the person has type II diabetes, and x3 = 1 if the person smokes cigarettes. In this case, v is the regression model estimate for the lifespan of a female nondiabetic nonsmoker; β1 is the increase in estimated lifespan if the person is male, β2 is the increase in estimated lifespan if the person is diabetic, and β3 is the increase in estimated lifespan if the person smokes cigarettes. (In a model that fits real data, all three of these coefficients would be negative, meaning that they decrease the regression model estimate of lifespan.) Simplified regression model notation. Vector stacking can be used to lump the weights and offset in the regression model (2.7) into a single parameter vector, which simplifies the regression model notation a bit. We create a new regressor vector ˜x, with n + 1 entries, as ˜x = (1, x). We can think of ˜x as a new feature vector, consisting of all n original features, and one new feature added (˜x1) at the beginning, which always has the value one. We define the parameter vector ˜β = (v, β), so the regression model (2.7) has the simple inner product form ˆy = xT xT ˜β. (2.8) Often we omit the tildes, and simply write this as ˆy = xT β, where we assume that the first feature in x is the constant 1. A feature that always has the value 1 is not particularly informative or interesting, but it does simplify the notation in a regression model. 2.3 Regression model 39 House x1 (area) x2 (beds) y (price) ˆy (prediction) 1 2 3 4 5 0.846 1.324 1.150 3.037 3.984 1 2 3 4 5 115.00 234.50 198.00 528.00 572.50 161.37 213.61 168.88 430.67 552.66 Table 2.3 Five houses with associated feature vectors shown in the second and third columns. The fourth and fifth column give the actual price, and the price predicted by the regression model. House price regression model. As a simple example of a regression model, suppose that y is the selling price of a house in some neighborhood, over some time period, and the 2-vector x contains attributes of the house: x1 is the house area (in 1000 square feet), x2 is the number of bedrooms. • • If y represents the selling price of the house, in thousands of dollars, the regression model ˆy = xT β + v = β1x1 + β2x2 + v predicts the price in terms of the attributes or features. This regression model is not meant to describe an exact relationship between the house attributes and its selling price; it is a model or approximation. Indeed, we would expect such a model to give, at best, only a crude approximation of selling price. As a specific numerical example, consider the regression model parameters β = (148.73, 18.85), − v = 54.40. (2.9) These parameter values were found using the methods we will see in chapter 13, based on records of sales for 774 houses in the Sacramento area. Table 2.3 shows the feature vectors x for five houses that sold during the period, the actual sale price y, and the predicted price ˆy from the regression model above. Figure 2.4 shows the predicted and actual sale prices for 774 houses, including the five houses in the table, on a scatter plot, with actual price on the horizontal axis and predicted price on the vertical axis. We can see that this particular regression model gives reasonable, but not very accurate, predictions of the actual sale price. (Regression models for house prices that are used in practice use many more than two regressors, and are much more accurate.) The model parameters in (2.9) are readily interpreted. The parameter β1 = 148.73 is the amount the regression model price prediction increases (in thousands of dollars) when the house area increases by 1000 square feet (with the same number 18.85 is the price prediction increase with of bedrooms). The parameter β2 = the addition of one bedroom, with the total house area held constant, in units of − 40 2 Linear functions Figure 2.4 Scatter plot of actual and predicted sale prices for 774 houses sold in Sacramento during a five-day period. 02004006008000200400600800House1House2House3House4House5Actualpricey(thousanddollars)Predictedpriceˆy(thousanddollars) 2.3 Regression model 41 thousands of dollars per bedroom. It might seem strange that β2 is negative, since one imagines that adding a bedroom to a house would increase its sale price, not decrease it. To understand why β2 might be negative, we note that it gives the change in predicted price when we add a bedroom, without adding any additional area to the house. If we remodel a house by adding a bedroom that also adds more than around 127 square feet to the house area, the regression model (2.9) does predict an increase in house sale price. The offset v = 54.40 is the predicted price for a house with no area and no bedrooms, which we might interpret as the model’s prediction of the value of the lot. But this regression model is crude enough that these interpretations are dubious. 42 2 Linear functions Exercises 2.1 Linear or not? Determine whether each of the following scalar-valued functions of nvectors is linear. If it is a linear function, give its inner product representation, i.e., an n-vector a for which f (x) = aT x for all x. If it is not linear, give specific x, y, α, and β for which superposition fails, i.e., f (αx + βy) = αf (x) + βf (y). (a) The spread of values of the vector, defined as f (x) = maxk xk mink xk. (b) The difference of the last element and the first, f (x) = xn − x1. − (c) The median of an n-vector, where we will assume n = 2k + 1 is odd. The median of the vector x is defined as the (k + 1)st largest number among the entries of x. For example, the median of ( 7.1, 3.2, 1.5) is 1.5. − − − (d) The average of the entries with odd indices, minus the average of the entries with even indices. You can assume that n = 2k is even. (e) Vector extrapolation, defined as xn + (xn 2. (This is a simple prediction of what xn+1 would be, based on a straight line drawn through xn and xn 1), for n xn ≥ − − 1.) − 2.2 Processor powers and temperature. The temperature T of an electronic device containing three processors is an affine function of the power dissipated by the three processors, P = (P1, P2, P3). When all three processors are idling, we have P = (10, 10, 10), which results in a temperature T = 30. When the first processor operates at full power and the other two are idling, we have P = (100, 10, 10), and the temperature rises to T = 60. When the second processor operates at full power and the other two are idling, we have P = (10, 100, 10) and T = 70. When the third processor operates at full power and the other two are idling, we have P = (10, 10, 100) and T = 65. Now suppose that all three processors are operated at the same power P same. How large can P same be, if we require 85? Hint. From the given data, find the 3-vector a and number b for which that T T = aT P + b. ≤ 2.3 Motion of a mass in response to applied force. A unit mass moves on a straight line (in one dimension). The position of the mass at time t (in seconds) is denoted by s(t), and its derivatives (the velocity and acceleration) by s(t) and s(t). The position as a function of time can be determined from Newton’s second law s(t) = F (t), where F (t) is the force applied at time t, and the initial conditions s(0), s(0). We assume F (t) is piecewise-constant, and is kept constant in intervals of one second. The sequence of forces F (t), for 0 t < 10, can then be represented by a 10-vector f , with ≤ F (t) = fk, k 1 − ≤ t < k. Derive expressions for the final velocity s(10) and final position s(10). Show that s(10) and s(10) are affine functions of x, and give 10-vectors a, c and constants b, d for which s(10) = aT f + b, s(10) = cT f + d. This means that the mapping from the applied force sequence to the final position and velocity is affine. Hint. You can use t t s(t) = s(0) + F (τ ) dτ, s(t) = s(0) + s(τ ) dτ. 0 0 You will find that the mass velocity s(t) is piecewise-linear. Exercises 43 2.4 Linear function? The function φ : R3 R satisfies → φ(1, 1, 0) = 1, − 1, 1, 1) = 1, φ( − φ(1, 1, − 1) = 1. − Choose one of the following, and justify your choice: φ must be linear; φ could be linear; φ cannot be linear. 2.5 Affine function. Suppose ψ : R2 → (a) What can you say about ψ(1, it cannot be determined. R is an affine function, with ψ(1, 0) = 1, ψ(1, 2) = 2. 1)? Either give the value of ψ(1, − − − 1), or state that (b) What can you say about ψ(2, it cannot be determined. 2)? Either give the value of ψ(
2, − 2), or state that − Justify your answers. 2.6 Questionnaire scoring. A questionnaire in a magazine has 30 questions, broken into two sets of 15 questions. Someone taking the questionnaire answers each question with ‘Rarely’, ‘Sometimes’, or ‘Often’. The answers are recorded as a 30-vector a, with ai = 1, 2, 3 if question i is answered Rarely, Sometimes, or Often, respectively. The total score on a completed questionnaire is found by adding up 1 point for every question answered Sometimes and 2 points for every question answered Often on questions 1–15, and by adding 2 points and 4 points for those responses on questions 16–30. (Nothing is added to the score for Rarely responses.) Express the total score s in the form of an affine function s = wT a + v, where w is a 30-vector and v is a scalar (number). f : Rn 2.7 General formula for affine functions. Verify that formula (2.4) holds for any affine function R. You can use the fact that f (x) = aT x + b for some n-vector a and scalar b. 2.8 Integral and derivative of polynomial. Suppose the n-vector c gives the coefficients of a 1. polynomial p(x) = c1 + c2x + + cnxn → − · · · (a) Let α and β be numbers with α < β. Find an n-vector a for which aT c = β α p(x) dx always holds. This means that the integral of a polynomial over an interval is a linear function of its coefficients. (b) Let α be a number. Find an n-vector b for which bT c = p(α). This means that the derivative of the polynomial at a given point is a linear function of its coefficients. 2.9 Taylor approximation. Consider the function f : R2 R given by f (x1, x2) = x1x2. Find the Taylor approximation ˆf at the point z = (1, 1). Compare f (x) and ˆf (x) for the following values of x: → x = (1, 1), x = (1.05, 0.95), x = (0.85, 1.25), x = ( 1, 2). − Make a brief comment about the accuracy of the Taylor approximation in each case. 2.10 Regression model. Consider the regression model ˆy = xT β + v, where ˆy is the predicted response, x is an 8-vector of features, β is an 8-vector of coefficients, and v is the offset term. Determine whether each of the following statements is true or false. (a) If β3 > 0 and x3 > 0, then ˆy (b) If β2 = 0 then the prediction ˆy does not depend on the second feature x2. (c) If β6 = 0.8, then increasing x6 (keeping all other xis the same) will decrease ˆy. ≥ 0. − 44 2 Linear functions 2.11 Sparse regression weight vector. Suppose that x is an n-vector that gives n features for some object, and the scalar y is some outcome associated with the object. What does it mean if a regression model ˆy = xT β + v uses a sparse weight vector β? Give your answer in English, referring to ˆy as our prediction of the outcome. 2.12 Price change to maximize profit. A business sells n products, and is considering changing the price of one of the products to increase its total profits. A business analyst develops a regression model that (reasonably accurately) predicts the total profit when the product prices are changed, given by ˆP = βT x + P , where the n-vector x denotes the fractional change in the product prices, xi = (pnew pi)/pi. Here P is the profit with the current prices, ˆP is the predicted profit with the changed prices, pi is the current (positive) price of product i, and pnew is the new price of product i. i − i (a) What does it mean if β3 < 0? (And yes, this can occur.) (b) Suppose that you are given permission to change the price of one product, by up to 1%, to increase total profit. Which product would you choose, and would you increase or decrease the price? By how much? (c) Repeat part (b) assuming you are allowed to change the price of two products, each by up to 1%. Chapter 3 Norm and distance In this chapter we focus on the norm of a vector, a measure of its magnitude, and on related concepts like distance, angle, standard deviation, and correlation. 3.1 Norm The Euclidean norm of an n-vector x (named after the Greek mathematician Euclid), denoted , is the squareroot of the sum of the squares of its elements, x = x 1 + x2 x2 2 + + x2 n. · · · x The Euclidean norm can also be expressed as the squareroot of the inner product of the vector with itself, i.e., = √xT x. The Euclidean norm is sometimes written with a subscript 2, as 2. (The subscript 2 indicates that the entries of x are raised to the second power.) Other less widely used terms for the Euclidean norm of a vector are the magnitude, or length, of a vector. (The term length should be avoided, since it is also often used to refer to the dimension of the vector.) We use the same notation for the norms of vectors of different dimensions. As simple examples, we have 9 = 3, 0 1 − = 1. When x is a scalar, i.e., a 1-vector, the Euclidean norm is the same as the absolute value of x. Indeed, the Euclidean norm can be considered a generalization or extension of the absolute value or magnitude, that applies to vectors. The double bar notation is meant to suggest this. Like the absolute value of a number, the norm of a vector is a (numerical) measure of its magnitude. We say a vector is small if its norm is a small number, and we say it is large if its norm is a large number. (The numerical values of the norm that qualify for small or large depend on the particular application and context.) 46 3 Norm and distance Properties of norm. Some important properties of the Euclidean norm are given below. Here x and y are vectors of the same size, and β is a scalar. Nonnegative homogeneity. multiplies the norm by the absolute value of the scalar. . Multiplying a vector by a scalar βx β | = | x Triangle inequality. . The Euclidean norm of a sum of two y vectors is no more than the sum of their norms. (The name of this property will be explained later.) Another name for this inequality is subadditivity. ≤ x+y + x Nonnegativity. Definiteness. x 0. ≥ = 0 only if x = 0. x • • • • The last two properties together, which state that the norm is always nonnegative, and zero only when the vector is zero, are called positive definiteness. The first, third, and fourth properties are easy to show directly from the definition of the norm. As an example, let’s verify the definiteness property. = 0, then x 2 = 0, which means that x2 n = 0. This is a sum of n we also have nonnegative numbers, which is zero. We can conclude that each of the n numbers is zero, since if any of them were nonzero the sum would be positive. So we conclude that x2 i = 0 for i = 1, . . . , n, and therefore xi = 0 for i = 1, . . . , n; and thus, x = 0. Establishing the second property, the triangle inequality, is not as easy; we will give a derivation on page 57. + x2 x 1 + · · · If General norms. Any real-valued function of an n-vector that satisfies the four properties listed above is called a (general) norm. But in this book we will only use the Euclidean norm, so from now on, we refer to the Euclidean norm as the norm. (See exercise 3.5, which describes some other useful norms.) Root-mean-square value. The norm is related to the root-mean-square (RMS) value of an n-vector x, defined as x2 1 + rms(x) = + x2 n = x √n . · · · n The argument of the squareroot in the middle expression is called the mean square value of x, denoted ms(x), and the RMS value is the squareroot of the mean square value. The RMS value of a vector x is useful when comparing norms of vectors with different dimensions; the RMS value tells us what a ‘typical’ value of is. For example, the norm of 1, the n-vector of all ones, is √n, but its RMS value is 1, independent of n. More generally, if all the entries of a vector are the same, say, α α, then the RMS value of the vector is | xi| | | . Norm of a sum. A useful formula for the norm of the sum of two vectors x and y is x + y = x 2 + 2xT y + y 2. (3.1) 3.1 Norm 47 To derive this formula, we start with the square of the norm of x+y and use various properties of the inner product: x + y 2 = (x + y)T (x + y) = xT x + xT y + yT x + yT y 2 + 2xT y + = 2. y x Taking the squareroot of both sides yields the formula (3.1) above. In the first line, we use the definition of the norm. In the second line, we expand the inner product. In the fourth line we use the definition of the norm, and the fact that xT y = yT x. Some other identities relating norms, sums, and inner products of vectors are explored in exercise 3.4. Norm of block vectors. The norm-squared of a stacked vector is the sum of the norm-squared values of its subvectors. For example, with d = (a, b, c) (where a, b, and c are vectors), we have d 2 = dT d = aT a + bT b + cT . This idea is often used in reverse, to express the sum of the norm-squared values of some vectors as the norm-square value of a block vector formed from them. We can write the equality above in terms of norms as (a, b, c . ) In words: The norm of a stacked vector is the norm of the vector formed from the norms of the subvectors. The right-hand side of the equation above should be carefully read. The outer norm symbols enclose a 3-vector, with (scalar) entries , a b , and c . Chebyshev inequality. Suppose that x is an n-vector, and that k of its entries a2. It follows that satisfy a, where a > 0. Then k of its entries satisfy x2 xi| ≥ | i ≥ 2 = x2 1 + x + x2 n ≥ · · · ka2, since k of the numbers in the sum are at least a2, and the other n nonnegative. We can conclude that k inequality, after the mathematician Pafnuty Chebyshev. When inequality tells us nothing, since we always have k the number of entries in a vector that can be large. For a > k no entry of a vector can be larger in magnitude than the norm of the vector. k numbers are 2/a2, which is called the Chebyshev 2/a2 n, the n. In other cases it limits , the inequality is 2/a2 < 1, so we conclude that k = 0 (since k is an integer). In other words The Chebyshev inequality is easier to interpret in terms of the RMS value of a vector. We can write it as k n ≤ rms(x) a 2 , (3.2) where k is, as above, the number of entries of x with absolute value at least a. The left-hand side is the fraction of entries of the vect
or that are at least a in absolute 48 3 Norm and distance Figure 3.1 The norm of the displacement b points with coordinates a and b. − a is the distance between the value. The right-hand side is the inverse square of the ratio of a to rms(x). It says, for example, that no more than 1/25 = 4% of the entries of a vector can exceed its RMS value by more than a factor of 5. The Chebyshev inequality partially justifies the idea that the RMS value of a vector gives an idea of the size of a typical entry: It states that not too many of the entries of a vector can be much bigger (in absolute value) than its RMS value. (A converse statement can also be made: At least one entry of a vector has absolute value as large as the RMS value of the vector; see exercise 3.8.) 3.2 Distance Euclidean distance. We can use the norm to define the Euclidean distance between two vectors a and b as the norm of their difference: dist(a, b) = a − b . For one, two, and three dimensions, this distance is exactly the usual distance between points with coordinates a and b, as illustrated in figure 3.1. But the Euclidean distance is defined for vectors of any dimension; we can refer to the distance between two vectors of dimension 100. Since we only use the Euclidean norm in this book, we will refer to the Euclidean distance between vectors as, simply, the distance between the vectors. If a and b are n-vectors, we refer to the /√n, as the RMS deviation between the two RMS value of the difference, vectors. a b − When the distance between two n-vectors x and y is small, we say they are is large, we say they are ‘far’. x that correspond to ‘close’ or ‘far’ depend ‘close’ or ‘nearby’, and when the distance The particular numerical values of on the particular application. x − − y y ab 3.2 Distance 49 Figure 3.2 Triangle inequality. As an example, consider the 4-vectors u =     1.8 2.0 3.7 4..6 2.1 1.9 1.4 − w =     2.0 1.9 4.0 4.6 −     . The distances between pairs of them are u − v = 8.368, u − w = 0.387, v w − = 8.533, so we can say that u is much nearer (or closer) to w than it is to v. We can also say that w is much nearer to u than it is to v. Triangle inequality. We can now explain where the triangle inequality gets its name. Consider a triangle in two or three dimensions, whose vertices have coordinates a, b, and c. The lengths of the sides are the distances between the vertices, dist(a, b) = a − , b dist(b, c) = b c , − dist(a, c) = a − . c Geometric intuition tells us that the length of any side of a triangle cannot exceed the sum of the lengths of the other two sides. For example, we have 3.3) This follows from the triangle inequality, since a − c = (a − b) + (b c) − a ≤ b − + b c . − This is illustrated in figure 3.2. ka−bkkb−ckka−ckabc 50 3 Norm and distance Figure 3.3 A point x, shown as a square, and six other points z1, . . . , z6. The point z3 is the nearest neighbor of x among the points z1, . . . , z6. Examples. • • y − x Feature distance. If x and y represent vectors of n features of two objects, is called the feature distance, and gives a measure of the quantity how different the objects are (in terms of their feature values). Suppose for example the feature vectors are associated with patients in a hospital, with entries such as weight, age, presence of chest pain, difficulty breathing, and the results of tests. We can use feature vector distance to say that one patient case is near another one (at least in terms of their feature vectors). RMS prediction error. Suppose that the n-vector y represents a time series of some quantity, for example, hourly temperature at some location, and ˆy is another n-vector that represents an estimate or prediction of the time series y, ˆy is called the prediction error, based on other information. The difference y ˆy) is called the RMS prediction error. If this value and its RMS value rms(y is small (say, compared to rms(y)) the prediction is good. − − • Nearest neighbor. Suppose z1, . . . , zm is a collection of m n-vectors, and that x is another n-vector. We say that zj is the nearest neighbor of x (among z1, . . . , zm) if x , zi In words: zj is the closest vector to x among the vectors z1, . . . , zm. This is illustrated in figure 3.3. The idea of nearest neighbor, and generalizations such as the k-nearest neighbors, are used in many applications. x zj ≤ i = 1, . . . , m. − − • Document dissimilarity. Suppose n-vectors x and y represent the histograms represents a measure of word occurrences for two documents. Then of the dissimilarity of the two documents. We might expect the dissimilarity − x y z1z2z3z4z5z6x 3.2 Distance 51 Veterans Memorial Academy Golden Globe Super Bowl Veterans Day Memorial Day Academy A. Golden Globe A. Super Bowl Day 0 0.095 0.130 0.153 0.170 Day 0.095 0 0.122 0.147 0.164 Awards Awards 0.130 0.122 0 0.108 0.164 0.153 0.147 0.108 0 0.181 0.170 0.164 0.164 0.181 0 Table 3.1 Pairwise word count histogram distances between five Wikipedia articles. to be smaller when the two documents have the same genre, topic, or author; we would expect it to be larger when they are on different topics, or have different authors. As an example we form the word count histograms for the 5 Wikipedia articles with titles ‘Veterans Day’, ‘Memorial Day’, ‘Academy Awards’, ‘Golden Globe Awards’, and ‘Super Bowl’, using a dictionary of 4423 words. (More detail is given in 4.4.) The pairwise distances between § the word count histograms are shown in table 3.1. We can see that pairs of related articles have smaller word count histogram distances than less related pairs of articles. Units for heterogeneous vector entries. The square of the distance between two n-vectors x and y is given by x − y 2 = (x1 − y1)2 + + (xn − · · · yn)2, the sum of the squares of the differences between their respective entries. Roughly speaking, the entries in the vectors all have equal status in determining the distance between them. For example, if x2 and y2 differ by one, the contribution to the square of the distance between them is the same as the contribution when x3 and y3 differ by one. This makes sense when the entries of the vectors x and y represent the same type of quantity, using the same units (say, at different times or locations), for example meters or dollars. For example if x and y are word count histograms, their entries are all word occurrence frequencies, and it makes sense to say they are close when their distance is small. When the entries of a vector represent different types of quantities, for example when the vector entries represent different types of features associated with an object, we must be careful about choosing the units used to represent the numerical values of the entries. If we want the different entries to have approximately equal status in determining distance, their numerical values should be approximately of the same magnitude. For this reason units for different entries in vectors are often chosen in such a way that their typical numerical values are similar in magnitude, so that the different entries play similar roles in determining distance. As an example suppose that the 2-vectors x, y, and z are the feature vectors for three houses that were sold, as in the example described on page 39. The first entry of each vector gives the house area and the second entry gives the number of 52 3 Norm and distance bedrooms. These are very different types of features, since the first one is a physical area, and the second one is a count, i.e., an integer. In the example on page 39, we chose the unit used to represent the first feature, area, to be thousands of square feet. With this choice of unit used to represent house area, the numerical values of both of these features range from around 1 to 5; their values have roughly the same magnitude. When we determine the distance between feature vectors associated with two houses, the difference in the area (in thousands of square feet), and the difference in the number of bedrooms, play equal roles. For example, consider three houses with feature vectors x = (1.6, 2), y = (1.5, 2), z = (1.6, 4). The first two are ‘close’ or ‘similar’ since = 0.1 is small (compared to the norms of x and y, which are around 2.5). This matches our intuition that the first two houses are similar, since they both have two bedrooms and are close in area. The third house would be considered ‘far’ or ‘different’ from the first two houses, and rightly so since it has four bedrooms instead of two. − x y To appreciate the significance of our choice of units in this example, suppose we had chosen instead to represent house area directly in square feet, and not thousands of square feet. The three houses above would then be represented by feature vectors ˜x = (1600, 2), ˜y = (1500, 2), ˜z = (1600, 4). The distance between the first and third houses is now 2, which is very small compared to the norms of the vectors (which are around 1600). The distance between the first and second houses is much larger. It seems strange to consider a two-bedroom house and a four-bedroom house as ‘very close’, while two houses with the same number of bedrooms and similar areas are much more dissimilar. The reason is simple: With our choice of square feet as the unit to measure house area, distances are very strongly influenced by differences in area, with number of bedrooms playing a much smaller (relative) role. 3.3 Standard deviation − avg(x)1 is called the associated de-meaned For any vector x, the vector ˜x = x vector, obtained by subtracting from each entry of x the mean value of the entries. (This is not standard notation; i.e., ˜x is not generally used to denote the de-meaned vector.) The mean value of the entries of ˜x is zero, i.e., avg(˜x) = 0. This explains why ˜x is called the de-meaned version of x; it is x with its mean removed. The de-meaned vector is useful for understanding how the entries of a vector deviate from their mean value. It is zero if all the entries in the original vector x are the sa
me. The standard deviation of an n-vector x is defined as the RMS value of the de-meaned vector x − avg(x)1, i.e., std(x) = (x1 − avg(x))2 + + (xn − avg(x))2 . · · · n 3.3 Standard deviation 53 This is the same as the RMS deviation between a vector x and the vector all of whose entries are avg(x). It can be written using the inner product and norm as std(x) = x − (1T x/n)1 √n . (3.4) The standard deviation of a vector x tells us the typical amount by which its entries deviate from their average value. The standard deviation of a vector is zero only when all its entries are equal. The standard deviation of a vector is small when the entries of the vector are nearly the same. As a simple example consider the vector x = (1, 2, 3, 2). Its mean or average value is avg(x) = 1, so the de-meaned vector is ˜x = (0, Its standard deviation is std(x) = 1.872. We interpret this number as a ‘typical’ value by which the entries differ from the mean of the entries. These numbers are 0, 3, 2, and 1, so 1.872 is reasonable. 3, 2, 1). − − We should warn the reader that another slightly different definition of the standard deviation of a vector is widely used, in which the denominator √n in (3.4) is replaced with √n 2). In this book we will only use the definition (3.4). In some applications the Greek letter σ (sigma) is traditionally used to denote standard deviation, while the mean is denoted µ (mu). In this notation we have, for an n-vector x, 1 (for n − ≥ µ = 1T x/n, σ = x − µ1 /√n. We will use the symbols avg(x) and std(x), switching to µ and σ only with explanation, when describing an application that traditionally uses these symbols. Average, RMS value, and standard deviation. The average, RMS value, and standard deviation of a vector are related by the formula rms(x)2 = avg(x)2 + std(x)2. (3.5) This formula makes sense: rms(x)2 is the mean square value of the entries of x, which can be expressed as the square of the mean value, plus the mean square fluctuation of the entries of x around their mean value. We can derive this formula from our vector notation formula for std(x) given above. We have std(x)2 = (1/n) x (1T x/n)1 2 − = (1/n)(xT x = (1/n)(xT x = (1/n)xT x = rms(x)2 − − 2xT (1T x/n)1 + ((1T x/n)1)T ((1T x/n)1)) (2/n)(1T x)2 + n(1T x/n)2) (1T x/n)2 − avg(x)2, − which can be re-arranged to obtain the identity (3.5) above. This derivation uses many of the properties for norms and inner products, and should be read carefully to understand every step. In the second line, we expand the norm-square of the sum of two vectors. In the third line, we use the commutative property of scalarvector multiplication, moving scalars such as (1T x/n) to the front of each term, and also the fact that 1T 1 = n. 54 3 Norm and distance Examples. • • Mean return and risk. Suppose that an n-vector represents a time series of return on an investment, expressed as a percentage, in n time periods over Its average gives the mean return over the whole some interval of time. interval, often shortened to its return. Its standard deviation is a measure of how variable the return is, from period to period, over the time interval, i.e., how much it typically varies from its mean, and is often called the (per period) risk of the investment. Multiple investments can be compared by plotting them on a risk-return plot, which gives the mean and standard deviation of the returns of each of the investments over some interval. A desirable return history vector has high mean return and low risk; this means that the returns in the different periods are consistently high. Figure 3.4 shows an example. Temperature or rainfall. Suppose that an n-vector is a time series of the daily average temperature at a particular location, over a one year period. Its average gives the average temperature at that location (over the year) and its standard deviation is a measure of how much the temperature varied from its average value. We would expect the average temperature to be high and the standard deviation to be low in a tropical location, and the opposite for a location with high latitude. (std(x)/a)2. Chebyshev inequality for standard deviation. The Chebyshev inequality (3.2) can be transcribed to an inequality expressed in terms of the mean and standard a, then deviation: If k is the number of entries of x that satisfy k/n (This inequality is only interesting for a > std(x).) For example, at most 1/9 = 11.1% of the entries of a vector can deviate from the mean value avg(x) by 3 standard deviations or more. Another way to state this is: The 1/α2 fraction of entries of x within α standard deviations of avg(x) is at least 1 (for α > 1). xi − avg(x) | ≥ − ≤ | As an example, consider a time series of return on an investment, with a mean return of 8%, and a risk (standard deviation) 3%. By the Chebyshev inequality, 0) is no more than (3/8)2 = 14.1%. the fraction of periods with a loss (i.e., xi ≤ (In fact, the fraction of periods when the return is either a loss, xi ≤ 0, or very good, xi ≥ 16%, is together no more than 14.1%.) Properties of standard deviation. • • Adding a constant. For any vector x and any number a, we have std(x+a1) = std(x). Adding a constant to every entry of a vector does not change its standard deviation. Multiplying by a scalar. For any vector x and any number a, we have std(ax) = std(x). Multiplying a vector by a scalar multiplies the standard deviation by the absolute value of the scalar. a | | 3.3 Standard deviation 55 Figure 3.4 The vectors a, b, c, d represent time series of returns on investments over 10 periods. The bottom plot shows the investments in a risk-return plane, with return defined as the average value and risk as the standard deviation of the corresponding vector. 510−50510kak510−50510kbk510−50510kck510−50510kdk0240123abcdriskreturn 56 3 Norm and distance Figure 3.5 A 10-vector x, the de-meaned vector ˜x = x avg(x)1, and the standardized vector z = (1/ std(x))˜x. The horizontal dashed lines indicate the mean and the standard deviation of each vector. The middle line is the mean; the distance between the middle line and the other two is the standard deviation. − Standardization. For any vector x, we refer to ˜x = x avg(x)1 as the de-meaned version of x, since it has average or mean value zero. If we then divide by the RMS value of ˜x (which is the standard deviation of x), we obtain the vector − z = 1 std(x) (x − avg(x)1). This vector is called the standardized version of x. It has mean zero, and standard Its entries are sometimes called the z-scores associated with the deviation one. original entries of x. For example, z4 = 1.4 means that x4 is 1.4 standard deviations above the mean of the entries of x. Figure 3.5 shows an example. The standardized values for a vector give a simple way to interpret the original values in the vectors. For example, if an n-vector x gives the values of some medical test of n patients admitted to a hospital, the standardized values or zscores tell us how high or low, compared to the population, that patient’s value is. A value z6 = 3.2, for example, means that patient 6 has a very low value of the measurement; whereas z22 = 0.3 says that patient 22’s value is quite close to the average value. − 3.4 Angle Cauchy–Schwarz inequality. An important inequality that relates norms and inner products is the Cauchy–Schwarz inequality: aT b | a b | ≤ for any n-vectors a and b. Written out in terms of the entries, this is a1b1 + | · · · + anbn| ≤ a2 1 + · · · + a2 n 1/2 b2 1 + · · · + b2 n 1/2 , 246810−404kxk246810−404k˜xk246810−404kzk 3.4 Angle 57 which looks more intimidating. This inequality is attributed to the mathematician Augustin-Louis Cauchy; Hermann Schwarz gave the derivation given below. The Cauchy–Schwarz inequality can be shown as follows. The inequality clearly holds if a = 0 or b = 0 (in this case, both sides of the inequality are zero). So we suppose now that a = 0, and define α = = 0, b , β = a b . We observe that 2 2 2 0 βa − 2 − 2 2 2 2 a b a αb 2(βa)T (αb) + αb 2βα(aT b) + α2 b (aT b) + a (aT b). b ≤ − 2 = βa = β2 yields aT b a and b a Dividing by 2 aT b . Putting these two inequalities together we get the b we obtain b a − aT b Cauchy–Schwarz inequality, | . b This argument also reveals the conditions on a and b under which they satisfy = 0, the Cauchy–Schwarz inequality with equality. This occurs only if i.e., βa = αb. This means that each vector is a scalar multiple of the other (in the case when they are nonzero). This statement remains true when either a or b is zero. So the Cauchy–Schwarz inequality holds with equality when one of the vectors is a multiple of the other; in all other cases, it holds with strict inequality. . Applying this inequality to ≤ b αb | ≤ ≤ 2 b βa − − − a a Verification of triangle inequality. We can use the Cauchy–Schwarz inequality to verify the triangle inequality. Let a and b be any vectors. Then a + b 2 = ≤ = ( 2 + 2aT 2 , a b + 2 where we used the Cauchy–Schwarz inequality in the second line. Taking the squareroot we get the triangle inequality, + a + b ≤ a . b Angle between vectors. The angle between two nonzero vectors a, b is defined as θ = arccos aT b b a where arccos denotes the inverse cosine, normalized to lie in the interval [0, π]. In other words, we define θ as the unique number between 0 and π that satisfies aT b = a cos θ. b The angle between a and b is written as (a, b), and is sometimes expressed in (The default angle unit is radians; 360◦ is 2π radians.) For example, degrees. (a, b) = 60◦ means (a, b) = π/3, i.e., aT b = (1/2) The angle coincides with the usual notion of angle between vectors, when they have dimension two or three, and they are thought of as displacements from a b a . 58 3 Norm and distance common point. For example, the angle between the vectors a = (1, 2, b = (2, 0, 3) is − 1) and − arccos 5 √6 √13 = arccos(0.5661) = 0.9690 = 55.52◦ (to 4 digits). But the definition of angle is more general; we can refer to the angle between two vectors wi
th dimension 100. The angle is a symmetric function of a and b: We have (a, b) = (b, a). The angle is not affected by scaling each of the vectors by a positive scalar: We have, for any vectors a and b, and any positive numbers α and β, (αa, βb) = (a, b). Acute and obtuse angles. Angles are classified according to the sign of aT b. Suppose a and b are nonzero vectors of the same size. If the angle is π/2 = 90◦, i.e., aT b = 0, the vectors are said to be orthogonal. We write a b if a and b are orthogonal. (By convention, we also say that a zero vector is orthogonal to any vector.) ⊥ If the angle is zero, which means aT b = a vector is a positive multiple of the other. b , the vectors are aligned. Each If the angle is π = 180◦, which means aT b = aligned. Each vector is a negative multiple of the other. b − a , the vectors are anti- If (a, b) < π/2 = 90◦, the vectors are said to make an acute angle. This is the same as aT b > 0, i.e., the vectors have positive inner product. If (a, b) > π/2 = 90◦, the vectors are said to make an obtuse angle. This is the same as aT b < 0, i.e., the vectors have negative inner product. • • • • • These definitions are illustrated in figure 3.6. Examples. • • Spherical distance. Suppose a and b are 3-vectors that represent two points that lie on a sphere of radius R (for example, locations on earth). The spherical distance between them, measured along the sphere, is given by R (a, b). This is illustrated in figure 3.7. Document similarity via angles. If n-vectors x and y represent the word counts for two documents, their angle (x, y) can be used as a measure of document dissimilarity. (When using angle to measure document dissimilarity, either word counts or histograms can be used; they produce the same result.) As an example, table 3.2 gives the angles in degrees between the word histograms in the example at the end of 3.2. § 3.4 Angle 59 Figure 3.6 Top row. Examples of orthogonal, aligned, and anti-aligned vectors. Bottom row. Vectors that make an obtuse and an acute angle. Figure 3.7 Two points a and b on a sphere with radius R and center at the origin. The spherical distance between the points is equal to R (a, b). Veterans Memorial Academy Golden Globe Super Bowl Veterans Day Memorial Day Academy A. Golden Globe A. Super Bowl Day 0 60.6 85.7 87.0 87.7 Day 60.6 0 85.6 87.5 87.5 Awards Awards 85.7 85.6 0 58.7 86.1 87.0 87.5 58.7 0 86.0 87.7 87.5 85.7 86.0 0 Table 3.2 Pairwise angles (in degrees) between word histograms of five Wikipedia articles. ab0 60 3 Norm and distance Norm of sum via angles. For vectors x and y we have x + y 2 = x 2 + 2xT y + y 2 = x where θ = (x, y). (The first equality comes from (3.1).) From this we can make several observations. y cos θ + 2 + 2 (3.6) x y 2, • • If x and y are aligned (θ = 0), we have norms add. x + y = + x y . Thus, their 2. In this 2 + y If x and y are orthogonal (θ = 90◦), we have 2. 2 + y x case the norm-squared values add, and we have This formula is sometimes called the Pythagorean theorem, after the Greek mathematician Pythagoras of Samos Correlation coefficient. Suppose a and b are n-vectors, with associated de-meaned vectors ˜a = a − avg(a)1, ˜b = b avg(b)1. − Assuming these de-meaned vectors are not zero (which occurs when the original vectors have all equal entries), we define their correlation coefficient as ˜aT ˜b ˜b ˜a Thus, ρ = cos θ, where θ = (˜a, ˜b). We can also express the correlation coefficient in terms of the vectors u and v obtained by standardizing a and b. With u = ˜a/ std(a) and v = ˜b/ std(b), we have (3.7) ρ = . ρ = uT v/n. (3.8) = √n.) (We use u = v This is a symmetric function of the vectors: The correlation coefficient between a and b is the same as the correlation coefficient between b and a. The Cauchy– Schwarz inequality tells us that the correlation coefficient ranges between 1 and +1. For this reason, the correlation coefficient is sometimes expressed as a percentage. For example, ρ = 30% means ρ = 0.3. When ρ = 0, we say the vectors are uncorrelated. (By convention, we say that a vector with all entries equal is uncorrelated with any vector.) − The correlation coefficient tells us how the entries in the two vectors vary together. High correlation (say, ρ = 0.8) means that entries of a and b are typically above their mean for many of the same entries. The extreme case ρ = 1 occurs only if the vectors ˜a and ˜b are aligned, which means that each is a positive mul1 occurs only when ˜a and ˜b tiple of the other, and the other extreme case ρ = are negative multiples of each other. This idea is illustrated in figure 3.8, which shows the entries of two vectors, as well as a scatter plot of them, for cases with correlation near 1, near 1, and near 0. − The correlation coefficient is often used when the vectors represent time series, such as the returns on two investments over some time interval, or the rainfall in two locations over some time interval. If they are highly correlated (say, ρ > 0.8), − 3.4 Angle 61 Figure 3.8 Three pairs of vectors a, b of length 10, with correlation coeffi0.988 (middle), and 0.004 (bottom). cients 0.968 (top), − kakkbkakbkkakkbkakbkkakkbkakbk 62 3 Norm and distance the two time series are typically above their mean values at the same times. For example, we would expect the rainfall time series at two nearby locations to be highly correlated. As another example, we might expect the returns of two similar companies, in the same business area, to be highly correlated. Standard deviation of sum. We can derive a formula for the standard deviation of a sum from (3.6): std(a + b) = std(a)2 + 2ρ std(a) std(b) + std(b)2. (3.9) To derive this from (3.6) we let ˜a and ˜b denote the de-meaned versions of a and b. Then ˜a + ˜b is the de-meaned version of a + b, and std(a + b)2 = ˜a + ˜b 2/n. Now using (3.6) and ρ = cos (˜a, ˜b), we get n std(a + b)2 = ˜b 2 = + = n std(a)2 + 2ρn std(a) std(b) + n std(b)2. ˜a + ˜b 2 2 + 2ρ ˜a ˜b ˜a Dividing by n and taking the squareroot yields the formula above. If ρ = 1, the standard deviation of the sum of vectors is the sum of their standard deviations, i.e., std(a + b) = std(a) + std(b). As ρ decreases, the standard deviation of the sum decreases. When ρ = 0, i.e., a and b are uncorrelated, the standard deviation of the sum a + b is std(a + b) = std(a)2 + std(b)2, which is smaller than std(a) + std(b) (unless one of them is zero). When ρ = the standard deviation of the sum is as small as it can be, 1, − std(a + b) = std(a) std(b) | . − | Hedging investments. Suppose that vectors a and b are time series of returns for two assets with the same return (average) µ and risk (standard deviation) σ, and correlation coefficient ρ. (These are the traditional symbols used.) The vector c = (a + b)/2 is the time series of returns for an investment with 50% in each of the assets. This blended investment has the same return as the original assets, since avg(c) = avg((a + b)/2) = (avg(a) + avg(b))/2 = µ. The risk (standard deviation) of this blended investment is std(c) = 2σ2 + 2ρσ2/2 = σ (1 + ρ)/2, using (3.9). From this we see that the risk of the blended investment is never more than the risk of the original assets, and is smaller when the correlation of the original asset returns is smaller. When the returns are uncorrelated, the risk is a factor 1/√2 = 0.707 smaller than the risk of the original assets. If the asset returns are strongly negatively correlated (i.e., ρ is near 1), the risk of the blended investment is much smaller than the risk of the original assets. Investing in two assets with uncorrelated, or negatively correlated, returns is called hedging (which is short for ‘hedging your bets’). Hedging reduces risk. − 3.5 Complexity 63 Units for heterogeneous vector entries. When the entries of vectors represent different types of quantities, the choice of units used to represent each entry affects the angle, standard deviation, and correlation between a pair of vectors. The discussion on page 51, about how the choice of units can affect distances between pairs of vectors, therefore applies to these quantities as well. The general rule of thumb is to choose units for different entries so the typical vector entries have similar sizes or ranges of values. 3.5 Complexity − Computing the norm of an n-vector requires n multiplications (to square each entry), n 1 additions (to add the squares), and one squareroot. Even though computing the squareroot typically takes more time than computing the product or sum of two numbers, it is counted as just one flop. So computing the norm takes 2n flops. The cost of computing the RMS value of an n-vector is the same, since we can ignore the two flops involved in division by √n. Computing the distance between two vectors costs 3n flops, and computing the angle between them costs 6n flops. All of these operations have order n. De-meaning an n-vector requires 2n flops (n for forming the average and another n flops for subtracting the average from each entry). The standard deviation is the RMS value of the de-meaned vector, and this calculation takes 4n flops (2n for computing the de-meaned vector and 2n for computing its RMS value). Equation (3.5) suggests a slightly more efficient method with a complexity of 3n flops: first compute the average (n flops) and RMS value (2n flops), and then find the standard deviation as std(x) = (rms(x)2 avg(x)2)1/2. Standardizing an n-vector − costs 5n flops. The correlation coefficient between two vectors costs 10n flops to compute. These operations also have order n. As a slightly more involved computation, suppose that we wish to determine the nearest neighbor among a collection of k n-vectors z1, . . . , zk to another n-vector x. (This will come up in the next chapter.) The simple approach is to compute the distances for i = 1, . . . , k, and then find the minimum of these. (Sometimes zi a comparison of two numbers is also counted as a flop.) The cost of this is 3kn flops to compute the distances, and k 1 comparisons to find the minimum. The latt
er term can be ignored, so the flop count is 3kn. The order of finding the nearest neighbor in a collection of k n-vectors is kn. x − − 64 3 Norm and distance Exercises 3.1 Distance between Boolean vectors. Suppose that x and y are Boolean n-vectors, which means that each of their entries is either 0 or 1. What is their distance x − y ? 3.2 RMS value and average of block vectors. Let x be a block vector with two vector elements, x = (a, b), where a and b are vectors of size n and m, respectively. (a) Express rms(x) in terms of rms(a), rms(b), m, and n. (b) Express avg(x) in terms of avg(a), avg(b), m, and n. 3.3 Reverse triangle inequality. Suppose a and b are vectors of the same size. The triangle inequality states that . Hints. Draw a picture to get the idea. To show the inequality, apply the triangle inequality to (a + b) + ( . Show that we also have ≥ ≤ − a + b a + b b). + a a b b 3.4 Norm identities. Verify that the following identities hold for any two vectors a and b of − the same size. (a) (a + b)T (a 2 + a + b (b) b( b − a 2. 2 + b 2). This is called the parallelogram law. 3.5 General norms. Any real-valued function f that satisfies the four properties given on page 46 (nonnegative homogeneity, triangle inequality, nonnegativity, and definiteness) is called a vector norm, and is usually written as f (x) = mn, where the subscript is some kind of identifier or mnemonic to identify it. The most commonly used norm is the one we use in this book, the Euclidean norm, which is sometimes written with the subscript 2, 1 and the as 2. Two other common vector norms for n-vectors are the 1-norm x x x -norm ∞ x ∞ , defined as x 1 = x1 + + xn , x = max x1 , . . . , | | | | · · · These norms are the sum and the maximum of the absolute values of the entries in the -norm arise in some recent and advanced vector, respectively. The 1-norm and the applications, but we will not encounter them in this book. Verify that the 1-norm and the -norm satisfy the four norm properties listed on page 46. 3.6 Taylor approximation of norm. Find a general formula for the Taylor approximation of near a given nonzero vector z. You can express the approximation ∞ ∞ ∞ {| | xn | . |} the function f (x) = in the form ˆf (x) = aT (x x z) + b. − 3.7 Chebyshev inequality. Suppose x is a 100-vector with rms(x) = 1. What is the maximum number of entries of x that can satisfy 3? If your answer is k, explain why no such vector can have k + 1 entries with absolute values at least 3, and give an example of a specific 100-vector that has RMS value 1, with k of its entries larger than 3 in absolute value. | ≥ xi | 3.8 Converse Chebyshev inequality. Show that at least one entry of a vector has absolute value at least as large as the RMS value of the vector. 3.9 Difference of squared distances. Determine whether the difference of the squared distances to two fixed vectors c and d, defined as f (x) = x − 2 c x 2, d − − If it is linear, give its inner product representation, i.e., is linear, affine, or neither. an n-vector a for which f (x) = aT x for all x. If it is affine, give a and b for which f (x) = aT x + b holds for all x. If it is neither linear nor affine, give specific x, y, α, and β for which superposition fails, i.e., (Provided α + β = 1, this shows the function is neither linear nor affine.) f (αx + βy) = αf (x) + βf (y). Exercises 65 3.10 Nearest neighbor document. Consider the 5 Wikipedia pages in table 3.1 on page 51. What is the nearest neighbor of (the word count histogram vector of) ‘Veterans Day’ among the others? Does the answer make sense? 3.11 Neighboring electronic health records. Let x1, . . . , xN be n-vectors that contain n features extracted from a set of N electronic health records (EHRs), for a population of N patients. (The features might involve patient attributes and current and past symptoms, diagnoses, test results, hospitalizations, procedures, and medications.) Briefly describe in words a practical use for identifying the 10 nearest neighbors of a given EHR (as measured by their associated feature vectors), among the other EHRs. 3.12 Nearest point to a line. Let a and b be different n-vectors. The line passing through a θ)a + θb, where θ is a scalar that and b is given by the set of vectors of the form (1 determines the particular point on the line. (See page 18.) Let x be any n-vector. Find a formula for the point p on the line that is closest to x. The point p is called the projection of x onto the line. Show that (p b), and draw a simple picture illustrating this in 2-D. Hint. Work with the square of the distance 2. Expand this, and minimize between a point on the line and x, i.e., over θ. θ)a + θb x) (a (1 − − ⊥ − − − x 3.13 Nearest nonnegative vector. Let x be an n-vector and define y as the nonnegative vector (i.e., the vector with nonnegative entries) closest to x. Give an expression for the elements of y. Show that the vector z = y x is also nonnegative and that zT y = 0. 3.14 Nearest unit vector. What is the nearest neighbor of the n-vector x among the unit vectors e1, . . . , en? 3.15 Average, RMS value, and standard deviation. Use the formula (3.5) to show that for any vector x, the following two inequalities hold: − avg(x) | | ≤ rms(x), std(x) rms(x). ≤ avg(x) | Is it possible to have equality in these inequalities? If the conditions on x under which it holds. Repeat for std(x) = rms(x). | = rms(x) is possible, give 3.16 Effect of scaling and offset on average and standard deviation. Suppose x is an n-vector and α and β are scalars. (a) Show that avg(αx + β1) = α avg(x) + β. (b) Show that std(αx + β1) = std(x). α | | · · · 3.17 Average and standard deviation of linear combination. Let x1, . . . , xk be n-vectors, and α1, . . . , αk be numbers, and consider the linear combination z = α1x1 + + αkxk. (a) Show that avg(z) = α1 avg(x1) + (b) Now suppose the vectors are uncorrelated, which means that for i + αk avg(xk). · · · = j, xi and xj are uncorrelated. Show that std(z) = α2 1 std(x1)2 + + α2 k std(xk)2. · · · 3.18 Triangle equality. When does the triangle inequality hold with equality, i.e., what are the a conditions on a and b to have a + b + = b ? 3.19 Norm of sum. Use the formulas (3.1) and (3.6) to show the following: (a) a b if and only if a + b = ⊥ (b) Nonzero vectors a and b make an acute angle if and only if a 2 + b 2. (c) Nonzero vectors a and b make an obtuse angle if and only if Draw a picture illustrating each case in 2-D. a + b a+. 2. b b 3.20 Regression model sensitivity. Consider the regression model ˆy = xT β + v, where ˆy is the prediction, x is a feature vector, β is a coefficient vector, and v is the offset term. If x and ˜x are feature vectors with corresponding predictions ˆy and ˜y, show that . is small, the prediction is not very sensitive to a change in the This means that when feature vector. | ≤ − − ˜y ˆy x ˜x β β | 66 3 Norm and distance 3.21 Dirichlet energy of a signal. Suppose the T -vector x represents a time series or signal. The quantity (x) = (x1 x2)2 + D − + (xT 1 − − · · · xT )2, the sum of the differences of adjacent values of the signal, is called the Dirichlet energy of the signal, named after the mathematician Peter Gustav Lejeune Dirichlet. The Dirichlet It is sometimes energy is a measure of the roughness or wiggliness of the time series. 1, to give the mean square difference of adjacent values. divided by T − D (a) Express (x) in vector notation. (You can use vector slicing, vector addition or subtraction, inner product, norm, and angle.) (b) How small can energy? D (x) be? What signals x have this minimum value of the Dirichlet (c) Find a signal x with entries no more than one in absolute value that has the largest possible value of D (x). Give the value of the Dirichlet energy achieved. 3.22 Distance from Palo Alto to Beijing. The surface of the earth is reasonably approximated as a sphere with radius R = 6367.5km. A location on the earth’s surface is traditionally given by its latitude θ and its longitude λ, which correspond to angular distance from the equator and prime meridian, respectively. The 3-D coordinates of the location are given by R sin λ cos θ R cos λ cos θ R sin θ . (In this coordinate system (0, 0, 0) is the center of the earth, R(0, 0, 1) is the North pole, and R(0, 1, 0) is the point on the equator on the prime meridian, due south of the Royal Observatory outside London.) The distance through the earth between two locations (3-vectors) a and b is . The distance along the surface of the earth between points a and b is R (a, b). Find these two distances between Palo Alto and Beijing, with latitudes and longitudes given below. − a b City Latitude θ Longitude λ Beijing Palo Alto 39.914◦ 37.429◦ 116.392◦ 122.138◦ − 3.23 Angle between two nonnegative vectors. Let x and y be two nonzero n-vectors with nonnegative entries, i.e., each xi 0. Show that the angle between x 0 and each yi and y lies between 0 and 90◦. Draw a picture for the case when n = 2, and give a short geometric explanation. When are x and y orthogonal? ≥ ≥ 3.24 Distance versus angle nearest neighbor. Suppose z1, . . . , zm is a collection of n-vectors, and x is another n-vector. The vector zj is the (distance) nearest neighbor of x (among the given vectors) if zi − i.e., x has smallest distance to zj. We say that zj is the angle nearest neighbor of x if i = 1, . . . , m, ≤ zj − x x , i.e., x has smallest angle to zj. (x, zj) ≤ (x, zi), i = 1, . . . , m, (a) Give a simple specific numerical example where the (distance) nearest neighbor is not the same as the angle nearest neighbor. (b) Now suppose that the vectors z1, . . . , zm are normalized, which means that = 1, i = 1, . . . , m. Show that in this case the distance nearest neighbor and the angle nearest neighbor are always the same. Hint. You can use the fact that arccos is a decreasing function, i.e., for any u and v with 1, we have arccos(u) > arccos(v). u < v ≤ ≤ − zi 1 Exercises 67 3.25 Leveraging. Consider an asset with return time series over T periods give
n by the T vector r. This asset has mean return µ and risk σ, which we assume is positive. We also consider cash as an asset, with return vector µrf 1, where µrf is the cash interest rate per period. Thus, we model cash as an asset with return µrf and zero risk. (The superscript in µrf stands for ‘risk-free’.) We will create a simple portfolio consisting of the asset and θ in cash, our portfolio return is given cash. If we invest a fraction θ in the asset, and 1 by the time series − θ)µrf 1. p = θr + (1 − We interpret θ as the fraction of our portfolio we hold in the asset. We allow the choices θ > 1, or θ < 0. In the first case we are borrowing cash and using the proceeds to buy more of the asset, which is called leveraging. In the second case we are shorting the asset. When θ is between 0 and 1 we are blending our investment in the asset and cash, which is a form of hedging. (a) Derive a formula for the return and risk of the portfolio, i.e., the mean and standard deviation of p. These should be expressed in terms of µ, σ, µrf , and θ. Check your formulas for the special cases θ = 0 and θ = 1. (b) Explain how to choose θ so the portfolio has a given target risk level σtar (which is positive). If there are multiple values of θ that give the target risk, choose the one that results in the highest portfolio return. (c) Assume we choose the value of θ as in part (b). When do we use leverage? When do we short the asset? When do we hedge? Your answers should be in English. 3.26 Time series auto-correlation. Suppose the T -vector x is a non-constant time series, with xt the value at time (or period) t. Let µ = (1T x)/T denote its mean value. The autocorrelation of x is the function R(τ ), defined for τ = 0, 1, . . . as the correlation coefficient of the two vectors (x, µ1τ ) and (µ1τ , x). (The subscript τ denotes the length of the ones vector.) Both of these vectors also have mean µ. Roughly speaking, R(τ ) tells us how correlated the time series is with a version of itself lagged or shifted by τ periods. (The argument τ is called the lag.) (a) Explain why R(0) = 1, and R(τ ) = 0 for τ T . ≥ (b) Let z denote the standardized or z-scored version of x (see page 56). Show that for τ = 0, . . . , T 1, − R(τ ) = 1 T T τ − t=1 ztzt+τ . (c) Find the auto-correlation for the time series x = (+1, can assume that T is even. 1, +1, − − 1, . . . , +1, 1). You − (d) Suppose x denotes the number of meals served by a restaurant on day τ . It is observed that R(7) is fairly high, and R(14) is also high, but not as high. Give an English explanation of why this might be. 3.27 Another measure of the spread of the entries of a vector. The standard deviation is a measure of how much the entries of a vector differ from their mean value. Another measure of how much the entries of an n-vector x differ from each other, called the mean square difference, is defined as MSD(x) = 1 n2 n (xi i,j=1 xj)2. − (The sum means that you should add up the n2 terms, as the indices i and j each range from 1 to n.) Show that MSD(x) = 2 std(x)2. Hint. First observe that MSD(˜x) = avg(x)1 is the de-meaned vector. Expand the sum and recall MSD(x), where ˜x = x that n − i=1 ˜xi = 0. 68 3 Norm and distance 3.28 Weighted norm. On page 51 we discuss the importance of choosing the units or scaling for the individual entries of vectors, when they represent heterogeneous quantities. Another approach is to use a weighted norm of a vector x, defined as w = x w1x2 1 + + wnx2 n, · · · where w1, . . . , wn are given positive weights, used to assign more or less importance to the different elements of the n-vector x. If all the weights are one, the weighted norm reduces to the usual (‘unweighted’) norm. It can be shown that the weighted norm is a general norm, i.e., it satisfies the four norm properties listed on page 46. Following the discussion on page 51, one common rule of thumb is to choose the weight wi as the inverse of the typical value of x2 A version of the Cauchy–Schwarz inequality holds for weighted norms: For any n-vector x and y, we have i in the application. w1x1y1 + + wnxnyn | · · · x w y w. | ≤ (The expression inside the absolute value on the left-hand side is sometimes called the weighted inner product of x and y.) Show that this inequality holds. Hint. Consider the vectors ˜x = (x1√w1, . . . , xn√wn) and ˜y = (y1√w1, . . . , yn√wn), and use the (standard) Cauchy–Schwarz inequality. Chapter 4 Clustering In this chapter we consider the task of clustering a collection of vectors into groups or clusters of vectors that are close to each other, as measured by the distance between pairs of them. We describe a famous clustering method, called the kmeans algorithm, and give some typical applications. The material in this chapter will not be used in the sequel. But the ideas, and the k-means algorithm in particular, are widely used in practical applications, and rely only on the ideas developed in the previous three chapters. So this chapter can be considered an interlude that covers useful material that builds on the ideas developed so far. 4.1 Clustering Suppose we have N n-vectors, x1, . . . , xN . The goal of clustering is to group or partition the vectors (if possible) into k groups or clusters, with the vectors in each group close to each other. Clustering is very widely used in many application areas, typically (but not always) when the vectors represent features of objects. Normally we have k much smaller than N , i.e., there are many more vectors than groups. Typical applications use values of k that range from a handful to a few hundred or more, with values of N that range from hundreds to billions. Part of the task of clustering a collection of vectors is to determine whether or not the vectors can be divided into k groups, with vectors in each group near each other. Of course this depends on k, the number of clusters, and the particular data, i.e., the vectors x1, . . . , xN . Figure 4.1 shows a simple example, with N = 300 2-vectors, shown as small circles. We can easily see that this collection of vectors can be divided into k = 3 clusters, shown on the right with the colors representing the different clusters. We could partition these data into other numbers of clusters, but we can see that k = 3 is a good value. This example is not typical in several ways. First, the vectors have dimension n = 2. Clustering any set of 2-vectors is easy: We simply scatter plot the values 70 4 Clustering Figure 4.1 300 points in a plane. The points can be clustered in the three groups shown on the right. and check visually if the data are clustered, and if so, how many clusters there are. In almost all applications n is larger than 2 (and typically, much larger than 2), in which case this simple visual method cannot be used. The second way in which it is not typical is that the points are very well clustered. In most applications, the data are not as cleanly clustered as in this simple example; there are several or even many points that lie in between clusters. Finally, in this example, it is clear that the best choice of k is k = 3. In real examples, it can be less clear what the best value of k is. But even when the clustering is not as clean as in this example, and the best value of k is not clear, clustering can be very useful in practice. Examples. Before we delve more deeply into the details of clustering and clustering algorithms, we list some common applications where clustering is used. • • • Topic discovery. Suppose xi are word histograms associated with N documents. A clustering algorithm partitions the documents into k groups, which typically can be interpreted as groups of documents with the same or similar topics, genre, or author. Since the clustering algorithm runs automatically and without any understanding of what the words in the dictionary mean, this is sometimes called automatic topic discovery. Patient clustering. If xi are feature vectors associated with N patients admitted to a hospital, a clustering algorithm clusters the patients into k groups of similar patients (at least in terms of their feature vectors). Customer market segmentation. Suppose the vector xi gives the quantities (or dollar values) of n items purchased by customer i over some period of time. A clustering algorithm will group the customers into k market segments, which are groups of customers with similar purchasing patterns. 4.1 Clustering 71 • • • • • • ZIP code clustering. Suppose that xi is a vector giving n quantities or statistics for the residents of ZIP code i, such as numbers of residents in various age groups, household size, education statistics, and income statistics. (In this example N is around 40000.) A clustering algorithm might be used to cluster the 40000 ZIP codes into, say, k = 100 groups of ZIP codes with similar statistics. Student clustering. Suppose the vector xi gives the detailed grading record of student i in a course, i.e., her grades on each question in the quizzes, homework assignments, and exams. A clustering algorithm might be used to cluster the students into k = 10 groups of students who performed similarly. Survey response clustering. A group of N people respond to a survey with n questions. Each question contains a statement, such as ‘The movie was too long’, followed by some ordered options such as Strongly Disagree, Disagree, Neutral, Agree, Strongly Agree. (This is called a Likert scale, named after the psychologist Rensis Likert.) Suppose the n-vector xi encodes the selections of respondent i on the n questions, using the numerical coding 1, 0, +1, +2 for the responses above. A clustering algorithm can be used to cluster the respondents into k groups, each with similar responses to the survey. − − 2, Weather zones. For each of N counties we have a 24-vector xi that gives the average monthly temperature in the first 12 entries and the average monthly rainfall in the last 12 entries. (We can standardize all the temperatures, and 1 and +1.) The all
the rainfall data, so they have a typical range between vector xi summarizes the annual weather pattern in county i. A clustering algorithm can be used to cluster the counties into k groups that have similar weather patterns, called weather zones. This clustering can be shown on a map, and used to recommend landscape plantings depending on zone. − Daily energy use patterns. The 24-vectors xi give the average (electric) energy use for N customers over some period (say, a month) for each hour of the day. A clustering algorithm partitions customers into groups, each with similar patterns of daily energy consumption. We might expect a clustering algorithm to ‘discover’ which customers have a swimming pool, an electric water heater, or solar panels. Financial sectors. For each of N companies we have an n-vector whose components are financial and business attributes such as total capitalization, quarterly returns and risks, trading volume, profit and loss, or dividends paid. (These quantities would typically be scaled so as to have similar ranges of values.) A clustering algorithm would group companies into sectors, i.e., groups of companies with similar attributes. In each of these examples, it would be quite informative to know that the vectors can be well clustered into, say, k = 5 or k = 37 groups. This can be used to develop insight into the data. By examining the clusters we can often understand them, and assign labels or descriptions to them. 72 4 Clustering 4.2 A clustering objective In this section we formalize the idea of clustering, and introduce a natural measure of the quality of a given clustering. Specifying the cluster assignments. We specify a clustering of the vectors by saying which cluster or group each vector belongs to. We label the groups 1, . . . , k, and specify a clustering or assignment of the N given vectors to groups using an N -vector c, where ci is the group (number) that the vector xi is assigned to. As a simple example with N = 5 vectors and k = 3 groups, c = (3, 1, 1, 1, 2) means that x1 is assigned to group 3, x2, x3, and x4 are assigned to group 1, and x5 is assigned to group 2. We will also describe the clustering by the sets of indices for each group. We let Gj be the set of indices corresponding to group j. For our simple example above, we have G1 = 2, 3, 4 } , { G2 = , 5 } { G3 = . 1 } { (Here we are using the notation of sets; see appendix A.) Formally, we can express these index sets in terms of the group assignment vector c as which means that Gj is the set of all indices i for which ci = j. Gj = i { | ci = j , } Group representatives. With each of the groups we associate a group representative n-vector, which we denote z1, . . . , zk. These representatives can be any n-vectors; they do not need to be one of the given vectors. We want each representative to be close to the vectors in its associated group, i.e., we want the quantities xi − to be small. (Note that xi is in group j = ci, so zci is the representative vector associated with data vector xi.) zci A clustering objective. We can now give a single number that we use to judge a choice of clustering, along with a choice of the group representatives. We define J clust = x1 − zc1 2 + + xN − · · · 2 /N, zcN (4.1) which is the mean square distance from the vectors to their associated representatives. Note that J clust depends on the cluster assignments (i.e., c), as well as the choice of the group representatives z1, . . . , zk. The smaller J clust is, the better the clustering. An extreme case is J clust = 0, which means that the distance between every original vector and its assigned representative is zero. This happens only when the original collection of vectors only takes k different values, and each vector is assigned to the representative it is equal to. (This extreme case would probably not occur in practice.) Our choice of clustering objective J clust makes sense, since it encourages all points to be near their associated representative, but there are other reasonable 4.2 A clustering objective 73 choices. For example, it is possible to use an objective that encourages more balanced groupings. But we will stick with this basic (and very common) choice of clustering objective. Optimal and suboptimal clustering. We seek a clustering, i.e., a choice of group assignments c1, . . . , cN and a choice of representatives z1, . . . , zk, that minimize the objective J clust. We call such a clustering optimal. Unfortunately, for all but the very smallest problems, it is practically impossible to find an optimal clustering. (It can be done in principle, but the amount of computation needed grows extremely rapidly with N .) The good news is that the k-means algorithm described in the next section requires far less computation (and indeed, can be run for problems with N measured in billions), and often finds a very good, if not the absolute best, (Here, ‘very good’ means a clustering and choice of representatives clustering. that achieves a value of J clust near its smallest possible value.) We say that the clustering choices found by the k-means algorithm are suboptimal, which means that they might not give the lowest possible value of J clust. Even though it is a hard problem to choose the best clustering and the best representatives, it turns out that we can find the best clustering, if the representatives are fixed, and we can find the best representatives, if the clustering is fixed. We address these two topics now. Partitioning the vectors with the representatives fixed. Suppose that the group representatives z1, . . . , zk are fixed, and we seek the group assignments c1, . . . , cN that achieve the smallest possible value of J clust. It turns out that this problem can be solved exactly. The objective J clust is a sum of N terms. The choice of ci (i.e., the group to which we assign the vector xi) only affects the ith term in J clust, which is 2. We can choose ci to minimize just this term, since ci does not (1/N ) zci xi − 1 terms in J clust. How do we choose ci to minimize this term? affect the other N zj This is easy: We simply choose ci to be the value of j that minimizes over j. In other words, we should assign each data vector xi to its nearest neighbor among the representatives. This choice of assignment is very natural, and easily carried out. xi − − So when the group representatives are fixed, we can readily find the best group assignment (i.e., the one that minimizes J clust), by assigning each vector to its nearest representative. With this choice of group assignment, we have (by the way the assignment is made) xi − zci so the value of J clust is given by = min j=1,...,k xi − , zj min j=1,...,k x1 − 2 + zj + min j=1,...,k xN − zj · · · 2 /N. This has a simple interpretation: It is the mean of the squared distance from the data vectors to their closest representative. 74 4 Clustering Optimizing the group representatives with the assignment fixed. Now we turn to the problem of choosing the group representatives, with the clustering (group assignments) fixed, in order to minimize our objective J clust. It turns out that this problem also has a simple and natural solution. We start by re-arranging the sum of N terms into k sums, each associated with one group. We write where J clust = J1 + + Jk, · · · Jj = (1/N ) 2 xi − zj i Gj ∈ is the contribution to the objective J clust from the vectors in group j. (The sum Gj, here means that we should add up all terms of the form i.e., for any vector xi in group j; see appendix A.) 2, for any i xi − zj ∈ The choice of group representative zj only affects the term Jj; it has no effect on the other terms in J clust. So we can choose each zj to minimize Jj. Thus we should choose the vector zj so as to minimize the mean square distance to the vectors in group j. This problem has a very simple solution: We should choose zj to be the average (or mean or centroid) of the vectors xi in its group: zj = (1/ | Gj| ) xi, Gj i ∈ where set Gj, i.e., the size of group j. (See exercise 4.1.) Gj| | is standard mathematical notation for the number of elements in the So if we fix the group assignments, we minimize J clust by choosing each group representative to be the average or centroid of the vectors assigned to its group. (This is sometimes called the group centroid or cluster centroid.) 4.3 The k-means algorithm It might seem that we can now solve the problem of choosing the group assignments and the group representatives to minimize J clust, since we know how to do this when one or the other choice is fixed. But the two choices are circular, i.e., each depends Instead we rely on a very old idea in computation: We simply on the other. iterate between the two choices. This means that we repeatedly alternate between updating the group assignments, and then updating the representatives, using the methods developed above. In each step the objective J clust gets better (i.e., goes Iterating between choosing down) unless the step does not change the choice. the group representatives and choosing the group assignments is the celebrated k-means algorithm for clustering a collection of vectors. The k-means algorithm was first proposed in 1957 by Stuart Lloyd, and independently by Hugo Steinhaus. It is sometimes called the Lloyd algorithm. The name ‘k-means’ has been used since the 1960s. 4.3 The k-means algorithm 75 Figure 4.2 One iteration of the k-means algorithm. The 30 2-vectors xi are shown as filled circles, and the 3 group representatives zj are shown as rectangles. In the left-hand figure the vectors are each assigned to the closest representative. In the right-hand figure, the representatives are replaced by the cluster centroids. Algorithm 4.1 k-means algorithm given a list of N vectors x1, . . . , xN , and an initial list of k group representative vectors z1, . . . , zk repeat until convergence 1. Partition the vectors into k groups. For each vector i = 1, . . . , N , assign xi to the group associated with the n
earest representative. 2. Update representatives. For each group j = 1, . . . , k, set zj to be the mean of the vectors in group j. One iteration of the k-means algorithm is illustrated in figure 4.2. Comments and clarifications. • • Ties in step 1 can be broken by assigning xi to the group associated with one of the closest representatives with the smallest value of j. It is possible that in step 1, one or more of the groups can be empty, i.e., contain no vectors. In this case we simply drop this group (and its representative). When this occurs, we end up with a partition of the vectors into fewer than k groups. 76 4 Clustering • • If the group assignments found in step 1 are the same in two successive iterations, the representatives in step 2 will also be the same. It follows that the group assignments and group representatives will never change in future iterations, so we should stop the algorithm. This is what we mean by ‘until convergence’. In practice, one often stops the algorithm earlier, as soon as the improvement in J clust in successive iterations becomes very small. We start the algorithm with a choice of initial group representatives. One simple method is to pick the representatives randomly from the original vectors; another is to start from a random assignment of the original vectors to k groups, and use the means of the groups as the initial representatives. (There are more sophisticated methods for choosing an initial representatives, but this topic is beyond the scope of this book.) Convergence. The fact that J clust decreases in each step implies that the k-means algorithm converges in a finite number of steps. However, depending on the initial choice of representatives, the algorithm can, and does, converge to different final partitions, with different objective values. The k-means algorithm is a heuristic, which means it cannot guarantee that the partition it finds minimizes our objective J clust. For this reason it is common to run the k-means algorithm several times, with different initial representatives, and choose the one among them with the smallest final value of J clust. Despite the fact that the k-means algorithm is a heuristic, it is very useful in practical applications, and very widely used. Figure 4.3 shows a few iterations generated by the k-means algorithm, applied to the example of figure 4.1. We take k = 3 and start with randomly chosen group representatives. The final clustering is shown in figure 4.4. Figure 4.5 shows how the clustering objective decreases in each step. Interpreting the representatives. The representatives z1, . . . , zk associated with a clustering are quite interpretable. Suppose, for example, that voters in some election can be well clustered into 7 groups, on the basis of a data set that includes demographic data and questionnaire or poll data. If the 4th component of our vectors is the age of the voter, then (z3)4 = 37.8 tells us that the average age of voters in group 3 is 37.8. Insight gained from this data can be used to tune campaign messages, or choose media outlets for campaign advertising. Another way to interpret the group representatives is to find one or a few of the original data points that are closest to each representive. These can be thought of as archetypes for the group. Choosing k. It is common to run the k-means algorithm for different values of k, and compare the results. How to choose a value of k among these depends on how the clustering will be used, which we discuss a bit more in 4.5. But some general statements can be made. For example, if the value of J clust with k = 7 is quite a bit smaller than the values of J clust for k = 2, . . . , 6, and not much larger than the values of J clust for k = 8, 9, . . ., we could reasonably choose k = 7, and conclude that our data (list of vectors) partitions nicely into 7 groups. § 4.3 The k-means algorithm 77 Iteration 1 Iteration 2 Iteration 10 Figure 4.3 Three iterations of the k-means algorithm. The group representatives are shown as squares. In each row, the left-hand plot shows the result of partitioning the vectors in the 3 groups (step 1 of algorithm 4.1). The right-hand plot shows the updated representatives (step 2 of the algorithm). 78 4 Clustering Figure 4.4 Final clustering. Figure 4.5 The clustering objective J clust after step 1 of each iteration. 135791113150.511.5IterationJclustscale 4.4 Examples 79 Complexity. In step 1 of the k-means algorithm, we find the nearest neighbor to each of N n-vectors, over the list of k centroids. This requires approximately 3N kn flops. In step 2 we average the n-vectors over each of the cluster groups. For a cluster with p vectors, this requires n(p 1) flops, which we approximate as np flops; averaging all clusters requires a total of N n flops. This is less than the cost of partitioning in step 1. So k-means requires around (3k + 1)N n flops per iteration. Its order is N kn flops. − Each run of k-means typically takes fewer than a few tens of iterations, and usually k-means is run some modest number of times, like 10. So a very rough guess of the number of flops required to run k-means 10 times (in order to choose the best partition found) is 1000N kn flops. As an example, suppose we use k-means to partition N = 100000 vectors with size n = 100 into k = 10 groups. On a 1 Gflop/s computer we guess that this will take around 100 seconds. Given the approximations made here (for example, the number of iterations that each run of k-means will take), this is obviously a crude estimate. 4.4 Examples 4.4.1 Image clustering The MNIST (Mixed National Institute of Standards) database of handwritten dig28, which its is a data set containing N = 60000 grayscale images of size 28 we represent as n-vectors with n = 28 28 = 784. Figure 4.6 shows a few examples from the data set. (The data set is available from Yann LeCun at yann.lecun.com/exdb/mnist.) × × We use the k-means algorithm to partition these images into k = 20 clusters, starting with a random assignment of the vectors to groups, and repeating the experiment 20 times. Figure 4.7 shows the clustering objective versus iteration number for three of the 20 initial assignments, including the two that gave the lowest and the highest final values of the objective. Figure 4.8 shows the representatives with the lowest final value of the clustering objective. Figure 4.9 shows the set with the highest value. We can see that most of the representatives are recognizable digits, with some reasonable confusion, for example between ‘4’ and ‘9’ or ‘3’ and ‘8’. This is impressive when you consider that the k-means algorithm knows nothing about digits, handwriting, or even that the 784-vectors represent 28 28 images; it uses only the distances between 784vectors. One interpretation is that the k-means algorithm has ‘discovered’ the digits in the data set. × 80 4 Clustering Figure 4.6 25 images of handwritten digits from the MNIST data set. Each image has size 28 28, and can be represented by a 784-vector. × Figure 4.7 Clustering objective J clust after each iteration of the k-means algorithm, for three initial partitions, on digits of the MNIST set. 1591317212536384042IterationJclust 4.4 Examples 81 Figure 4.8 Group representatives found by the k-means algorithm applied to the MNIST set. Figure 4.9 Group representatives found by the k-means algorithm applied to the MNIST set, with a different starting point than in figure 4.8. 82 4 Clustering Figure 4.10 Clustering objective J clust after each iteration of the k-means algorithm, for three initial partitions, on Wikipedia word count histograms. 4.4.2 Document topic discovery We start with a corpus of N = 500 Wikipedia articles, compiled from weekly lists of the most popular articles between September 6, 2015, and June 11, 2016. We remove the section titles and reference sections (bibliography, notes, references, further reading), and convert each document to a list of words. The conversion removes numbers and stop words, and applies a stemming algorithm to nouns and verbs. We then form a dictionary of all the words that appear in at least 20 documents. This results in a dictionary of 4423 words. Each document in the corpus is represented by a word histogram vector of length 4423. We apply the k-means algorithm with k = 9, and 20 randomly chosen initial partitions. The k-means algorithm converges to similar but slightly different clusterings of the documents in each case. Figure 4.10 shows the clustering objective versus iteration of the k-means algorithm for three of these, including the one that gave the lowest final value of J clust, which we use below. Table 4.1 summarizes the clustering with the lowest value of J clust. For each of the nine clusters we show the largest ten coefficients of the word histogram of the cluster representative. Table 4.2 gives the size of each cluster and the titles of the ten articles closest to the cluster representative. Each of the clusters makes sense, and mostly contains documents on similar topics, or similar themes. The words with largest coefficients in the group representatives also make sense. It is interesting to see that k-means clustering has assigned movies and TV series (mostly) to different clusters (9 and 6). One can also note that clusters 8 and 9 share several top key words but are on separate topics (actors and movies, respectively). 1510152077.58·10−3IterationJclust 4.4 Examples 83 Cluster 1 Cluster 2 Cluster 3 Word Coefficient Word Coefficient Word Coefficient fight win event champion fighter bout title Ali championship bonus 0.038 0.022 0.019 0.015 0.015 0.015 0.013 0.012 0.011 0.010 holiday celebrate festival celebration calendar church united date moon event 0.012 0.009 0.007 0.007 0.006 0.006 0.005 0.005 0.005 0.005 united family party president government school American university city attack 0.004 0.003 0.003 0.003 0.003 0.003 0.003 0.003 0.003 0.003 Cluster 4 Cluster 5 Cluster 6 Word Coefficient Word Coefficient Word Coefficient album 0.031 0.016 r
elease 0.015 song 0.014 music 0.011 single 0.010 record 0.009 band perform 0.007 0.007 0.007 tour chart 0.023 game season 0.020 team 0.018 0.017 win 0.014 player 0.013 play 0.010 league 0.010 final 0.008 score 0.007 record series season episode character film television cast announce release appear 0.029 0.027 0.013 0.011 0.008 0.007 0.006 0.006 0.005 0.005 Cluster 7 Cluster 8 Cluster 9 Word Coefficient Word Coefficient Word Coefficient match win championship team event style raw title episode perform 0.065 0.018 0.016 0.015 0.015 0.014 0.013 0.011 0.010 0.010 film star role play series appear award actor character release 0.036 0.014 0.014 0.010 0.009 0.008 0.008 0.007 0.006 0.006 film million release star character role movie weekend story gross 0.061 0.019 0.013 0.010 0.006 0.006 0.005 0.005 0.005 0.005 Table 4.1 The 9 cluster representatives. For each representative we show the largest 10 coefficients of the word histogram. 84 4 Clustering Cluster Size Titles 1 2 3 4 5 6 7 8 9 21 43 Floyd Mayweather, Jr; Kimbo Slice; Ronda Rousey; Jos´e Aldo; Joe Frazier; Wladimir Klitschko; Saul ´Alvarez; Gennady Golovkin; Nate Diaz; Conor McGregor. Halloween; Guy Fawkes Night; Diwali; Hanukkah; Groundhog Day; Rosh Hashanah; Yom Kippur; Seventh-day Adventist Church; Remembrance Day; Mother’s Day. 189 Mahatma Gandhi; Sigmund Freud; Carly Fiorina; 46 49 39 Frederick Douglass; Marco Rubio; Christopher Columbus; Fidel Castro; Jim Webb; Genie (feral child); Pablo Escobar. David Bowie; Kanye West; Celine Dion; Kesha; Ariana Grande; Adele; Gwen Stefani; Anti (album); Dolly Parton; Sia Furler. Kobe Bryant; Lamar Odom; Johan Cruyff; Yogi Berra; Jos´e Mourinho; Halo 5: Guardians; Tom Brady; Eli Manning; Stephen Curry; Carolina Panthers. The X-Files; Game of Thrones; House of Cards (U.S. TV series); Daredevil (TV series); Supergirl (U.S. TV series); American Horror Story; The Flash (2014 TV series); The Man in the High Castle (TV series); Sherlock (TV series); Scream Queens (2015 TV series). 16 Wrestlemania 32; Payback (2016); Survivor Series (2015); Royal Rumble (2016); Night of Champions (2015); Fastlane (2016); Extreme Rules (2016); Hell in a Cell (2015); TLC: Tables, Ladders & Chairs (2015); Shane McMahon. 58 39 Ben Affleck; Johnny Depp; Maureen O’Hara; Kate Beckinsale; Leonardo DiCaprio; Keanu Reeves; Charlie Sheen; Kate Winslet; Carrie Fisher; Alan Rickman. Star Wars: The Force Awakens; Star Wars Episode I: The Phantom Menace; The Martian (film); The Revenant (2015 film); The Hateful Eight; Spectre (2015 film); The Jungle Book (2016 film); Bajirao Mastani (film); Back to the Future II; Back to the Future. Table 4.2 Cluster sizes and titles of 10 documents closest to the cluster representatives. 4.5 Applications 85 The identification of these separate topics among the documents is impressive, when you consider that the k-means algorithm does not understand the meaning of the words in the documents (and indeed, does not even know the order of the words in each document). It uses only the simple concept of document dissimilarity, as measured by the distance between word count histogram vectors. 4.5 Applications Clustering, and the k-means algorithm in particular, has many uses and applications. It can be used for exploratory data analysis, to get an idea of what a large collection of vectors ‘looks like’. When k is small enough, say less than a few tens, it is common to examine the group representatives, and some of the vectors in the associated groups, to interpret or label the groups. Clustering can also be used for more specific directed tasks, a few of which we describe below. Classification. We cluster a large collection of vectors into k groups, and label the groups by hand. We can now assign (or classify) new vectors to one of the k groups by choosing the nearest group representative. In our example of the handwritten digits above, this would give us a rudimentary digit classifier, which would automatically guess what a written digit is from its image. In the topic discovery example, we can automatically classify new documents into one of the k topics. (We will see better classification methods in chapter 14.) Recommendation engine. Clustering can be used to build a recommendation engine, which suggests items that a user or customer might be interested in. Suppose the vectors give the number of times a user has listened to or streamed each song from a library of n songs over some period. These vectors are typically sparse, since each user has listened to only a very small fraction of the music library. Clustering the vectors reveals groups of users with similar musical taste. The group representatives have a nice interpretation: (zj)i is the average number of times users in group j listened to song i. This interpretation allows us to create a set of recommendations for each user. We first identify which cluster j her music listening vector xi is in. Then we can suggest to her songs that she has not listened to, but others in her group (i.e., those with similar musical taste) have listened to most often. To recommend 5 songs to her, we find the indices l with (xi)l = 0, with the 5 largest values of (zj)l. Guessing missing entries. Suppose we have a collection of vectors, with some (The symbol ‘?’ or ‘*’ is entries of some of the vectors missing or not given. sometimes used to denote a missing entry in a vector.) For example, suppose the vectors collect attributes of a collection of people, such as age, sex, years of education, income, number of children, and so on. A vector containing the symbol in the age entry means that we do not know that particular person’s age. ‘?’ Guessing missing entries of vectors in a collection of vectors is sometimes called 86 4 Clustering imputing the missing entries. In our example, we might want to guess the age of the person whose age we do not know. We can use clustering, and the k-means algorithm in particular, to guess the missing entries. We first carry out k-means clustering on our data, using only those vectors that are complete, i.e., all of their entries are known. Now consider a vector x in our collection that is missing one or more entries. Since some of the entries of x are unknown, we cannot find the distances , and therefore we cannot say which group representative is closest to x. Instead we will find the closest group representative to x using only the known entries in x, by finding j that minimizes zj x − (xi − (zj)i)2, i ∈K K is the set of indices for the known entries of the vector x. This gives us where the closest representative to x, calculated using only its known entries. To guess the missing entries in x, we simply use the corresponding entries in zj, the nearest representative. Returning to our example, we would guess the age of the person with a missing age entry by finding the closest representative (ignoring age); then we use the age entry of the representative, which is simply the average age of all the people in that cluster. Exercises Exercises 87 4.1 Minimizing mean square distance to a set of vectors. Let x1, . . . , xL be a collection of n-vectors. In this exercise you will fill in the missing parts of the argument to show that the vector z which minimizes the sum-square distance to the vectors, − is the average or centroid of the vectors, x = (1/L) (x1 + + xL). (This result is used in one of the steps in the k-means algorithm. But here we have simplified the notation.) · · · · · · − J(z) = x1 z 2 + + xL z 2, (a) Explain why, for any z, we have J(z) = L i=1 xi − x − (z − x) 2 = L i=1 xi − 2 x − 2(xi − x)T (z x) + L z − 2. x − (b) Explain why L i=1(xi − x)T (z x) = 0. Hint. Write the left-hand side as − L i=1 T x) − (z − x), (xi and argue that the left-hand vector is 0. (c) Combine the results of (a) and (b) to get J(z) = L 2. = x, we have J(z) > J(x). This shows that the choice z = x 2 + L z i=1 xi − − x x Explain why for any z minimizes J(z). 4.2 k-means with nonnegative, proportions, or Boolean vectors. Suppose that the vectors x1, . . . , xN are clustered using k-means, with group representatives z1, . . . , zk. (a) Suppose the original vectors xi are nonnegative, i.e., their entries are nonnegative. Explain why the representatives zj are also nonnegative. (b) Suppose the original vectors xi represent proportions, i.e., their entries are nonnegative and sum to one. (This is the case when xi are word count histograms, for example.) Explain why the representatives zj also represent proportions, i.e., their entries are nonnegative and sum to one. (c) Suppose the original vectors xi are Boolean, i.e., their entries are either 0 or 1. Give an interpretation of (zj)i, the ith entry of the j group representative. Hint. Each representative is the average of some of the original vectors. 4.3 Linear separation in 2-way partitioning. Clustering a collection of vectors into k = 2 groups is called 2-way partitioning, since we are partitioning the vectors into 2 groups, with index sets G1 and G2. Suppose we run k-means, with k = 2, on the n-vectors x1, . . . , xN . Show that there is a nonzero vector w and a scalar v that satisfy wT xi + v 0 for i G1, wT xi + v ≥ ∈ 0 for i G2. ∈ ≤ In other words, the affine function f (x) = wT x + v is greater than or equal to zero on the first group, and less than or equal to zero on the second group. This is called linear separation of the two groups (although affine separation would be more accurate). 2 Hint. Consider the function representatives. 2, where z1 and z2 are the group − z2 z1 − − x x 4.4 Pre-assigned vectors. Suppose that some of the vectors x1, . . . , xN are assigned to specific groups. For example, we might insist that x27 be assigned to group 5. Suggest a simple modification of the k-means algorithm that respects this requirement. Describe a practical example where this might arise, when each vector represents n features of a medical patient. Chapter 5 Linear independence In this chapter we explore the concept of linear independence, which will play an imp
ortant role in the sequel. 5.1 Linear dependence A collection or list of n-vectors a1, . . . , ak (with k if ≥ 1) is called linearly dependent β1a1 + · · · + βkak = 0 holds for some β1, . . . , βk that are not all zero. In other words, we can form the zero vector as a linear combination of the vectors, with coefficients that are not all zero. Linear dependence of a list of vectors does not depend on the ordering of the vectors in the list. When a collection of vectors is linearly dependent, at least one of the vectors = 0 in the can be expressed as a linear combination of the other vectors: If βi equation above (and by definition, this must be true for at least one i), we can move the term βiai to the other side of the equation and divide by βi to get ai = ( − β1/βi)a1 + + ( βi − · · · − 1/βi)ai 1 + ( − βi+1/βi)ai+1 + + ( − · · · βk/βi)ak. − The converse is also true: If any vector in a collection of vectors is a linear combination of the other vectors, then the collection of vectors is linearly dependent. Following standard mathematical language usage, we will say “The vectors a1, . . . , ak are linearly dependent” to mean “The list of vectors a1, . . . , ak is linearly dependent”. But it must be remembered that linear dependence is an attribute of a collection of vectors, and not individual vectors. Linearly independent vectors. A collection of n-vectors a1, . . . , ak (with k ≥ is called linearly independent if it is not linearly dependent, which means that 1) β1a1 + · · · + βkak = 0 (5.1) 90 5 Linear independence = βk = 0. In other words, the only linear combination of only holds for β1 = the vectors that equals the zero vector is the linear combination with all coefficients zero. · · · As with linear dependence, we will say “The vectors a1, . . . , ak are linearly independent” to mean “The list of vectors a1, . . . , ak is linearly independent”. But, like linear dependence, linear independence is an attribute of a collection of vectors, and not individual vectors. It is generally not easy to determine by casual inspection whether or not a list of vectors is linearly dependent or linearly independent. But we will soon see an algorithm that does this. Examples. • • • • • A list consisting of a single vector is linearly dependent only if the vector is zero. It is linearly independent only if the vector is nonzero. Any list of vectors containing the zero vector is linearly dependent. A list of two vectors is linearly dependent if and only if one of the vectors is a multiple of the other one. More generally, a list of vectors is linearly dependent if any one of the vectors is a multiple of another one. The vectors        −  , a1 = 0.1 0.2 2.0 7.0 1.0 8.6 − 3a3 = 0. We can express any of are linearly dependent, since a1 + 2a2 − these vectors as a linear combination of the other two. For example, we have a2 = ( 1/2)a1 + (3/2)a3. 0.0 1.0 2.2 a3 = a2 =  , − −    − The vectors a1 =   ,   1 0 0 a2 =   ,   0 1 1 − a3 =     − 1 1 1 are linearly independent. To see this, suppose β1a1 + β2a2 + β3a3 = 0. This means that β1 − β3 = 0, − β2 + β3 = 0, β2 + β3 = 0. Adding the last two equations we find that 2β3 = the first equation is then β1 = 0, and the second equation is β2 = 0. 0, so β3 = 0. Using this, − • The standard unit n-vectors e1, . . . , en are linearly independent. To see this, suppose that (5.1) holds. We have 0 = β1e1 + + βnen = · · ·    ,    β1 ... βn so we conclude that β1 = = βn = 0. · · · 5.2 Basis 91 Linear combinations of linearly independent vectors. Suppose a vector x is a linear combination of a1, . . . , ak, x = β1a1 + + βkak. · · · When the vectors a1, . . . , ak are linearly independent, the coefficients that form x are unique: If we also have x = γ1a1 + + γkak, · · · then βi = γi for i = 1, . . . , k. This tells us that, in principle at least, we can find the coefficients that form a vector x as a linear combination of linearly independent vectors. To see this, we subtract the two equations above to get 0 = (β1 − γ1)a1 + + (βk − · · · γk)ak. Since a1, . . . , ak are linearly independent, we conclude that βi − The converse is also true: If each linear combination of a list of vectors can only be expressed as a linear combination with one set of coefficients, then the list of vectors is linearly independent. This gives a nice interpretation of linear independence: A list of vectors is linearly independent if and only if for any linear combination of them, we can infer or deduce the associated coefficients. (We will see later how to do this.) γi are all zero. Supersets and subsets. If a collection of vectors is linearly dependent, then any superset of it is linearly dependent. In other words: If we add vectors to a linearly dependent collection of vectors, the new collection is also linearly dependent. Any nonempty subset of a linearly independent collection of vectors is linearly independent. In other words: Removing vectors from a collection of vectors preserves linear independence. 5.2 Basis Independence-dimension inequality. pendent, then k n. In words: ≤ If the n-vectors a1, . . . , ak are linearly inde- A linearly independent collection of n-vectors can have at most n elements. Put another way: Any collection of n + 1 or more n-vectors is linearly dependent. As a very simple example, we can conclude that any three 2-vectors must be linearly dependent. This is illustrated in figure 5.1. We will prove this fundamental fact below; but first, we describe the concept of basis, which relies on the independence-dimension inequality. 92 5 Linear independence Figure 5.1 Left. Three 2-vectors. Right. The vector a3 is a linear combination of a1 and a2, which shows that the vectors are linearly dependent. Basis. A collection of n linearly independent n-vectors (i.e., a collection of linearly independent vectors of the maximum possible size) is called a basis. If the n-vectors a1, . . . , an are a basis, then any n-vector b can be written as a linear combination of them. To see this, consider the collection of n + 1 n-vectors a1, . . . , an, b. By the independence-dimension inequality, these vectors are linearly dependent, so there are β1, . . . , βn+1, not all zero, that satisfy β1a1 + · · · + βnan + βn+1b = 0. If βn+1 = 0, then we have β1a1 + · · · + βnan = 0, which, since a1, . . . , an are linearly independent, implies that β1 = But then all the βi are zero, a contradiction. So we conclude that βn+1 follows that · · · = βn = 0. = 0. It · · · i.e., b is a linear combination of a1, . . . , an. − b = ( β1/βn+1)a1 + + ( − βn/βn+1)an, Combining this result with the observation above that any linear combination of linearly independent vectors can be expressed in only one way, we conclude: Any n-vector b can be written in a unique way as a linear combination of a basis a1, . . . , an. Expansion in a basis. When we express an n-vector b as a linear combination of a basis a1, . . . , an, we refer to b = α1a1 + + αnan, · · · as the expansion of b in the a1, . . . , an basis. The numbers α1, . . . , αn are called the coefficients of the expansion of b in the basis a1, . . . , an. (We will see later how to find the coefficients in the expansion of a vector in a basis.) a1a2a3a3γ1a1γ2a2 5.2 Basis Examples. 93 • The n standard unit n vectors e1, . . . , en are a basis. Any n-vector b can be written as the linear combination b = b1e1 + + bnen. · · · (This was already observed on page 17.) This expansion is unique, which means that there is no other linear combination of e1, . . . , en that equals b. The vectors • a1 = , 1.2 2.6 − a2 = 0.3 3.7 − − are a basis. The vector b = (1, 1) can be expressed in only one way as a linear combination of them: b = 0.6513 a1 − 0.7280 a2. (The coefficients are given here to 4 significant digits. We will see later how these coefficients can be computed.) Cash flows and single period loans. As a practical example, we consider cash flows over n periods, with positive entries meaning income or cash in and negative entries meaning payments or cash out. We define the single-period loan cash flow vectors as  li =     1 0i − 1 (1 + r) − 0n , . . . , n 1, − ≥ where r 0 is the per-period interest rate. The cash flow li represents a loan of $1 in period i, which is paid back in period i + 1 with interest r. (The subscripts on the zero vectors above give their dimensions.) Scaling li changes the loan amount; scaling li by a negative coefficient converts it into a loan to another entity (which is paid back in period i + 1 with interest). The vectors e1, l1, . . . , ln 1 are a basis. (The first vector e1 represents income of $1 in period 1.) To see this, we show that they are linearly independent. Suppose that − β1e1 + β2l1 + + βnln 1 = 0. − · · · We can express this as        β1 + β2 (1 + r)β2 ... (1 + r)βn (1 + r)βn − β3 − βn − −        1 = 0. The last entry is Using βn = 0, the second to last entry becomes that βn (1 + r)βn = 0, which implies that βn = 0 (since 1 + r > 0). 1 = 0, so we conclude 2, . . . , β2 are all zero. The 1 = 0. Continuing this way we find that βn (1 + r)βn − − − − − 94 5 Linear independence first entry of the equation above, β1 + β2 = 0, then implies β1 = 0. We conclude that the vectors e1, l1, . . . , ln 1 are linearly independent, and therefore a basis. This means that any cash flow n-vector c can be expressed as a linear combi- − nation of (i.e., replicated by) an initial payment and one period loans: c = α1e1 + α2l1 + + αnln 1. − · · · It is possible to work out what the coefficients are (see exercise 5.3). The most interesting one is the first coefficient α1 = c1 + c2 1 + r + · · · + cn (1 + r)n 1 , − which is exactly the net present value (NPV) of the cash flow, with interest rate r. Thus we see that any cash flow can be replicated as an income in period 1 equal to its net present value, plus a linear combination of one-period loans at interest rate r. Proof of independence-dimension inequality. The proof is by induction on the dimension n. First consider a linear
ly independent collection a1, . . . , ak of 1-vectors. = 0. This means that every element ai of the collection can be We must have a1 expressed as a multiple ai = (ai/a1)a1 of the first element a1. This contradicts linear independence unless k = 1. Next suppose n 2 and the independence-dimension inequality holds for di1. Let a1, . . . , ak be a linearly independent list of n-vectors. We need ≥ mension n to show that k − ≤ n. We partition the vectors as bi αi ai = , i = 1, . . . , k, where bi is an (n 1)-vector and αi is a scalar. First suppose that α1 = − independent: k i=1 βibi = 0 holds if and only if k possible for β1 = · · · The vectors b1, . . . , bk therefore form a linearly independent collection of (n n. vectors. By the induction hypothesis we have k = αk = 0. Then the vectors b1, . . . , bk are linearly i=1 βiai = 0, which is only = βk = 0 because the vectors ai are linearly independent. 1)- 1, so certainly k · · · − n Next suppose that the scalars αi are not all zero. Assume αj 1 vectors ci of length n 1 as follows: collection of k ≤ − ≤ = 0. We define a ci = bi − αi αj − bj, − ci = bi+1 − 1 vectors are linearly independent: If k i = 1, . . . , j − 1, αi+1 αj bj, i = j, . . . , k 1. − 1 i=1 βici = 0 then − j 1 − i=1 bi αi βi + γ bj αj + k i=j+1 bi αi βi − 1 = 0 (5.2) γ = 1 αj ( − j 1 − i=1 βiαi + k i=j+1 βi 1αi). − These k − with 5.3 Orthonormal vectors 95 Figure 5.2 Orthonormal vectors in a plane. Since the vectors ai = (bi, αi) are linearly independent, the equality (5.2) only holds when all the coefficients βi and γ are all zero. This in turns implies that the vectors c1, . . . , ck 1, so we have established that k 1 are linearly independent. By the induction hypothesis k n. − − ≤ n 1 − ≤ 5.3 Orthonormal vectors A collection of vectors a1, . . . , ak is orthogonal or mutually orthogonal if ai ⊥ aj for = j, i, j = 1, . . . , k. A collection of vectors a1, . . . , ak is orthonormal any i, j with i = 1 for i = 1, . . . , k. (A vector of norm one is called if it is orthogonal and normalized ; dividing a vector by its norm is called normalizing it.) Thus, each vector in an orthonormal collection of vectors is normalized, and two different vectors from the collection are orthogonal. These two conditions can be combined into one statement about the inner products of pairs of vectors in the collection: a1, . . . , ak is orthonormal means that ai aT i aj = 1 0 i = j = j. i Orthonormality, like linear dependence and independence, is an attribute of a collection of vectors, and not an attribute of vectors individually. By convention, though, we say “The vectors a1, . . . , ak are orthonormal” to mean “The collection of vectors a1, . . . , ak is orthonormal”. Examples. The standard unit n-vectors e1, . . . , en are orthonormal. As another example, the 3-vectors   ,   0 0 1 −   1 √2 1 1 0 −   , (5.3) are orthonormal. Figure 5.2 shows a set of two orthonormal 2-vectors. Linear independence of orthonormal vectors. Orthonormal vectors are linearly independent. To see this, suppose a1, . . . , ak are orthonormal, and β1a1 + · · · + βkak = 0. 96 5 Linear independence Taking the inner product of this equality with ai yields 0 = aT i (β1a1 + i a1) + · · · + βkak) + βk(aT i ak) · · · = β1(aT = βi, since aT = i and aT a1, . . . , ak that is zero is the one with all coefficients zero. i aj = 0 for j i ai = 1. Thus, the only linear combination of Linear combinations of orthonormal vectors. Suppose a vector x is a linear combination of a1, . . . , ak, where a1, . . . , ak are orthonormal, x = β1a1 + + βkak. · · · Taking the inner product of the left-hand and right-hand sides of this equation with ai yields aT i x = aT i (β1a1 + + βkak) = βi, · · · using the same argument as above. So if a vector x is a linear combination of orthonormal vectors, we can easily find the coefficients of the linear combination by taking the inner products with the vectors. For any x that is a linear combination of orthonormal vectors a1, . . . , ak, we have the identity x = (aT 1 x)a1 + + (aT k x)ak. · · · (5.4) This identity gives us a simple way to check if an n-vector y is a linear combination of the orthonormal vectors a1, . . . , ak. If the identity (5.4) holds for y, i.e., y = (aT 1 y)a1 + + (aT k y)ak, · · · then (evidently) y is a linear combination of a1, . . . , ak; conversely, if y is a linear combination of a1, . . . , ak, the identity (5.4) holds for y. Orthonormal basis. If the n-vectors a1, . . . , an are orthonormal, they are linearly independent, and therefore also a basis. In this case they are called an orthonormal basis. The three examples above (on page 95) are orthonormal bases. If a1, . . . , an is an orthonormal basis, then we have, for any n-vector x, the identity x = (aT 1 x)a1 + + (aT n x)an. · · · (5.5) To see this, we note that since a1, . . . , an are a basis, x can be expressed as a linear combination of them; hence the identity (5.4) above holds. The equation above is sometimes called the orthonormal expansion formula; the right-hand side is called the expansion of x in the basis a1, . . . , an. It shows that any n-vector can be expressed as a linear combination of the basis elements, with the coefficients given by taking the inner product of x with the elements of the basis. As an example, we express the 3-vector x = (1, 2, 3) as a linear combination of the orthonormal basis given in (5.3). The inner products of x with these vectors 5.4 Gram–Schmidt algorithm 97 are  T  x = 32 ,   1 √2 . It can be verified that the expansion of x in this basis is  x = ( − 3)    +   1 √2   3 √2   1 √.4 Gram–Schmidt algorithm In this section we describe an algorithm that can be used to determine if a list of n-vectors a1, . . . , ak is linearly independent. In later chapters we will see that it has many other uses as well. The algorithm is named after the mathematicians Jørgen Pedersen Gram and Erhard Schmidt, although it was already known before their work. If the vectors are linearly independent, the Gram–Schmidt algorithm produces an orthonormal collection of vectors q1, . . . , qk with the following properties: For each i = 1, . . . , k, ai is a linear combination of q1, . . . , qi, and qi is a linear com1 are linearly independent, but bination of a1, . . . , ai. a1, . . . , aj are linearly dependent, the algorithm detects this and terminates. In other words, the Gram–Schmidt algorithm finds the first vector aj that is a linear combination of previous vectors a1, . . . , aj If the vectors a1, . . . , aj 1. − − Algorithm 5.1 Gram–Schmidt algorithm given n-vectors a1, . . . , ak for i = 1, . . . , k, 1. Orthogonalization. ˜qi = ai 2. Test for linear dependence. if ˜qi = 0, quit. 3. Normalization. qi = ˜qi/ 1 ai)q1 − ˜qi (qT − · · · − (qT i − 1ai)qi 1 − The orthogonalization step, with i = 1, reduces to ˜q1 = a1. If the algorithm does not quit (in step 2), i.e., ˜q1, . . . , ˜qk are all nonzero, we can conclude that the original collection of vectors is linearly independent; if the algorithm does quit early, say, with ˜qj = 0, we can conclude that the original collection of vectors is linearly dependent (and indeed, that aj is a linear combination of a1, . . . , aj 1). Figure 5.3 illustrates the Gram–Schmidt algorithm for two 2-vectors. The top row shows the original vectors; the middle and bottom rows show the first and second iterations of the loop in the Gram–Schmidt algorithm, with the left-hand side showing the orthogonalization step, and the right-hand side showing the normalization step. − 98 5 Linear independence Figure 5.3 Gram–Schmidt algorithm applied to two 2-vectors a1, a2. Top. The original vectors a1 and a2. The gray circle shows the points with norm one. Middle left. The orthogonalization step in the first iteration yields ˜q1 = a1. Middle right. The normalization step in the first iteration scales ˜q1 to have norm one, which yields q1. Bottom left. The orthogonalization step in the second iteration subtracts a multiple of q1 to yield the vector ˜q2, which is orthogonal to q1. Bottom right. The normalization step in the second iteration scales ˜q2 to have norm one, which yields q2. a1a2˜q1a2q1a2q1a2−(qT1a2)q1˜q2q1q2 5.4 Gram–Schmidt algorithm 99 Analysis of Gram–Schmidt algorithm. Let us show that the following hold, for i = 1, . . . , k, assuming a1, . . . , ak are linearly independent. = 0, so the linear dependence test in step 2 is not satisfied, and we do not 1. ˜qi have a divide-by-zero error in step 3. 2. q1, . . . , qi are orthonormal. 3. ai is a linear combination of q1, . . . , qi. 4. qi is a linear combination of a1, . . . , ai. )a1, so assertions 3 and 4 hold. = 0, and therefore ˜q1 = 1, so assertion 2 holds. We have a1 = We show this by induction. For i = 1, we have ˜q1 = a1. Since a1, . . . , ak are = 0, so assertion 1 linearly independent, we must have a1 holds. The single vector q1 (considered as a list with one element) is evidently orthonormal, since q1, and ˜q1 q1 = (1/ q1 Suppose our assertion holds for some i 1, with i < k; we will show it holds for i. 1 (from the first step in the If ˜qi = 0, then ai is a linear combination of q1, . . . , qi algorithm); but each of these is (by the induction hypothesis) a linear combination of a1, . . . , ai 1, which contradicts our assumption that a1, . . . , ak are linearly independent. So assertion 1 holds for i. 1, so it follows that ai is a linear combination of a1, . . . , ai ˜q1 − − − − Step 3 of the algorithm ensures that q1, . . . , qi are normalized; to show they are 1. (Our induction hypothesis qj for j = 1, . . . , i 1, we have (using step 1) − qs for r, s < i.) For any j = 1, . . . , i orthogonal we will show that qi ⊥ tells us that qr ⊥ j ˜qi = qT qT = qT j ai − j ai − = k and qT j q1) (qT 1 ai)(qT qT j ai = 0, − · · · − − (qT i − 1ai)(qT j qi 1) − j qk = 0 for j using qT orthogonalization step: We subtract from ai a linear combination of q1, . . . , qi that ensures qi ⊥ j = 1, . . . , i j qj = 1. (This explains why step 1 is called the 1 − i
qj = 0 for ˜qj for j < i.) Since qi = (1/ 1. So assertion 2 holds for i. )˜qi, we have qT ˜qi It is immediate that ai is a linear combination of q1, . . . , qi: − ai = ˜qi + (qT = (qT 1 ai)q1 + 1 ai)q1 + + (qT i − 1ai)qi 1ai)qi qT i − qi. ˜qi · · · From step 1 of the algorithm, we see that ˜qi is a linear combination of the vectors a1, q1, . . . , qi 1 is a linear combination of a1, . . . , ai 1, so ˜qi (and therefore also qi) is a linear combination of a1, . . . , ai. Thus assertions 3 and 4 hold. 1. By the induction hypothesis, each of q1, . . . , qi − − − Gram–Schmidt completion implies linear independence. From the properties 1–4 above, we can argue that the original collection of vectors a1, . . . , ak is linearly independent. To see this, suppose that β1a1 + · · · + βkak = 0 (5.6) 100 5 Linear independence holds for some β1, . . . , βk. We will show that β1 = = βk = 0. We first note that any linear combination of q1, . . . , qk 1 is orthogonal to any 1qk = 0 (by definition). But each of = 1 = 0. Taking the inner product of qk with the left- and right-hand sides 1 is a linear combination of q1, . . . , qk 1, so we have qT = qT k − multiple of qk, since qT a1, . . . , ak qT k ak of (5.6) we obtain k a1 = 1 qk = · · · · · · − − − − · · · · · · + βkak) 1qT + βk − · · · k ak 1 + βkqT k ak − 0 = qT k (β1a1 + k a1 + , ˜qk = β1qT = βk ˜qk where we use qT k ak = From (5.6) and βk = 0 we have in the last line. We conclude that βk = 0. β1a1 + + βk 1ak − · · · 1 = 0. − We now repeat the argument above to conclude that βk times we conclude that all βi are zero. − 1 = 0. Repeating it k Early termination. Suppose that the Gram–Schmidt algorithm terminates prematurely, in iteration j, because ˜qj = 0. The conclusions 1–4 above hold for i = 1, . . . , j 1, since in those steps ˜qi is nonzero. Since ˜qj = 0, we have − aj = (qT 1 aj)q1 + + (qT j − 1aj)qj 1, − · · · which shows that aj is a linear combination of q1, . . . , qj 1. But each of these vectors is in turn a linear combination of a1, . . . , aj 1, by conclusion 3 above. Then 1, since it is a linear combination of linear aj is a linear combination of a1, . . . , aj combinations of them (see exercise 1.18). This means that a1, . . . , aj are linearly dependent, which implies that the larger set a1, . . . , ak is linearly dependent. − − − In summary, the Gram–Schmidt algorithm gives us an explicit method for de- termining if a list of vectors is linearly dependent or independent. Example. We define three vectors a1 = ( 1, 1, − 1, 1), − a2 = ( − 1, 3, 1, 3), − a3 = (1, 3, 5, 7). Applying the Gram–Schmidt algorithm gives the following results. • • i = 1. We have ˜q1 = 2, so 1 ˜q1 which is simply a1 normalized. q1 = ˜q1 = ( 1/2, 1/2, 1/2, 1/2), − − i = 2. We have qT 1 a2 = 4, so ˜q2 = a2 − (qT 1 a2)q1 =     − − /2 1/2 1/2 1/.4 Gram–Schmidt algorithm 101 which is indeed orthogonal to q1 (and a1). It has norm it gives ˜q2 = 2; normalizing q2 = 1 ˜q2 1 a3 = 2 and qT i = 3. We have qT • 2 a3 = 8, so ˜q2 = (1/2, 1/2, 1/2, 1/2).  ˜q3 = a3 − 1 3 5 7    = (qT 1 a3)q1 −   −    − 2    − (qT 1/2 1/2 1/2 1/2 2 a3)q2     − /2 1/2 1/2 1/ which is orthogonal to q1 and q2 (and a1 and a2). We have normalized vector is ˜q3 = 4, so the q3 = 1 ˜q3 ˜q3 = ( 1/2, − 1/2, 1/2, 1/2). − Completion of the Gram–Schmidt algorithm without early termination tells us that the vectors a1, a2, a3 are linearly independent. Determining if a vector is a linear combination of linearly independent vectors. Suppose the vectors a1, . . . , ak are linearly independent, and we wish to determine if another vector b is a linear combination of them. (We have already noted on page 91 that if it is a linear combination of them, the coefficients are unique.) The Gram–Schmidt algorithm provides an explicit way to do this. We apply the Gram–Schmidt algorithm to the list of k + 1 vectors a1, . . . , ak, b. These vectors are linearly dependent if b is a linear combination of a1, . . . , ak; they are linearly independent if b is not a linear combination of a1, . . . , ak. The Gram–Schmidt algorithm will determine which of these two cases holds. It cannot terminate in the first k steps, since we assume that a1, . . . , ak are linearly independent. It will terminate in the (k+1)st step with ˜qk+1 = 0 if b is a linear combination of a1, . . . , ak. It will not terminate in the (k + 1)st step (i.e., ˜qk+1 = 0), otherwise. Checking if a collection of vectors is a basis. To check if the n-vectors a1, . . . , an are a basis, we run the Gram–Schmidt algorithm on them. If Gram–Schmidt terminates early, they are not a basis; if it runs to completion, we know they are a basis. 102 5 Linear independence Complexity of the Gram–Schmidt algorithm. We now derive an operation count for the Gram–Schmidt algorithm. In the first step of iteration i of the algorithm, i 1 inner products − qT 1 ai, . . . , qT i − 1ai between vectors of length n are computed. This takes (i then use these inner products as the coefficients in i the vectors q1, . . . , qi resulting vectors from ai, which requires another n(i for step 1 is 1. This requires n(i − − − − 1) flops. We then subtract the i − 1)(2n 1) flops. We − 1 scalar multiplications with 1 1) flops. The total flop count − 1)(2n (i − − 1) + n(i − 1) + n(i − 1) = (4n 1)(i 1) − − flops. In step 3 we compute the norm of ˜qi, which takes approximately 2n flops. We then divide ˜qi by its norm, which requires n scalar divisions. So the total flop count for the ith iteration is (4n 1) + 3n flops. 1)(i The total flop count for all k iterations of the algorithm is obtained by summing − − our counts for i = 1, . . . , k: k ((4n i=1 1)(i − − 1) + 3n) = (4n k(k 1) − 2 1) − + 3nk 2nk2, ≈ where we use the fact that k (i i=1 − 1) = 1 + 2 + + (k − · · · 2) + (k 1) = − k(k 1) , − 2 (5.7) which we justify below. The complexity of the Gram–Schmidt algorithm is 2nk2; its order is nk2. We can guess that its running time grows linearly with the lengths of the vectors n, and quadratically with the number of vectors k. In the special case of k = n, the complexity of the Gram–Schmidt method is 2n3. For example, if the Gram–Schmidt algorithm is used to determine whether a collection of 1000 1000-vectors is linearly independent (and therefore a basis), the 109 flops. On a modern computer, can we can computational cost is around 2 expect this to take on the order of one second. × A famous anecdote alleges that the formula (5.7) was discovered by the mathematician Carl Friedrich Gauss when he was a child, although it was known before that time. Here is his argument, for the case when k is odd. Lump the first entry in the sum together with the last entry, the second entry together with the secondto-last entry, and so on. Each of these pairs of numbers adds up to k; since there are (k 1)/2. A similar argument works when − k is even. 1)/2 such pairs, the total is k(k − Modified Gram–Schmidt algorithm. When the Gram–Schmidt algorithm is implemented, a variation on it called the modified Gram–Schmidt algorithm is typically used. This algorithm produces the same results as the Gram–Schmidt algorithm (5.1), but is less sensitive to the small round-off errors that occur when arithmetic calculations are done using floating point numbers. (We do not consider round-off error in floating-point computations in this book.) Exercises Exercises 103 5.1 Linear independence of stacked vectors. Consider the stacked vectors c1 = a1 b1 , . . . , ck = , ak bk where a1, . . . , ak are n-vectors and b1, . . . , bk are m-vectors. (a) Suppose a1, . . . , ak are linearly independent. (We make no assumptions about the vectors b1, . . . , bk.) Can we conclude that the stacked vectors c1, . . . , ck are linearly independent? (b) Now suppose that a1, . . . , ak are linearly dependent. (Again, with no assumptions about b1, . . . , bk.) Can we conclude that the stacked vectors c1, . . . , ck are linearly dependent? 5.2 A surprising discovery. An intern at a quantitative hedge fund examines the daily returns of around 400 stocks over one year (which has 250 trading days). She tells her supervisor that she has discovered that the returns of one of the stocks, Google (GOOG), can be expressed as a linear combination of the others, which include many stocks that are unrelated to Google (say, in a different type of business or sector). Her supervisor then says: “It is overwhelmingly unlikely that a linear combination of the returns of unrelated companies can reproduce the daily return of GOOG. So you’ve made a mistake in your calculations.” Is the supervisor right? Did the intern make a mistake? Give a very brief explanation. 5.3 Replicating a cash flow with single-period loans. We continue the example described on page 93. Let c be any n-vector representing a cash flow over n periods. Find the coefficients α1, . . . , αn of c in its expansion in the basis e1, l1, . . . , ln 1, i.e., − c = α1e1 + α2l1 + + αnln 1. − · · · Verify that α1 is the net present value (NPV) of the cash flow c, defined on page 22, with interest rate r. Hint. Use the same type of argument that was used to show that e1, l1, . . . , ln 1, and so on. 1 are linearly independent. Your method will find αn first, then αn − − 5.4 Norm of linear combination of orthonormal vectors. Suppose a1, . . . , ak are orthonormal in terms + βkak, where β1, . . . , βk are scalars. Express x n-vectors, and x = β1a1 + of β = (β1, . . . , βk). · · · 5.5 Orthogonalizing vectors. Suppose that a and b are any n-vectors. Show that we can always = 0. (Give a formula for find a scalar γ so that (a the scalar γ.) In other words, we can always subtract a multiple of a vector from another one, so that the result is orthogonal to the original vector. The orthogonalization step in the Gram–Schmidt algorithm is an application of this. 5.6 Gram–Schmidt algorithm. Consider the list of n n-vectors b, and that γ is unique if b γb) ⊥ − a1 =             1 0 0 ... 0 , a2 =             1 1 0 ... 0 , . . . , an =       .  
    1 1 1 ... 1 (The vector ai has its first i entries equal to one, and the remaining entries zero.) Describe what happens when you run the Gram–Schmidt algorithm on this list of vectors, i.e., say what q1, . . . , qn are. Is a1, . . . , an a basis? 104 5 Linear independence 5.7 Running Gram–Schmidt algorithm twice. We run the Gram–Schmidt algorithm once on a given set of vectors a1, . . . , ak (we assume this is successful), which gives the vectors q1, . . . , qk. Then we run the Gram–Schmidt algorithm on the vectors q1, . . . , qk, which produces the vectors z1, . . . , zk. What can you say about z1, . . . , zk? 5.8 Early termination of Gram–Schmidt algorithm. When the Gram–Schmidt algorithm is run on a particular list of 10 15-vectors, it terminates in iteration 5 (since ˜q5 = 0). Which of the following must be true? (a) a2, a3, a4 are linearly independent. (b) a1, a2, a5 are linearly dependent. (c) a1, a2, a3, a4, a5 are linearly dependent. (d) a4 is nonzero. 5.9 A particular computer can carry out the Gram–Schmidt algorithm on a list of k = 1000 n-vectors, with n = 10000, in around 2 seconds. About how long would you expect it to take to carry out the Gram–Schmidt algorithm with ˜k = 500 ˜n-vectors, with ˜n = 1000? Part II Matrices Chapter 6 Matrices In this chapter we introduce matrices and some basic operations on them. We give some applications in which they arise. 6.1 Matrices A matrix is a rectangular array of numbers written between rectangular brackets, as in   0 1.3 4.1 1 4 1 − − − 2.3 0.1 0 0.1 0 1.7   . It is also common to use large parentheses instead of rectangular brackets, as in   0 1.3 4.1 1 4 1 − − − 2.3 0.1 0 0.1 0 1.7   . × × An important attribute of a matrix is its size or dimensions, i.e., the numbers of 4. rows and columns. The matrix above has 3 rows and 4 columns, so its size is 3 A matrix of size m n is called an m n matrix. × The elements (or entries or coefficients) of a matrix are the values in the array. The i, j element is the value in the ith row and jth column, denoted by double subscripts: the i, j element of a matrix A is denoted Aij (or Ai,j, when i or j is more than one digit or character). The positive integers i and j are called the (row and column) indices. If A is an m n matrix, then the row index i runs from 1 to m and the column index j runs from 1 to n. Row indices go from top to bottom, so row 1 is the top row and row m is the bottom row. Column indices go from left to right, so column 1 is the left column and column n is the right column. × If the matrix above is B, then we have B13 = 2.3, B32 = 1. The row index of the bottom left element (which has value 4.1) is 3; its column index is 1. − − Two matrices are equal if they have the same size, and the corresponding entries are all equal. As with vectors, we normally deal with matrices with entries that 108 6 Matrices are real numbers, which will be our assumption unless we state otherwise. The set n. But matrices with complex entries, for n matrices is denoted Rm of real m × example, do arise in some applications. × Matrix indexing. As with vectors, standard mathematical notation indexes the rows and columns of a matrix starting from 1. In computer languages, matrices are often (but not always) stored as 2-dimensional arrays, which can be indexed in a variety of ways, depending on the language. Lower level languages typically use indices starting from 0; higher level languages and packages that support matrix operations usually use standard mathematical indexing, starting from 1. Square, tall, and wide matrices. A square matrix has an equal number of rows n is said to be of order n. A tall matrix and columns. A square matrix of size n × n with m > n). A wide matrix has more has more rows than columns (size m columns than rows (size m n with n > m). × × Column and row vectors. An n-vector can be interpreted as an n 1 matrix; we do not distinguish between vectors and matrices with one column. A matrix with only one row, i.e., with size 1 n, is called a row vector ; to give its size, we can refer to it as an n-row-vector. As an example, × × 2.1 − 3 − 0 is a 3-row-vector (or 1 are sometimes called column vectors. A 1 as a scalar. × × 3 matrix). To distinguish them from row vectors, vectors 1 matrix is considered to be the same Notational conventions. Many authors (including us) tend to use capital letters to denote matrices, and lower case letters for (column or row) vectors. But this convention is not standardized, so you should be prepared to figure out whether a symbol represents a matrix, column vector, row vector, or a scalar, from context. (The more considerate authors will tell you what the symbols represent, for example, by referring to ‘the matrix A’ when introducing it.) Columns and rows of a matrix. An m m-vectors)  aj =   n matrix A has n columns, given by (the ×    , A1j ... Amj for j = 1, . . . , n. The same matrix has m rows, given by the (n-row-vectors) bi = Ai1 Ain , · · · for i = 1, . . . , m. As a specific example, the 2 × 3 matrix 1 4 2 5 3 6 109 6.1 Matrices has first row 1 2 3 (which is a 3-row-vector or a 1 3 matrix), and second column × 2 5 (which is a 2-vector or 2 × 1 matrix), also written compactly as (2, 5). Block matrices and submatrices. are themselves matrices, as in It is useful to consider matrices whose entries A = B C D E , where B, C, D, and E are matrices. Such matrices are called block matrices; the elements B, C, D, and E are called blocks or submatrices of A. The submatrices can be referred to by their block row and column indices; for example, C is the 1,2 block of A. Block matrices must have the right dimensions to fit together. Matrices in the same (block) row must have the same number of rows (i.e., the same ‘height’); matrices in the same (block) column must have the same number of columns (i.e., the same ‘width’). In the example above, B and C must have the same number of rows, and C and E must have the same number of columns. Matrix blocks placed next to each other in the same row are said to be concatenated ; matrix blocks placed above each other are called stacked. As an example, consider . Then the block matrix A above is given by 6.1) (Note that we have dropped the left and right brackets that delimit the blocks. 1 matrix to get a scalar.) This is similar to the way we drop the brackets in a 1 We can also divide a larger matrix (or vector) into ‘blocks’. In this context the blocks are called submatrices of the big matrix. As with vectors, we can use colon notation to denote submatrices. If A is an m n matrix, and p, q, r, s are integers m and 1 with 1 n, then Ap:q,r:s denotes the submatrix × × p s r q ≤ ≤ ≤ ≤  ≤ ≤ Apr Ap,r+1 Ap+1,r Ap+1,r+1 ... Aqr ... Aq,r+1 Ap:q,r:s =          . Aps Ap+1,s ... Aqs · · · · · · · · · 110 6 Matrices p + 1) This submatrix has size (q A the elements in rows p through q and columns r through s. (s − − × r + 1) and is obtained by extracting from For the specific matrix A in (6.1), we have A2:3,3:4 = 1 5 . 4 4 Column and row representation of a matrix. Using block matrix notation we n matrix A as a block matrix with one block row and n block can write an m columns, × A = a1 a2 an · · · , where aj, which is an m-vector, is the jth column of A. Thus, an m can be viewed as its n columns, concatenated. × n matrix Similarly, an m n matrix A can be written as a block matrix with one block column and m block rows: × A =      ,      b1 b2 ... bm where bi, which is a row n-vector, is the ith row of A. In this notation, the matrix A is interpreted as its m rows, stacked. Examples Table interpretation. The most direct interpretation of a matrix is as a table of numbers that depend on two indices, i and j. (A vector is a list of numbers that depend on only one index.) In this case the rows and columns of the matrix usually have some simple interpretation. Some examples are given below. • • • Images. A black and white image with M N pixels is naturally represented × as an M N matrix. The row index i gives the vertical position of the pixel, the column index j gives the horizontal position of the pixel, and the i, j entry gives the pixel value. × × Rainfall data. An m n matrix A gives the rainfall at m different locations on n consecutive days, so A42 (which is a number) is the rainfall at location 4 on day 2. The jth column of A, which is an m-vector, gives the rainfall at the m locations on day j. The ith row of A, which is an n-row-vector, is the time series of rainfall at location i. Asset returns. A T n matrix R gives the returns of a collection of n assets (called the universe of assets) over T periods, with Rij giving the return of 0.03 means that asset 7 had a 3% loss in asset j in period i. So R12,7 = period 12. The 4th column of R is a T -vector that is the return time series − × 6.1 Matrices 111 Date AAPL GOOG MMM AMZN March 1, 2016 March 2, 2016 March 3, 2016 0.00219 0.00744 0.01488 0.00006 0.00894 0.00215 − − − − 0.00113 0.00019 0.00433 0.00202 0.00468 0.00407 − − Table 6.1 Daily returns of Apple (AAPL), Google (GOOG), 3M (MMM), and Amazon (AMZN), on March 1, 2, and 3, 2016 (based on closing prices). for asset 4. The 3rd row of R is an n-row-vector that gives the returns of all assets in the universe in period 3. An example of an asset return matrix, with a universe of n = 4 assets over T = 3 periods, is shown in table 6.1. Prices from multiple suppliers. An m n matrix P gives the prices of n different goods from m different suppliers (or locations): Pij is the price that supplier i charges for good j. The jth column of P is the m-vector of supplier prices for good j; the ith row gives the prices for all goods from supplier i. × × Contingency table. Suppose we have a collection of objects with two attributes, the first attribute with m possible values and the second with n possible values. An m n matrix A can be used to hold the counts of the numbers of objects with the different pairs of attributes: Aij is the
number of objects with first attribute i and second attribute j. (This is the analog of a count n-vector, that records the counts of one attribute in a collection.) For example, a population of college students can be described by a 4 50 matrix, with the i, j entry the number of students in year i of their studies, from state j (with the states ordered in, say, alphabetical order). The ith row of A gives the geographic distribution of students in year i of their studies; the jth column of A is a 4-vector giving the numbers of student from state j in their first through fourth years of study. × • • • Customer purchase history. An n N matrix P can be used to store a set of N customers’ purchase histories of n products, items, or services, over some period. The entry Pij represents the dollar value of product i that customer j purchased over the period (or as an alternative, the number or quantity of the product). The jth column of P is the purchase history vector for customer j; the ith row gives the sales report for product i across the N customers. × Matrix representation of a collection of vectors. Matrices are very often used as a compact way to give a set of indexed vectors of the same size. For example, if x1, . . . , xN are n-vectors that give the n feature values for each of N objects, we can collect them all into one n N matrix × X = x1 x2 xN , · · · 112 6 Matrices Figure 6.1 The relation (6.2) as a directed graph. often called a data matrix or feature matrix. Its jth column is the feature n-vector for the jth object (in this context sometimes called the jth example). The ith row of the data matrix X is an N -row-vector whose entries are the values of the ith feature across the examples. We can also directly interpret the entries of the data matrix: Xij (which is a number) is the value of the ith feature for the jth example. M matrix can be used to represent a collection of M locations or positions in 3-D space, with its jth column giving the jth position. As another example, a 3 × R on the set of objects Matrix representation of a relation or graph. Suppose we have n objects labeled 1, . . . , n. A relation is a subset of ordered pairs can represent a preference relation among n possible of objects. As an example, meaning that choice i is preferred to choice j. products or choices, with (i, j) A relation can also be viewed as a directed graph, with nodes (or vertices) labeled 1, . . . , n, and a directed edge from j to i for each (i, j) . This is typically drawn as a graph, with arrows indicating the direction of the edge, as shown in figure 6.1, for the relation on 4 objects 11, 2), (1, 3), (2, 1), (2, 4), (3, 4), (4, 1) { } . R (6.2) A relation on 1, . . . , n { } R is represented by the n n matrix A with × Aij = 1 0 (i, j) (i, j) ∈ R . ∈ R This matrix is called the adjacency matrix associated with the graph. (Some authors define the adjacency matrix in the reverse sense, with Aij = 1 meaning there is an edge from i to j.) The relation (6.2), for example, is represented by the matrix This is the adjacency matrix of the associated graph, shown in figure 6.1. (We will encounter another matrix associated with a directed graph in 7.3.) § 1234 6.2 Zero and identity matrices 113 6.2 Zero and identity matrices Zero matrix. A zero matrix is a matrix with all elements equal to zero. The zero matrix of size m n, but usually a zero matrix is denoted just 0, the same symbol used to denote the number 0 or zero vectors. In this case the size of the zero matrix must be determined from the context. n is sometimes written as 0m × × Identity matrix. An identity matrix is another common matrix. It is always square. Its diagonal elements, i.e., those with equal row and column indices, are all equal to one, and its off-diagonal elements (those with unequal row and column indices) are zero. Identity matrices are denoted by the letter I. Formally, the identity matrix of size n is defined by Iij = 1 0 i = j = j, i for i, j = 1, . . . , n. For example identity matrices. are the 2 2 and 4 × × The column vectors of the n n identity matrix are the unit vectors of size n. Using block matrix notation, we can write × I = e1 e2 , en · · · where ek is the kth unit vector of size n. Sometimes a subscript is used to denote the size of an identity matrix, as in 2. But more often the size is omitted and follows from the context. For I4 or I2 example, if × then The dimensions of the two identity matrices follow from the size of A. The identity matrix in the 1,1 position must be 2 2, and the identity matrix in the 2,2 position 3. This also determines the size of the zero matrix in the 2,1 position. must be 3 × × The importance of the identity matrix will become clear later, in 10.1. § 114 6 Matrices Sparse matrices. A matrix A is said to be sparse if many of its entries are zero, or (put another way) just a few of its entries are nonzero. Its sparsity pattern is = 0. The number of nonzeros of a sparse the set of indices (i, j) for which Aij matrix A is the number of entries in its sparsity pattern, and denoted nnz(A). If mn. Its density is nnz(A)/(mn), which is no more n we have nnz(A) A is m than one. Densities of sparse matrices that arise in applications are typically small 4. There is no precise definition of how small the or very small, as in 10− density must be for a matrix to qualify as sparse. A famous definition of sparse matrix due to the mathematician James H. Wilkinson is: A matrix is sparse if it has enough zero entries that it pays to take advantage of them. Sparse matrices can be stored and manipulated efficiently on a computer. ≤ 2 or 10− × Many common matrices are sparse. An n n identity matrix is sparse, since it has only n nonzeros, so its density is 1/n. The zero matrix is the sparsest possible matrix, since it has no nonzero entries. Several special sparsity patterns have names; we describe some important ones below. × Like sparse vectors, sparse matrices arise in many applications. A typical customer purchase history matrix (see page 111) is sparse, since each customer has likely only purchased a small fraction of all the products available. Diagonal matrices. A square n n matrix A is diagonal if Aij = 0 for i = j. (The entries of a matrix with i = j are called the diagonal entries; those with i = j are its off-diagonal entries.) A diagonal matrix is one for which all off-diagonal entries are zero. Examples of diagonal matrices we have already seen are square zero matrices and identity matrices. Other examples are × 3 − 0 , 0 0   0..2 (Note that in the first example, one of the diagonal elements is also zero.) The notation diag(a1, . . . , an) is used to compactly describe the n n diagonal matrix A with diagonal entries A11 = a1, . . . , Ann = an. This notation is not yet standard, but is coming into more prevalent use. As examples, the matrices above would be expressed as × diag( 3, 0), − diag(0.2, 3, 1.2), − respectively. We also allow diag to take one n-vector argument, as in I = diag(1). Triangular matrices. A square n n matrix A is upper triangular if Aij = 0 for i > j, and it is lower triangular if Aij = 0 for i < j. (So a diagonal matrix is one that is both lower and upper triangular.) If a matrix is either lower or upper triangular, it is called triangular. For example, the matrices ×   1 0 0 1 − 1.2 0 0.7 1.1 3.2 −   , 0.6 0.3 − − , 0 3.5 are upper and lower triangular, respectively. 6.3 Transpose, addition, and norm 115 A triangular n n matrix A has up to n(n + 1)/2 nonzero entries, i.e., around half its entries are zero. Triangular matrices are generally not considered sparse matrices, since their density is around 50%, but their special sparsity pattern will be important in the sequel. × 6.3 Transpose, addition, and norm 6.3.1 Matrix transpose n matrix, its transpose, denoted AT (or sometimes A or A∗), is the m matrix given by (AT )ij = Aji. In words, the rows and columns of A are If A is an m n transposed in AT . For example If we transpose a matrix twice, we get back the original matrix: (AT )T = A. (The superscript T in the transpose is the same one used to denote the inner product of two n-vectors; we will soon see how they are related.) Row and column vectors. Transposition converts row vectors into column vectors and vice versa. It is sometimes convenient to express a row vector as aT , where n a is a column vector. For example, we might refer to the m rows of an m matrix A as ˜aT m, where ˜a1, . . . , ˜am are (column) n-vectors. As an example, the second row of the matrix i , . . . , ˜aT × 3 1 can be written as (the row vector) (4, 0, 1)T . 7 0 0 4 It is common to extend concepts from (column) vectors to row vectors, by applying the concept to the transposed row vectors. We say that a collection of row vectors is linearly dependent (or independent) if their transposes (which are column vectors) are linearly dependent (or independent). For example, ‘the rows of a matrix A are linearly independent’ means that the columns of AT are linearly independent. As another example, ‘the rows of a matrix A are orthonormal’ means that their transposes, the columns of AT , are orthonormal. ‘Clustering the rows of a matrix X’ means clustering the columns of X T . Transpose of block matrix. The transpose of a block matrix has the simple form (shown here for a 2 × 2 block matrix) A B C D T AT C T BT DT = , where A, B, C, and D are matrices with compatible sizes. The transpose of a block matrix is the transposed block matrix, with each element transposed. 116 6 Matrices Document-term matrix. Consider a corpus (collection) of N documents, with word count vectors for a dictionary with n words. The document-term matrix n matrix A, with Aij the number of times word associated with the corpus is the N × j appears in document i. The rows of the document-term matrix are aT 1 , . . . , aT N , where the n-vectors a1, . . . , aN are the word count vectors for documents 1, . . . , N , respectively. The columns of the document-term ma
trix are also interesting. The jth column of A, which is an N -vector, gives the number of times word j appears in the corpus of N documents. × Data matrix. A collection of N n-vectors, for example feature n-vectors associated with N objects, can be given as an n N matrix whose N columns are the vectors, as described on page 111. It is also common to describe this collection of vectors n using the transpose of that matrix. In this case, we give the vectors as an N matrix X. Its ith row is xT i , the transpose of the ith vector. Its jth column gives the value of the jth entry (or feature) across the collection of N vectors. When an author refers to a data matrix or feature matrix, it can usually be determined from context (for example, its dimensions) whether they mean the data matrix organized by rows or columns. × Symmetric matrix. A square matrix A is symmetric if A = AT , i.e., Aij = Aji for all i, j. Symmetric matrices arise in several applications. For example, suppose that A is the adjacency matrix of a graph or relation (see page 112). The matrix A is symmetric when the relation is symmetric, i.e., whenever (i, j) , we also have (j, i) ∈ R means that person i and person j are friends. (In this case the associated graph is called the ‘social network graph’.) . An example is the friend relation on a set of n people, where (i, j) ∈ R ∈ R 6.3.2 Matrix addition Two matrices of the same size can be added together. The result is another matrix of the same size, obtained by adding the corresponding elements of the two matrices. For example Matrix subtraction is similar. As an exampleThis gives another example where we have to figure out the size of the identity matrix. Since we can only add or subtract matrices of the same size, I refers to a 2 2 identity matrix.) × Properties of matrix addition. The following important properties of matrix addition can be verified directly from the definition. We assume here that A, B, and C are matrices of the same size. 6.3 Transpose, addition, and norm 117 • • • • Commutativity. A + B = B + A. Associativity. A + B + C. (A + B) + C = A + (B + C). We therefore write both as Addition with zero matrix. Adding the zero matrix to a matrix has no effect. Transpose of sum. (A + B)T = AT + BT . The transpose of a sum of two matrices is the sum of their transposes. 6.3.3 Scalar-matrix multiplication Scalar multiplication of matrices is defined in a similar way as for vectors, and is done by multiplying every element of the matrix by the scalar. For example   ) −   . − 12 6 − 0 2 − 18 12 − − As with scalar-vector multiplication, the scalar can also appear on the right. Note that 0 A = 0 (where the left-hand zero is the scalar zero, and the right-hand 0 is the zero matrix). Several useful properties of scalar multiplication follow directly from the definition. For example, (βA)T = β(AT ) for a scalar β and a matrix A. If A is a matrix and β, γ are scalars, then (β + γ)A = βA + γA, (βγ)A = β(γA). It is useful to identify the symbols appearing in these two equations. The + symbol on the left of the left-hand equation is addition of scalars, while the + symbol on the right of the left-hand equation denotes matrix addition. On the left side of the right-hand equation we see scalar-scalar multiplication (αβ) and scalar-matrix multiplication; on the right we see two cases of scalar-matrix multiplication. Finally, we mention that scalar-matrix multiplication has higher precedence than matrix addition, which means that we should carry out multiplication before addition (when there are no parentheses to fix the order). So the right-hand side of the left equation above is to be interpreted as (βA) + (γA). 6.3.4 Matrix norm The norm of an m × squares of its entries, n matrix A, denoted A , is the squareroot of the sum of the m n i=1 j=1 A2 ij. = A (6.3) 118 6 Matrices × This agrees with our definition for vectors when A is a vector, i.e., n = 1. The norm of an m n matrix is the norm of an mn-vector formed from the entries of the matrix (in any order). Like the vector norm, the matrix norm is a quantitative In some applications it is more natural measure of the magnitude of a matrix. /√mn, as a measure of matrix to use the RMS values of the matrix entries, size. The RMS value of the matrix entries tells us the typical size of the entries, independent of the matrix dimensions. A n matrix A, we have The matrix norm (6.3) satisfies the properties of any norm, given on page 46. = For any m 0 only if A = 0 (definiteness). The matrix norm is nonnegative homogeneous: For any scalar γ and m . Finally, for any two m | n matrices A and B, we have the triangle inequality, 0 (i.e., the norm is nonnegative), and n matrix A, we have γA The plus symbol on the left-hand side is matrix addition, and the plus symbol on the right-hand side is addition of numbers.) A B − The matrix norm allows us to define the distance between two matrices as . As with vectors, we can say that one matrix is close to, or near, another one if their distance is small. (What qualifies as small depends on the application.) In this book we will only use the matrix norm (6.3). Several other norms of a matrix are commonly used, but are beyond the scope of this book. In contexts where other norms of a matrix are used, the norm (6.3) is called the Frobenius norm, after the mathematician Ferdinand Georg Frobenius, and is usually denoted with a subscript, as F . One simple property of the matrix norm is A , i.e., the norm of a = A AT matrix is the same as the norm of its transpose. Another one is A 2 = 2 + a1 · · · + 2, an where a1, . . . , an are the columns of A. In other words: The squared norm of a matrix is the sum of the squared norms of its columns. 6.4 Matrix-vector multiplication If A is an m is the m-vector y with elements × n matrix and x is an n-vector, then the matrix-vector product y = Ax yi = n k=1 Aikxk = Ai1x1 + · · · + Ainxn, i = 1, . . . , m. (6.4) As a simple example, we have 0)(2) + (2)(1) + ( 1)( 2)(2) + (1)(1) + (1)( − ( − = 1) 1) . 3 4 − − − 6.4 Matrix-vector multiplication 119 Row and column interpretations. We can express the matrix-vector product in terms of the rows or columns of the matrix. From (6.4) we see that yi is the inner product of x with the ith row of A: yi = bT i = 1, . . . , m, i x, where bT i terms of the columns of A. written is the row i of A. The matrix-vector product can also be interpreted in If ak is the kth column of A, then y = Ax can be This shows that y = Ax is a linear combination of the columns of A; the coefficients in the linear combination are the elements of x. y = x1a1 + x2a2 + + xnan. · · · General examples. n-vector. In the examples below, A is an m n matrix and x is an × • • • • • Zero matrix. When A = 0, we have Ax = 0. In other words, 0x = 0. (The left-hand 0 is an m n matrix, and the right-hand zero is an m-vector.) × Identity. We have Ix = x for any vector x. (The identity matrix here has dimension n n.) In other words, multiplying a vector by the identity matrix gives the same vector. × Picking out columns and rows. An important identity is Aej = aj, the jth column of A. Multiplying a unit vector by a matrix ‘picks out’ one of the columns of the matrix. AT ei, which is an n-vector, is the ith row of A, transposed. (In other words, (AT ei)T is the ith row of A.) Summing or averaging columns or rows. The m-vector A1 is the sum of the columns of A; its ith entry is the sum of the entries in the ith row of A. The m-vector A(1/n) is the average of the columns of A; its ith entry is the average of the entries in the ith row of A. In a similar way, AT 1 is an n-vector, whose jth entry is the sum of the entries in the jth column of A. Difference matrix. The () × 1 1 − n matrix 6.5) (where entries not shown are zero, and entries with diagonal dots are 1 or 1, continuing the pattern) is called the difference matrix. The vector Dx is − the (n − 1)-vector of differences of consecutive entries of x:   Dx =     x1 x2 x2 − x3 − ... xn xn − −     . 1 120 6 Matrices • Running sum matrix. The matrix 6.6) is called the running sum matrix. The ith entry of the n-vector Sx is the sum of the first i entries of x: Sx =        x1 x1 + x2 x1 + x2 + x3 ... x1 + · · · + xn        . Application examples. • • • Feature matrix and weight vector. Suppose X is a feature matrix, where its N columns x1, . . . , xN are feature n-vectors for N objects or examples. Let the n-vector w be a weight vector, and let si = xT i w be the score associated with object i using the weight vector w. Then we can write s = X T w, where s is the N -vector of scores of the objects. Portfolio return time series. Suppose that R is a T n asset return matrix, that gives the returns of n assets over T periods. A common trading strategy maintains constant investment weights given by the n-vector w over the T periods. For example, w4 = 0.15 means that 15% of the total portfolio value is held in asset 4. (Short positions are denoted by negative entries in w.) Then Rw, which is a T -vector, is the time series of the portfolio returns over the periods 1, . . . , T . × As an example, consider a portfolio of the 4 assets in table 6.1, with weights 0.00201, 0.00241) w = (0.4, 0.3, gives the portfolio returns over the three periods in the example. 0.2, 0.5). The product Rw = (0.00213, − − Polynomial evaluation at multiple points. Suppose the entries of the n-vector c are the coefficients of a polynomial p of degree n 1 or less: p(t) = c1 + c2t + + cn 1tn − − · · · − 2 + cntn 1. − Let t1, . . . , tm be m numbers, and define the m-vector y as yi = p(ti). Then we have y = Ac, where A is the m n matrix A =      1 1 ... 1 × · · · · · · t1 t2 ... tm · · · 2 2 − − tn 1 tn 2 ... tn m 2 − 1 1 − − tn 1 tn 2 ... tn 6.7) 6.4 Matrix-vector multiplication 121 So multiplying a vector c by the matrix A is the same as evaluating a polynomial with coefficients c at m points. The matrix A in (6.7) comes up often, and is called a Vandermonde matrix (of de
gree n 1, at the points t1, . . . , tm), named for the mathematician Alexandre-Th´eophile Vandermonde. − • • Total price from multiple suppliers. Suppose the m n matrix P gives the prices of n goods from m suppliers (or in m different locations). If q is an n-vector of quantities of the n goods (sometimes called a basket of goods), then c = P q is an N -vector that gives the total cost of the goods, from each of the N suppliers. × Document scoring. Suppose A in an N n document-term matrix, which gives × the word counts of a corpus of N documents using a dictionary of n words, so the rows of A are the word count vectors for the documents. Suppose that w in an n-vector that gives a set of weights for the words in the dictionary. Then s = Aw is an N -vector that gives the scores of the documents, using the weights and the word counts. A search engine, for example, might choose w (based on the search query) so that the scores are predictions of relevance of the documents (to the search). • Audio mixing. Suppose the k columns of A are vectors representing audio signals or tracks of length T , and w is a k-vector. Then b = Aw is a T -vector representing the mix of the audio signals, with track weights given by the vector w. Inner product. When a and b are n-vectors, aT b is exactly the inner product of a and b, obtained from the rules for transposing matrices and forming a matrix-vector 1 matrix, product. We start with the (column) n-vector a, consider it as an n × and transpose it to obtain the n-row-vector aT . Now we multiply this 1 n matrix × by the n-vector b, to obtain the 1-vector aT b, which we also consider a scalar. So the notation aT b for the inner product is just a special case of matrix-vector multiplication. Linear dependence of columns. We can express the concepts of linear dependence and independence in a compact form using matrix-vector multiplication. The columns of a matrix A are linearly dependent if Ax = 0 for some x = 0. The columns of a matrix A are linearly independent if Ax = 0 implies x = 0. Expansion in a basis. If the columns of A are a basis, which means A is square with linearly independent columns a1, . . . , an, then for any n-vector b there is a unique n-vector x that satisfies Ax = b. In this case the vector x gives the coefficients in the expansion of b in the basis a1, . . . , an. Properties of matrix-vector multiplication. Matrix-vector multiplication satisfies several properties that are readily verified. First, it distributes across the vector argument: For any m n matrix A and any n-vectors u and v, we have × A(u + v) = Au + Av. 122 6 Matrices Matrix-vector multiplication, like ordinary multiplication of numbers, has higher precedence than addition, which means that when there are no parentheses to force the order of evaluation, multiplications are to be carried out before additions. This means that the right-hand side above is to be interpreted as (Au) + (Av). The equation above looks innocent and natural, but must be read carefully. On the left-hand side, we first add the vectors u and v, which is the addition of n-vectors. We then multiply the resulting n-vector by the matrix A. On the right-hand side, we first multiply each of n-vectors by the matrix A (this is two matrix-vector multiplies); and then add the two resulting m-vectors together. The left- and righthand sides of the equation above involve very different steps and operations, but the final result of each is the same m-vector. Matrix-vector multiplication also distributes across the matrix argument: For any m × n matrices A and B, and any n-vector u, we have (A + B)u = Au + Bu. On the left-hand side the plus symbol is matrix addition; on the right-hand side it is vector addition. Another basic property is, for any m scalar α, we have n matrix A, any n-vector u, and any × (αA)u = α(Au) (and so we can write this as αAu). On the left-hand side, we have scalar-matrix multiplication, followed by matrix-vector multiplication; on the right-hand side, we start with matrix-vector multiplication, and then perform scalar-vector multiplication. (Note that we also have αAu = A(αu).) × n matrix, as a mapping from the n-vector x to the m-vector y. Input-output interpretation. We can interpret the relation y = Ax, with A an m In this context we might think of x as an input, and y as the corresponding output. From equation (6.4), we can interpret Aij as the factor by which yi depends on xj. Some examples of conclusions we can draw are given below. If A23 is positive and large, then y2 depends strongly on x3, and increases as x3 increases. If A32 is much larger than the other entries in the third row of A, then y3 depends much more on x2 than the other inputs. If A is square and lower triangular, then yi only depends on x1, . . . , xi. • • • 6.5 Complexity Computer representation of matrices. An m n matrix is usually represented n array of floating point numbers, which requires 8mn on a computer as an m In some software systems symmetric matrices are represented in a more bytes. efficient way, by only storing the upper triangular elements in the matrix, in some × × 6.5 Complexity 123 specific order. This reduces the memory requirement by around a factor of two. Sparse matrices are represented by various methods that encode for each nonzero element its row index i (an integer), its column index j (an integer) and its value Aij (a floating point number). When the row and column indices are represented using 4 bytes (which allows m and n to range up to around 4.3 billion) this requires a total of around 16 nnz(A) bytes. × n matrices or a scalar multiplication of an m Complexity of matrix addition, scalar multiplication, and transposition. The n matrix addition of two m each take mn flops. When A is sparse, scalar multiplication requires nnz(A) flops. When at least one of A and B is sparse, computing A + B requires at most min flops. (For any entry i, j for which one of Aij or Bij is zero, no arithmetic operations are needed to find (A + B)ij.) Matrix transposition, i.e., computing AT , requires zero flops, since we simply copy entries of A to those of AT . (Copying the entries does take time to carry out, but this is not reflected in the flop count.) nnz(A), nnz(B) } × { × n matrix A with an n-vector x requires m(2n Complexity of matrix-vector multiplication. A matrix-vector multiplication of an m 1) flops, which we simplify to 2mn flops. This can be seen as follows. The result y = Ax of the product is an m-vector, so there are m numbers to compute. The ith element of y is the inner product of the ith row of A and the vector x, which takes 2n 1 flops. − If A is sparse, computing Ax requires nnz(A) multiplies (of Aij and xj, for each nonzero entry of A) and a number of additions that is no more than nnz(A). Thus, the complexity is between nnz(A) and 2 nnz(A) flops. As a special example, n and diagonal. Then Ax can be computed with n multiplies (Aii suppose A is n times xi) and no additions, a total of n = nnz(A) flops. × − 124 6 Matrices Exercises 6.1 Matrix and vector notation. Suppose a1, . . . , an are m-vectors. Determine whether each If the expression does make expression below makes sense (i.e., uses valid notation). sense, give its dimensions.     (a) a1 ... an aT 1 ... aT n (c) a1 (d) aT (b)  1    an aT n · · · · · · 6.2 Matrix notation. Suppose the block matrix A I I C q matrix. What are the dimensions of C? makes sense, where A is a p × 6.3 Block matrix. Assuming the matrix K = I AT 0 A makes sense, which of the following statements must be true? (‘Must be true’ means that it follows with no additional assumptions.) (a) K is square. (b) A is square or wide. (c) K is symmetric, i.e., K T = K. (d) The identity and zero submatrices in K have the same dimensions. (e) The zero submatrix is square. 6.4 Adjacency matrix row and column sums. Suppose A is the adjacency matrix of a directed graph (see page 112). What are the entries of the vector A1? What are the entries of the vector AT 1? 6.5 Adjacency matrix of reversed graph. Suppose A is the adjacency matrix of a directed graph (see page 112). The reversed graph is obtained by reversing the directions of all the edges of the original graph. What is the adjacency matrix of the reversed graph? (Express your answer in terms of A.) 6.6 Matrix-vector multiplication. For each of the following matrices, describe in words how x and y = Ax are related. In each case x and y are n-vectors, with n = 3k. (a) A = (b) A = . Ik 0 0 0 0 Ik 0 Ik , where E is the k × k matrix with all entries 1/k. Exercises 125 6.7 Currency exchange matrix. We consider a set of n currencies, labeled 1, . . . , n. (These might correspond to USD, RMB, EUR, and so on.) At a particular time the exchange or conversion rates among the n currencies are given by an n n (exchange rate) matrix R, where Rij is the amount of currency i that you can buy for one unit of currency j. (All entries of R are positive.) The exchange rates include commission charges, so we have RjiRij < 1 for all i Suppose y = Rx, where x is a vector (with nonnegative entries) that represents the amounts of the currencies that we hold. What is yi? Your answer should be in English. = j. You can assume that Rii = 1. × 6.8 Cash flow to bank account balance. The T -vector c represents the cash flow for an interest bearing bank account over T time periods. Positive values of c indicate a deposit, and negative values indicate a withdrawal. The T -vector b denotes the bank account balance in the T periods. We have b1 = c1 (the initial deposit or withdrawal) and bt = (1 + r)bt 1 + ct, − t = 2, . . . , T, where r > 0 is the (per-period) interest rate. (The first term is the previous balance plus the interest, and the second term is the deposit or withdrawal.) Find the T T matrix A for which b = Ac. That is, the matrix A maps a cash flow sequence into a bank account balance sequence. Your description must make clear what all entries of A are. × 6.9 Multiple channel marketing campaig
n. Potential customers are divided into m market segments, which are groups of customers with similar demographics, e.g., college educated women aged 25–29. A company markets its products by purchasing advertising in a set of n channels, i.e., specific TV or radio shows, magazines, web sites, blogs, direct mail, and so on. The ability of each channel to deliver impressions or views by potential customers is characterized by the reach matrix, the m n matrix R, where Rij is the number of views of customers in segment i for each dollar spent on channel j. (We assume that the total number of views in each market segment is the sum of the views from each channel, and that the views from each channel scale linearly with spending.) The n-vector c will denote the company’s purchases of advertising, in dollars, in the n channels. The m-vector v gives the total number of impressions in the m market segments due to the advertising in all channels. Finally, we introduce the m-vector a, where ai gives the profit in dollars per impression in market segment i. The entries of R, c, v, and a are all nonnegative. × (a) Express the total amount of money the company spends on advertising using vec- tor/matrix notation. (b) Express v using vector/matrix notation, in terms of the other vectors and matrices. (c) Express the total profit from all market segments using vector/matrix notation. (d) How would you find the single channel most effective at reaching market segment 3, in terms of impressions per dollar spent? (e) What does it mean if R35 is very small (compared to other entries of R)? 6.10 Resource requirements. We consider an application with n different job (types), each of which consumes m different resources. We define the m n resource matrix R, with entry Rij giving the amount of resource i that is needed to run one unit of job j, for i = 1, . . . , m and j = 1, . . . , n. (These numbers are typically positive.) The number (or amount) of each of the different jobs to be processed or run is given by the entries of the n-vector x. (These entries are typically nonnegative integers, but they can be fractional if the jobs are divisible.) The entries of the m-vector p give the price per unit of each of the resources. × (a) Let y be the m-vector whose entries give the total of each of the m resources needed to process the jobs given by x. Express y in terms of R and x using matrix and vector notation. 126 6 Matrices (b) Let c be an n-vector whose entries gives the cost per unit for each job type. (This is the total cost of the resources required to run one unit of the job type.) Express c in terms of R and p using matrix and vector notation. Remark. One example is a data center, which runs many instances of each of n types of application programs. The resources include number of cores, amount of memory, disk, and network bandwidth. 6.11 Let A and B be two m n matrices. Under each of the assumptions below, determine whether A = B must always hold, or whether A = B holds only sometimes. × (a) Suppose Ax = Bx holds for all n-vectors x. (b) Suppose Ax = Bx for some nonzero n-vector x. 6.12 Skew-symmetric matrices. An n n matrix A is called skew-symmetric if AT = × its transpose is its negative. (A symmetric matrix satisfies AT = A.) A, i.e., − (a) Find all 2 2 skew-symmetric matrices. × (b) Explain why the diagonal entries of a skew-symmetric matrix must be zero. (c) Show that for a skew-symmetric matrix A, and any n-vector x, (Ax) means that Ax and x are orthogonal. Hint. First show that for any n and n-vector x, xT (Ax) = n i,j=1 Aijxixj. × x. This ⊥ n matrix A (d) Now suppose A is any matrix for which (Ax) x for any n-vector x. Show that A must be skew-symmetric. Hint. You might find the formula ⊥ (ei + ej)T (A(ei + ej)) = Aii + Ajj + Aij + Aji, valid for any n × n matrix A, useful. For i = j, this reduces to eT i (Aei) = Aii. 6.13 Polynomial differentiation. Suppose p is a polynomial of degree n p(t) = c1 + c2t + degree n d = Dc. (Give the entries of D, and be sure to specify its dimensions.) − 2 or less, given by p(t) = d1 + d2t + 1 or less, given by 1. Its derivative (with respect to t) p(t) is a polynomial of 2. Find a matrix D for which − + cntn + dn 1tn · · · · · · − − − 6.14 Norm of matrix-vector product. Suppose A is an m famous inequality relates , x A , and Ax n matrix and x is an n-vector. A × : A Ax ≤ x . The left-hand side is the (vector) norm of the matrix-vector product; the right-hand side is the (scalar) product of the matrix and vector norms. Show this inequality. Hints. Let i be the ith row of A. Use the Cauchy–Schwarz inequality to get (aT aT 2. Then add the resulting m inequalities. i x)2 ≤ ai x 2 6.15 Distance between adjacency matrices. Let A and B be the n two directed graphs with n vertices (see page 112). The squared distance be used to express how different the two graphs are. Show that B number of directed edges that are in one of the two graphs but not in the other. − A × n adjacency matrices of 2 can B A 2 is the total − 6.16 Columns of difference matrix. Are the columns of the difference matrix D, defined in (6.5), linearly independent? 6.17 Stacked matrix. Let A be an m × n matrix, and consider the stacked matrix S defined by S = . A I When does S have linearly independent columns? When does S have linearly independent rows? Your answer can depend on m, n, or whether or not A has linearly independent columns or rows. Exercises 127 6.18 Vandermonde matrices. A Vandermonde matrix is an m V =     1 1 ... 1 t2 t1 1 · · · t2 t2 2 · · · ... ... . . . tm t2 m · · · n matrix of the form     × 1 − − 1 1 − tn 1 tn 2 ... tn m where t1, . . . , tm are numbers. Multiplying an n-vector c by the Vandermonde matrix V is the same as evaluating the polynomial of degree less than n, with coefficients c1, . . . , cn, at the points t1, . . . , tm; see page 120. Show that the columns of a Vandermonde matrix are linearly independent if the numbers t1, . . . , tm are distinct, i.e., different from each other. Hint. Use the following fact from algebra: If a polynomial p with degree less than n has n or more roots (points t for which p(t) = 0) then all its coefficients are zero. 6.19 Back-test timing. The T × n asset returns matrix R gives the returns of n assets over T periods. (See page 120.) When the n-vector w gives a set of portfolio weights, the T -vector Rw gives the time series of portfolio return over the T time periods. Evaluating portfolio return with past returns data is called back-testing. Consider a specific case with n = 5000 assets, and T = 2500 returns. (This is 10 years of daily returns, since there are around 250 trading days in each year.) About how long would it take to carry out this back-test, on a 1 Gflop/s computer? 6.20 Complexity of matrix-vector multiplication. On page 123 we worked out the complexity of computing the m-vector Ax, where A is an m n matrix and x is an n-vector, when each entry of Ax is computed as an inner product of a row of A and the vector x. Suppose instead that we compute Ax as a linear combination of the columns of A, with coefficients x1, . . . , xn. How many flops does this method require? How does it compare to the method described on page 123? × 6.21 Complexity of matrix-sparse-vector multiplication. On page 123 we consider the complexn matrix and x is an n-vector x (not ity of computing Ax, where A is a sparse m n assumed to be sparse). Now consider the complexity of computing Ax when the m matrix A is not sparse, but the n-vector x is sparse, with nnz(x) nonzero entries. Give the total number of flops in terms of m, n, and nnz(x), and simplify it by dropping terms that are dominated by others when the dimensions are large. Hint. The vector Ax is a linear combination of nnz(x) columns of A. × × 6.22 Distribute or not? Suppose you need to compute z = (A + B)(x + y), where A and B are m n matrices and x and y are n-vectors. × (a) What is the approximate flop count if you evaluate z as expressed, i.e., by adding A and B, adding x and y, and then carrying out the matrix-vector multiplication? (b) What is the approximate flop count if you evaluate z as z = Ax + Ay + Bx + By, i.e., with four matrix-vector multiplies and three vector additions? (c) Which method requires fewer flops? Your answer can depend on m and n. Remark. When comparing two computation methods, we usually do not consider a factor of 2 or 3 in flop counts to be significant, but in this exercise you can. Chapter 7 Matrix examples In this chapter we describe some special matrices that occur often in applications. 7.1 Geometric transformations Suppose the 2-vector (or 3-vector) x represents a position in 2-D (or 3-D) space. Several important geometric transformations or mappings from points to points can be expressed as matrix-vector products y = Ax, with A a 2 3) matrix. In the examples below, we consider the mapping from x to y, and focus on the 2-D case (for which some of the matrices are simpler to describe). 2 (or 3 × × Scaling. Scaling is the mapping y = ax, where a is a scalar. This can be expressed as y = Ax with A = aI. This mapping stretches a vector by the factor (or shrinks it when a | < 1), and it flips the vector (reverses its direction) if a < 0. | a | | Dilation. Dilation is the mapping y = Dx, where D is a diagonal matrix, D = diag(d1, d2). This mapping stretches the vector x by different factors along the two different axes. (Or shrinks, if < 1, and flips, if di < 0.) di| | Rotation. Suppose that y is the vector obtained by rotating x by θ radians counterclockwise. Then we have y = cos θ sin θ − sin θ cos θ x. (7.1) This matrix is called (for obvious reasons) a rotation matrix. Reflection. Suppose that y is the vector obtained by reflecting x through the line that passes through the origin, inclined θ radians with respect to horizontal. Then we have y = cos(2θ) sin(2θ) sin(2θ) cos(2θ) x. − 130 7 Matrix examples Figure 7.1 From left to right: A dilation with A = diag(2, 2/3), a counterclockwise rotation by π/6 radians, a
nd a reflection through a line that makes an angle of π/4 radians with the horizontal line. Projection onto a line. The projection of the point x onto a set is the point in the set that is closest to x. Suppose y is the projection of x onto the line that passes through the origin, inclined θ radians with respect to horizontal. Then we have y = (1/2)(1 + cos(2θ)) (1/2) sin(2θ) (1/2) sin(2θ) (1/2)(1 − cos(2θ)) x. Some of these geometric transformations are illustrated in figure 7.1. Finding the matrix. When a geometric transformation is represented by matrixvector multiplication (as in the examples above), a simple method to find the matrix is to find its columns. The ith column is the vector obtained by applying the transformation to ei. As a simple example consider clockwise rotation by 90◦ in 2-D. Rotating the vector e1 = (1, 0) by 90◦ gives (0, 1); rotating e2 = (0, 1) by 90◦ gives (1, 0). So rotation by 90◦ is given by − y = 0 1 − x. 1 0 Change of coordinates. In many applications multiple coordinate systems are used to describe locations or positions in 2-D or 3-D. For example in aerospace engineering we can describe a position using earth-fixed coordinates or body-fixed coordinates, where the body refers to an aircraft. Earth-fixed coordinates are with respect to a specific origin, with the three axes pointing East, North, and straight up, respectively. The origin of the body-fixed coordinates is a specific location on the aircraft (typically the center of gravity), and the three axes point forward (along the aircraft body), left (with respect to the aircraft body), and up (with respect to the aircraft body). Suppose the 3-vector xbody describes a location using the body coordinates, and xearth describes the same location in earth-fixed coordinates. These are related by xearth = p + Qxbody, where p is the location of the airplane center (in earth-fixed coordinates) and Q is 3 matrix. The ith column of Q gives the earth-fixed coordinates for the ith a 3 × xAxxAxxAx 7.2 Selectors 131 axis of the airplane. For an airplane in level flight, heading due South, we have .2 Selectors An m × n selector matrix A is one in which each row is a unit vector (transposed): A =    ,    eT k1 ... eT km where k1, . . . , km are integers in the range 1, . . . , n. When it multiplies a vector, it simply copies the kith entry of x into the ith entry of y = Ax: y = (xk1, xk2 , . . . , xkm). In words, each entry of Ax is a selection of an entry of x. The identity matrix, and the reverser matrix A =    =    eT n ... eT ... 0 1 0 0 ... ... ... 0 0 are special cases of selector matrices. (The reverser matrix reverses the order of 1, . . . , x2, x1).) Another one is the r : s slicing the entries of a vector: Ax = (xn, xn matrix, which can be described as the block matrix A = 0m m 0m , Im (n 1) s) (r − × − × × − where m = s Ax = xr:s, i.e., multiplying by A gives the r : s slice of a vector. r + 1. (We show the dimensions of the blocks for clarity.) We have − Down-sampling. Another example is the (n/2 ... ... ... ... ... 0 0 0 0 0 ... , xn n matrix (with n even)  0 0 0 ... 0 0 0 0 0 ... 0 1 0 0 0 ... ... 1 0 If y = Ax, we have y = (x1, x3, x5, . . . , xn called the 2 then y is the same quantity, sampled every 2 hours. 1). When x is a time series, y is − down-sampled version of x. If x is a quantity sampled every hour, × − 132 7 Matrix examples Figure 7.2 Directed graph with four vertices and five edges. × Image cropping. As a more interesting example, suppose that x is an image with N pixels, with M and N even. (That is, x is an M N -vector, with its entries M giving the pixel values in some specific order.) Let y be the (M/2) (N/2) image that is the upper left corner of the image x, i.e., a cropped version. Then we have (M N ) selector matrix. The ith row of A is eT y = Ax, where A is an (M N/4) ki, where ki is the index of the pixel in x that corresponds to the ith pixel in y. × × × Permutation matrices. An n n permutation matrix is one in which each column is a unit vector, and each row is the transpose of a unit vector. (In other words, A and AT are both selector matrices.) Thus, exactly one entry of each row is one, and exactly one entry of each column is one. This means that y = Ax can be expressed as yi = xπi , where π is a permutation of 1, 2, . . . , n, i.e., each integer from 1 to n appears exactly once in π1, . . . , πn. As a simple example consider the permutation π = (3, 1, 2). The associated permutation matrix is Multiplying a 3-vector by A re-orders its entries: Ax = (x3, x1, x2). 7.3 Incidence matrix Directed graph. A directed graph consists of a set of vertices (or nodes), labeled 1, . . . , n, and a set of directed edges (or branches), labeled 1, . . . , m. Each edge is connected from one of the nodes and into another one, in which case we say the two nodes are connected or adjacent. Directed graphs are often drawn with the vertices as circles or dots, and the edges as arrows, as in figure 7.2. A directed 123415423 7.3 Incidence matrix 133 graph can be described by its n m incidence matrix, defined as Aij =    − × 1 edge j points to node i 1 edge j points from node i 0 otherwise. The incidence matrix is evidently sparse, since it has only two nonzero entries in each column (one with value 1 and other with value 1). The jth column is associated with the jth edge; the indices of its two nonzero entries give the nodes that the edge connects. The ith row of A corresponds to node i; its nonzero entries tell us which edges connect to the node, and whether they point into or away from the node. The incidence matrix for the graph shown in figure 7.2 is − directed graph can also be described by its adjacency matrix, described on page 112. The adjacency and incidence matrices for a directed graph are closely related, but not the same. The adjacency matrix does not explicitly label the edges j = 1, . . . , m. There are also some small differences in the graphs that can be represented using incidence and adjacency matrices. For example, self edges (that connect from and to the same vertex) cannot be represented in an incidence matrix. 7.3.1 Networks In many applications a graph is used to represent a network, through which some commodity or quantity such as electricity, water, heat, or vehicular traffic flows. The edges of the graph represent the paths or links over which the quantity can move or flow, in either direction. If x is an m-vector representing a flow in the network, we interpret xj as the flow (rate) along the edge j, with a positive value meaning the flow is in the direction of edge j, and negative meaning the flow is in the opposite direction of edge j. In a network, the direction of the edge or link does not specify the direction of flow; it only specifies which direction of flow we consider to be positive. Flow conservation. When x represents a flow in a network, the matrix-vector product y = Ax can be given a very simple interpretation. The n-vector y = Ax can be interpreted as the vector of net flows, from the edges, into the nodes: yi is equal to the total of the flows that come in to node i, minus the total of the flows that go out from node i. The quantity yi is sometimes called the flow surplus at node i. If Ax = 0, we say that flow conservation occurs, since at each node, the total inflow matches the total out-flow. In this case the flow vector x is called a circulation. This could be used as a model of traffic flow (in a closed system), with the nodes 134 7 Matrix examples Figure 7.3 Network with four nodes and five edges, with source flows shown. representing intersections and the edges representing road segments (one for each direction). For a network described by the directed graph example above, the vector x = (1, 1, 1, 0, 1) − is a circulation, since Ax = 0. This flow corresponds to a unit clockwise flow on the outer edges (1, 3, 5, and 2) and no flow on the diagonal edge (4). (Visualizing this explains why such vectors are called circulations.) Sources. In many applications it is useful to include additional flows called source flows or exogenous flows, that enter or leave the network at the nodes, but not along the edges, as shown in figure 7.3. We denote these flows with an n-vector s. We can think of si as a flow that enters the network at node i from outside, i.e., not from any edge. When si > 0 the exogenous flow is called a source, since it is injecting the quantity into the network at the node. When si < 0 the exogenous flow is called a sink, since it is removing the quantity from the network at the node. Flow conservation with sources. The equation Ax + s = 0 means that the flow is conserved at each node, counting the source flow: The total of all incoming flow, from the incoming edges and exogenous source, minus the total outgoing flow from outgoing edges and exogenous sinks, is zero. As an example, flow conservation with sources can be used as an approximate model of a power grid (ignoring losses), with x being the vector of power flows along the transmission lines, si > 0 representing a generator injecting power into the grid at node i, si < 0 representing a load that consumes power at node i, and si = 0 representing a substation where power is exchanged among transmission lines, with no generation or load attached. For the example above, consider the source vector s = (1, 0, 1, 0), which corresponds to an injection of one unit of flow into node 1, and the removal of one unit of flow at node 3. In other words, node 1 is a source, node 3 is a sink, and − 1234x1x5x4x2x3s1s2s3s4 7.3 Incidence matrix 135 flow is conserved at nodes 2 and 4. For this source, the flow vector x = (0.6, 0.3, 0.6, 0.1, − − 0.3) satisfies flow conservation, i.e., Ax + s = 0. This flow can be explained in words: The unit external flow entering node 1 splits three ways, with 0.6 flowing up, 0.3 flowing right, and 0.1 flowing diagonally up (on edge 4). The upward flow on edge 1 passes through node 2, where flow is conserved, and proceeds right on edge 3 towards node 3. The ri
ghtward flow on edge 2 passes through node 4, where flow is conserved, and proceeds up on edge 5 to node 3. The one unit of excess flow arriving at node 3 is removed as external flow. Node potentials. A graph is also useful when we focus on the values of some quantity at each graph vertex or node. Let v be an n-vector, often interpreted as a potential, with vi the potential value at node i. We can give a simple interpretation to the matrix-vector product u = AT v. The m-vector u = AT v gives the potential vk, where edge j goes from node k to node l. differences across the edges: uj = vl − Dirichlet energy. When the m-vector AT v is small, it means that the potential differences across the edges are small. Another way to say this is that the potentials of connected vertices are near each other. A quantitative measure of this is the function of v given by AT v This function arises in many applications, and is called the Dirichlet energy (or Laplacian quadratic form) associated with the graph. It can be expressed as (v) = 2. D (v) = D edges (k,l) vk)2, (vl − which is the sum of the squares of the potential differences of v across all edges in the graph. The Dirichlet energy is small when the potential differences across the edges of the graph are small, i.e., nodes that are connected by edges have similar potential values. The Dirichlet energy is used as a measure the non-smoothness (roughness) of a set of node potentials on a graph. A set of node potentials with small Dirichlet energy can be thought of as smoothly varying across the graph. Conversely, a set of potentials with large Dirichlet energy can be thought of as non-smooth or rough. The Dirichlet energy will arise as a measure of roughness in several applications we will encounter later. As a simple example, consider the potential vector v = (1, 1) for the graph shown in figure 7.2. For this set of potentials, the potential differences across the edges are relatively large, with AT v = ( 3), and the − 2 = 27. Now consider the potential vector v = associated Dirichlet energy is (1, 2, 2, 1). The associated edge potential differences are AT v = (1, 0, 0, 1), and the Dirichlet energy has the much smaller value AT v 1, 2, 2, 3, − − − − − − − 1, 2, 1, AT v 2 = 3. 136 7 Matrix examples Figure 7.4 Chain graph. Figure 7.5 Two vectors of length 100, with Dirichlet energy (b) = 8.99. D (a) = 1.14 and D Chain graph. The incidence matrix and the Dirichlet energy function have a particularly simple form for the chain graph shown in figure 7.4, with n vertices and n 1) incidence matrix is the transpose of the difference matrix D described on page 119, in (6.5). The Dirichlet energy is then 1 edges. The n (n − × − (v) = D Dv 2 = (v2 − v1)2 + + (vn − · · · vn 1)2, − the sum of squares of the differences between consecutive entries of the n-vector v. This is used as a measure of the non-smoothness of the vector v, considered as a time series. Figure 7.5 shows an example. 7.4 Convolution The convolution of an n-vector a and an m-vector b is the (n + m denoted c = a b, with entries ∗ ck = i+j=k+1 aibj, k = 1, . . . , n + m 1, − 1)-vector − (7.2) where the subscript in the sum means that we should sum over all values of i and j in their index ranges 1, . . . , n and 1, . . . , m, for which the sum i + j is k + 1. For 123n123n−10204060801000123kak0204060801000123kbk 7.4 Convolution 137 example, with n = 4, m = 3, we have c1 = a1b1 c2 = a1b2 + a2b1 c3 = a1b3 + a2b2 + a3b1 c4 = a2b3 + a3b2 + a4b1 c5 = a3b3 + a4b2 c6 = a4b3. Convolution reduces to ordinary multiplication of numbers when n = m = 1, and to scalar-vector multiplication when either n = 1 or m = 1. Convolution arises in many applications and contexts. As a specific numerical example, we have (1, 0, (2, 1, where the entries of the convolution result are found from 1) − ∗ 1) = (2, 1, 3, − 1, 1), − − 2 = (1)(2) 1 = (1)(1) + (0)(2) 3 = (1)( 1) + (0)(1) + ( 1)(2) − − − − 1)( 1 = (0)( 1) + ( 1 = ( − 1). − − 1)(1) − Polynomial multiplication. If a and b represent the coefficients of two polynomials p(x) = a1 + a2x + · · · + anxn − 1, q(x) = b1 + b2x + + bmxm 1, − · · · then the coefficients of the product polynomial p(x)q(x) are represented by c = a b: ∗ p(x)q(x) = c1 + c2x + + cn+m − · · · 1xn+m − 2. To see this we will show that ck is the coefficient of xk product polynomial into mn terms, and collect those terms associated with xk These terms have the form aibjxi+j i.e., i + j = k 1. convolution formula (7.2). 1 in p(x)q(x). We expand the 1. 1, i+j=k+1 aibj, which agrees with the It follows that ck = 2, for i and j that satisfy b c = a b = b c), so we can write both as a Properties of convolution. Convolution is symmetric: We have a a. It c. b is also associative: We have (a b) ∗ Another property is that a b = 0 implies that either a = 0 or b = 0. These properties follow from the polynomial coefficient property above, and can also be directly shown. As an example, let us show that a a. Suppose p is the polynomial with coefficients a, and q is the polynomial with coefficients b. The two polynomials p(x)q(x) and q(x)p(x) are the same (since multiplication of numbers is commutative), so they have the same coefficients. The coefficients of p(x)q(x) are a b and the coefficients of q(x)p(x) are b a. These must be the same basic property is that for fixed a, the convolution a ∗ of b; and for fixed b, it is a linear function of a. This means we can express a a matrix-vector product: ∗ ∗ b is a linear function b as b = T (b)a = T (a)b, a ∗ 138 7 Matrix examples where T (b) is the (n + m 1) − T (b)ij = × bi 0 n matrix with entries j+1 − j + 1 1 i otherwise − ≤ m ≤ (7.3) and similarly for T (a). For example, with n = 4 and m = 3, we have     T (b) =        b1 b2 b3 0 0 0 0 b1 b2 b3 0 0 0 0 b1 b2 b3 0 0 0 0 b1 b2 b3        , T (a a1 0 a2 a1 0 a3 a2 a1 a4 a3 a2 a4 a3 0 a4 0 0        . The matrices T (b) and T (a) are called Toeplitz matrices (named after the mathematician Otto Toeplitz), which means the entries on any diagonal (i.e., indices with i j constant) are the same. The columns of the Toeplitz matrix T (a) are simply shifted versions of the vector a, padded with zero entries. − Variations. Several slightly different definitions of convolution are used in different applications. In one variation, a and b are infinite two-sided sequences (and not vectors) with indices ranging from . In another variation, the rows of to T (a) at the top and bottom that do not contain all the coefficients of a are dropped. (In this version, the rows of T (a) are shifted versions of the vector a, reversed.) For consistency, we will use the one definition (7.2). −∞ ∞ Examples. • • • • Time series smoothing. Suppose the n-vector x is a time series, and a = (1/3, 1/3, 1/3). Then the (n + 2)-vector y = a x can be interpreted as a smoothed version of the original time series: for i = 3, . . . , n, yi is the average 2. The time series y is called the (3-period) moving average of xi, xi of the time series x. Figure 7.6 shows an example. 1, xi ∗ − − First order differences. If the n-vector x is a time series and a = (1, x gives the first order differences in the series x: time series y = a x2, . . . , xn − y = (x1, x2 − x1, x3 − xn). xn 1, − ∗ − 1), the − (The first and last entries here would be the first order difference if we take x0 = xn+1 = 0.) Audio filtering. If the n-vector x is an audio signal, and a is a vector (typically x with length less than around 0.1 second of real time) the vector y = a is called the filtered audio signal, with filter coefficients a. Depending on the coefficients a, y will be perceived as enhancing or suppressing different frequencies, like the familiar audio tone controls. ∗ Communication channel. In a modern data communication system, a time series u is transmitted or sent over some channel (e.g., electrical, optical, or radio) to a receiver, which receives the time series y. A very common model u, where the vector c is is that y and u are related via convolution: y = c the channel impulse response. ∗ 7.4 Convolution 139 Figure 7.6 Top. A time series represented by a vector x of length 100. Bottom. The 3-period moving average of the time series as a vector of length 102. This vector is the convolution of x with a = (1/3, 1/3, 1/3). 02040608010000.511.522.53kxk02040608010000.511.522.53k(a∗x)k 140 7 Matrix examples Input-output convolution system. Many physical systems with an input (time series) m-vector u and output (time series) y are well modeled as y = h u, where the n-vector h is called the system impulse response. For example, ut might represent the power level of a heater at time period t, and yt might represent the resulting temperature rise (above the surrounding temperature). The lengths of u and y, n and m + n 1, are typically large, and not relevant in these applications. We can express the ith entry of the output y as − ∗ yi = n j=1 ui − j+1hj, where we interpret uk as zero for k < 0 or k > n. This formula states that y at n+1, i.e., a linear combination time i is a linear combination of ui, ui of the current input value ui, and the past n n+1. The coefficients are precisely h1, . . . , hn. Thus, h3 can be interpreted as the factor by which the current output depends on what the input was, 2 time steps before. Alternatively, we can say that h3 is the factor by which the input at any time will affect the output 2 steps in the future. − 1 input values ui 1, . . . , ui 1, . . . , ui − − − − ∗ Complexity of convolution. The na¨ıve method to compute the convolution c = b of an n-vector a and an m-vector b, using the basic formula (7.2) to calculate a each ck, requires around 2mn flops. The same number of flops is required to compute the matrix-vector products T (a)b or T (b)a, taking into account the zeros at the top right and bottom left in the Toeplitz matrices T (b) and T (a). Forming these matrices requires us to store mn numbers, even though the original data contains only m + n numbers. It turns out that the convolution of two vectors can be
computed far faster, using a so-called fast convolution algorithm. By exploiting the special structure of the convolution equations, this algorithm can compute the convolution of an n-vector and an m-vector in around 5(m + n) log2(m + n) flops, and with no additional memory requirement beyond the original m + n numbers. The fast convolution algorithm is based on the fast Fourier transform (FFT), which is beyond the scope of this book. (The Fourier transform is named for the mathematician Jean-Baptiste Fourier.) 7.4.1 2-D convolution Convolution has a natural extension to multiple dimensions. Suppose that A is an m 1) × matrix q matrix. Their convolution is the (m+p n matrix and B is a p (n+q 1) × − − × Crs = i+k=r+1, j+l=s+1 AijBkl, r = 1, . . . , m + p 1, s = 1, . . . , n + q 1, − − where the indices are restricted to their ranges (or alternatively, we assume that Aij and Bkl are zero, when the indices are out of range). This is not denoted 7.4 Convolution 141 C = A ∗ notation C = A B. B, however, in standard mathematical notation. So we will use the The same properties that we observed for 1-D convolution hold for 2-D convolution: We have A B = B A, (A B) C = A (B C), and for fixed B, A B is a linear function of A. If the m Image blurring. n matrix X represents an image, Y = X B represents the effect of blurring the image by the point spread function (PSF) given by the entries of the matrix B. If we represent X and Y as vectors, we have y = T (B)x, for some (m + p mn-matrix T (B). 1)(n + q 1) × As an example, with − − × B = 1/4 1/4 , 1/4 1/4 (7.4) Y = X B is an image where each pixel value is the average of a 2 2 block of 4 adjacent pixels in X. The image Y would be perceived as the image X, with some blurring of the fine details. This is illustrated in figure 7.7 for the 8 9 matrix × × 7.5) and its convolution with B/4 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/4 1/2 1/2 1/2 1 1 3/4 1 3//2 1/2 1 1/2 1/4 1/2 1/2 3/4 1 1/2 1/2 1 1/2 1/4 1/2 1/2 3/4 1 1/2 1/2 1 1/2 1/2 1 1 1 1 1/2 1/2 1 1/2 1/4 1/2 1/2 3/4 1 1/2 1/2 1 3/4 1/2 1/2 1/2 3/4 1 1/2 1/2 1 1 1 1 1 1 1 1//4 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/4 With the point spread function Dhor = 1 1 , − the pixel values in the image Y = X Dhor are the horizontal first order differences of those in X: Yij = Xij − Xi,j 1, − i = 1, . . . , m, j = 2, . . . , n (and Yi1 = Xi1, Xi,n+1 = − Xin for i = 1, . . . , m). With the point spread function Dver = , 1 1 − 142 7 Matrix examples Figure 7.7 An 8 tion (7.4). × 9 image and its convolution with the point spread func- the pixel values in the image Y = X Dver are the vertical first order differences of those in X: Yij = Xij − (and Y1j = X1j, Xm+1,j = tions of the matrix (7.5) with Dhor and Dver are 1,j, Xi − i = 2, . . . , m, − j = 1, . . . , n Xmj for j = 1, . . . , n). As an example, the convolu- X Dhor =             1 1 1 1 1 1 1 1 and X Dver =               − Figure 7.8 shows the effect of convolution on a larger image. The figure shows 8 matrix B with constant 512 and its convolution with the 8 × an image of size 512 entries Bij = 1/64. × 7.4 Convolution 143 Figure 7.8 512 512 image and the 519 convolution of the first image with an 8 1/64. Image credit: NASA. × × × 519 image that results from the 8 matrix with constant entries 144 7 Matrix examples Exercises 7.1 Projection on a line. Let P (x) denote the projection of the 2-D point (2-vector) x onto the line that passes through (0, 0) and (1, 3). (This means that P (x) is the point on the line that is closest to x; see exercise 3.12.) Show that P is a linear function, and give the matrix A for which P (x) = Ax for any x. 7.2 3-D rotation. Let x and y be 3-vectors representing positions in 3-D. Suppose that the vector y is obtained by rotating the vector x about the vertical axis (i.e., e3) by 45◦ (counterclockwise, i.e., from e1 toward e2). Find the 3 3 matrix A for which y = Ax. Hint. Determine the three columns of A by finding the result of the transformation on the unit vectors e1, e2, e3. × 7.3 Trimming a vector. Find a matrix A for which Ax = (x2, . . . , xn − n-vector. (Be sure to specify the size of A, and describe all its entries.) 1), where x is an 7.4 Down-sampling and up-conversion. We consider n-vectors x that represent signals, with xk the value of the signal at time k for k = 1, . . . , n. Below we describe two functions of x that produce new signals f (x). For each function, give a matrix A such that f (x) = Ax for all x. (a) 2 downsampling. We assume n is even and define f (x) as the n/2-vector y with × elements yk = x2k. To simplify your notation you can assume that n = 8, i.e., f (x) = (x2, x4, x6, x8). (On page 131 we describe a different type of down-sampling, that uses the average of pairs of original values.) (b) 2 up-conversion with linear interpolation. We define f (x) as the (2n 1)-vector y × with elements yk = x(k+1)/2 if k is odd and yk = (xk/2 + xk/2+1)/2 if k is even. To simplify your notation you can assume that n = 5, i.e., − f (x) = x1, x1 + x2 2 , x2, x2 + x3 2 , x3, x3 + x4 2 , x4, x4 + x5 2 . , x5 7.5 Transpose of selector matrix. Suppose the m n matrix A is a selector matrix. Describe the relation between the m-vector u and the n-vector v = AT u. × 7.6 Rows of incidence matrix. Show that the rows of the incidence matrix of a graph are always linearly dependent. Hint. Consider the sum of the rows. 7.7 Incidence matrix of reversed graph. (See exercise 6.5.) Suppose A is the incidence matrix of a graph. The reversed graph is obtained by reversing the directions of all the edges of the original graph. What is the incidence matrix of the reversed graph? (Express your answer in terms of A.) 7.8 Flow conservation with sources. Suppose that A is the incidence matrix of a graph, x is the vector of edge flows, and s is the external source vector, as described in 7.3. Assuming § that flow is conserved, i.e., Ax + s = 0, show that 1T s = 0. This means that the total amount injected into the network by the sources (si > 0) must exactly balance the total amount removed from the network at the sink nodes (si < 0). For example if the network is a (lossless) electrical power grid, the total amount of electrical power generated (and injected into the grid) must exactly balance the total electrical power consumed (from the grid). 7.9 Social network graph. Consider a group of n people or users, and some symmetric social relation among them. This means that some pairs of users are connected, or friends (say). We can create a directed graph by associating a node with each user, and an edge between each pair of friends, arbitrarily choosing the direction of the edge. Now consider an nvector v, where vi is some quantity for user i, for example, age or education level (say, (v) denote the Dirichlet energy associated with the graph and v, given in years). Let thought of as a potential on the nodes. D Exercises 145 Figure 7.9 Tree with six vertices. (a) Explain why the number edges of the graph. D (v) does not depend on the choice of directions for the (b) Would you guess that (v) is small or large? This is an open-ended, vague question; there is no right answer. Just make a guess as to what you might expect, and give a short English justification of your guess. D 7.10 Circle graph. A circle graph (also called a cycle graph) has n vertices, with edges pointing 1 to vertex n, from vertex 1 to vertex 2, from vertex 2 to vertex 3, . . . , from vertex n and finally, from vertex n to vertex 1. (This last edge completes the circle.) − (a) Draw a diagram of a circle graph, and give its incidence matrix A. (b) Suppose that x is a circulation for a circle graph. What can you say about x? (c) Suppose the n-vector v is a potential on a circle graph. What is the Dirichlet energy (v) = D AT v 2? Remark. The circle graph arises when an n-vector v represents a periodic time series. For example, v1 could be the value of some quantity on Monday, v2 its value on Tuesday, and v7 its value on Sunday. The Dirichlet energy is a measure of the roughness of such an n-vector v. 7.11 Tree. An undirected graph is called a tree if it is connected (there is a path from every vertex to every other vertex) and contains no cycles, i.e., there is no path that begins and ends at the same vertex. Figure 7.9 shows a tree with six vertices. For the tree in the figure, find a numbering of the vertices and edges, and an orientation of the edges, so that the incidence matrix A of the resulting directed graph satisfies Aii = 1 for i = 1, . . . , 5 and Aij = 0 for i < j. In other words, the first 5 rows of A form a lower triangular matrix with ones on the diagonal. 7.12 Some properties of convolution. Suppose that a is an n-vector. (a) Convolution with 1. What is 1 ∗ a? (Here we interpret 1 as a 1-vector.) (b) Convolution with a unit vector. What is ek a, where ek is the kth unit vector of dimension q? Describe this vector mathematically (i.e., give its entries), and via a brief English description. You might find vector slice notation useful. ∗ 7.13 Sum property of convolution. Show that for any vectors a and b, we have 1T (a b) = (1T a)(1T b). In words: The sum of the coefficients of the convolution of two vectors is the product of the sums of the coefficients of the vectors. Hint. If the vector a represents the coefficients of a polynomial p, 1T a = p(1). ∗ 146 7 Matrix examples 7.14 Rainfall and river height. The T -vector r gives the daily rainfall in some region over a period of T days. The vector h gives the daily height of a river in the region (above its normal height). By careful modeling of water flow, or by fitting a model to past data, it r, where is found that these vectors are (approximately) related by convolution: h = g ∗ g = (0.1, 0.4, 0.5, 0.2). Give a short story in English (with no mathematical terms) to approximately describe this relation. For example, you might mention how many days after a one day heavy rainfall the river height is most affected. Or how many days it takes for the river height to retu
rn to the normal height once the rain stops. 7.15 Channel equalization. We suppose that u1, . . . , um is a signal (time series) that is transmitted (for example by radio). A receiver receives the signal y = c u, where the n-vector c is called the channel impulse response. (See page 138.) In most applications n is small, e.g., under 10, and m is much larger. An equalizer is a k-vector h that satisfies h e1, 1. The receiver equalizes the received signal y by the first unit vector of length n + k convolving it with the equalizer to obtain z = h y. ≈ − ∗ ∗ c ∗ (a) How are z (the equalized received signal) and u (the original transmitted signal) related? Hint. Recall that h (c u) = (h c) u. ∗ ∗ ∗ ∗ (b) Numerical example. Generate a signal u of length m = 50, with each entry a random 0.3). Also u, with c = (1, 0.7, value that is either plot the equalized signal z = h 1 or +1. Plot u and y = c y, with − − ∗ ∗ 0.5, 0.5, h = (0.9, − 0.4, 0.3, − 0.3, 0.2, 0.1). − − Chapter 8 Linear equations In this chapter we consider vector-valued linear and affine functions, and systems of linear equations. 8.1 Linear and affine functions Vector-valued functions of vectors. The notation f : Rn Rm means that f is a function that maps real n-vectors to real m-vectors. The value of the function f , evaluated at an n-vector x, is an m-vector f (x) = (f1(x), f2(x), . . . , fm(x)). Each of the components fi of f is itself a scalar-valued function of x. As with scalar-valued functions, we sometimes write f (x) = f (x1, x2, . . . , xn) to emphasize that f is a function of n scalar arguments. We use the same notation for each of the components of f , writing fi(x) = fi(x1, x2, . . . , xn) to emphasize that fi is a function mapping the scalar arguments x1, . . . , xn into a scalar. → The matrix-vector product function. Suppose A is an m define a function f : Rn f : Rn m = 1. n matrix. We can Rm by f (x) = Ax. The inner product function 2.1, is the special case with R, defined as f (x) = aT x, discussed in → → × § Superposition and linearity. The function f : Rn is linear, i.e., it satisfies the superposition property: → Rm, defined by f (x) = Ax, f (αx + βy) = αf (x) + βf (y) (8.1) holds for all n-vectors x and y and all scalars α and β. It is a good exercise to parse this simple looking equation, since it involves overloading of notation. On the left-hand side, the scalar-vector multiplications αx and βy involve n-vectors, and the sum αx+βy is the sum of two n-vectors. The function f maps n-vectors to m-vectors, so f (αx + βy) is an m-vector. On the right-hand side, the scalar-vector multiplications and the sum are those for m-vectors. Finally, the equality sign is equality between two m-vectors. 148 8 Linear equations We can verify that superposition holds for f using properties of matrix-vector and scalar-vector multiplication: f (αx + βy) = A(αx + βy) = A(αx) + A(βy) = α(Ax) + β(Ay) = αf (x) + βf (y) Thus we can associate with every matrix A a linear function f (x) = Ax. The converse is also true. Suppose f is a function that maps n-vectors to mvectors, and is linear, i.e., (8.1) holds for all n-vectors x and y and all scalars α n matrix A such that f (x) = Ax for all x. This and β. Then there exists an m × 2.1, by showing can be shown in the same way as for scalar-valued functions in that if f is linear, then § f (x) = x1f (e1) + x2f (e2) + + xnf (en), · · · (8.2) where ek is the kth unit vector of size n. The right-hand side can also be written as a matrix-vector product Ax, with A = f (e1) f (e2) f (en) . · · · The expression (8.2) is the same as (2.3), but here f (x) and f (ek) are vectors. The implications are exactly the same: A linear vector-valued function f is completely characterized by evaluating f at the n unit vectors e1, . . . , en. As in 2.1 it is easily shown that the matrix-vector representation of a linear Rm is a linear function, then there exists exactly § function is unique. If f : Rn one matrix A such that f (x) = Ax for all x. → Examples of linear functions. In the examples below we define functions f that map n-vectors x to n-vectors f (x). Each function is described in words, in terms of its effect on an arbitrary x. In each case we give the associated matrix multiplication representation. • • Negation. f changes the sign of x: f (x) = Negation can be expressed as f (x) = Ax with A = x. − I. − Reversal. f reverses the order of the elements of x: f (x) = (xn, xn The reversal function can be expressed as f (x) = Ax with 1, . . . , x1). − A =      0 0 ... ... 0      . 1 0 ... 0 (This is the n is the reverser matrix introduced in × n identity matrix with the order of its columns reversed. It 7.2.) § 8.1 Linear and affine functions 149 • • Running sum. f forms the running sum of the elements in x: f (x) = (x1, x1 + x2, x1 + x2 + x3, . . . , x1 + x2 + + xn). · · · The running sum function can be expressed as f (x) = Ax with ... 1 1 0 1 ... ... ... 0 1 i.e., Aij = 1 if i defined in (6.6). ≥ j and Aij = 0 otherwise. This is the running sum matrix De-meaning. f subtracts the mean from each entry of a vector x: f (x) = x avg(x)1. − The de-meaning function can be expressed as f (x) = Ax with      A = 1 − − 1/n 1/n ... 1/n − − 1 − 1/n 1/n ... 1/n −      . 1/n 1/n ... 1/ · · · − Examples of functions that are not linear. Here we list some examples of functions f that map n-vectors x to n-vectors f (x) that are not linear. In each case we show a superposition counterexample. • • , . . . , x2| | Absolute value. f replaces each element of x with its absolute value: f (x) = , x1| ( | The absolute value function is not linear. For example, with n = 1, x = 1, y = 0, α = 1, β = 0, we have xn| ). | − f (αx + βy) = 1 = αf (x) + βf (y) = 1, − so superposition does not hold. Sort. f sorts the elements of x in decreasing order. The sort function is not linear (except when n = 1, in which case f (x) = x). For example, if n = 2, x = (1, 0), y = (0, 1), α = β = 1, then f (αx + βy) = (1, 1) = αf (x) + βf (y) = (2, 0). Affine functions. A vector-valued function f : Rn be expressed as f (x) = Ax + b, where A is an m It can be shown that a function f : Rn × Rm is affine if and only if Rm is called affine if it can → n matrix and b is an m-vector. → f (αx + βy) = αf (x) + βf (y) 150 8 Linear equations holds for all n-vectors x, y, and all scalars α, β that satisfy α + β = 1. In other words, superposition holds for affine combinations of vectors. (For linear functions, superposition holds for any linear combinations of vectors.) The matrix A and the vector b in the representation of an affine function as f (x) = Ax + b are unique. These parameters can be obtained by evaluating f at the vectors 0, e1, . . . , en, where ek is the kth unit vector in Rn. We have A = f (e1) f (0) f (e2) f (0) − · · · f (en) − − f (0) , b = f (0). Just like affine scalar-valued functions, affine vector-valued functions are often called linear, even though they are linear only when the vector b is zero. 8.2 Linear function models Many functions or relations between variables that arise in natural science, engineering, and social sciences can be approximated as linear or affine functions. In these cases we refer to the linear function relating the two sets of variables as a model or an approximation, to remind us that the relation is only an approximation, and not exact. We give a few examples here. • • Price elasticity of demand. Consider n goods or services with prices given by the n-vector p, and demands for the goods given by the n-vector d. A change in prices will induce a change in demands. We let δprice be the n-vector that gives the fractional change in the prices, i.e., δprice pi)/pi, where pnew is the n-vector of new (changed) prices. We let δdem be the nvector that gives the fractional change in the product demands, i.e., δdem i = di)/di, where dnew is the n-vector of new demands. A linear demand (dnew elasticity model relates these vectors as δdem = Edδprice, where Ed is the n n demand elasticity matrix. For example, suppose Ed 21 = 0.2. This means that a 1% increase in the price of the first good, with other prices kept the same, will cause demand for the first good to drop by 0.4%, and demand for the second good to increase by 0.2%. (In this example, the second good is acting as a partial substitute for the first good.) 0.4 and Ed = (pnew i − i − 11 = × − i Elastic deformation. Consider a steel structure like a bridge or the structural frame of a building. Let f be an n-vector that gives the forces applied to the structure at n specific places (and in n specific directions), sometimes called a loading. The structure will deform slightly due to the loading. Let d be an m-vector that gives the displacements (in specific directions) of m points in the structure, due to the load, e.g., the amount of sag at a specific point on a bridge. For small displacements, the relation between displacement n and loading is well approximated as linear: d = Cf , where C is the m compliance matrix. The units of the entries of C are m/N. × 8.2 Linear function models 151 8.2.1 Taylor approximation Suppose f : Rn n-vector. The first-order Taylor approximation of f near z is given by Rm is differentiable, i.e., has partial derivatives, and z is an → ˆf (x)i = fi(z) + ∂fi ∂x1 (z)(x1 − z1) + + · · · ∂fi ∂xn (z)(xn − zn) = fi(z) + fi(z)T (x ∇ z), − for i = 1, . . . , m. (This is just the first-order Taylor approximation of each of the 2.2.) For x near z, ˆf (x) is a very good scalar-valued functions fi, described in § approximation of f (x). We can express this approximation in compact notation, using matrix-vector multiplication, as ˆf (x) = f (z) + Df (z)(x z), − (8.3) n matrix Df (z) is the derivative or Jacobian matrix of f at z where the m (see × § C.1). Its components are the partial derivatives of f , Df (z)ij = ∂fi ∂xj (z), i = 1, . . . , m, j = 1, . . . , n, fi(z)T , for i = 1, . . . , m. evaluated at the point z. The rows of the Jacobian are The Jacobian matrix is named for the mathematician Ca
rl Gustav Jacob Jacobi. As in the scalar-valued case, Taylor approximation is sometimes written with a second argument as ˆf (x; z) to show the point z around which the approximation is made. Evidently the Taylor series approximation ˆf is an affine function of x. (It is often called a linear approximation of f , even though it is not, in general, a linear function.) ∇ 8.2.2 Regression model Recall the regression model (2.7) ˆy = xT β + v, (8.4) where the n-vector x is a feature vector for some object, β is an n-vector of weights, v is a constant (the offset), and ˆy is the (scalar) value of the regression model prediction. Now suppose we have a set of N objects (also called samples or examples), with feature vectors x(1), . . . , x(N ). The regression model predictions associated with the examples are given by ˆy(i) = (x(i))T β + v, i = 1, . . . , N. These numbers usually correspond to predictions of the value of the outputs or responses. If in addition to the example feature vectors x(i) we are also given the 152 8 Linear equations actual value of the associated response variables, y(1), . . . , y(N ), then our prediction errors or residuals are r(i) = y(i) ˆy(i), − i = 1, . . . , N. (Some authors define the prediction errors as ˆy(i) y(i).) − We can express this using compact matrix-vector notation. We form the n N feature matrix X with columns x(1), . . . , x(N ). We let yd denote the N -vector whose entries are the actual values of the response for the N examples. (The superscript ‘d’ stands for ‘data’.) We let ˆyd denote the N -vector of regression model predictions for the N examples, and we let rd denote the N -vector of residuals or prediction errors. We can then express the regression model predictions for this data set in matrix-vector form as × The vector of N prediction errors for the examples is given by ˆyd = X T β + v1. rd = yd ˆyd = yd X T β v1. − − − We can include the offset v in the regression model by including an additional feature equal to one as the first entry of each feature vector: ˆyd = 1T X T v β = ˜X T ˜β, where ˜X is the new feature matrix, with a new first row of ones, and ˜β = (v, β) is the vector of regression model parameters. This is often written without the tildes, as ˆyd = X T β, by simply including the feature one as the first feature. The equation above shows that the N -vector of predictions for the N examples is a linear function of the model parameters (v, β). The N -vector of prediction errors is an affine function of the model parameters. 8.3 Systems of linear equations Consider a set (also called a system) of m linear equations in n variables or unknowns x1, . . . , xn: A11x1 + A12x2 + A21x1 + A22x2 + · · · · · · + A1nxn = b1 + A2nxn = b2 ... Am1x1 + Am2x2 + + Amnxn = bm. · · · The numbers Aij are called the coefficients in the linear equations, and the numbers bi are called the right-hand sides (since by tradition, they appear on the right-hand 8.3 Systems of linear equations 153 side of the equation). These equations can be written succinctly in matrix notation as Ax = b. (8.5) n matrix A is called the coefficient matrix, and the mIn this context, the m vector b is called the right-hand side. An n-vector x is called a solution of the linear equations if Ax = b holds. A set of linear equations can have no solutions, one solution, or multiple solutions. × Examples. The set of linear equations x1 + x2 = 1, x1 = 1, − x1 − x2 = 0 is written as Ax = b with − It has no solutions. The set of linear equations • • x1 + x2 = 1, x2 + x3 = 2 is written as Ax = b with . It has multiple solutions, including x = (1, 0, 2) and x = (0, 1, 1). Over-determined and under-determined systems of linear equations. The set of linear equations is called over-determined if m > n, under-determined if m < n, and square if m = n; these correspond to the coefficient matrix being tall, wide, and square, respectively. When the system of linear equations is over-determined, there are more equations than variables or unknowns. When the system of linear equations is under-determined, there are more unknowns than equations. When the system of linear equations is square, the numbers of unknowns and equations is the same. A set of equations with zero right-hand side, Ax = 0, is called a homogeneous set of equations. Any homogeneous set of equations has x = 0 as a solution. In chapter 11 we will address the question of how to determine if a system of linear equations has a solution, and how to find one when it does. For now, we give a few interesting examples. 154 8.3.1 Examples 8 Linear equations Coefficients of linear combinations. Let a1, . . . , an denote the columns of A. The system of linear equations Ax = b can be expressed as x1a1 + · · · + xnan = b, i.e., b is a linear combination of a1, . . . , an with coefficients x1, . . . , xn. So solving Ax = b is the same as finding coefficients that express b as a linear combination of the vectors a1, . . . , an. Polynomial interpolation. We seek a polynomial p of degree at most n 1 that interpolates a set of m given points (ti, yi), i = 1, . . . , m. (This means that p(ti) = yi.) We can express this as a set of m linear equations in the n unknowns c, where c is the n-vector of coefficients: Ac = y. Here the matrix A is the Vandermonde matrix (6.7), and the vector c is the vector of polynomial coefficients, as described in the example on page 120. − Balancing chemical reactions. A chemical reaction involves p reactants (molecules) and q products, and can be written as a1R1 + + apRp −→ · · · b1P1 + · · · + bqPq. Here R1, . . . , Rp are the reactants, P1, . . . , Pq are the products, and the numbers a1, . . . , ap and b1, . . . , bq are positive numbers that tell us how many of each of these molecules is involved in the reaction. They are typically integers, but can be scaled arbitrarily; we could double all of these numbers, for example, and we still have the same reaction. As a simple example, we have the electrolysis of water, 2H2O −→ 2H2 + O2, which has one reactant, water (H2O), and two products, molecular hydrogen (H2) and molecular oxygen (O2). The coefficients tell us that 2 water molecules create 2 hydrogen molecules and 1 oxygen molecule. The coefficients in a reaction can be multiplied by any nonzero numbers; for example, we could write the reaction above as 3H2O 3H2 + (3/2)O2. By convention reactions are written with all coefficients integers, with least common divisor one. −→ In a chemical reaction the numbers of constituent atoms must balance. This means that for each atom appearing in any of the reactants or products, the total amount on the left-hand side must equal the total amount on the right-hand side. (If any of the reactants or products is charged, i.e., an ion, then the total charge must also balance.) In the simple water electrolysis reaction above, for example, we have 4 hydrogen atoms on the left (2 water molecules, each with 2 hydrogen atoms), and 4 on the right (2 hydrogen molecules, each with 2 hydrogen atoms). The oxygen atoms also balance, so this reaction is balanced. Balancing a chemical reaction with specified reactants and products, i.e., finding the numbers a1, . . . , ap and b1, . . . , bq, can be expressed as a system of linear equations. We can express the requirement that the reaction balances as a set of 8.3 Systems of linear equations 155 m equations, where m is the number of different atoms appearing in the chemical reaction. We define the m p matrix R by × Rij = number of atoms of type i in Rj, i = 1, . . . , m, j = 1, . . . , p. (The entries of R are nonnegative integers.) The matrix R is interesting; for example, its jth column gives the chemical formula for reactant Rj. We let a denote the p-vector with entries a1, . . . , ap. Then, the m-vector Ra gives the total number of atoms of each type appearing in the reactants. We define an m q matrix P in a similar way, so the m-vector P b gives the total number of atoms of each type that appears in the products. × We write the balance condition using vectors and matrices as Ra = P b. We can express this as R P − a b = 0, which is a set of m homogeneous linear equations. A simple solution of these equations is a = 0, b = 0. But we seek a nonzero solution. We can set one of the coefficients, say a1, to be one. (This might cause the other quantities to be fractional-valued.) We can add the condition that a1 = 1 to our system of linear equations as R eT 1 P − 0 a b = em+1. Finally, we have a set of m + 1 equations in p + q variables that expresses the requirement that the chemical reaction balances. Finding a solution of this set of equations is called balancing the chemical reaction. For the example of electrolysis of water described above, we have p = 1 reactant (water) and q = 2 products (molecular hydrogen and oxygen). The reaction involves m = 2 atoms, hydrogen and oxygen. The reactant and product matrices are The balancing equations are then       a1 b1 b2    =    . 0 0 1 These equations are easily solved, and have the solution (1, 1, 1/2). (Multiplying these coefficients by 2 gives the reaction given above.) Diffusion systems. A diffusion system is a common model that arises in many areas of physics to describe flows and potentials. We start with a directed graph with n nodes and m edges. (See 6.1.) Some quantity (like electricity, heat, energy, or mass) can flow across the edges, from one node to another. § With edge j we associate a flow (rate) fj, which is a scalar; the vector of all m flows is the flow m-vector f . The flows fj can be positive or negative: Positive 156 8 Linear equations Figure 8.1 A node in a diffusion system with label 1, exogenous flow s1 and three incident edges. fj means the quantity flows in the direction of edge j, and negative fj means the quantity flows in the opposite direction of edge j. The flows can represent, for example, heat flow (in units of Watts) in a thermal model, electrical current (Amps) in an electrical circuit, or movement (diffusion) of mass (such as, for exam
ple, a pollutant). We also have a source (or exogenous) flow si at each node, with si > 0 meaning that an exogenous flow is injected into node i, and si < 0 means that an exogenous flow is removed from node i. (In some contexts, a node where flow is removed is called a sink.) In a thermal system, the sources represent thermal (heat) sources; in an electrical circuit, they represent electrical current sources; in a system with diffusion, they represent external injection or removal of the mass. In a diffusion system, the flows must satisfy (flow) conservation, which means that at each node, the total flow entering each node from adjacent edges and the exogenous source, must be zero. This is illustrated in figure 8.1, which shows three edges adjacent to node 1, two entering node 1 (flows 1 and 2), and one (flow 3) leaving node 1, and an exogenous flow. Flow conservation at this node is expressed as f1 + f2 − f3 + s1 = 0. Flow conservation at every node can be expressed by the simple matrix-vector equation Af + s = 0, (8.6) (This is called Kirchhoff ’s where A is the incidence matrix described in current law in an electrical circuit, after the physicist Gustav Kirchhoff; when the flows represent movement of mass, it is called conservation of mass.) 7.3. § With node i we associate a potential ei; the n-vector e gives the potential at all nodes. (Note that here, e represents the n-vector of potentials; ei is the scalar potential at node i, and not the standard ith unit vector.) The potential might represent the node temperature in a thermal model, the electrical potential (voltage) in an electrical circuit, and the concentration in a system that involves mass diffusion. 1s1123 8.3 Systems of linear equations 157 Figure 8.2 The flow through edge 8 is equal to f8 = (e2 e3)/r8. − In a diffusion system the flow on an edge is proportional to the potential difference across its adjacent nodes. This is typically written as rjfj = ek − el, where edge j goes from node k to node l, and rj (which is typically positive) is called the resistance of edge j. In a thermal model, rj is called the thermal resistance of the edge; in an electrical circuit, it is called the electrical resistance. This is illustrated in figure 8.2, which shows edge 8, connecting node 2 and node 3, corresponding to an edge flow equation r8f8 = e2 − e3. We can write the edge flow equations in a compact way as Rf = AT e, − (8.7) where R = diag(r) is called the resistance matrix. The diffusion model can be expressed as one set of block linear equations in the variables f , s, and e: A I 0 R 0 AT   = 0.   f s e This is a set of n + m homogeneous equations in m + 2n variables. To these underdetermined equations we can add others, for example, by specifying some of the entries of f , s, and e. Leontief input-ouput model. We consider an economy with n different industrial sectors. We let xi be the economic activity level, or total production output, of sector i, for i = 1, . . . , n, measured in a common unit, such as (billions of) dollars. The output of each sector flows to other sectors, to support their production, and also to consumers. We denote the total consumer demand for sector i as di, for i = 1, . . . , n. Supporting the output level xj for sector j requires Aijxj output for sector i. We refer to Aijxj as the sector i input that flows to sector j. (We can have Aii = 0; for example, it requires some energy to support the production of energy.) Thus, Ai1x1 + + Ainxn is the total sector i output required by, or flowing into, the n industrial sectors. The matrix A is called the input-output matrix of the economy, since it describes the flows of sector outputs to the inputs of itself and other sectors. The vector Ax gives the sector outputs required to support the production levels given by x. (This sounds circular, but isn’t.) · · · 238 158 8 Linear equations Finally, we require that for each sector, the total production level matches the demand plus the total amount required to support production. This leads to the balance equations, x = Ax + d. Suppose the demand vector d is given, and we wish to find the sector output levels that will support it. We can write this as a set of n equations in n unknowns, A)x = d. (I − This model of the sector inputs and outputs of an economy was developed by Wassily Leontief in the late 1940s, and is now known as Leontief input-output analysis. He was awarded the Nobel Prize in economics for this work in 1973. Exercises Exercises 159 8.1 Sum of linear functions. Suppose f : Rn Rm are linear functions. → Their sum is the function h : Rn Rm, defined as h(x) = f (x) + g(x) for any n-vector x. The sum function is often denoted as h = f +g. (This is another case of overloading the + symbol, in this case to the sum of functions.) If f has matrix representation f (x) = F x, and g has matrix representation f (x) = Gx, where F and G are m n matrices, what is the matrix representation of the sum function h = f + g? Be sure to identify any + symbols appearing in your justification. Rm and g : Rn → → × 8.2 Averages and affine functions. Suppose that G : Rn Rm is an affine function. Let x1, . . . , xk be n-vectors, and define the m-vectors y1 = G(x1), . . . , yk = G(xk). Let → x = (x1 + · · · + xk)/k, y = (y1 + + yk)/k · · · be the averages of these two lists of vectors. (Here x is an n-vector and y is an m-vector.) Show that we always have y = G(x). In words: The average of an affine function applied to a list of vectors is the same as the affine function applied to the average of the list of vectors. 8.3 Cross-product. The cross product of two 3-vectors a = (a1, a2, a3) and x = (x1, x2, x3) is defined as the vector x = a × a2x3 a3x1 a1x2 . a3x2 a1x3 a2x1 − − − The cross product comes up in physics, for example in electricity and magnetism, and in dynamics of mechanical systems like robots or satellites. (You do not need to know this for this exercise.) Assume a is fixed. Show that the function f (x) = a a matrix A that satisfies f (x) = Ax for all x. x is a linear function of x, by giving × 8.4 Linear functions of images. In this problem we consider several linear functions of a monochrome image with N N pixels. To keep the matrices small enough to work out by hand, we will consider the case with N = 3 (which would hardly qualify as an image). We represent a 3 3 image as a 9-vector using the ordering of pixels shown below. × × (This ordering is called column-major.) Each of the operations or transformations below defines a function y = f (x), where the 9-vector x represents the original image, and the 9-vector y represents the resulting or transformed image. For each of these operations, give the 9 9 matrix A for which y = Ax. × (a) Turn the original image x upside-down. (b) Rotate the original image x clockwise 90◦. (c) Translate the image up by 1 pixel and to the right by 1 pixel. In the translated image, assign the value yi = 0 to the pixels in the first column and the last row. (d) Set each pixel value yi to be the average of the neighbors of pixel i in the original image. By neighbors, we mean the pixels immediately above and below, and immediately to the left and right. The center pixel has 4 neighbors; corner pixels have 2 neighbors, and the remaining pixels have 3 neighbors. 123456789 160 8 Linear equations 8.5 Symmetric and anti-symmetric part. An n-vector x is symmetric if xk = xn k = 1, . . . , n. It is anti-symmetric if xk = xn k+1 for k = 1, . . . , n. − − k+1 for − (a) Show that every vector x can be decomposed in a unique way as a sum x = xs + xa of a symmetric vector xs and an anti-symmetric vector xa. (b) Show that the symmetric and anti-symmetric parts xs and xa are linear functions of x. Give matrices As and Aa such that xs = Asx and xa = Aax for all x. 8.6 Linear functions. For each description of y below, express it as y = Ax for some A. (You should specify A.) 1. (We take y1 = x1.) (a) yi is the difference between xi and the average of x1, . . . , xi (b) yi is the difference between xi and the average value of all other xjs, i.e., the average − of x1, . . . , xi 1, xi+1, . . . , xn. − 8.7 Interpolation of polynomial values and derivatives. The 5-vector c represents the coefficients of a quartic polynomial p(x) = c1 + c2x + c3x2 + c4x3 + c5x4. Express the conditions p(0) = 0, p(0) = 0, p(1) = 1, p(1) = 0, as a set of linear equations of the form Ac = b. determined, over-determined, or square? Is the system of equations under- 8.8 Interpolation of rational functions. A rational function of degree two has the form f (t) = c1 + c2t + c3t2 1 + d1t + d2t2 , where c1, c2, c3, d1, d2 are coefficients. (‘Rational’ refers to the fact that f is a ratio of polynomials. Another name for f is bi-quadratic.) Consider the interpolation conditions f (ti) = yi, i = 1, . . . , K, where ti and yi are given numbers. Express the interpolation conditions as a set of linear equations in the vector of coefficients θ = (c1, c2, c3, d1, d2), as Aθ = b. Give A and b, and their dimensions. 8.9 Required nutrients. We consider a set of n basic foods (such as rice, beans, apples) and a set of m nutrients or components (such as protein, fat, sugar, vitamin C). Food j has a cost given by cj (say, in dollars per gram), and contains an amount Nij of nutrient i (per gram). (The nutrients are given in some appropriate units, which can depend on the particular nutrient.) A daily diet is represented by an n-vector d, with di the daily intake (in grams) of food i. Express the condition that a diet d contains the total nutrient amounts given by the m-vector ndes, and has a total cost B (the budget) as a set of linear equations in the variables d1, . . . , dn. (The entries of d must be nonnegative, but we ignore this issue here.) 8.10 Blending crude oil. A set of K different types of crude oil are blended (mixed) together in proportions θ1, . . . , θK . These numbers sum to one; they must also be nonnegative, but we will ignore that requirement here. Associated with crude oil type k is an n-vector ck
that gives its concentration of n different constituents, such as specific hydrocarbons. Find a set of linear equations on the blending coefficients, Aθ = b, that expresses the requirement that the blended crude oil achieves a target set of constituent concentrations, given by the n-vector ctar. (Include the condition that θ1 + + θK = 1 in your equations.) 8.11 Location from range measurements. The 3-vector x represents a location in 3-D. We measure the distances (also called the range) of x to four points at known locations a1, a2, a3, a4: · · · ρ1 = x − a1 , ρ2 = x − a2 , ρ3 = x − a3 , ρ4 = x − a4 . Express these distance conditions as a set of three linear equations in the vector x. Hint. Square the distance equations, and subtract one from the others. Exercises 161 8.12 Quadrature. Consider a function f : R integral α = 1 have 1 ≤ estimating α is to form a weighted sum of the values f (ti): R. We are interested in estimating the definite f (x) dx based on the value of f at some points t1, . . . , tn. (We typically 1, but this is not needed here.) The standard method for 1 − t1 < t2 < < tn · · · → ≤ − ˆα = w1f (t1) + + wnf (tn), · · · where ˆα is our estimate of α, and w1, . . . , wn are the weights. This method of estimating the value of an integral of a function from its values at some points is a classical method in applied mathematics called quadrature. There are many quadrature methods (i.e., choices of the points ti and weights wi). The most famous one is due to the mathematician Carl Friedrich Gauss, and bears his name. (a) A typical requirement in quadrature is that the approximation should be exact (i.e., ˆα = α) when f is any polynomial up to degree d, where d is given. In this case we say that the quadrature method has order d. Express this condition as a set of linear equations on the weights, Aw = b, assuming the points t1, . . . , tn are given. Hint. If ˆα = α holds for the specific cases f (x) = 1, f (x) = x, . . . , f (x) = xd, then it holds for any polynomial of degree up to d. (b) Show that the following quadrature methods have order 1, 2, and 3 respectively. • • • Trapezoid rule: n = 2, t1 = 1, t2 = 1, and − w1 = 1/2, w2 = 1/2. Simpson’s rule: n = 3, t1 = − w1 = 1/3, 1, t2 = 0, t3 = 1, and w2 = 4/3, w3 = 1/3. (Named after the mathematician Thomas Simpson.) Simpson’s 3/8 rule: n = 4, t1 = 1, t2 = 1/3, t3 = 1/3, t4 = 1, w1 = 1/4, w2 = 3/4, w4 = 1/4. − − w3 = 3/4, 8.13 Portfolio sector exposures. (See exercise 1.14.) The n-vector h denotes a portfolio of investments in n assets, with hi the dollar value invested in asset i. We consider a set of m industry sectors, such as pharmaceuticals or consumer electronics. Each asset is assigned to one of these sectors. (More complex models allow for an asset to be assigned to more than one sector.) The exposure of the portfolio to sector i is defined as the sum of investments in the assets in that sector. We denote the sector exposures using the m-vector s, where si is the portfolio exposure to sector i. (When si = 0, the portfolio is said to be neutral to sector i.) An investment advisor specifies a set of desired sector exposures, given as the m-vector sdes. Express the requirement s = sdes as a set of linear equations of the form Ah = b. (You must describe the matrix A and the vector b.) Remark. A typical practical case involves n = 1000 assets and m = 50 sectors. An advisor might specify sdes i = 0 if she does not have an opinion as how companies in that sector will do in the future; she might specify a positive value for sdes if she thinks the companies in that sector will do well (i.e., generate positive returns) in the future, and a negative value if she thinks they will do poorly. i 8.14 Affine combinations of solutions of linear equations. Consider the set of m linear equations in n variables Ax = b, where A is an m n matrix, b is an m-vector, and x is the n-vector of variables. Suppose that the n-vectors z1, . . . , zk are solutions of this set of equations, i.e., satisfy Azi = b. Show that if the coefficients α1, . . . , αk satisfy α1 + + αk = 1, then the affine combination · · · × is a solution of the linear equations, i.e., satisfies Aw = b. In words: Any affine combination of solutions of a set of linear equations is also a solution of the equations. w = α1z1 + + αkzk · · · 162 8 Linear equations 8.15 Stoichiometry and equilibrium reaction rates. We consider a system (such as a single cell) containing m metabolites (chemical species), with n reactions among the metabolites occurring at rates given by the n-vector r. (A negative reaction rate means the reaction runs in reverse.) Each reaction consumes some metabolites and produces others, in known n stoichiometry matrix rates proportional to the reaction rate. This is specified in the m S, where Sij is the rate of metabolite i production by reaction j, running at rate one. (When Sij is negative, it means that when reaction j runs at rate one, metabolite i is consumed.) The system is said to be in equilibrium if the total production rate of each metabolite, due to all the reactions, is zero. This means that for each metabolite, the total production rate balances the total consumption rate, so the total quantities of the metabolites in the system do not change. Express the condition that the system is in equilibrium as a set of linear equations in the reaction rates. × 8.16 Bi-linear interpolation. We are given a scalar value at each of the four corners of a square in 2-D, (x1, y1), (x1, y2), (x2, y1), and (x2, y2), where x1 < x2 and y1 < y2. We refer to these four values as F11, F12, F21, and F22, respectively. A bi-linear interpolation is a function of the form f (u, v) = θ1 + θ2u + θ3v + θ4uv, where θ1, . . . , θ4 are coefficients, that satisfies f (x1, y1) = F11, f (x1, y2) = F12, f (x2, y1) = F21, f (x2, y2) = F22, i.e., it agrees with (or interpolates) the given values on the four corners of the square. (The function f is usually evaluated only for points (u, v) inside the square. It is called bi-linear since it is affine in u when v is fixed, and affine in v when u is fixed.) Express the interpolation conditions as a set of linear equations of the form Aθ = b, where A is a 4 4 matrix and b is a 4-vector. Give the entries of A and b in terms of x1, x2, y1, y2, F11, F12, F21, and F22. Remark. Bi-linear interpolation is used in many applications to guess or approximate the values of a function at an arbitrary point in 2-D, given the function values on a grid of points. To approximate the value at a point (x, y), we first find the square of grid points that the point lies in. Then we use bi-linear interpolation to get the approximate value at (x, y). × Chapter 9 Linear dynamical systems In this chapter we consider a useful application of matrix-vector multiplication, which is used to describe many systems or phenomena that change or evolve over time. 9.1 Linear dynamical systems Suppose x1, x2, . . . is a sequence of n-vectors. The index (subscript) denotes time or period, and is written as t; xt, the value of the sequence at time (or period) t, is called the state at time t. We can think of xt as a vector that changes over time, i.e., one that changes dynamically. In this context, the sequence x1, x2, . . . is sometimes called a trajectory or state trajectory. We sometimes refer to xt as the current state of the system (implicitly assuming the current time is t), and xt+1 as the next state, xt 1 as the previous state, and so on. The state xt can represent a portfolio that changes daily, or the positions and velocities of the parts of a mechanical system, or the quarterly activity of an economy. If xt represents a portfolio that changes daily, (x5)3 is the amount of asset 3 held in the portfolio on (trading) day 5. − A linear dynamical system is a simple model for the sequence, in which each xt+1 is a linear function of xt: xt+1 = Atxt, t = 1, 2, . . . . (9.1) × n matrices At are called the dynamics matrices. The equation above Here the n is called the dynamics or update equation, since it gives us the next value of x, i.e., xt+1, as a function of the current value xt. Often the dynamics matrix does not depend on t, in which case the linear dynamical system is called time-invariant. If we know xt (and At, At+1, . . .) we can determine xt+1, xt+2, . . . simply by In other words: If we know the current iterating the dynamics equation (9.1). value of x, we can find all future values. In particular, we do not need to know the past states. This is why xt is called the state of the system. It contains all the information needed at time t to determine the future evolution of the system. 164 9 Linear dynamical systems Linear dynamical system with input. There are many variations on and extensions of the basic linear dynamical system model (9.1), some of which we will encounter later. As an example, we can add additional terms to the update equation: xt+1 = Atxt + Btut + ct, t = 1, 2, . . . . (9.2) Here ut is an m-vector called the input, Bt is the n m input matrix, and the n-vector ct is called the offset, all at time t. The input and offset are used to model other factors that affect the time evolution of the state. Another name for the input ut is exogenous variable, since, roughly speaking, it comes from outside the system. × Markov model. The linear dynamical system (9.1) is sometimes called a Markov model (after the mathematician Andrey Markov). Markov studied systems in which the next state value depends on the current one, and not on the previous state values xt 2, . . .. The linear dynamical system (9.1) is the special case of a Markov system where the next state is a linear function of the current state. 1, xt − − In a variation on the Markov model, called a (linear) K-Markov model, the 1 previous states. Such a next state xt+1 depends on the current state and K system has the form − xt+1 = A1xt + + AKxt − · · · K+1, t = K, K + 1, . . . . (9.3) Models of this form are used in time series analysis and econometrics, whe
re they are called (vector) auto-regressive models. When K = 1, the Markov model (9.3) is the same as a linear dynamical system (9.1). When K > 1, the Markov model (9.3) can be reduced to a standard linear dynamical system (9.1), with an appropriately chosen state; see exercise 9.4. Simulation. If we know the dynamics (and input) matrices, and the state at time t, we can find the future state trajectory xt+1, xt+2, . . . by iterating the equation (9.1) (or (9.2), provided we also know the input sequence ut, ut+1, . . .). This is called simulating the linear dynamical system. Simulation makes predictions about the future state of a system. (To the extent that (9.1) is only an approximation or model of some real system, we must be careful when interpreting the results.) We can carry out what-if simulations, to see what would happen if the system changes in some way, or if a particular set of inputs occurs. 9.2 Population dynamics Linear dynamical systems can be used to describe the evolution of the age distribution in some population over time. Suppose xt is a 100-vector, with (xt)i denoting the number of people in some population (say, a country) with age i 1 (say, on January 1) in year t, where t is measured starting from some base year, for i = 1, . . . , 100. While (xt)i is an integer, it is large enough that we simply consider − 9.2 Population dynamics 165 Figure 9.1 Age distribution in the US in 2010. (United States Census Bureau, census.gov). it a real number. In any case, our model certainly is not accurate at the level of individual people. Also, note that the model does not track people 100 and older. The distribution of ages in the US in 2010 is shown in figure 9.1. The birth rate is given by a 100-vector b, where bi is the average number of 1, i = 1, . . . , 100. (This is half the average number births per person with age i − of births per woman with age i 1, assuming equal numbers of men and women in the population.) Of course bi is approximately zero for i < 13 and i > 50. The approximate birth rates for the US in 2010 are shown in figure 9.2. The death rate is given by a 100-vector d, where di is the portion of those aged i 1 who will die this year. The death rates for the US in 2010 are shown in figure 9.3. − − To derive the dynamics equation (9.1), we find xt+1 in terms of xt, taking into account only births and deaths, and not immigration. The number of 0-year olds next year is the total number of births this year: (xt+1)1 = bT xt. The number of i-year olds next year is the number of (i minus those who die: − 1)-year-olds this year, (xt+1)i+1 = (1 − di)(xt)i, i = 1, . . . , 99. We can assemble these equations into the time-invariant linear dynamical system xt+1 = Axt, t = 1, 2, . . . , (9.4) 0102030405060708090100012345AgePopulation(millions) 166 9 Linear dynamical systems Figure 9.2 Approximate birth rate versus age in the US in 2010. The figure is based on statistics for age groups of five years (hence, the piecewise-constant shape) and assumes an equal number of men and women in each age group. (Martin J.A., Hamilton B.E., Ventura S.J. et al., Births: Final data for 2010. National Vital Statistics Reports; vol. 61, no. 1. National Center for Health Statistics, 2012.) Figure 9.3 Death rate versus age, for ages 0–99, in the US in 2010. (Centers for Disease Control and Prevention, National Center for Health Statistics, wonder.cdc.gov.) 0102030405060708090100024AgeBirthrate(%)01020304050607080901000102030AgeDeathrate(%) 9.2 Population dynamics 167 Figure 9.4 Predicted age distribution in the US in 2020. where A is given by A =          b1 d1 1 − 0 ... 0 0 b2 0 d2 1 − ... 0 0 b3 0 0 ... 0 0 b98 0 0 ... 1 d98 − 0 1          . b100 0 0 ... 0 0 b99 0 0 ... 0 d99 − · · · · · · · · · · · · · · · We can use this model to predict the total population in 10 years (not including immigration), or to predict the number of school age children, or retirement age adults. Figure 9.4 shows the predicted age distribution in 2020, computed by iterating the model xt+1 = Axt for t = 1, . . . , 10, with initial value x1 given by the 2010 age distribution of figure 9.1. Note that the distribution is based on an approximate model, since we neglect the effect of immigration, and assume that the death and birth rates remain constant and equal to the values shown in figures 9.2 and 9.3. Population dynamics models are used to carry out projections of the future age distribution, which in turn is used to predict how many retirees there will be in some future year. They are also used to carry out various ‘what if’ analyses, to predict the effect of changes in birth or death rates on the future age distribution. It is easy to include the effects of immigration and emigration in the population dynamics model (9.4), by simply adding a 100-vector ut: xt+1 = Axt + ut, which is a time-invariant linear dynamical system of the form (9.2), with input ut and B = I. The vector ut gives the net immigration in year t over all ages; (ut)i 1. (Negative entries mean net is the number of immigrants in year t of age i emigration.) − 010203040506070809010001234AgePopulation(millions) 168 9 Linear dynamical systems 9.3 Epidemic dynamics The dynamics of infection and the spread of an epidemic can be modeled using a linear dynamical system. (More sophisticated nonlinear epidemic dynamic models are also used.) In this section we describe a simple example. A disease is introduced into a population. In each period (say, days) we count the fraction of the population that is in four different infection states: Susceptible. These individuals can acquire the disease the next day. Infected. These individuals have the disease. Recovered (and immune). These individuals had the disease and survived, and now have immunity. Deceased. These individuals had the disease, and unfortunately died from it. • • • • We denote the fractions of each of these as a 4-vector xt, so, for example, xt = (0.75, 0.10, 0.10, 0.05) means that in day t, 75% of the population is susceptible, 10% is infected, 10% is recovered and immune, and 5% has died from the disease. There are many mathematical models that predict how the disease state fractions xt evolve over time. One simple model can be expressed as a linear dynamical system. The model assumes the following happens over each day. • • 5% of the susceptible population will acquire the disease. (The other 95% will remain susceptible.) 1% of the infected population will die from the disease, 10% will recover and acquire immunity, and 4% will recover and not acquire immunity (and therefore, become susceptible). The remaining 85% will remain infected. (Those who have have recovered with immunity and those who have died remain in those states.) We first determine (xt+1)1, the fraction of susceptible individuals in the next day. These include the susceptible individuals from today, who did not become infected, which is 0.95(xt)1, plus the infected individuals today who recovered without immunity, which is 0.04(xt)2. All together we have (xt+1)1 = 0.95(xt)1 + 0.04(xt)2. We have (xt+1)2 = 0.85(xt)2 + 0.05(xt)1; the first term counts those who are infected and remain infected, and the second term counts those who are susceptible and acquire the disease. Similar arguments give (xt+1)3 = (xt)3 + 0.10(xt)2, and (xt+1)4 = (xt)4 + 0.01(xt)2. We put these together to get xt+1 =     0.95 0.05 0 0 0.04 0.85 0.10 0.01 xt, which is a time-invariant linear dynamical system of the form (9.1). Figure 9.5 shows the evolution of the four groups from the initial condition x0 = (1, 0, 0, 0). The simulation shows that after around 100 days, the state converges to one with a little under 10% of the population deceased, and the remaining population immune. 9.4 Motion of a mass 169 Figure 9.5 Simulation of epidemic dynamics. Figure 9.6 Mass moving along a line. 9.4 Motion of a mass Linear dynamical systems can be used to (approximately) describe the motion of many mechanical systems, for example, an airplane (that is not undergoing extreme maneuvers), or the (hopefully not too large) movement of a building during an earthquake. Here we describe the simplest example: A single mass moving in 1-D (i.e., a straight line), with an external force and a drag force acting on it. This is illustrated in figure 9.6. The (scalar) position of the mass at time τ is given by p(τ ). (Here τ is continuous, i.e., a real number.) The position satisfies Newton’s law of motion, the differential equation m d2p dτ 2 (τ ) = dp dτ η − (τ ) + f (τ ), where m > 0 is the mass, f (τ ) is the external force acting on the mass at time τ , and η > 0 is the drag coefficient. The right-hand side is the total force acting on the mass; the first term is the drag force, which is proportional to the velocity and in the opposite direction. 05010015020000.20.40.60.81SusceptibleInfectedRecoveredDeceasedTimetxtmp(τ)f(τ)0 170 9 Linear dynamical systems Introducing the velocity of the mass, v(τ ) = dp(τ )/dτ , we can write the equation above as two coupled differential equations, dp dτ (τ ) = v(τ ), m dv dτ (τ ) = ηv(τ ) + f (τ ). − The first equation relates the position and velocity; the second is from the law of motion. Discretization. To develop an (approximate) linear dynamical system model from the differential equations above, we first discretize time. We let h > 0 be a time interval (called the ‘sampling interval’) that is small enough that the velocity and forces do not change very much over h seconds. We define pk = p(kh), vk = v(kh), fk = f (kh), which are the continuous quantities ‘sampled’ at multiples of h seconds. We now use the approximations dp dτ (kh) pk+1 − h pk , ≈ dv dτ (kh) vk+1 − h vk , ≈ (9.5) which are justified since h is small. This leads to the (approximate) equations (replacing with =) ≈ pk pk+1 − h = vk, m vk+1 − h vk = fk − ηvk. Finally, using state xk = (pk, vk), we write this as xk+1 = 1 0 1 − h hη/m xk + 0 h/m fk, k = 1, 2, . . . , which is a linear dynamical system of t
he form (9.2), with input fk and dynamics and input matrices A = 1 0 1 − , h hη/m B = . 0 h/m This linear dynamical system gives an approximation of the true motion, due to our approximation (9.5) of the derivatives. But for h small enough, it is accurate. This linear dynamical system can be used to simulate the motion of the mass, if we know the external force applied to it, i.e., ut for t = 1, 2, . . .. The approximation (9.5), which turns a set of differential equations into a recursion that approximates it, is called the Euler method, named after the math(There are other, more sophisticated, methods for ematician Leonhard Euler. approximating differential equations as recursions.) 9.5 Supply chain dynamics 171 Example. As a simple example, we consider the case with m = 1 (kilogram), η = 1 (Newtons per meter per second), and sampling period h = 0.01 (seconds). The external force is f (τ ) =    0.0 1.0 1.3 0.0 − 0.0 0.5 1.0 1.4 ≤ ≤ ≤ ≤ τ < 0.5 τ < 1.0 τ < 1.4 τ. We simulate this system for a period of 2.5 seconds, starting from initial state x1 = (0, 0), which corresponds to the mass starting at rest (zero velocity) at position 0. The simulation involves iterating the dynamics equation from k = 1 to k = 250. Figure 9.7 shows the force, position, and velocity of the mass, with the axes labeled using continuous time τ . 9.5 Supply chain dynamics The dynamics of a supply chain can often be modeled using a linear dynamical system. (This simple model does not include some important aspects of a real supply chain, for example limits on storage at the warehouses, or the fact that demand fluctuates.) We give a simple example here. We consider a supply chain for a single divisible commodity (say, oil or gravel, or discrete quantities so small that their quantities can be considered real numbers). The commodity is stored at n warehouses or storage locations. Each of these locations has a target (desired) level or amount of the commodity, and we let the n-vector xt denote the deviations of the levels of the commodities from their target levels. For example, (x5)3 is the actual commodity level at location 3, in period 5, minus the target level for location 3. If this is positive it means we have more than the target level at the location; if it is negative, we have less than the target level at the location. The commodity is moved or transported in each period over a set of m transportation links between the storage locations, and also enters and exits the nodes through purchases (from suppliers) and sales (to end-users). The purchases and sales are given by the n-vectors pt and st, respectively. We expect these to be positive; but they can be negative if we include returns. The net effect of the purchases st)i of the commodity at location i. (This number is and sales is that we add (pt − negative if we sell more than we purchase at the location.) × m incidence matrix Asc (see We describe the links by the n 7.3). The direction § of each link does not indicate the direction of commodity flow; it only sets the reference direction for the flow: Commodity flow in the direction of the link is considered positive and commodity flow in the opposite direction is considered negative. We describe the commodity flow in period t by the m-vector ft. For example, (f6)2 = 1.4 means that in time period 6, 1.4 units of the commodity are moved along link 2 in the direction opposite the link direction (since the flow is negative). The n-vector Ascft gives the net flow of the commodity into the n locations, due to the transport across the links. − 172 9 Linear dynamical systems Figure 9.7 Simulation of mass moving along a line. Applied force (top), position (middle), and velocity (bottom). 0123456−1.5−1−0.500.51f(τ)012345600.050.10.15p(τ)0123456−0.200.20.4τv(τ) 9.5 Supply chain dynamics 173 Figure 9.8 A simple supply chain with n = 3 storage locations and m = 3 transportation links. Taking into account the movement of the commodity across the network, and the purchase and sale of the commodity, we get the dynamics xt+1 = xt + Ascft + pt − st, t = 1, 2, . . . . In applications where we control or run a supply chain, st is beyond our control, but we can manipulate ft (the flow of goods between storage locations) and pt (purchases at locations). This suggests treating st as the offset, and ut = (ft, pt) as the input in a linear dynamical system with input (9.2). We can write the dynamics equations above in this form, with dynamics and input matrices A = I, B = Asc I . (Note that Asc refers to the supply chain graph incidence matrix, while A is the dynamics matrix in (9.2).) This gives xt+1 = Axt + B(ft, pt) st, t = 1, 2, . . . , . − A simple example is shown in figure 9.8. The supply chain dynamics equation is xt+1 = xt +   −   ft pt st, − t = 1, 2, . . . . It is a good exercise to check that the matrix-vector product (the middle term of the right-hand side) gives the amount of commodity added at each location, as a result of shipment and purchasing. 123f1f2f3s1p1s2p2s3p3 174 9 Linear dynamical systems Exercises 9.1 Compartmental system. A compartmental system is a model used to describe the movement of some material over time among a set of n compartments of a system, and the outside world. It is widely used in pharmaco-kinetics, the study of how the concentration of a drug varies over time in the body. In this application, the material is a drug, and the compartments are the bloodstream, lungs, heart, liver, kidneys, and so on. Compartmental systems are special cases of linear dynamical systems. In this problem we will consider a very simple compartmental system with 3 compartments. We let (xt)i denote the amount of the material (say, a drug) in compartment i at time period t. Between period t and period t + 1, the material moves as follows. 10% of the material in compartment 1 moves to compartment 2. (This decreases the amount in compartment 1 and increases the amount in compartment 2.) 5% of the material in compartment 2 moves to compartment 3. 5% of the material in compartment 3 moves to compartment 1. 5% of the material in compartment 3 is eliminated. • • • • Express this compartmental system as a linear dynamical system, xt+1 = Axt. (Give the matrix A.) Be sure to account for all the material entering and leaving each compartment. 9.2 Dynamics of an economy. An economy (of a country or region) is described by an nvector at, where (at)i is the economic output in sector i in year t (measured in billions of dollars, say). The total output of the economy in year t is 1T at. A very simple model of how the economic output changes over time is at+1 = Bat, where B is an n n matrix. (This is closely related to the Leontief input-output model described on page 157 of the book. But the Leontief model is static, i.e., doesn’t consider how an economy changes over time.) The entries of at and B are positive in general. In this problem we will consider the specific model with n = 4 sectors and × B =    0.10 0.48 0.00 0.04 0.06 0.44 0.55 0.01 0.05 0.10 0.52 0.42    . 0.70 0.04 0.04 0.51 (a) Briefly interpret B23, in English. (b) Simulation. Suppose a1 = (0.6, 0.9, 1.3, 0.5). Plot the four sector outputs (i.e., (at)i for i = 1, . . . , 4) and the total economic output (i.e., 1T at) versus t, for t = 1, . . . , 20. 9.3 Equilibrium point for linear dynamical system. Consider a time-invariant linear dynamical system with offset, xt+1 = Axt +c, where xt is the state n-vector. We say that a vector z is an equilibrium point of the linear dynamical system if x1 = z implies x2 = z, x3 = z, . . . . (In words: If the system starts in state z, it stays in state z.) Find a matrix F and vector g for which the set of linear equations F z = g characterizes equilibrium points. (This means: If z is an equilibrium point, then F z = g; conversely if F z = g, then z is an equilibrium point.) Express F and g in terms of A, c, any standard matrices or vectors (e.g., I, 1, or 0), and matrix and vector operations. Remark. Equilibrium points often have interesting interpretations. For example, if the linear dynamical system describes the population dynamics of a country, with the vector c denoting immigration (emigration when entries of c are negative), an equilibrium point is a population distribution that does not change, year to year. In other words, immigration exactly cancels the changes in population distribution caused by aging, births, and deaths. Exercises 175 9.4 Reducing a Markov model to a linear dynamical system. Consider the 2-Markov model xt+1 = A1xt + A2xt 1, − t = 2, 3, . . . , 1). Show that zt satisfies the linear dynamical where xt is an n-vector. Define zt = (xt, xt (2n) matrix. This idea system equation zt+1 = Bzt, for t = 2, 3, . . ., where B is a (2n) can be used to express any K-Markov model as a linear dynamical system, with state (xt, . . . , xt K+1). × − − 9.5 Fibonacci sequence. The Fibonacci sequence y0, y1, y2, . . . starts with y0 = 0, y1 = 1, and for t = 2, 3, . . ., yt is the sum of the previous two entries, i.e., yt 2. (Fibonacci is the name used by the 13th century mathematician Leonardo of Pisa.) Express this as a time-invariant linear dynamical system with state xt = (yt, yt 1) and output yt, for t = 1, 2, . . .. Use your linear dynamical system to simulate (compute) the Fibonacci sequence up to t = 20. Also simulate a modified Fibonacci sequence z0, z1, z2, . . ., which starts with the same values z0 = 0 and z1 = 1, but for t = 2, 3, . . ., zt is the difference of the two previous values, i.e., zt 1 + yt zt − − − 2. 1 9.6 Recursive averaging. Suppose that u1, u2, . . . is a sequence of n-vectors. Let x1 = 0, and for t = 2, 3, . . ., let xt be the average of u1, . . . , ut 1). Express this as a linear dynamical system with input, i.e., xt+1 = Atxt +Btut, t = 1, 2, . . . (with initial state x1 = 0). Remark. This can be used to compute the average of an extremely large collection of vectors, by accessing them one-by-one. 1, i.e., xt = (u1 + 1)/(
t + ut · · · − − − − − − 9.7 Complexity of linear dynamical system simulation. Consider the time-invariant linear dynamical system with n-vector state xt and m-vector input ut, and dynamics xt+1 = Axt + But, t = 1, 2, . . .. You are given the matrices A and B, the initial state x1, and the 1. What is the complexity of carrying out a simulation, i.e., computing inputs u1, . . . , uT x2, x3, . . . , xT ? About how long would it take to carry out a simulation with n = 15, m = 5, and T = 105, using a 1 Gflop/s computer? − Chapter 10 Matrix multiplication In this chapter we introduce matrix multiplication, a generalization of matrix-vector multiplication, and describe several interpretations and applications. 10.1 Matrix-matrix multiplication It is possible to multiply two matrices using matrix multiplication. You can multiply two matrices A and B provided their dimensions are compatible, which means the number of columns of A equals the number of rows of B. Suppose A and B are compatible, e.g., A has size m n. Then the product matrix p and B has size p C = AB is the m × n matrix with elements × × Cij = p k=1 AikBkj = Ai1B1j+ +AipBpj, · · · i = 1, . . . , m, j = 1, . . . , n. (10.1) There are several ways to remember this rule. To find the i, j element of the product C = AB, you need to know the ith row of A and the jth column of B. The summation above can be interpreted as ‘moving left to right along the ith row of A’ while moving ‘top to bottom’ down the jth column of B. As you go, you keep a running sum of the product of elements, one from A and one from B. As a specific example, we have − 1..5 1 − . − 4.5 1 To find the 1, 2 entry of the right-hand matrix, we move along the first row of the left-hand matrix, and down the second column of the middle matrix, to get ( − 1.5)( Matrix-matrix multiplication includes as special cases several other types of 2) + (2)(0) = 1) + (3)( 4.5. − − − multiplication (or product) we have encountered so far. 178 10 Matrix multiplication 1 matrix. The matrix product xa then makes sense, and is an n Scalar-vector product. If x is an n-vector and a is a number, we can interpret the scalar-vector product xa, with the scalar appearing on the right, as matrix-matrix 1 matrix, and the scalar multiplication. We consider the n-vector x to be an n a to be a 1 1 matrix, which we consider the same as an n-vector. It coincides with the scalarvector product xa, which we usually write (by convention) as ax. But note that ax cannot be interpreted as matrix-matrix multiplication (except when n = 1), since the number of columns of a (which is one) is not equal to the number of rows of x (which is n). × × × Inner product. An important special case of matrix-matrix multiplication is the multiplication of a row vector with a column vector. If a and b are n-vectors, then the inner product aT b = a1b1 + a2b2 + + anbn · · · can be interpreted as the matrix-matrix product of the 1 n explains the notation aT b for the inner product of vectors a and b, defined in n matrix aT and the 1 matrix, which we consider to be a scalar. (This 1.4.) 1 matrix b. The result is a 1 × × × § Matrix-vector multiplication. The matrix-vector product y = Ax defined in (6.4) can be interpreted as a matrix-matrix product of A with the n 1 matrix x. × Vector outer product. The outer product of an m-vector a and an n-vector b is given by abT , which is an m n matrix ×  abT =     a1b1 a2b1 ... a1b2 a2b2 ... amb1 amb2      , a1bn a2bn ... ambn · · · · · · · · · whose entries are all products of the entries of a and the entries of b. Note that the outer product does not satisfy abT = baT , i.e., it is not symmetric (like the inner product). Indeed, the equation abT = baT does not even make sense, unless m = n; even then, it is not true in general. Multiplication by identity. n matrix, then AI = A and IA = A, i.e., when you multiply a matrix by an identity matrix, it has no effect. (Note the different sizes of the identity matrices in the formulas AI = A and IA = A.) If A is any m × Matrix multiplication order matters. Matrix multiplication is (in general) not commutative: We do not (in general) have AB = BA. In fact, BA may not even make sense, or, if it makes sense, may be a different size than AB. For example, if A is 2 4, then AB makes sense (the dimensions are compatible) but BA does not even make sense (the dimensions are incompatible). Even when AB and BA both make sense and are the same size, i.e., when A and B are square, we do not (in general) have AB = BA. As a simple example, take the matrices 3 and B is 10.1 Matrix-matrix multiplication 179 We have AB = , 6 3 − − 11 3 − BA = 9 − 17 − 3 0 . Two matrices A and B that satisfy AB = BA are said to commute. (Note that for AB = BA to make sense, A and B must both be square.) Properties of matrix multiplication. The following properties hold and are easy to verify from the definition of matrix multiplication. We assume that A, B, and C are matrices for which all the operations below are valid, and that γ is a scalar. • • • Associativity: (AB)C = A(BC). Therefore we can write the product simply as ABC. Associativity with scalar multiplication: γ(AB) = (γA)B, where γ is a scalar, and A and B are matrices (that can be multiplied). This is also equal to A(γB). (Note that the products γA and γB are defined as scalar-matrix products, but in general, unless A and B have one row, not as matrix-matrix products.) Distributivity with addition. Matrix multiplication distributes across matrix addition: A(B+C) = AB+AC and (A+B)C = AC +BC. On the right-hand sides of these equations we use the higher precedence of matrix multiplication over addition, so, for example, AC + BC is interpreted as (AC) + (BC). • Transpose of product. The transpose of a product is the product of the transposes, but in the opposite order: (AB)T = BT AT . From these properties we can derive others. For example, if A, B, C, and D are square matrices of the same size, we have the identity (A + B)(C + D) = AC + AD + BC + BD. This is the same as the usual formula for expanding a product of sums of scalars; but with matrices, we must be careful to preserve the order of the products. Inner product and matrix-vector products. As an exercise on matrix-vector products and inner products, one can verify that if A is m n, x is an n-vector, and y is an m-vector, then × yT (Ax) = (yT A)x = (AT y)T x, i.e., the inner product of y and Ax is equal to the inner product of x and AT y. (Note = n, these inner products involve vectors with different dimensions.) that when m Products of block matrices. Suppose A is a block matrix with m p block entries Aij, and B is a block matrix with p n block entries Bij, and for each k = 1, . . . , p, the matrix product AikBkj makes sense, i.e., the number of columns of Aik equals the number of rows of Bkj. (In this case we say that the block matrices conform or × × 180 10 Matrix multiplication are compatible.) Then C = AB can be expressed as the m entries Cij, given by the formula (10.1). For example, we have × n block matrix with A B C D E F G H = AE + BG AF + BH CE + DG CF + DH , for any matrices A, B, . . . , H for which the matrix products above make sense. This 2 matrices (i.e., with formula is the same as the formula for multiplying two 2 scalar entries); but when the entries of the matrix are themselves matrices (as in the block matrix above), we must be careful to preserve the multiplication order. × Column interpretation of matrix-matrix product. We can derive some additional insight into matrix multiplication by interpreting the operation in terms of the columns of the second matrix. Consider the matrix product of an m p matrix A and a p n matrix B, and denote the columns of B by bk. Using block-matrix notation, we can write the product AB as × × AB = A b1 b2 bn = Ab1 Ab2 Abn . · · · · · · Thus, the columns of AB are the matrix-vector products of A and the columns of B. The product AB can be interpreted as the matrix obtained by ‘applying’ A to each of the columns of B. Multiple sets of linear equations. We can use the column interpretation of matrix multiplication to express a set of k linear equations with the same m n coefficient matrix A, × in the compact form Axi = bi, i = 1, . . . , k, AX = B, bk]. The matrix equation AX = B is where X = [x1 · · · sometimes called a linear equation with matrix right-hand side, since it looks like Ax = b, but X (the variable) and B (the right-hand side) are now n k matrices, instead of n-vectors (which are n xk] and B = [b1 · · · 1 matrices). × × Row interpretation of matrix-matrix product. We can give an analogous row interpretation of the product AB, by partitioning A and AB as block matrices with row vector blocks. Let aT m be the rows of A. Then we have 1 , . . . , aT AB =           aT 1 aT 2 ... aT m B =      aT 1 B aT 2 B ... aT mB           = (BT a1)T (BT a2)T ... (BT am)T      . This shows that the rows of AB are obtained by applying BT to the transposed row vectors ak of A, and transposing the result. 10.1 Matrix-matrix multiplication 181 Inner product representation. From the definition of the i, j element of AB in (10.1), we also see that the elements of AB are the inner products of the rows of A with the columns of B: AB =      aT aT 1 b1 1 b2 aT aT 2 b1 2 b2 ... ... mb1 aT aT mb2      , aT 1 bn aT 2 bn ... aT mbn · · · · · · . . . · · · where aT the matrix-matrix product as the mn inner products aT matrix. i are the rows of A and bj are the columns of B. Thus we can interpret n i bj arranged in an m × × Gram matrix. For an m n matrix A, with columns a1, . . . , an, the matrix product G = AT A is called the Gram matrix associated with the set of m-vectors a1, . . . , an. (It is named after the mathematician Jørgen Pedersen Gram.) From the inner product interpretation above, the Gram matrix can be expressed as  1 a1 aT aT 1 a2 2 a1 aT aT 2 a2 ... ... n a1 aT aT n a2 The entries of the Gram matrix G give all inn
er products of pairs of columns of A. Note that a Gram matrix is symmetric, since aT j ai. This can also be seen using the transpose-of-product rule: aT 1 an aT 2 an ... aT n an G = AT A = i aj = aT · · · · · · . . .         · · ·  . GT = (AT A)T = (AT )(AT )T = AT A = G. The Gram matrix will play an important role later in this book. As an example, suppose the m in n groups, with entries × n matrix A gives the membership of m items Aij = 1 item i is in group j 0 item i is not in group j. (So the jth column of A gives the membership in the jth group, and the ith row gives the groups that item i is in.) In this case the Gram matrix G has a nice interpretation: Gij is the number of items that are in both groups i and j, and Gii is the number of items in group i. Outer product representation. columns a1, . . . , ap and the p × If we express the m n matrix B in terms of its rows bT × p matrix A in terms of its 1 , . . . , bT p , A = a1 · · · , ap B =    ,    bT 1 ... bT p then we can express the product matrix AB as a sum of outer products: AB = a1bT 1 + + apbT p . · · · 182 10 Matrix multiplication Complexity of matrix multiplication. The total number of flops required for a matrix-matrix product C = AB with A of size m n can be × found several ways. The product matrix C has size m n, so there are mn elements to compute. The i, j element of C is the inner product of row i of A with column 1 flops. j of B. This is an inner product of vectors of length p and requires 2p Therefore the total is mn(2p 1) flops, which we approximate as 2mnp flops. The order of computing the matrix-matrix product is mnp, the product of the three dimensions involved. p and B of size p − × − × In some special cases the complexity is less than 2mnp flops. As an example, n Gram matrix G = BT B we only need to compute the when we compute the n entries in the upper (or lower) half of G, since G is symmetric. This saves around half the flops, so the complexity is around pn2 flops. But the order is the same. × Complexity of sparse matrix multiplication. Multiplying sparse matrices can be done efficiently, since we don’t need to carry out any multiplications in which one or the other entry is zero. We start by analyzing the complexity of multiplying a sparse matrix with a non-sparse matrix. Suppose that A is m p and sparse, n, but not necessarily sparse. The inner product of the ith row aT and B is p i of A with the jth column of B requires no more than 2 nnz(aT i ) flops. Summing over i = 1, . . . , m and j = 1, . . . , n we get 2 nnz(A)n flops. If B is sparse, the total number of flops is no more that 2 nnz(B)m flops. (Note that these formulas agree with the one given above, 2mnp, when the sparse matrices have all entries nonzero.) × × There is no simple formula for the complexity of multiplying two sparse matri- ces, but it is certainly no more than 2 min nnz(A)n, nnz(B)m flops. } { Complexity of matrix triple product. Consider the product of three matrices, D = ABC × n, B of size n with A of size m q. The matrix D can be computed in two ways, as (AB)C and as A(BC). In the first method we start with AB (2mnp flops) and then form D = (AB)C (2mpq flops), for a total of 2mp(n+q) flops. In the second method we compute the product BC (2npq flops) and then form D = A(BC) (2mnq flops), for a total of 2nq(m + p) flops. p, and C of size p × × You might guess that the total number of flops required is the same with the two methods, but it turns out it is not. The first method is less expensive when 2mp(n + q) < 2nq(m + p), i.e., when . For example, if m = p and n = q, the first method has a complexity proportional to m2n, while the second method has complexity mn2, and one would prefer the first method when m n. As a more specific example, consider the product abT c, where a, b, c are nvectors. If we first evaluate the outer product abT , the cost is n2 flops, and we need to store n2 values. We then multiply the vector c by this n n matrix, which × 10.2 Composition of linear functions 183 costs 2n2 flops. The total cost is 3n2 flops. On the other hand if we first evaluate the inner product bT c, the cost is 2n flops, and we only need to store one number (the result). Multiplying the vector a by this number costs n flops, so the total cost is 3n flops. For n large, there is a dramatic difference between 3n and 3n2 flops. (The storage requirements are also dramatically different for the two methods of evaluating abT c: one number versus n2 numbers.) 10.2 Composition of linear functions n. We can associate with these matrices two linear functions f : Rp Matrix-matrix products and composition. Suppose A is an m is p × and g : Rn two functions is the function h : Rn p matrix and B Rm Rp, defined as f (x) = Ax and g(x) = Bx. The composition of the Rm with → → × → h(x) = f (g(x)) = A(Bx) = (AB)x. In words: To find h(x), we first apply the function g, to obtain the partial result g(x) (which is a p-vector); then we apply the function f to this result, to obtain h(x) (which is an m-vector). In the formula h(x) = f (g(x)), f appears to the left of g; but when we evaluate h(x), we apply g first. The composition h is evidently a linear function, that can be written as h(x) = Cx with C = AB. Using this interpretation of matrix multiplication as composition of linear functions, it is easy to understand why in general AB = BA, even when the dimensions are compatible. Evaluating the function h(x) = ABx means we first evaluate y = Bx, and then z = Ay. Evaluating the function BAx means we first evaluate y = Ax, and then z = By. In general, the order matters. As an example, take the 2 2 matrices × for which AB = 0 1 , 1 − 0 BA = 0 1 − . 1 0 − The mapping f (x) = Ax = ( x1, x2) changes the sign of the first element of the vector x. The mapping g(x) = Bx = (x2, x1) reverses the order of two elements x2, x1), we first reverse the order, and of x. If we evaluate f (g(x)) = ABx = ( then change the sign of the first element. This result is obviously different from g(f (x)) = BAx = (x2, x1), obtained by changing the sign of the first element, and then reversing the order of the elements. − − Second difference matrix. As a more interesting example of composition of linear n difference matrix Dn defined in (6.5). (We use functions, consider the (n the subscript n here to denote size of D.) Let Dn 1) 1 denote the (n 1Dn is called the second difference matrix, difference matrix. Their product Dn and sometimes denoted ∆. (n 1) 2) × − − × − − − 184 10 Matrix multiplication We can interpret ∆ in terms of composition of linear functions. Multiplying an 1)-vector of consecutive differences of the entries: n-vector x by Dn yields the (n − Dnx = (x2 − x1, . . . , xn − xn − 1). Multiplying this vector by Dn of consecutive differences (or second differences) of x: 1 gives the (n − − 2)-vector of consecutive differences Dn − 1Dnx = (x1 − 2) 2x2 + x3, x2 − n product matrix ∆ = Dn The (n × second difference function. − 2x3 + x4, . . . , xn 2xn 2 − − 1 + xn). − 1Dn is the matrix associated with the − For the case n = 5, ∆ = Dn 1Dn has the form −   − The left-hand matrix ∆ is associated with the second difference linear function that maps 5-vectors into 3-vectors. The middle matrix D4 is associated with the difference function that maps 4-vectors into 3-vectors. The right-hand matrix D5 is associated with the difference function that maps 5-vectors into 4-vectors. Composition of affine functions. The composition of affine functions is an affine function. Suppose f : Rp Rm is the affine function given by f (x) = Ax + b, and Rp is the affine function given by g(x) = Cx + d. The composition h is g : Rn → given by → h(x) = f (g(x)) = A(Cx + d) + b = (AC)x + (Ad + b) = ˜Ax + ˜b, where ˜A = AC, ˜b = Ad + b. Chain rule of differentiation. Let f : Rp Rp be differentiable functions. The composition of f and g is defined as the function h : Rn Rm and g : Rn Rm with → → → h(x) = f (g(x)) = f (g1(x), . . . , gp(x)). The function h is differentiable and its partial derivatives follow from those of f and g via the chain rule: ∂hi ∂xj (z) = ∂fi ∂y1 (g(z)) ∂g1 ∂xj (z) + + · · · ∂fi ∂yp (g(z)) ∂gp ∂xj (z) for i = 1, . . . , m and j = 1, . . . , n. This relation can be expressed concisely as a matrix-matrix product: The derivative matrix of h at z is the product Dh(z) = Df (g(z))Dg(z) 10.2 Composition of linear functions 185 of the derivative matrix of f at g(z) and the derivative matrix of g at z. This compact matrix formula generalizes the chain rule for scalar-valued functions of a single variable, i.e., h(z) = f (g(z))g(z). The first order Taylor approximation of h at z can therefore be written as ˆh(x) = h(z) + Dh(z)(x z) − = f (g(z)) + Df (g(z))Dg(z)(x z). − The same result can be interpreted as a composition of two affine functions, the first order Taylor approximation of f at g(z), ˆf (y) = f (g(z)) + Df (g(z))(y g(z)) − and the first order Taylor approximation of g at z, The composition of these two affine functions is ˆg(x) = g(z) + Dg(z)(x z). − ˆf (ˆg(x)) = ˆf (g(z) + Dg(z)(x z)) − = f (g(z)) + Df (g(z))(g(z) + Dg(z)(x = f (g(z)) + Df (g(z))Dg(z)(x z) − which is equal to ˆh(x). z) − − g(z)) When f is a scalar-valued function (m = 1), the derivative matrices Dh(z) and Df (g(z)) are the transposes of the gradients, and we write the chain rule as h(z) = Dg(z)T ∇ f (g(z)). ∇ In particular, if g(x) = Ax + b is affine, then the gradient of h(x) = f (g(x)) = f (Ax + b). f (Ax + b) is given by h(z) = AT ∇ ∇ Linear dynamical system with state feedback. We consider a time-invariant linear dynamical system with n-vector state xt and m-vector input ut, with dynamics xt+1 = Axt + But, t = 1, 2, . . . . Here we think of the input ut as something we can manipulate, e.g., the control surface deflections for an airplane or the amount of material we order or move in a supply chain. In state feedback control the state xt is measured, and the input ut is a linear function of the state, expressed as ut = Kxt, × n state-feedback gain matrix. The term feedback refers to where K is the m t
he idea that the state is measured, and then (after multiplying by K) fed back into the system, via the input. This leads to a loop, where the state affects the input, and the input affects the (next) state. State feedback is very widely used 17.2.3 we will see methods for choosing or designing an in many applications. (In appropriate state feedback matrix.) § 186 10 Matrix multiplication With state feedback, we have xt+1 = Axt + But = Axt + B(Kxt) = (A + BK)xt, t = 1, 2, . . . . This recursion is called the closed-loop system. The matrix A + BK is called the closed-loop dynamics matrix. (In this context, the recursion xt+1 = Axt is called the open-loop system. It gives the dynamics when ut = 0.) 10.3 Matrix power It makes sense to multiply a square matrix A by itself to form AA. We refer to this matrix as A2. Similarly, if k is a positive integer, then k copies of A multiplied together is denoted Ak. If k and l are positive integers, and A is square, then AkAl = Ak+l and (Ak)l = Akl. By convention we take A0 = I, which makes the formulas above hold for all nonnegative integer values of k and l. We should mention one ambiguity in matrix power notation that occasionally arises. When A is a square matrix and T is a nonnegative integer, AT can mean either the transpose of the matrix A or its T th power. Usually which is meant is clear from the context, or the author explicitly states which meaning is intended. To avoid this ambiguity, some authors use a different symbol for the transpose, such as AT (with the superscript in roman font) or A, or avoid referring to the T th power of a matrix. When A is not square there is no ambiguity, since AT can only be the transpose in this case. Other matrix powers. Matrix powers Ak with k a negative integer will be dis11.2. Non-integer powers, such as A1/2 (the matrix squareroot), need cussed in not make sense, or can be ambiguous, unless certain conditions on A hold. This is an advanced topic in linear algebra that we will not pursue in this book. § Paths in a directed graph. Suppose A is the n graph with n vertices: × n adjacency matrix of a directed Aij = 1 0 there is a edge from vertex j to vertex i otherwise (see page 112). A path of length is a sequence of + 1 vertices, with an edge from the first to the second vertex, an edge from the second to third vertex, and so on. We say the path goes from the first vertex to the last one. An edge can be considered a path of length one. By convention, every vertex has a path of length zero (from the vertex to itself). The elements of the matrix powers A have a simple meaning in terms of paths in the graph. First examine the expression for the i, j element of the square of A: (A2)ij = n k=1 AikAkj. 10.3 Matrix power 187 Figure 10.1 Directed graph. Each term in the sum is 0 or 1, and equal to one only if there is an edge from vertex j to vertex k and an edge from vertex k to vertex i, i.e., a path of length exactly two from vertex j to vertex i via vertex k. By summing over all k, we obtain the total number of paths of length two from j to i. The adjacency matrix A for the graph in figure 10.1, for example, and its square are given by A2 =       We can verify there is exactly one path of length two from vertex 1 to itself, i.e., the path (1, 2, 1)), and one path of length two from vertex 3 to vertex 1, i.e., the path (3, 2, 1). There are two paths of length two from vertex 4 to vertex 3, (4, 3, 3) and (4, 5, 3), so (A2)34 = 2. The property extends to higher powers of A. If is a positive integer, then the i, j element of A is the number of paths of length from vertex j to vertex i. This can be proved by induction on . We have already shown the result for = 2. Assume that it is true that the elements of A give the paths of length between the different vertices. Consider the expression for the i, j element of A+1: (A+1)ij = n k=1 Aik(A)kj. The kth term in the sum is equal to the number of paths of length from j to k if there is an edge from k to i, and is equal to zero otherwise. Therefore it is equal to the number of paths of length + 1 from j to i that end with the edge (k, i), i.e., of the form (j, . . . , k, i). By summing over all k we obtain the total number of paths of length + 1 from vertex j to i. 12345 188 10 Matrix multiplication Figure 10.2 Contribution factor per age in 2010 to the total population in 1 is the ith component of the row vector 1T A10. 2020. The value for age i − This can be verified in the example. The third power of A is A3 =       The (A3)24 = 3 paths of length three from vertex 4 to vertex 2 are (4, 3, 3, 2), (4, 5, 3, 2), (4, 5, 1, 2). Linear dynamical system. Consider a time-invariant linear dynamical system, described by xt+1 = Axt. We have xt+2 = Axt+1 = A(Axt) = A2xt. Continuing this argument, we have xt+ = Axt, for = 1, 2, . . .. In a linear dynamical system, we can interpret A as the matrix that propagates the state forward time steps. For example, in a population dynamics model, A is the matrix that maps the current population distribution into the population distribution periods in the future, taking into account births, deaths, and the births and deaths of children, and so on. The total population periods in the future is given by 1T (Axt), which we can write as (1T A)xt. The row vector 1T A has an interesting interpretation: Its ith entry is the contribution to the total population in periods due to each 1. It is plotted in figure 10.2 for the US data given person with current age i in 9.2. − § 010203040506070809010000.511.5AgeFactor 10.4 QR factorization 189 Matrix powers also come up in the analysis of a time-invariant linear dynamical system with an input. We have xt+2 = Axt+1 + But+1 = A(Axt + But) = A2xt + ABut + But+1. Iterating this over periods we obtain xt+ = Axt + A 1But + A 2But+1 + − − + But+ 1. − · · · (10.2) (The first term agrees with the formula for xt+ with no input.) The other terms are readily interpreted. The term AjBut+ j is the contribution to the state xt+ due to the input at time t + j. − − 10.4 QR factorization Matrices with orthonormal columns. As an application of Gram matrices, we can express the condition that the n-vectors a1, . . . , ak are orthonormal in a simple way using matrix notation: AT A = I, × k matrix with columns a1, . . . , ak. There is no standard term for where A is the n a matrix whose columns are orthonormal: We refer to a matrix whose columns are orthonormal as ‘a matrix whose columns are orthonormal’. But a square matrix that satisfies AT A = I is called orthogonal ; its columns are an orthonormal basis. Orthogonal matrices have many uses, and arise in many applications. We have already encountered some orthogonal matrices, including identity matrices, 2-D reflections and rotations (page 129), and permutation matrices (page 132). Norm, inner product, and angle properties. Suppose the columns of the m matrix A are orthonormal, and x and y are any n-vectors. We let f : Rn be the function that maps z to Az. Then we have the following: → n × Rm Ax = x . That is, f is norm preserving. • (Ax)T (Ay) = xT y. f preserves the inner product between vectors. • • (Ax, Ay) = (x, y). f also preserves angles between vectors. Note that in each of the three equations above, the vectors appearing in the leftand right-hand sides have different dimensions, m on the left and n on the right. We can verify these properties using simple matrix properties. We start with the second statement, that multiplication by A preserves the inner product. We have (Ax)T (Ay) = (xT AT )(Ay) = xT (AT A)y = xT Iy = xT y. 190 10 Matrix multiplication In the first line, we use the transpose-of-product rule; in the second, we re-associate a product of 4 matrices (considering the row vector xT and column vector x as matrices); in the third line, we use AT A = I; and in the fourth line, we use Iy = y. From the second property we can derive the first one: By taking y = x we get . The third (Ax)T (Ax) = xT x; taking the squareroot of each side gives property, angle preservation, follows from the first two, since Ax = x (Ax, Ay) = arccos (Ax)T (Ay) Ay Ax = arccos xT y y x = (x, y). QR factorization. We can express the result of the Gram–Schmidt algorithm described in k matrix 5.4 in a compact form using matrices. Let A be an n § with linearly independent columns a1, . . . , ak. By the independence-dimension ink matrix with columns q1, . . . , qk, equality, A is tall or square. Let Q be the n the orthonormal vectors produced by the Gram–Schmidt algorithm applied to the n-vectors a1, . . . , ak. Orthonormality of q1, . . . , qk is expressed in matrix form as QT Q = I. We express the equation relating ai and qi, × × ai = (qT 1 ai)q1 + + (qT i − 1ai)qi 1 + − qi, ˜qi · · · where ˜qi is the vector obtained in the first step of the Gram–Schmidt algorithm, as where Rij = qT i aj for i < j and Rii = write the equations above in compact matrix form as . Defining Rij = 0 for i > j, we can ai = R1iq1 + + Riiqi, · · · ˜qi A = QR. This is called the QR factorization of A, since it expresses the matrix A as a k matrix Q has orthonormal columns, product of two matrices, Q and R. The n and the k k matrix R is upper triangular, with positive diagonal elements. If A is square, with linearly independent columns, then Q is orthogonal and the QR factorization expresses A as a product of two square matrices. × × The attributes of the matrices Q and R in the QR factorization come directly from the Gram–Schmidt algorithm. The equation QT Q = I follows from the orthonormality of the vectors q1, . . . , qk. The matrix R is upper triangular because each vector ai is a linear combination of q1, . . . , qi. The Gram–Schmidt algorithm is not the only algorithm for QR factorization. Several other QR factorization algorithms exist, that are more reliable in the presence of round-off errors. (These QR factorization methods may also change the order in which the columns of A are processed.) Sparse QR factorization. There are algorithm
s for QR factorization that efficiently handle the case when the matrix A is sparse. In this case the matrix Q is stored in a special format that requires much less memory than if it were stored k matrix, i.e., nk numbers. The flop count for these sparse QR as a generic n factorizations is also much smaller than 2nk2. × Exercises Exercises 191 10.1 Scalar-row-vector multiplication. Suppose a is a number and x = [x1 xn] is an nrow-vector. The scalar-row-vector product ax is the n-row-vector [ax1 axn]. Is this a special case of matrix-matrix multiplication? That is, can you interpret scalar-row-vector multiplication as matrix multiplication? (Recall that scalar-vector multiplication, with the scalar on the left, is not a special case of matrix-matrix multiplication; see page 177.) · · · · · · 10.2 Ones matrix. There is no special notation for an m n matrix all of whose entries are one. Give a simple expression for this matrix in terms of matrix multiplication, transpose, and the ones vectors 1m, 1n (where the subscripts denote the dimension). × 10.3 Matrix sizes. Suppose A, B, and C are matrices that satisfy A + BBT = C. Determine which of the following statements are necessarily true. (There may be more than one true statement.) (a) A is square. (b) A and B have the same dimensions. (c) A, B, and C have the same number of rows. (d) B is a tall matrix. 10.4 Block matrix notation. Consider the block matrix A =   I BT 0   , 0 0 B 0 0 BBT where B is 10 matrix in the definition of A? What are the dimensions of A? 5. What are the dimensions of the four zero matrices and the identity × 10.5 When is the outer product symmetric? Let a and b be n-vectors. The inner product is symmetric, i.e., we have aT b = bT a. The outer product of the two vectors is generally not symmetric; that is, we generally have abT = baT . What are the conditions on a and b under which ab = baT ? You can assume that all the entries of a and b are nonzero. (The conclusion you come to will hold even when some entries of a or b are zero.) Hint. Show that abT = baT implies that ai/bi is a constant (i.e., independent of i). × × 10.6 Product of rotation matrices. Let A be the 2 2 matrix that corresponds to rotation by θ radians, defined in (7.1), and let B be the 2 2 matrix that corresponds to rotation by ω radians. Show that AB is also a rotation matrix, and give the angle by which it rotates vectors. Verify that AB = BA in this case, and give a simple English explanation. 10.7 Two rotations. Two 3-vectors x and y are related as follows. First, the vector x is rotated 40◦ around the e3 axis, counterclockwise (from e1 toward e2), to obtain the 3-vector z. Then, z is rotated 20◦ around the e1 axis, counterclockwise (from e2 toward e3), to form y. 3 matrix A for which y = Ax. Verify that A is an orthogonal matrix. Hint. Find the 3 Express A as a product of two matrices, which carry out the two rotations described above. × 10.8 Entries of matrix triple product. (See page 182.) Suppose A has dimensions m dimensions n × p, C has dimensions p Dij = × n p AikBklClj. q, and let D = ABC. Show that n, B has × This is the formula analogous to (10.1) for the product of two matrices. k=1 l=1 10.9 Multiplication by a diagonal matrix. Suppose that A is an m n matrix, D is a diagonal matrix, and B = DA. Describe B in terms of A and the entries of D. You can refer to the rows or columns or entries of A. × 192 10 Matrix multiplication 10.10 Converting from purchase quantity matrix to purchase dollar matrix. An n N matrix Q gives the purchase history of a set of n products by N customers, over some period, with Qij being the quantity of product i bought by customer j. The n-vector p gives the product prices. A data analyst needs the n N matrix D, where Dij is the total dollar value that customer j spent on product i. Express D in terms of Q and p, using compact matrix/vector notation. You can use any notation or ideas we have encountered, e.g., stacking, slicing, block matrices, transpose, matrix-vector product, matrix-matrix product, inner product, norm, correlation, diag(), and so on. × × 10.11 Trace of matrix-matrix product. The sum of the diagonal entries of a square matrix is called the trace of the matrix, denoted tr(A). (a) Suppose A and B are m n matrices. Show that × tr(AT B) = m n i=1 j=1 AijBij. What is the complexity of calculating tr(AT B)? (b) The number tr(AT B) is sometimes referred to as the inner product of the matrices A and B. (This allows us to extend concepts like angle to matrices.) Show that tr(AT B) = tr(BT A). (c) Show that tr(AT A) = 2. In other words, the square of the norm of a matrix is A the trace of its Gram matrix. (d) Show that tr(AT B) = tr(BAT ), even though in general AT B and BAT can have different dimensions, and even when they have the same dimensions, they need not be equal. 10.12 Norm of matrix product. Suppose A is an m that the product of the norms of the matrices. Hint. Let aT b1, . . . , bn be the columns of B. Then n matrix. Show , i.e., the (matrix) norm of the matrix product is no more than m be the rows of A, and p matrix and B is a p 1 , . . . , aT ≤ AB × × B A 2 = AB m n i=1 j=1 (aT i bj)2. Now use the Cauchy–Schwarz inequality. 10.13 Laplacian matrix of a graph. Let A be the incidence matrix of a directed graph with n 7.3). The Laplacian matrix associated with the graph is defined It is named after the mathematician nodes and m edges (see § as L = AAT , which is the Gram matrix of AT . Pierre-Simon Laplace. (a) Show that (v) = vT Lv, where (v) is the Dirichlet energy defined on page 135. D D (b) Describe the entries of L. Hint. The following two quantities might be useful: The degree of a node, which is the number of edges that connect to the node (in either direction), and the number of edges that connect a pair of distinct nodes (in either direction). 10.14 Gram matrix. Let a1, . . . , an be the columns of the m columns all have norm one, and for i Gram matrix G = AT A? Be as specific as you can be. 10.15 Pairwise distances from Gram matrix. Let A be an m and associated Gram matrix G = AT A. Express ai Gij, and Gjj. × − n matrix A. Suppose that the = j, (ai, aj) = 60◦. What can you say about the × n matrix with columns a1, . . . , an, in terms of G, specifically Gii, aj Exercises 10.16 Covariance matrix. Consider a list of k n-vectors a1, . . . , ak, and define the n 193 k matrix × A = [a1 ak]. · · · (a) Let the k-vector µ give the means of the columns, i.e., µi = avg(ai), i = 1, . . . , k. (The symbol µ is a traditional one to denote an average value.) Give an expression for µ in terms of the matrix A. (b) Let ˜a1, . . . , ˜ak be the de-meaned versions of a1, . . . , ak, and define ˜A as the n matrix ˜A = [˜a1 ˜ak]. Give a matrix expression for ˜A in terms of A and µ. k × (c) The covariance matrix of the vectors a1, . . . , ak is the k the Gram matrix of ˜A multiplied with 1/N . Show that k matrix Σ = (1/N ) ˜AT ˜A, × · · · Σij = std(ai)2 std(ai) std(aj)ρij i = j = j i = j assumes where ρij is the correlation coefficient of ai and aj. (The expression for i that ρij is defined, i.e., std(ai) and std(aj) are nonzero. If not, we interpret the formula as Σij = 0.) Thus the covariance matrix encodes the standard deviations of the vectors, as well as correlations between all pairs. The correlation matrix is widely used in probability and statistics. (d) Let z1, . . . , zk be the standardized versions of a1, . . . , ak. (We assume the de-meaned vectors are nonzero.) Derive a matrix expression for Z = [z1 zk], the matrix of standardized vectors. Your expression should use A, µ, and the numbers std(a1), . . . , std(ak). · · · 10.17 Patients and symptoms. Each of a set of N patients can exhibit any number of a set of n symptoms. We express this as an N n matrix S, with × Sij = 1 patient i exhibits symptom j 0 patient i does not exhibit symptom j. Give simple English descriptions of the following expressions. and describe the entries. Include the dimensions, (a) S1. (b) ST 1. (c) ST S. (d) SST . 10.18 Students, classes, and majors. We consider m students, n classes, and p majors. Each student can be in any number of the classes (although we’d expect the number to range from 3 to 6), and can have any number of the majors (although the common values would be 0, 1, or 2). The data about the students’ classes and majors are given by an m n matrix C and an m × and Cij = Mij = × p matrix M , where 1 0 student i is in class j student i is not in class j, 1 0 student i is in major j student i is not in major j. (a) Let E be the n-vector with Ei being the enrollment in class i. Express E using matrix notation, in terms of the matrices C and M . (b) Define the n p matrix S where Sij is the total number of students in class i with major j. Express S using matrix notation, in terms of the matrices C and M . × 194 10 Matrix multiplication 10.19 Student group membership. Let G who are members of n groups: ∈ Rm n represent a contingency matrix of m students × Gij = 1 0 student i is in group j student i is not in group j. (A student can be in any number of the groups.) (a) What is the meaning of the 3rd column of G? (b) What is the meaning of the 15th row of G? (c) Give a simple formula (using matrices, vectors, etc.) for the n-vector M , where Mi is the total membership (i.e., number of students) in group i. (d) Interpret (GGT )ij in simple English. (e) Interpret (GT G)ij in simple English. 10.20 Products, materials, and locations. P different products each require some amounts of M different materials, and are manufactured in L different locations, which have different material costs. We let Clm denote the cost of material m in location l, for l = 1, . . . , L and m = 1, . . . , M . We let Qmp denote the amount of material m required to manufacture one unit of product p, for m = 1, . . . , M and p = 1, . . . , P . Let Tpl denote the total cost to manufacture product p in location l, for p = 1, . . . , P and l = 1, . . . , L. Give an expression for the ma
trix T . 10.21 Integral of product of polynomials. Let p and q be two quadratic polynomials, given by p(x) = c1 + c2x + c3x2, q(x) = d1 + d2x + d3x2. Express the integral J = 1 Give the entries of G (as numbers). 0 p(x)q(x) dx in the form J = cT Gd, where G is a 3 3 matrix. × 10.22 Composition of linear dynamical systems. We consider two time-invariant linear dynami- cal systems with outputs. The first one is given by xt+1 = Axt + But, yt = Cxt, t = 1, 2, . . . , with state xt, input ut, and output yt. The second is given by ˜xt+1 = ˜A˜xt + ˜Bwt, vt = ˜C ˜xt, t = 1, 2, . . . , with state ˜xt, input wt, and output vt. We now connect the output of the first linear dynamical system to the input of the second one, which means we take wt = yt. (This is called the composition of the two systems.) Show that this composition can also be expressed as a linear dynamical system with state zt = (xt, ˜xt), input ut, and output vt. (Give the state transition matrix, input matrix, and output matrix.) 10.23 Suppose A is an n n matrix that satisfies A2 = 0. Does this imply that A = 0? (This is the case when n = 1.) If this is (always) true, explain why. If it is not, give a specific counterexample, i.e., a matrix A that is nonzero but satisfies A2 = 0. 10.24 Matrix power identity. A student says that for any square matrix A, × (A + I)3 = A3 + 3A2 + 3A + I. Is she right? If she is, explain why; if she is wrong, give a specific counterexample, i.e., a square matrix A for which it does not hold. 10.25 Squareroots of the identity. The number 1 has two squareroots (i.e., numbers who square is 1), 1 and 1. The n − × n identity matrix In has many more squareroots. (a) Find all diagonal squareroots of In. How many are there? (For n = 1, you should get 2.) Exercises (b) Find a nondiagonal 2 2 matrix A that satisfies A2 = I. This means that in general 195 there are even more squareroots of In than you found in part (a). × 10.26 Circular shift matrices. Let A be the 5 5 matrix × a) How is Ax related to x? Your answer should be in English. Hint. See exercise title. (b) What is A5? Hint. The answer should make sense, given your answer to part (a). 10.27 Dynamics of an economy. Let x1, x2, . . . be n-vectors that give the level of economic activity of a country in years 1, 2, . . ., in n different sectors (like energy, defense, manufacturing). Specifically, (xt)i is the level of economic activity in economic sector i (say, in billions of dollars) in year t. A common model that connects these economic activity vectors is xt+1 = Bxt, where B is an n Give a matrix expression for the total economic activity across all sectors in year t = 6, in terms of the matrix B and the vector of initial activity levels x1. Suppose you can increase economic activity in year t = 1 by some fixed amount (say, one billion dollars) in one sector, by government spending. How should you choose which sector to stimulate so as to maximize the total economic output in year t = 6? n matrix. (See exercise 9.2.) × 10.28 Controllability matrix. Consider the time-invariant linear dynamical system xt+1 = Axt + 1) denote But, with n-vector state xt and m-vector input ut. Let U = (u1, u2, . . . , uT the sequence of inputs, stacked in one vector. Find the matrix CT for which − xT = AT 1x1 + CT U − holds. The first term is what xT would be if u1 = shows how the sequence of inputs u1, . . . , uT controllability matrix of the linear dynamical system. − 1 = 0; the second term 1 affect xT . The matrix CT is called the = uT · · · − 10.29 Linear dynamical system with 2 down-sampling. We consider a linear dynamical system × with n-vector state xt, m-vector input ut, and dynamics given by xt+1 = Axt + But, t = 1, 2, . . . , where A is n × n matrix A and B is n m. Define zt = x2t 1 for t = 1, 2, . . ., i.e., z1 = x1, z3 = x5, . . . . × z2 = x3, − (The sequence zt is the original state sequence xt ‘down-sampled’ by 2 (2m)-vectors wt as wt = (u2t 1, u2t) for t = 1, 2, . . ., i.e., × − .) Define the w1 = (u1, u2), w2 = (u3, u4), w3 = (u5, u6), . . . . (Each entry of the sequence wt is a stack of two consecutive original inputs.) Show that zt, wt satisfy the linear dynamics equation zt+1 = F zt + Gwt, for t = 1, 2, . . .. Give the matrices F and G in terms of A and B. 10.30 Cycles in a graph. A cycle of length in a directed graph is a path of length that starts and ends at the same vertex. Determine the total number of cycles of length = 10 for the directed graph given in the example on page 187. Break this number down into the number of cycles that begin (and end) at vertex 1, vertex 2, . . . , vertex 5. (These should add up to the total.) Hint. Do not count the cycles by hand. 196 10 Matrix multiplication 10.31 Diameter of a graph. A directed graph with n vertices is described by its n matrix A (see 10.3). § n adjacency × (a) Derive an expression Pij for the total number of paths, with length no more than k, from vertex j to vertex i. (We include in this total the number of paths of length zero, which go from each vertex j to itself.) Hint. You can derive an expression for the matrix P , in terms of the matrix A. (b) The diameter D of a graph is the smallest number for which there is a path of length D from node j to node i, for every pair of vertices j and i. Using part (a), explain ≤ how to compute the diameter of a graph using matrix operations (such as addition, multiplication). Remark. Suppose the vertices represent all people on earth, and the graph edges represent acquaintance, i.e., Aij = 1 if person j and person i are acquainted. (This graph is symmetric.) Even though n is measured in billions, the diameter of this acquaintance In other words, any two people graph is thought to be quite small, perhaps 6 or 7. on earth can be connected though a set of 6 or 7 (or fewer) acquaintances. This idea, originally conjectured in the 1920s, is sometimes called six degrees of separation. 10.32 Matrix exponential. You may know that for any real number a, the sequence (1 + a/k)k to the exponential of a, denoted exp a or ea. The matrix exponential converges as k of a square matrix A is defined as the limit of the matrix sequence (I + A/k)k as k . → ∞ (It can shown that this sequence always converges.) The matrix exponential arises in many applications, and is covered in more advanced courses on linear algebra. → ∞ (a) Find exp 0 (the zero matrix) and exp I. (b) Find exp A, for A = 0 0 . 1 0 10.33 Matrix equations. Consider two m n matrices A and B. Suppose that for j = 1, . . . , n, the jth column of A is a linear combination of the first j columns of B. How do we express this as a matrix equation? Choose one of the matrix equations below and justify your choice. × (a) A = GB for some upper triangular matrix G. (b) A = BH for some upper triangular matrix H. (c) A = F B for some lower triangular matrix F . (d) A = BJ for some lower triangular matrix J. 10.34 Choose one of the responses always, never, or sometimes for each of the statements below. ‘Always’ means the statement is always true, ‘never’ means it is never true, and ‘Sometimes’ means it can be true or false, depending on the particular values of the matrix or matrices. Give a brief justification of each answer. (a) An upper triangular matrix has linearly independent columns. (b) The rows of a tall matrix are linearly dependent. (c) The columns of A are linearly independent, and AB = 0 for some nonzero matrix B. 10.35 Orthogonal matrices. Let U and V be two orthogonal n matrix U V and the (2n) (2n) matrix × n matrices. Show that the × 1 √2 U V U V − are orthogonal. Exercises 197 10.36 Quadratic form. Suppose A is an n × n matrix and x is an n-vector. The triple product xT Ax, a 1 1 matrix which we consider to be a scalar (i.e., number), is called a quadratic form of the vector x, with coefficient matrix A. A quadratic form is the vector analog of a quadratic function αu2, where α and u are both numbers. Quadratic forms arise in many fields and applications. (a) Show that xT Ax = n × i,j=1 Aijxixj. (b) Show that xT (AT )x = xT Ax. In other words, the quadratic form with the transposed coefficient matrix has the same value for any x. Hint. Take the transpose of the triple product xT Ax. (c) Show that xT ((A + AT )/2)x = xT Ax. In other words, the quadratic form with coefficient matrix equal to the symmetric part of a matrix (i.e., (A + AT )/2) has the same value as the original quadratic form. x2 2 as a quadratic form, with symmetric coefficient matrix A. (d) Express 2x2 3x1x2 1 − 2 matrices. In this problem, you will show that every 2 − 2 orthogonal × 10.37 Orthogonal 2 × matrix is either a rotation or a reflection (see 7.1). § (a) Let Q = a c b d be an orthogonal 2 2 matrix. Show that the following equations hold: × a2 + c2 = 1, b2 + d2 = 1, ab + cd = 0. (b) Define s = ad − bc. Combine the three equalities in part (a) to show that = 1, s | | b = sc, − d = sa. (c) Suppose a = cos θ. Show that there are two possible matrices Q: A rotation (counterclockwise over θ radians), and a reflection (through the line that passes through the origin at an angle of θ/2 radians with respect to horizontal). 10.38 Orthogonal matrix with nonnegative entries. Suppose the n n matrix A is orthogonal, and all of its entries are nonnegative, i.e., Aij 0 for i, j = 1, . . . , n. Show that A must be a permutation matrix, i.e., each entry is either 0 or 1, each row has exactly one entry with value one, and each column has exactly one entry with value one. (See page 132.) ≥ × 10.39 Gram matrix and QR factorization. Suppose the matrix A has linearly independent columns and QR factorization A = QR. What is the relationship between the Gram matrix of A and the Gram matrix of R? What can you say about the angles between the columns of A and the angles between the columns of R? 10.40 QR factorization of first i columns of A. Suppose the n A = QR. We define the n i matrices k matrix A has QR factorization × × Ai = a1 , ai Qi = q1 , qi · · · · · · for i = 1, . . . , k. Define the i rows and columns, f
or i = 1, . . . , k. Using index range notation, we have i matrix Ri as the submatrix of R containing its first i × Ai = A1:n,1:i, Qi = A1:n,1:i, Ri = R1:i,1:i. Show that Ai = QiRi is the QR factorization of Ai. This means that when you compute the QR factorization of A, you are also computing the QR factorization of all submatrices A1, . . . , Ak. 198 10 Matrix multiplication 10.41 Clustering via k-means as an approximate matrix factorization. Suppose we run the k-means algorithm on the N n-vectors x1, . . . , xN , to obtain the group representatives z1, . . . , zk. Define the matrices X = [ x1 · · · xN ], Z = [ z1 zN ]. · · · X has size n by the k otherwise. Each column of C is a unit vector; its transpose is a selector matrix. k. We encode the assignment of vectors to groups N clustering matrix C, with Cij = 1 if xj is assigned to group i, and Cij = 0 N and Z has size n × × × (a) Give an interpretation of the columns of the matrix X ZC, and the squared norm − (matrix) norm X − ZC 2. (b) Justify the following statement: The goal of the k-means algorithm is to find an N matrix C, which is the transpose of a selector matrix, k matrix Z, and a k n × so that X ZC is small, i.e., X ZC. × ≈ − 10.42 A matrix-vector multiplication Ax of an n n matrix A and an n-vector x takes 2n2 flops in general. Formulate a faster method, with complexity linear in n, for matrix-vector multiplication with the matrix A = I + abT , where a and b are given n-vectors. × 10.43 A particular computer takes about 0.2 seconds to multiply two 1500 About how long would you guess the computer takes to multiply two 3000 Give your prediction (i.e., the time in seconds), and your (very brief) reasoning. 10.44 Complexity of matrix quadruple product. (See page 182.) We wish to compute the product 1500 matrices. 3000 matrices? × × E = ABCD, where A is m n, B is n p, C is p × × × q, and D is q r. × (a) Find all methods for computing E using three matrix-matrix multiplications. For example, you can compute AB, CD, and then the product (AB)(CD). Give the total number of flops required for each of these methods. Hint. There are four other methods. (b) Which method requires the fewest flops, with dimensions m = 10, n = 1000, p = 10, q = 1000, r = 100? Chapter 11 Matrix inverses In this chapter we introduce the concept of matrix inverse. We show how matrix inverses can be used to solve linear equations, and how they can be computed using the QR factorization. 11.1 Left and right inverses Recall that for a number a, its (multiplicative) inverse is the number x for which 1. The xa = 1, which we usually denote as x = 1/a or (less frequently) x = a− inverse x exists provided a is nonzero. For matrices the concept of inverse is more complicated than for scalars; in the general case, we need to distinguish between left and right inverses. We start with the left inverse. Left inverse. A matrix X that satisfies XA = I is called a left inverse of A. The matrix A is said to be left-invertible if a left m, inverse exists. Note that if A has size m the same dimensions as AT . n, a left inverse X will have size n × × Examples. • • • If A is a number (i.e., a 1 the inverse of the number. nonzero, and it has only one left inverse. × 1 matrix), then a left inverse X is the same as In this case, A is left-invertible whenever A is Any nonzero n-vector a, considered as an n any index i with ai The matrix = 0, the row n-vector x = (1/ai)eT × 1 matrix, is left-invertible. For i satisfies xa = 1 200 11 Matrix inverses has two different left inverses: B = 1 9 − 11 7 − 10 8 , 16 11 − − This can be verified by checking that BA = CA = I. The example illustrates that a left-invertible matrix can have more than one left inverse. (In fact, if it has more than one left inverse, then it has infinitely many; see exercise 11.1.) A matrix A with orthonormal columns satisfies AT A = I, so it is leftinvertible; its transpose AT is a left inverse. • Left-invertibility and column independence. If A has a left inverse C then the columns of A are linearly independent. To see this, suppose that Ax = 0. Multiplying on the left by a left inverse C, we get 0 = C(Ax) = (CA)x = Ix = x, which shows that the only linear combination of the columns of A that is 0 is the one with all coefficients zero. We will see below that the converse is also true; a matrix has a left inverse if and only if its columns are linearly independent. So the generalization of ‘a number has an inverse if and only if it is nonzero’ is ‘a matrix has a left inverse if and only if its columns are linearly independent’. Dimensions of left inverses. Suppose the m n matrix A is wide, i.e., m < n. By the independence-dimension inequality, its columns are linearly dependent, and therefore it is not left-invertible. Only square or tall matrices can be left-invertible. × Solving linear equations with a left inverse. Suppose that Ax = b, where A is n matrix and x is an n-vector. If C is a left inverse of A, we have an m × Cb = C(Ax) = (CA)x = Ix = x, which means that x = Cb is a solution of the set of linear equations. The columns of A are linearly independent (since it has a left inverse), so there is only one solution of the linear equations Ax = b; in other words, x = Cb is the solution of Ax = b. Now suppose there is no x that satisfies the linear equations Ax = b, and let C be a left inverse of A. Then x = Cb does not satisfy Ax = b, since no vector satisfies this equation by assumption. This gives a way to check if the linear equations Ax = b have a solution, and to find one when there is one, provided we have a left inverse of A. We simply test whether A(Cb) = b. If this holds, then we have found a solution of the linear equations; if it does not, then we can conclude that there is no solution of Ax = b. In summary, a left inverse can be used to determine whether or not a solution of an over-determined set of linear equations exists, and when it does, find the unique solution. 11.1 Left and right inverses 201 Right inverse. Now we turn to the closely related concept of right inverse. A matrix X that satisfies AX = I is called a right inverse of A. The matrix A is right-invertible if a right inverse exists. Any right inverse has the same dimensions as AT . Left and right inverse of matrix transpose. If A has a right inverse B, then BT is a left inverse of AT , since BT AT = (AB)T = I. If A has a left inverse C, then C T is a right inverse of AT , since AT C T = (CA)T = I. This observation allows us to map all the results for left-invertibility given above to similar results for right-invertibility. Some examples are given below. • • A matrix is right-invertible if and only if its rows are linearly independent. A tall matrix cannot have a right inverse. Only square or wide matrices can be right-invertible. Solving linear equations with a right inverse. Consider the set of m linear equations in n variables Ax = b. Suppose A is right-invertible, with right inverse B. This implies that A is square or wide, so the linear equations Ax = b are square or under-determined. Then for any m-vector b, the n-vector x = Bb satisfies the equation Ax = b. To see this, we note that Ax = A(Bb) = (AB)b = Ib = b. We can conclude that if A is right-invertible, then the linear equations Ax = b can be solved for any vector b. Indeed, x = Bb is a solution. (There can be other solutions of Ax = b; the solution x = Bb is simply one of them.) In summary, a right inverse can be used to find a solution of a square or under- determined set of linear equations, for any vector b. Examples. Consider the matrix appearing in the example above on page 199 and the two left inverses B = 1 9 − 11 7 − 10 8 , 16 11 − − • • The over-determined linear equations Ax = (1, tion x = (1, 1), which can be obtained from either left inverse: − 2, 0) have the unique solu- − x = B(1, 2, 0) = C(1, − 2, 0). − The over-determined linear equations Ax = (1, 1, 0) = (1/2, since x = C(1, 1/2) does not satisfy Ax = (1, − 1, 0) do not have a solution, − − 1, 0). − 202 11 Matrix inverses The under-determined linear equations AT y = (1, 2) has (different) solutions • BT (1, 2) = (1/3, 2/3, 38/9), C T (1, 2) = (0, 1/2, 1). − (Recall that BT and C T are both right inverses of AT .) We can find a solution of AT y = b for any vector b. Left and right inverse of matrix product. Suppose A and D are compatible for the matrix product AD (i.e., the number of columns in A is equal to the number of rows in D.) If A has a right inverse B and D has a right inverse E, then EB is a right inverse of AD. This follows from (AD)(EB) = A(DE)B = A(IB) = AB = I. If A has a left inverse C and D has a left inverse F , then F C is a left inverse of AD. This follows from (F C)(AD) = F (CA)D = F D = I. 11.2 Inverse If a matrix is left- and right-invertible, then the left and right inverses are unique and equal. To see this, suppose that AX = I and Y A = I, i.e., X is any right inverse and Y is any left inverse of A. Then we have X = (Y A)X = Y (AX) = Y, i.e., any left inverse of A is equal to any right inverse of A. This implies that the left inverse is unique: If we have A ˜X = I, then the argument above tells us that ˜X = Y , so we have ˜X = X, i.e., there is only one right inverse of A. A similar argument shows that Y (which is the same as X) is the only left inverse of A. When a matrix A has both a left inverse Y and a right inverse X, we call the 1. We say that A is matrix X = Y simply the inverse of A, and denote it as A− invertible or nonsingular. A square matrix that is not invertible is called singular. Dimensions of invertible matrices. Invertible matrices must be square, since tall matrices are not right-invertible, while wide matrices are not left-invertible. A matrix A and its inverse (if it exists) satisfy AA− 1 = A− 1A = I. If A has inverse A− (A− 1)− 1 = A. For this reason we say that A and A− 1, then the inverse of A− 1 is A; in other words, we have 1 are inverses (of each other). 11.2 Inverse 203 Solving linear equations with
the inverse. Consider the square system of n linear equations with n variables, Ax = b. If A is invertible, then for any n-vector b, x = A− 1b (11.1) is a solution of the equations. (This follows since A− Moreover, it is the only solution of Ax = b. (This follows since A− of A.) We summarize this very important result as 1 is a right inverse of A.) 1 is a left inverse The square system of linear equations Ax = b, with A invertible, has the unique solution x = A− 1b, for any n-vector b. One immediate conclusion we can draw from the formula (11.1) is that the solution of a square set of linear equations is a linear function of the right-hand side vector b. Invertibility conditions. For square matrices, left-invertibility, right-invertibility, and invertibility are equivalent: If a matrix is square and left-invertible, then it is also right-invertible (and therefore invertible) and vice-versa. To see this, suppose A is an n n matrix and left-invertible. This implies that the n columns of A are linearly independent. Therefore they form a basis and so any n-vector can be expressed as a linear combination of the columns of A. In particular, each of the n unit vectors ei can be expressed as ei = Abi for some n-vector bi. The matrix B = b1 satisfies bn b2 × AB = Ab1 Ab2 · · · · · · = e1 Abn e2 · · · = I. en So B is a right inverse of A. We have just shown that for a square matrix A, left-invertibility = ⇒ column independence = ⇒ right-invertibility. (The symbol = means that the left-hand condition implies the right-hand condition.) Applying the same result to the transpose of A allows us to also conclude that ⇒ right-invertibility = ⇒ row independence = ⇒ left-invertibility. So all six of these conditions are equivalent; if any one of them holds, so do the other five. In summary, for a square matrix A, the following are equivalent. A is invertible. The columns of A are linearly independent. The rows of A are linearly independent. A has a left inverse. A has a right inverse. • • • • • 204 11 Matrix inverses Examples. The identity matrix I is invertible, with inverse I − 1 = I, since II = I. A diagonal matrix A is invertible if and only if its diagonal entries are nonzero. n diagonal matrix A with nonzero diagonal entries is The inverse of an n • • • • × A− 1 =      1/A11 0 ... 0 0 1/A22 ... 0 since AA− 1 =      A11/A11 0 ... 0 0 A22/A22 ... 0 In compact notation, we have diag(A11, . . . , Ann)−      , 0 0 ... 1/Ann      0 0 ... Ann/Ann = I = diag(A− 1 1 nn). 11 , . . . , A− Note that the inverse on the left-hand side of this equation is the matrix inverse, while the inverses appearing on the right-hand side are scalar inverses. As a non-obvious example, the matrix   − is invertible, with inverse A− 1 =   1 30 0 6 6 − − 20 5 10 − − 10 2 2   . This can be verified by checking that AA− either of these implies the other). 1 = I (or that A− 1A = I, since 2 matrices. A 2 2 with inverse × 2 matrix A is invertible if and only if A11A22 × = A12A21, − 1 A11 A12 A21 A22 A− 1 = 1 A11A22 − (There are similar formulas for the inverse of a matrix of any size, but they grow very quickly in complexity and so are not very useful in most applications.) A12 A21 A11 A12A21 A22 − − = . • Orthogonal matrix. If A is square with orthonormal columns, we have AT A = I, so A is invertible with inverse A− 1 = AT . 11.2 Inverse 205 Inverse of matrix transpose. and its inverse is (A− 1)T : If A is invertible, its transpose AT is also invertible 1 = (A− Since the order of the transpose and inverse operations does not matter, this matrix is sometimes written as A− (AT )− 1)T . T . Inverse of matrix product. same size, then AB is invertible, and If A and B are invertible (hence, square) and of the (AB)− 1 = B− 1A− 1. (11.2) The inverse of a product is the product of the inverses, in reverse order. Dual basis. Suppose that A is invertible with inverse B = A− the columns of A, and bT 1 , . . . , bT 1. Let a1, . . . , an be A = a1 n denote the rows of B, i.e., the columns of BT : bT 1 ... bT n B =   . , · · · an     We know that a1, . . . , an form a basis, since the columns of A are linearly independent. The vectors b1, . . . , bn also form a basis, since the rows of B are linearly independent. They are called the dual basis of a1, . . . , an. (The dual basis of b1, . . . , bn is a1, . . . , an, so they called dual bases.) Now suppose that x is any n-vector. It can be expressed as a linear combination of the basis vectors a1, . . . , an: x = β1a1 + + βnan. · · · The dual basis gives us a simple way to find the coefficients β1, . . . , βn. We start with AB = I, and multiply by x to get    an · · ·    x = (bT x = ABx = a1 bT 1 ... bT n This means (since the vectors a1, . . . , an are linearly independent) that βi = bT i x. In words: The coefficients in the expansion of a vector in a basis are given by the inner products with the dual basis vectors. Using matrix notation, we can say that β = BT x = (A− 1)T x is the vector of coefficients of x in the basis given by the columns of A. 1 x)a1 + n x)an. + (bT · · · As a simple numerical example, consider the basis a1 = (1, 1), a2 = (1, 1). The dual basis consists of the rows of [ a1 a2 ]− 1 = 1/2 bT To express the vector x = ( x = (bT 1/2 , 1 x)a1 + (bT 2 x)a2 = ( − 2 = 1/2 bT − 1, which are 1/2 . − 2)a1 + ( 3)a2, − − which can be directly verified. 5, 1) as a linear combination of a1 and a2, we have 206 11 Matrix inverses Negative matrix powers. We can now give a meaning to matrix powers with negative integer exponents. Suppose A is a square invertible matrix and k is a positive integer. Then by repeatedly applying property (11.2), we get (Ak)− 1 = (A− 1)k. We denote this matrix as A− A− holds for all integers k and l. 1 = (AA)− 2 = A− 1A− k. For example, if A is square and invertible, then 1. With A0 defined as A0 = I, the identity Ak+l = AkAl Triangular matrix. A triangular matrix with nonzero diagonal elements is invertible. We first discuss this for a lower triangular matrix. Let L be n n and lower triangular with nonzero diagonal elements. We show that the columns are linearly independent, i.e., Lx = 0 is only possible if x = 0. Expanding the matrix-vector product, we can write Lx = 0 as × L11x1 = 0 L21x1 + L22x2 = 0 L31x1 + L32x2 + L33x3 = 0 ... Ln1x1 + Ln2x2 + + Ln,n − 1xn − · · · 1 + Lnnxn = 0. Since L11 = 0, the first equation implies x1 = 0. Using x1 = 0, the second equation = 0, we conclude that x2 = 0. Using x1 = x2 = 0, reduces to L22x2 = 0. Since L22 the third equation now reduces to L33x3 = 0, and since L33 is assumed to be nonzero, we have x3 = 0. Continuing this argument, we find that all entries of x are zero, and this shows that the columns of L are linearly independent. It follows that L is invertible. A similar argument can be followed to show that an upper triangular matrix with nonzero diagonal elements is invertible. One can also simply note that if R is upper triangular, then L = RT is lower triangular with the same diagonal, and use the formula (LT )− 1)T for the inverse of the transpose. 1 = (L− Inverse via QR factorization. The QR factorization gives a simple expression for the inverse of an invertible matrix. If A is square and invertible, its columns are linearly independent, so it has a QR factorization A = QR. The matrix Q is orthogonal and R is upper triangular with positive diagonal entries. Hence Q and R are invertible, and the formula for the inverse product gives A− 1 = (QR)− 1 = R− 1Q− 1 = R− 1QT . (11.3) In the following section we give an algorithm for computing R− 1, or more 1QT . This gives us a method to compute the matrix directly, the product R− inverse. 11.3 Solving linear equations 207 11.3 Solving linear equations Back substitution. We start with an algorithm for solving a set of linear equations, Rx = b, where the n n matrix R is upper triangular with nonzero diagonal × entries (hence, invertible). We write out the equations as R11x1 + R12x2 + + R1,n − 1xn − · · · 1 + R1nxn = b1 Rn − 2xn 2,n − − 2 + Rn Rn 2,n − − 1,n − − 1xn 1xn − − 1 + Rn 1 + Rn ... 2,nxn = bn 1,nxn = bn − − Rnnxn = bn. − − 2 1 From the last equation, we find that xn = bn/Rnn. Now that we know xn, we substitute it into the second to last equation, which gives us xn 1 = (bn Rn 1,nxn)/Rn 1 − − We can continue this way to find xn 3, . . . , x1. This algorithm is known as 2, xn back substitution, since the variables are found one at a time, starting from xn, and we substitute the ones that are known into the remaining equations. 1,n − − − − − − 1. Algorithm 11.1 Back substitution given an n n-vector b. × n upper triangular matrix R with nonzero diagonal entries, and an For i = n, . . . , 1, xi = (bi Ri,i+1xi+1 Ri,nxn)/Rii. − · · · − − (In the first step, with i = n, we have xn = bn/Rnn.) The back substitution 1b. It cannot fail since the algorithm computes the solution of Rx = b, i.e., x = R− divisions in each step are by the diagonal entries of R, which are assumed to be nonzero. Lower triangular matrices with nonzero diagonal elements are also invertible; we can solve equations with lower triangular invertible matrices using forward substitution, the obvious analog of the algorithm given above. In forward substitution, we find x1 first, then x2, and so on. Complexity of back substitution. The first step requires 1 flop (division by Rnn). The next step requires one multiply, one subtraction, and one division, for a total of 3 flops. The kth step requires k 1 subtractions, and one division, for a total of 2k 1 flops. The total number of flops for back substitution is then 1 multiplies2n − · · · 1) = n2 flops. This formula can be obtained from the formula (5.7), or directly derived using a similar argument. Here is the argument for the case when n is even; a similar 208 11 Matrix inverses argument works when n is odd. Lump the first entry in the sum together with the last entry, the second entry together with the second-to-last entry, and so on. Each of these pairs add up to 2n; since the
re are n/2 such pairs, the total is (n/2)(2n) = n2. Solving linear equations using the QR factorization. The formula (11.3) for the inverse of a matrix in terms of its QR factorization suggests a method for solving a square system of linear equations Ax = b with A invertible. The solution x = A− 1b = R− 1QT b (11.4) can be found by first computing the matrix-vector product y = QT b, and then solving the triangular equation Rx = y by back substitution. Algorithm 11.2 Solving linear equations via QR factorization given an n × n invertible matrix A and an n-vector b. 1. QR factorization. Compute the QR factorization A = QR. 2. Compute QT b. 3. Back substitution. Solve the triangular equation Rx = QT b using back substi- tution. The first step requires 2n3 flops (see 5.4), the second step requires 2n2 flops, § and the third step requires n2 flops. The total number of flops is then so the order is n3, cubic in the number of variables, which is the same as the number of equations. 2n3 + 3n2 2n3, ≈ In the complexity analysis above, we found that the first step, the QR factorization, dominates the other two; that is, the cost of the other two is negligible in comparison to the cost of the first step. This has some interesting practical implications, which we discuss below. Factor-solve methods. Algorithm 11.2 is similar to many methods for solving a set of linear equations and is sometimes referred to as a factor-solve scheme. A factor-solve scheme consists of two steps. In the first (factor) step the coefficient matrix is factored as a product of matrices with special properties. In the second (solve) step one or more linear equations that involve the factors in the factorization are solved. (In algorithm 11.2, the solve step consists of steps 2 and 3.) The complexity of the solve step is smaller than the complexity of the factor step, and in many cases, it is negligible by comparison. This is the case in algorithm 11.2, where the factor step has order n3 and the solve step has order n2. Factor-solve methods with multiple right-hand sides. Now suppose that we must solve several sets of linear equations, Ax1 = b1, . . . , Axk = bk, 11.3 Solving linear equations 209 all with the same coefficient matrix A, but different right-hand sides. We can express this as the matrix equation AX = B, where X is the n k matrix with columns x1, . . . , xk, and B is the n k matrix with columns b1, . . . , bk (see page 180). Assuming A is invertible, the solution of AX = B is X = A− 1B. × × A na¨ıve way to solve the k problems Axi = bi (or in matrix notation, compute 1B) is to apply algorithm 11.2 k times, which costs 2kn3 flops. A more X = A− efficient method exploits the fact that A is the same matrix in each problem, so we can re-use the matrix factorization in step 1 and only need to repeat steps 2 1QT bk for l = 1, . . . , k. (This is sometimes referred to and 3 to compute ˆxk = R− as factorization caching, since we save or cache the factorization after carrying it out, for later use.) The cost of this method is 2n3 + 3kn2 flops, or approximately 2n3 flops if k n. The (surprising) conclusion is that we can solve multiple sets of linear equations, with the same coefficient matrix A, at essentially the same cost as solving one set of linear equations. In several software packages for manipulating matrices, A Backslash notation. b \ 1b, when A is invertible. This is taken to mean the solution of Ax = b, i.e., A− backslash notation is extended to matrix right-hand sides: A k 1B, the solution of the matrix equation AX = B. (The compumatrix, denotes A− tation is implemented as described above, by factoring A just once, and carrying out k back substitutions.) This backslash notation is not standard mathematical notation, however, so we will not use it in this book. B, with B an n × \ Computing the matrix inverse. We can now describe a method to compute the n matrix A. We first compute the QR inverse B = A− 1QT . We can write this as RB = QT , which, factorization of A, so A− written out by columns is 1 of an (invertible) n 1 = R− × Rbi = ˜qi, i = 1, . . . , n, where bi is the ith column of B and ˜qi is the ith column of QT . We can solve these equations using back substitution, to get the columns of the inverse B. Algorithm 11.3 Computing the inverse via QR factorization given an n × n invertible matrix A. 1. QR factorization. Compute the QR factorization A = QR. 2. For i = 1, . . . , n, Solve the triangular equation Rbi = ˜qi using back substitution. The complexity of this method is 2n3 flops (for the QR factorization) and n3 for n back substitutions, each of which costs n2 flops. So we can compute the matrix inverse in around 3n3 flops. This gives an alternative method for solving the square set of linear equations 1, and then the matrix-vector 1)b. This method has a higher flop count than directly solving Ax = b: We first compute the inverse matrix A− product x = (A− 210 11 Matrix inverses the equations using algorithm 11.2 (3n3 versus 2n3), so algorithm 11.2 is the usual method of choice. While the matrix inverse appears in many formulas (such as the solution of a set of linear equations), it is computed far less often. Sparse linear equations. Systems of linear equations with sparse coefficient matrix arise in many applications. By exploiting the sparsity of the coefficient matrix, these linear equations can be solved far more efficiently than by using the generic algorithm 11.2. One method is to use the same basic algorithm 11.2, replacing the QR factorization with a variant that handles sparse matrices (see page 190). The memory usage and complexity of these methods depends in a complicated way on the sparsity pattern of the coefficient matrix. In order, the memory usage is typically a modest multiple of nnz(A) + n, the number of scalars required to specify the problem data A and b, which is typically much smaller than n2 + n, the number of scalars required to store A and b if they are not sparse. The flop count for solving sparse linear equations is also typically closer in order to nnz(A) than n3, the order when the matrix A is not sparse. 11.4 Examples Polynomial interpolation. The 4-vector c gives the coefficients of a cubic polynomial, p(x) = c1 + c2x + c3x2 + c4x3 (see pages 154 and 120). We seek the coefficients that satisfy 1.1) = b1, p( − p( − 0.4) = b2, p(0.2) = b3, p(0.8) = b4. We can express this as the system of 4 equations in 4 variables Ac = b, where .1 − 0.4 − 0.2 0.8 ( ( 1.1)2 − 0.4)2 − (0.2)2 (0.8)2     , 1.1)3 ( − 0.4)3 ( − (0.2)3 (0.8)3 which is a specific Vandermonde matrix (see (6.7)). The unique solution is c = A− 1b, where A− 1 =     0.5784 0.3470 0.1388 0.0370 − − 1.9841 0.1984 1.8651 0.3492 − − − 2.1368 1.4957 1.6239 0.7521     0.7310 0.9503 0.1023 0.0643 − (to 4 decimal places). This is illustrated in figure 11.1, which shows the two cubic polynomials that interpolate the two sets of points shown as filled circles and squares, respectively. The columns of A− 1 are interesting: They give the coefficients of a polynomial that evaluates to 0 at three of the points, and 1 at the other point. For example, the 11.4 Examples 211 Figure 11.1 Cubic interpolants through two sets of points, shown as circles and squares. 1, which is A− 1.1, and value 0 at 1e1, gives the coefficients of the polynomial that first column of A− 0.4, 0.2, and 0.8. The four polynomials with has value 1 at 1 are called the Lagrange polynomials assocoefficients given by the columns of A− ciated with the points 0.4, 0.2, 0.8. These are plotted in figure 11.2. (The Lagrange polynomials are named after the mathematician Joseph-Louis Lagrange, whose name will re-appear in several other contexts.) 1.1, − − − − The rows of A− 1 are also interesting: The ith row shows how the values b1, . . . , b4, the polynomial values at the points 0.4, 0.2, 0.8, map into the ith − coefficient of the polynomial, ci. For example, we see that the coefficient c4 is not 1)41 is small). We can also see that for very sensitive to the value of b1 (since (A− each increase of one in b4, the coefficient c2 increases by around 0.95. 1.1, − Balancing chemical reactions. problem of balancing the chemical reaction (See page 154 for background.) We consider the a1Cr2O2 −7 + a2Fe2+ + a3H+ −→ b1Cr3+ + b2Fe3+ + b3H2O, where the superscript gives the charge of each reactant and product. There are 4 atoms (Cr, O, Fe, H) and charge to balance. The reactant and product matrices are (using the order just listed1.5−1−0.500.51xp(x) 212 11 Matrix inverses Figure 11.2 Lagrange polynomials associated with the points 0.2, 0.8. 1.1, − − 0.4, −10101xp(x)−10101xp(x)−10101xp(x)−10101xp(x) 11.4 Examples 213 Imposing the condition that a1 = 1 we obtain a square set of 6 linear equations                         a1 a2 a3 b1 b2 b3         .         0 0 0 0 0 1 = Solving these equations we obtain a1 = 1, a2 = 6, a3 = 14, b1 = 2, b2 = 6, b3 = 7. (Setting a1 = 1 could have yielded fractional values for the other coefficients, but in this case, it did not.) The balanced reaction is Cr2O2 −7 + 6Fe2+ + 14H+ −→ 2Cr3+ + 6Fe3+ + 7H2O. Heat diffusion. We consider a diffusion system as described on page 155. Some of the nodes have fixed potential, i.e., ei is given; for the other nodes, the associated external source si is zero. This would model a thermal system in which some nodes are in contact with the outside world or a heat source, which maintains their temperatures (via external heat flows) at constant values; the other nodes are internal, and have no heat sources. This gives us a set of n additional equations: ei = efix i , i , ∈ P si = 0, i , ∈ P where equations in matrix-vector form as P is the set of indices of nodes with fixed potential. We can write these n where B and C are the n 0 1 Bii = i i , × ∈ P ∈ P Bs + Ce = d, n diagonal matrices, and d is the n-vector given by Cii = 1 0 i i di = efix . We assemble the flow conservation, edge flow, and the boundary conditions into one set of m + 2n equations in m + 2n var
iables (f, s, e):        0 A I R 0 AT The matrix A is the incidence matrix of the graph, and R is the resistance matrix; see page 155.) Assuming the coefficient matrix is invertible, we have  AT This is illustrated with an example in figure 11.3. The graph is a 100 100 grid, with 10000 nodes, and edges connecting each node to its horizontal and vertical neighbors. The resistance on each edge is the same. The nodes at the top and bottom are held at zero temperature, and the three sets of nodes with rectilinear shapes are held at temperature one. All other nodes have zero source value. × 214 11 Matrix inverses Figure 11.3 Temperature distribution on a 100 100 grid of nodes. Nodes in the top and bottom rows are held at zero temperature. The three sets of nodes with rectilinear shapes are held at temperature one. × 11.5 Pseudo-inverse Linearly independent columns and Gram invertibility. We first show that an m n Gram matrix AT A is invertible. n matrix A has linearly independent columns if and only if its n × × First suppose that the columns of A are linearly independent. Let x be an n-vector which satisfies (AT A)x = 0. Multiplying on the left by xT we get 0 = xT 0 = xT (AT Ax) = xT AT Ax = 2, Ax which implies that Ax = 0. Since the columns of A are linearly independent, we conclude that x = 0. Since the only solution of (AT A)x = 0 is x = 0, we conclude that AT A is invertible. Now let’s show the converse. Suppose the columns of A are linearly dependent, which means there is a nonzero n-vector x which satisfies Ax = 0. Multiply on the left by AT to get (AT A)x = 0. This shows that the Gram matrix AT A is singular. Pseudo-inverse of square or tall matrix. We show here that if A has linearly independent columns (and therefore, is square or tall) then it has a left inverse. (We already have observed the converse, that a matrix with a left inverse has linearly independent columns.) Assuming A has linearly independent columns, we 1AT is a know that AT A is invertible. We now observe that the matrix (AT A)− left inverse of A: (AT A)− 1AT A = (AT A)− 1(AT A) = I. This particular left-inverse of A will come up in the sequel, and has a name, 00.20.40.60.81 11.5 Pseudo-inverse 215 the pseudo-inverse of A. It is denoted A† (or A+): A† = (AT A)− 1AT . (11.5) The pseudo-inverse is also called the Moore–Penrose inverse, after the mathematicians Eliakim Moore and Roger Penrose. When A is square, the pseudo-inverse A† reduces to the ordinary inverse: A† = (AT A)− 1AT = A− 1A− T AT = A− 1I = A− 1. Note that this equation does not make sense (and certainly is not correct) when A is not square. Pseudo-inverse of a square or wide matrix. Transposing all the equations, we can show that a (square or wide) matrix A has a right inverse if and only if its rows are linearly independent. Indeed, one right inverse is given by AT (AAT )− 1. (11.6) (The matrix AAT is invertible if and only if the rows of A are linearly independent.) The matrix in (11.6) is also referred to as the pseudo-inverse of A, and denoted A†. The only possible confusion in defining the pseudo-inverse using the two different formulas (11.5) and (11.6) occurs when the matrix A is square. In this case, however, they both reduce to the ordinary inverse: AT (AAT )− 1 = AT A− T A− 1 = A− 1. Pseudo-inverse in other cases. The pseudo-inverse A† is defined for any matrix, including the case when A is tall but its columns are linearly dependent, the case when A is wide but its rows are linearly dependent, and the case when A is square but not invertible. In these cases, however, it is not a left inverse, right inverse, or inverse, respectively. We mention it here since the reader may encounter it. (We will see what A† means in these cases in exercise 15.11.) Pseudo-inverse via QR factorization. The QR factorization gives a simple formula for the pseudo-inverse. If A is left-invertible, its columns are linearly independent and the QR factorization A = QR exists. We have AT A = (QR)T (QR) = RT QT QR = RT R, so A† = (AT A)− 1AT = (RT R)− 1(QR)T = R− 1R− T RT QT = R− 1QT . We can compute the pseudo-inverse using the QR factorization, followed by back substitution on the columns of QT . (This is exactly the same as algorithm 11.3 when A is square and invertible.) The complexity of this method is 2n2m flops (for the QR factorization), and mn2 flops for the m back substitutions. So the total is 3mn2 flops. 216 11 Matrix inverses Similarly, if A is right-invertible, the QR factorization AT = QR of its transpose exists. We have AAT = (QR)T (QR) = RT QT QR = RT R and A† = AT (AAT )− 1 = QR(RT R)− 1 = QRR− 1R− T = QR− T . We can compute it using the method described above, using the formula (AT )† = (A†)T . Solving over- and under-determined systems of linear equations. The pseudoinverse gives us a method for solving over-determined and under-determined systems of linear equations, provided the columns of the coefficient matrix are linearly independent (in the over-determined case), or the rows are linearly independent (in the under-determined case). If the columns of A are linearly independent, and the over-determined equations Ax = b have a solution, then x = A†b is it. If the rows of A are linearly independent, the under-determined equations Ax = b have a solution for any vector b, and x = A†b is a solution. Numerical example. We illustrate these ideas with a simple numerical example, using the 3 2 matrix A used in earlier examples on pages 199 and 201 This matrix has linearly independent columns, and QR factorization with (to 4 digits)   Q = − 0.5883 0.7845 0.1961   , 0.4576 0.5230 0.7191 − R = 5.0990 0 7.2563 0.5883 . It has pseudo-inverse (to 4 digits) A† = R− 1QT = − 1.2222 0.7778 − 1.1111 0.8889 1.7778 1.2222 . − We can use the pseudo-inverse to check if the over-determined systems of equations 2, 0), has a solution, and to find a solution if it does. We Ax = b, with b = (1, 1) and check whether Ax = b holds. It does, so compute x = A†(1, we have found the unique solution of Ax = b. − 2, 0) = (1, − − Exercises Exercises 217 11.1 Affine combinations of left inverses. Let Z be a tall m n matrix with linearly independent columns, and let X and Y be left inverses of Z. Show that for any scalars α and β satisfying α + β = 1, αX + βY is also a left inverse of Z. It follows that if a matrix has two different left inverses, it has an infinite number of different left inverses. × 11.2 Left and right inverses of a vector. Suppose that x is a nonzero n-vector with n > 1. (a) Does x have a left inverse? (b) Does x have a right inverse? In each case, if the answer is yes, give a left or right inverse; if the answer is no, give a specific nonzero vector and show that it is not left- or right-invertible. 11.3 Matrix cancellation. Suppose the scalars a, x, and y satisfy ax = ay. When a = 0 we can conclude that x = y; that is, we can cancel the a on the left of the equation. In this exercise we explore the matrix analog of cancellation, specifically, what properties of A are needed to conclude X = Y from AX = AY , for matrices A, X, and Y ? (a) Give an example showing that A = 0 is not enough to conclude that X = Y . (b) Show that if A is left-invertible, we can conclude from AX = AY that X = Y . (c) Show that if A is not left-invertible, there are matrices X and Y with X = Y , and AX = AY . Remark. Parts (b) and (c) show that you can cancel a matrix on the left when, and only when, the matrix is left-invertible. 11.4 Transpose of orthogonal matrix. Let U be an orthogonal n transpose U T is also orthogonal. n matrix. Show that its × 11.5 Inverse of a block matrix. Consider the (n + 1) A = I aT (n + 1) matrix , × a 0 where a is an n-vector. (a) When is A invertible? Give your answer in terms of a. Justify your answer. (b) Assuming the condition you found in part (a) holds, give an expression for the inverse matrix A− 1. 11.6 Inverse of a block upper triangular matrix. Let B and D be invertible matrices of sizes m × m and n × n, respectively, and let C be any m n matrix. Find the inverse of × A = B C 0 D 1, C, and D− in terms of B− Hints. First get an idea of what the solution should look like by considering the case when B, C, and D are scalars. For the matrix case, your goal is to find matrices W , X, Y , Z (in terms of B− 1. (The matrix A is called block upper triangular.) 1) that satisfy 1, C, and D− A W X Z Y = I. Use block matrix multiplication to express this as a set of four matrix equations that you can then solve. The method you will find is sometimes called block back substitution. 218 11 Matrix inverses 11.7 Inverse of an upper triangular matrix. Suppose the n n matrix R is upper triangular 1 is also upper and invertible, i.e., its diagonal entries are all nonzero. Show that R− triangular. Hint. Use back substitution to solve Rsk = ek, for k = 1, . . . , n, and argue that (sk)i = 0 for i > k. × 11.8 If a matrix is small, its inverse is large. If a number a is small, its inverse 1/a (assuming = 0) is large. In this exercise you will explore a matrix analog of this idea. Suppose the 1 A− . This implies that if a matrix , which a n is small, its inverse is large. Hint. You can use the inequality B holds for any matrices for which the product makes sense. (See exercise 10.12.) n matrix A is invertible. Show that ≤ √n/ ≥ AB × A A 11.9 Push-through identity. Suppose A is m n, B is n × × m, and the m × m matrix I + AB is invertible. (a) Show that the n implies (I + AB)y = 0, where y = Ax. × n matrix I + BA is invertible. Hint. Show that (I + BA)x = 0 (b) Establish the identity B(I + AB)− 1 = (I + BA)− 1B. This is sometimes called the push-through identity since the matrix B appearing on the left ‘moves’ into the inverse, and ‘pushes’ the B in the inverse out to the right side. Hint. Start with the identity B(I + AB) = (I + BA)B, and multiply on the right by (I + AB)− 1, and on the left by (I + BA)− 1. 11.10 Reverse-time linear dynamical system. A linear dynamical system has the form xt+1 = Axt, where xt
in the (n-vector) state in period t, and A is the n formula gives the state in the next period as a function of the current state. We want to derive a recursion of the form × n dynamics matrix. This 1 = Arevxt, xt − which gives the previous state as a function of the current state. We call this the reverse time linear dynamical system. (a) When is this possible? When it is possible, what is Arev? (b) For the specific linear dynamical system with dynamics matrix − find Arev, or explain why the reverse time linear dynamical system doesn’t exist. A = , 3 1 2 4 11.11 Interpolation of rational functions. (Continuation of exercise 8.8.) Find a rational function f (t) = c1 + c2t + c3t2 1 + d1t + d2t2 that satisfies the following interpolation conditions: f (1) = 2, f (2) = 5, f (3) = 9, f (4) = 1, − f (5) = 4. − In exercise 8.8 these conditions were expressed as a set of linear equations in the coefficients c1, c2, c3, d1 and d2; here we are asking you to form and (numerically) solve the system of equations. Plot the rational function you find over the range x = 0 to x = 6. Your 4). (Your rational plot should include markers at the interpolation points (1, 2), . . . , (5, function graph should pass through these points.) − Exercises 219 11.12 Combinations of invertible matrices. Suppose the n n matrices A and B are both invertible. Determine whether each of the matrices given below is invertible, without any further assumptions about A and B. × (a) A + B. . A 0 0 B (b) (c) A A + B 0 B . (d) ABA. 11.13 Another left inverse. Suppose the m columns. One left inverse of A is the pseudo-inverse A†. another one. Write A as the block matrix × n matrix A is tall and has linearly independent In this problem we explore A = , A1 A2 where A1 is n Show that the following matrix is a left inverse of A: × n. We assume that A1 is invertible (which need not happen in general). ˜A = A− 1 1 0n (m × n) − . 11.14 Middle inverse. Suppose A is an n q matrix X exists that satisfies AXB = I, we call it a middle inverse of the pair A, B. (This is not a standard concept.) Note that when A or B is an identity matrix, the middle inverse reduces to the right or left inverse, respectively. p matrix and B is a q n matrix. If a p × × × (a) Describe the conditions on A and B under which a middle inverse X exists. Give your answer using only the following four concepts: Linear independence of the rows or columns of A, and linear independence of the rows or columns of B. You must justify your answer. (b) Give an expression for a middle inverse, assuming the conditions in part (a) hold. 11.15 Invertibility of population dynamics matrix. Consider the population dynamics matrix 1       A = b1 − 0 ... 0 d1 1 d2 b2 0 − ... 0 · · · · · · · · · . . . b99 0 0 ... 1 d99       , b100 0 0 ... 0 · · · where bi 1 are death rates. What are the conditions ≤ on bi and di under which A is invertible? (If the matrix is never invertible or always invertible, say so.) Justify your answer. 0 are the birth rates and 0 di ≤ − ≥ 11.16 Inverse of running sum matrix. Find the inverse of the ... 1 1 0 1 ... 1 1 0 0 ... ... 0 1 · · · · · · . . . · · · · · · Does your answer make sense? n running sum matrix, × . 220 11 Matrix inverses | a | < 1. 11.17 A matrix identity. Suppose A is a square matrix that satisfies Ak = 0 for some integer k. 1, 1 = I + A + , which holds for numbers a that (Such a matrix is called nilpotent.) A student guesses that (I based on the infinite series 1/(1 satisfy Is the student right or wrong? If right, show that her assertion holds with no further If she is wrong, give a counterexample, i.e., a matrix A that assumptions about A. + Ak satisfies Ak = 0, but I + A + − 11.18 Tall-wide product. Suppose A is an n n matrix, so C = AB makes sense. Explain why C cannot be invertible if A is tall and B is wide, i.e., if p < n. Hint. First argue that the columns of B must be linearly dependent. 1 is not the inverse of I p matrix and B is a p a) = 1 + a + a2 + + Ak A)− · · · · · · · · · A. − − × × − − 11.19 Control restricted to one time period. A linear dynamical system has the form xt+1 = Axt + ut, where the n-vector xt is the state and ut is the input at time t. Our goal is to 1 so as to achieve xN = xdes, where xdes is a given choose the input sequence u1, . . . , uN n-vector, and N is given. The input sequence must satisfy ut = 0 unless t = K, where K < N is given. In other words, the input can only act at time t = K. Give a formula for uK that achieves this goal. Your formula can involve A, N , K, x1, and xdes. You can assume that A is invertible. Hint. First derive an expression for xK , then use the dynamics equation to find xK+1. From xK+1 you can find xN . − − 11.20 Immigration. The population dynamics of a country is given by xt+1 = Axt + u, t = 1, where the 100-vector xt gives the population age distribution in year t, 1, . . . , T and u gives the immigration age distribution (with negative entries meaning emigration), which we assume is constant (i.e., does not vary with t). You are given A, x1, and xdes, a 100-vector that represents a desired population distribution in year T . We seek a constant level of immigration u that achieves xT = xdes. Give a matrix formula for u. If your formula only makes sense when some conditions hold (for example invertibility of one or more matrices), say so. 11.21 Quadrature weights. Consider a quadrature problem (see exercise 8.12) with n = 4, with 0.2, 0.2, 0.6). We require that the quadrature rule be exact for all points t = ( 0.6, polynomials of degree up to d = 3. Set this up as a square system of linear equations in the weight vector. Numerically solve this system to get the weights. Compute the true value and the quadrature estimate, − − 1 α = f (x) dx, ˆα = w1f ( 1 − 0.6) + w2f ( − 0.2) + w3f (0.2) + w4f (0.6), − for the specific function f (x) = ex. 11.22 Properties of pseudo-inverses. For an m that A = AA†A and A† = A†AA† in each of the following cases. × n matrix A and its pseudo-inverse A†, show (a) A is tall with linearly independent columns. (b) A is wide with linearly independent rows. (c) A is square and invertible. 11.23 Product of pseudo-inverses. Suppose A and D are right-invertible matrices and the product AD exists. We have seen that if B is a right inverse of A and E is a right inverse of D, then EB is a right inverse of AD. Now suppose B is the pseudo-inverse of A and E is the pseudo-inverse of D. Is EB the pseudo-inverse of AD? Prove that this is always true or give an example for which it is false. 11.24 Simultaneous left inverse. The two matrices Exercises 221 and both left-invertible, and have multiple left inverses. Do they have a common left inverse? Explain how to find a 2 4 matrix C that satisfies CA = CB = I, or determine that no such matrix exists. (You can use numerical computing to find C.) Hint. Set up a set of linear equations for the entries of C. Remark. There is nothing special about the particular entries of the two matrices A and B. × − 11.25 Checking the computed solution of linear equations. One of your colleagues says that whenever you compute the solution x of a square set of n equations Ax = b (say, using QR factorization), you should compute the number and check that it is small. (It is not exactly zero due to the small rounding errors made in floating point computations.) Another colleague says that this would be nice to do, but the additional cost of computing is too high. Briefly comment on your colleagues’ advice. Who is right? Ax Ax − b b 11.26 Sensitivity of solution of linear equations. Let A be an invertible n n matrix, and b and x be n-vectors satisfying Ax = b. Suppose we perturb the jth entry of b by = 0 (which is a traditional symbol for a small quantity), so b becomes ˜b = b + ej. Let ˜x be the nvector that satisfies A˜x = ˜b, i.e., the solution of the linear equations using the perturbed , which is how much the solution changes right-hand side. We are interested in ˜x due to the change in the right-hand side. The ratio gives the sensitivity of the ˜x − solution to changes (perturbations) of the jth entry of b. | × − x x / | (a) Show that x ˜x does not depend on b; it only depends on the matrix A, , and j. (b) How would you find the index j that maximizes the value of ˜x ? By part (a), your answer should be in terms of A (or quantities derived from A) and only. x − − Remark. If a small change in the right-hand side vector b can lead to a large change in the solution, we say that the linear equations Ax = b are poorly conditioned or ill-conditioned. As a practical matter it means that unless you are very confident in what the entries of b are, the solution A− 1b may not be useful in practice. 11.27 Timing test. Generate a random n n matrix A and an n-vector b, for n = 500, n = 1000, 1b (for example using the and n = 2000. For each of these, compute the solution x = A− b is backslash operator, if the software you are using supports it), and verify that Ax (very) small. Report the time it takes to solve each of these three sets of linear equations, and for each one work out the implied speed of your processor in Gflop/s, based on the 2n3 complexity of solving equations using the QR factorization. − × 11.28 Solving multiple linear equations efficiently. Suppose the n × n matrix A is invertible. We can solve the system of linear equations Ax = b in around 2n3 flops using algorithm 11.2. Once we have done that (specifically, computed the QR factorization of A), we can solve an additional set of linear equations with same matrix but different right-hand side, Ay = c, in around 3n2 additional flops. Assuming we have solved both of these sets of equations, suppose we want to solve Az = d, where d = αb + βc is a linear combination of b and c. (We are given the coefficients α and β.) Suggest a method for doing this that is even faster than re-using the QR factorization of A. Your method should have a complexity that is linear in n. Give rough estimates for the time needed to solve Ax = b,
Ay = c, and Az = d (using your method) for n = 3000 on a computer capable of carrying out 1 Gflop/s. Part III Least squares Chapter 12 Least squares In this chapter we look at the powerful idea of finding approximate solutions of over-determined systems of linear equations by minimizing the sum of the squares of the errors in the equations. The method, and some extensions we describe in later chapters, are widely used in many application areas. It was discovered independently by the mathematicians Carl Friedrich Gauss and Adrien-Marie Legendre around the beginning of the 19th century. 12.1 Least squares problem Suppose that the m n matrix A is tall, so the system of linear equations Ax = b, where b is an m-vector, is over-determined, i.e., there are more equations (m) than variables to choose (n). These equations have a solution only if b is a linear combination of the columns of A. × For most choices of b, however, there is no n-vector x for which Ax = b. As a b, which we call the residual (for the compromise, we seek an x for which r = Ax equations Ax = b), is as small as possible. This suggests that we should choose x . If we find an x for which the so as to minimize the norm of the residual, b, i.e., x almost satisfies the linear equations residual vector is small, we have Ax Ax = b. (Some authors define the residual as b Ax, which will not affect us since Ax Minimizing the norm of the residual and its square are the same, so we can just .) b Ax Ax − − − ≈ − − = b b as well minimize Ax b 2 = r 2 = r2 1 + − · · · + r2 m, the sum of squares of the residuals. The problem of finding an n-vector ˆx that 2, over all possible choices of x, is called the least squares minimizes problem. It is denoted using the notation Ax − b Ax where we should specify that the variable is x (meaning that we should choose x). The matrix A and the vector b are called the data for the problem (12.1), which minimize (12.1) b − 2, 226 12 Least squares means that they are given to us when we are asked to choose x. The quantity to 2, is called the objective function (or just objective) of the be minimized, least squares problem (12.1). b Ax − The problem (12.1) is sometimes called linear least squares to emphasize that the residual r (whose norm squared we are to minimize) is an affine function of x, and to distinguish it from the nonlinear least squares problem, in which we allow the residual r to be an arbitrary function of x. We will study the nonlinear least squares problem in chapter 18. Any vector ˆx that satisfies 2 for all x is a solution of the least ≤ squares problem (12.1). Such a vector is called a least squares approximate solution of Ax = b. It is very important to understand that a least squares approximate solution ˆx of Ax = b need not satisfy the equations Aˆx = b; it simply makes the norm of the residual as small as it can be. Some authors use the confusing phrase ‘ˆx solves Ax = b in the least squares sense’, but we emphasize that a least squares approximate solution ˆx does not, in general, solve the equation Ax = b. Aˆx b Ax − − b 2 b If − Aˆx (which we call the optimal residual norm) is small, then we can say that ˆx approximately solves Ax = b. On the other hand, if there is an n-vector x that satisfies Ax = b, then it is a solution of the least squares problem, since its associated residual norm is zero. Another name for the least squares problem (12.1), typically used in data fitting applications (the topic of the next chapter), is regression. We say that ˆx, a solution of the least squares problem, is the result of regressing the vector b onto the columns of A. Column interpretation. If the columns of A are the m-vectors a1, . . . , an, then the least squares problem (12.1) is the problem of finding a linear combination of the columns that is closest to the m-vector b; the vector x gives the coefficients: Ax b − 2 = (x1a1 + · · · + xnan) b 2. − If ˆx is a solution of the least squares problem, then the vector is closest to the vector b, among all linear combinations of the vectors a1, . . . , an. Aˆx = ˆx1a1 + + ˆxnan · · · Row interpretation. Suppose the rows of A are the n-row-vectors ˜aT the residual components are given by 1 , . . . , ˜aT m, so ri = ˜aT i x bi, − i = 1, . . . , m. The least squares objective is then Ax b 2 = (˜aT 1 x − − b1)2 + · · · + (˜aT mx − bm)2, the sum of the squares of the residuals in m scalar linear equations. Minimizing this sum of squares of the residuals is a reasonable compromise if our goal is to choose x so that all of them are small. 12.2 Solution 227 Example. We consider the least squares problem with data − The over-determined set of three equations in two variables Ax = b, 2x1 = 1, x1 + x2 = 0, − 2x2 = 1, − has no solution. (From the first equation we have x1 = 1/2, and from the last equation we have x2 = 1/2; but then the second equation does not hold.) The corresponding least squares problem is − minimize (2x1 − 1)2 + ( x1 + x2)2 + (2x2 + 1)2. − This least squares problem can be solved using the methods described in the next section (or simple calculus). 1/3). The least squares approximate solution ˆx does not satisfy the equations Ax = b; the corresponding residuals are Its unique solution is ˆx = (1/3, − ˆr = Aˆx b = ( − 1/3, − 2/3, 1/3), − b with sum of squares value of x, ˜x = (1/2, the three equations in Ax = b. It gives the residual 2 = 2/3. Let us compare this to another choice 1/2), which corresponds to (exactly) solving the first and last of Aˆx − − with sum of squares value − 2 = 1. The column interpretation tells us that A˜x − b ˜r = A˜x b = (0, 1, 0), − (1/3/3/3 2/3 2/3 − − is the linear combination of the columns of A that is closest to b. Figure 12.1 shows the values of the least squares objective 2 versus x = (x1, x2), with the least squares solution ˆx shown as the dark point, with 2 = 2/3. The curves show the points x that have objective objective value b value b Aˆx Aˆx Ax − b b Aˆx − 2 + 1, − 2 + 2, and so on. − 12.2 Solution In this section we derive several expressions for the solution of the least squares problem (12.1), under one assumption on the data matrix A: The columns of A are linearly independent. (12.2) 228 12 Least squares Figure 12.1 Level curves of the function x2)2 + (2x2 + 1)2. The point ˆx minimizes the function. Ax 2 = (2x1 − b − 1)2 + ( x1 + − Solution via calculus. In this section we find the solution of the least squares C.2. (We will also problem using some basic results from calculus, reviewed in give an independent verification of the result, that does not rely on calculus, below.) We know that any minimizer ˆx of the function f (x) = § b Ax − 2 must satisfy ∂f ∂xi (ˆx) = 0, i = 1, . . . , n, which we can express as the vector equation f (ˆx) = 0, ∇ where ∇ matrix form as f (ˆx) is the gradient of f evaluated at ˆx. The gradient can be expressed in f (x) = 2AT (Ax ∇ b). − (12.3) This formula can be derived from the chain rule given on page 184, and the gradient C.1. For completeness, we will derive the of the sum of squares function, given in § formula (12.3) from scratch here. Writing the least squares objective out as a sum, we get f (x) = Ax b − 2 = m   n i=1 j=1  2 Aijxj − bi  . −1−0.500.511.5−1.5−1−0.500.51ˆxf(ˆx)+1f(ˆx)+2x1x2 12.2 Solution 229 To find ating the sum term by term, we get ∇ f (x)k we take the partial derivative of f with respect to xk. Differenti- f (x)k = ∇ = = (x) ∂f ∂xk m i=1 m i=1   n j=1  Aijxj − bi  (Aik) 2 2(AT )ki(Ax b)i − = 2AT (Ax b) k . − This is our formula (12.3), written out in terms of its components. Now we continue the derivation of the solution of the least squares problem. Any minimizer ˆx of Ax b 2 must satisfy − f (ˆx) = 2AT (Aˆx ∇ b) = 0, − which can be written as AT Aˆx = AT b. (12.4) These equations are called the normal equations. The coefficient matrix AT A is the Gram matrix associated with A; its entries are inner products of columns of A. Our assumption (12.2) that the columns of A are linearly independent implies that the Gram matrix AT A is invertible ( 11.5, page 214). This implies that § ˆx = (AT A)− 1AT b (12.5) is the only solution of the normal equations (12.4). So this must be the unique solution of the least squares problem (12.1). We have already encountered the matrix (AT A)− 1AT that appears in (12.5): It is the pseudo-inverse of the matrix A, given in (11.5). So we can write the solution of the least squares problem in the simple form ˆx = A†b. (12.6) § − b 11.5 that A† is a left inverse of A, which means that ˆx = A†b We observed in solves Ax = b if this set of over-determined equations has a solution. But now we see that ˆx = A†b is the least squares approximate solution, i.e., it minimizes Ax 2. (And if there is a solution of Ax = b, then ˆx = A†b is it.) The equation (12.6) looks very much like the formula for solution of the linear equations Ax = b, when A is square and invertible, i.e., x = A− It is very important to understand the difference between the formula (12.6) for the least squares approximate solution, and the formula for the solution of a square set In the case of linear equations and the inverse, of linear equations, x = A− 1b actually satisfies Ax = b. In the case of the least squares approximate x = A− solution, ˆx = A†b generally does not satisfy Aˆx = b. 1b. 1b. The formula (12.6) shows us that the solution ˆx of the least squares problem is a linear function of b. This generalizes the fact that the solution of a square invertible set of linear equations is a linear function of its right-hand side. 230 12 Least squares Direct verification of least squares solution. that ˆx = (AT A)− relying on calculus. We will show that for any x In this section we directly show 1AT b is the solution of the least squares problem (12.1), without = ˆx, we have establishing that ˆx is the unique vector that minimizes Aˆx − b 2 < Ax 2, b − Ax − b 2. We start by writing Ax − b 2 = = (Ax Ax − Aˆx) + (Aˆx 2 + Aˆx Aˆx − − b − b) 2 2 + 2(Ax Aˆx)T (Aˆx − − b), (12.7) where we use the
identity u + v 2 = (u + v)T (u + v) = 2 + u v 2 + 2uT v. The third term in (12.7) is zero: (Ax − Aˆx)T (Aˆx − b) = (x = (x = (x = 0, ˆx)T AT (Aˆx ˆx)T (AT Aˆx ˆx)T 0 − − b) AT b) − − − where we use (AT A)ˆx = AT b (the normal equations) in the third line. With this simplification, (12.7) reduces to Ax b − 2 = A(x ˆx) 2 + Aˆx − 2. b − The first term on the right-hand side is nonnegative and therefore b − 2. Aˆx ≥ Ax This shows that ˆx minimizes Suppose equality holds above, that is, 2 2; we now show that it is the unique minimizer. b 2. Then we have − 2 = 0, which implies A(x ˆx) = 0. Since A has linearly independent ˆx) 2 = columns, we conclude that x 2 is x = ˆx; for all x ˆx = 0, i.e., x = ˆx. So the only x with b − = ˆx, we have 2 = 2 > Aˆx Aˆx Ax Ax A(x b b Aˆx Ax Ax 2 Row form. The formula for the least squares approximate solution can be expressed in a useful form in terms of the rows ˜aT i of the matrix A. ˆx = (AT A)− 1AT b = m i=1 − 1 m bi˜ai . ˜ai˜aT i i=1 (12.8) In this formula we express the n products, and the n-vector AT b as a sum of m n-vectors. × n Gram matrix AT A as a sum of m outer 12.3 Solving least squares problems 231 Figure 12.2 Illustration of orthogonality principle for a least squares problem of size m = 3, n = 2. The optimal residual ˆr is orthogonal to any linear combination of a1 and a2, the two columns of A. Orthogonality principle. The point Aˆx is the linear combination of the columns b. The optimal of A that is closest to b. The optimal residual is ˆr = Aˆx residual satisfies a property that is sometimes called the orthogonality principle: It is orthogonal to the columns of A, and therefore, it is orthogonal to any linear combination of the columns of A. In other words, for any n-vector z, we have − (Az) ˆr. ⊥ (12.9) We can derive the orthogonality principle from the normal equations, which can be expressed as AT (Aˆx b) = 0. For any n-vector z, we have − (Az)T ˆr = (Az)T (Aˆx b) = zT AT (Aˆx − b) = 0. − The orthogonality principle is illustrated in figure 12.2, for a least squares problem with m = 3 and n = 2. The shaded plane is the set of all linear combinations z1a1 + z2a2 of a1 and a2, the two columns of A. The point Aˆx is the closest point in the plane to b. The optimal residual ˆr is shown as the vector from b to Aˆx. This vector is orthogonal to any point in the shaded plane. 12.3 Solving least squares problems We can use the QR factorization to compute the least squares approximate solution (12.5). Let A = QR be the QR factorization of A (which exists by our assumption (12.2) that its columns are linearly independent). We have already seen that the pseudo-inverse A† can be expressed as A† = R− 1QT , so we have ˆx = R− 1QT b. (12.10) To compute ˆx we first multiply b by QT ; then we compute R− 1(QT b) using back substitution. This is summarized in the following algorithm, which computes the least squares approximate solution ˆx, given A and b. a1a2ˆrbAˆx 232 12 Least squares Algorithm 12.1 Least squares via QR factorization given an m × n matrix A with linearly independent columns and an m-vector b. 1. QR factorization. Compute the QR factorization A = QR. 2. Compute QT b. 3. Back substitution. Solve the triangular equation Rˆx = QT b. Comparison to solving a square system of linear equations. Recall that the 1b. solution of the square invertible system of linear equations Ax = b is x = A− 1QT b (see (11.4)). This We can express x using the QR factorization of A as x = R− equation is formally identical to (12.10). The only difference is that in (12.10), A 1QT b is the least squares approximate solution, and Q need not be square, and R− which is not (in general) a solution of Ax = b. Indeed, algorithm 12.1 is formally the same as algorithm 11.2, the QR fac(The only difference is that in torization method for solving linear equations. algorithm 12.1, A and Q can be tall.) When A is square, solving the linear equations Ax = b and the least squares 2 are the same, and algorithm 11.2 and algoproblem of minimizing rithm 12.1 are the same. So we can think of algorithm 12.1 as a generalization of algorithm 11.2, which solves the equation Ax = b when A is square, and computes the least squares approximate solution when A is tall. Ax − b Backslash notation. Several software packages for manipulating matrices extend the backslash operator (see page 209) to mean the least squares approximate solution of an over-determined set of linear equations. In these packages A b is taken \ 1b of Ax = b when A is square and invertible, and the to mean the solution A− least squares approximate solution A†b when A is tall and has linearly independent columns. (We remind the reader that this backslash notation is not standard mathematical notation.) Complexity. The complexity of the first step of algorithm 12.1 is 2mn2 flops. The second step involves a matrix-vector multiplication, which takes 2mn flops. The third step requires n2 flops. The total number of flops is 2mn2 + 2mn + n2 2mn2, ≈ neglecting the second and third terms, which are smaller than the first by factors of n and 2m, respectively. The order of the algorithm is mn2. The complexity is linear in the row dimension of A and quadratic in the number of variables. Sparse least squares. Least squares problems with sparse A arise in several applications and can be solved more efficiently, for example by using a QR factorization tailored for sparse matrices (see page 190) in the generic algorithm 12.1. 12.3 Solving least squares problems 233 Another simple approach for exploiting sparsity of A is to solve the normal equations AT Aˆx = AT b by solving a larger (but sparse) system of equations, 0 AT A I ˆx ˆy = 0 b . (12.11) This is a square set of m+n linear equations. Its coefficient matrix is sparse when A is sparse. If (ˆx, ˆy) satisfies these equations, it is easy to see that ˆx satisfies (12.11); conversely, if ˆx satisfies the normal equations, (ˆx, ˆy) satisfies (12.11) with ˆy = b Aˆx. Any method for solving a sparse system of linear equations can be used to solve (12.11). − × k matrix X so as to minimize Matrix least squares. A simple extension of the least squares problem is to choose 2. Here A is an m the n n matrix and AX B B is an m k matrix, and the norm is the matrix norm. This is sometimes called the matrix least squares problem. When k = 1, x and b are vectors, and the matrix least squares problem reduces to the usual least squares problem. × − × The matrix least squares problem is in fact nothing but a set of k ordinary least squares problems. To see this, we note that 2 + 2 = 2, bk B − + · · · AX Ax1 − Axk − b1 where xj is the jth column of X and bj is the jth column of B. (Here we use the property that the square of the matrix norm is the sum of the squared norms of the columns of the matrix.) So the objective is a sum of k terms, with each term depending on only one column of X. It follows that we can choose the columns xj 2. Assuming independently, each one by minimizing its associated term that A has linearly independent columns, the solution is ˆxj = A†bj. The solution of the matrix least squares problem is therefore Axj − bj ˆX = ˆx1 ˆxk · · · = A†b1 b1 = A† = A†B. · · · · · · A†bk bk (12.12) The very simple solution ˆX = A†B of the matrix least squares problem agrees with the solution of the ordinary least squares problem when k = 1 (as it must). Many software packages for linear algebra use the backslash operator A B to denote A†B, but this is not standard mathematical notation. \ The matrix least squares problem can be solved efficiently by exploiting the fact that algorithm 12.1 is another example of a factor-solve algorithm. To compute ˆX = A†B we carry out the QR factorization of A once; we carry out steps 2 and 3 of algorithm 12.1 for each of the k columns of B. The total cost is 2mn2 +k(2mn+n2) flops. When k is small compared to n this is roughly 2mn2 flops, the same cost as solving a single least squares problem (i.e., one with a vector right-hand side). 234 12.4 Examples 12 Least squares × Advertising purchases. We have m demographic groups or audiences that we want to advertise to, with a target number of impressions or views for each group, which we give as a vector vdes. (The entries are positive.) To reach these audiences, we purchase advertising in n different channels (say, different web publishers, radio, print, . . . ), in amounts that we give as an n-vector s. (The entries of s are nonnegative, which we ignore.) The m n matrix R gives the number of impressions in each group per dollar spending in the channels: Rij is the number of impressions in group i per dollar spent on advertising in channel j. (These entries are estimated, and are nonnegative.) The jth column of R gives the effectiveness or reach (in impressions per dollar) for channel j. The ith row of R shows which media demographic group i is exposed to. The total number of impressions in each demographic group is the m-vector v, which is given by v = Rs. The goal is to vdes. We can do this using least squares, by choosing find s so that v = Rs 2. (We are not guaranteed that the resulting channel s to minimize spend vector will be nonnegative.) This least squares formulation does not take into account the total cost of the advertising; we will see in chapter 16 how this can be done. Rs ≈ vdes − We consider a simple numerical example, with n = 3 channels and m = 10 demographic groups, and matrix  .97 1.23 0.80 1.29 1.10 0.67 0.87 1.10 1.92 1.29 1.86 2.18 1.24 0.98 1.23 0.34 0.26 0.16 0.22 0.12                 , 0.41 0.53 0.62 0.51 0.69 0.54 0.62 0.48 0.71 0.62 with units of 1000 views per dollar. The entries of R range over an 18:1 range, so the 3 channels are quite different in terms of their audience reach; see figure 12.3. We take vdes = (103)1, i.e., our goal is to reach one million customers in each of the 10 demographic groups. Least squares gives the advertising budget allocation ˆs = (62, 100, 1443), which achieves a views vector with RMS erro
r 132, or 13.2% of the target values. The views vector is shown in figure 12.4. Illumination. A set of n lamps illuminates an area that we divide into m regions or pixels. We let li denote the lighting level in region i, so the m-vector l gives the illumination levels across all regions. We let pi denote the power at which lamp i operates, so the n-vector p gives the set of lamp powers. (The lamp powers are nonnegative and also must not exceed a maximum allowed power, but we ignore these issues here.) 12.4 Examples 235 Figure 12.3 Number of impressions in ten demographic groups, per dollar spent on advertising in three channels. The units are 1000 views per dollar. Figure 12.4 Views vector that best approximates the target of one million impressions in each group. 1234567891012GroupImpressionsChannel1Channel2Channel31234567891005001,000GroupImpressions 236 12 Least squares The vector of illumination levels is a linear function of the lamp powers, so we have l = Ap for some m n matrix A. The jth column of A gives the illumination pattern for lamp j, i.e., the illumination when lamp j has power 1 and all other lamps are off. We will assume that A has linearly independent columns (and therefore is tall). The ith row of A gives the sensitivity of pixel i to the n lamp powers. × The goal is to find lamp powers that result in a desired illumination pattern ldes, such as ldes = α1, which is uniform illumination with value α across the area. ldes. We can use least squares to find ˆp that In other words, we seek p so that Ap 2. minimizes the sum square deviation from the desired illumination, This gives the lamp power levels ldes Ap ≈ − ˆp = A†ldes = (AT A)− 1AT ldes. (We are not guaranteed that these powers are nonnegative, or less than the maximum allowed power level.) An example is shown in figure 12.5. The area is a 25 25 grid with m = 625 pixels, each (say) 1m square. The lamps are at various heights ranging from 3m to 6m, and at the positions shown in the figure. The illumination decays with an inverse square law, so Aij is proportional to d− ij , where dij is the (3-D) distance between the center of the pixel and the lamp position. The matrix A is scaled so that when all lamps have power one, the average illumination level is one. The desired illumination pattern is 1, i.e., uniform with value 1. × 2 With p = 1, the resulting illumination pattern is shown in the top part of figure 12.5. The RMS illumination error is 0.24. We can see that the corners are quite a bit darker than the center, and there are pronounced bright spots directly beneath each lamp. Using least squares we find the lamp powers ˆp = (1.46, 0.79, 2.97, 0.74, 0.08, 0.21, 0.21, 2.05, 0.91, 1.47). The resulting illumination pattern has an RMS error of 0.14, about half of the RMS error with all lamp powers set to one. The illumination pattern is shown in the bottom plot of figure 12.5; we can see that the illumination is more uniform than when all lamps have power 1. Most illumination values are near the target level 1, with the corners a bit darker and the illumination a bit brighter directly below each lamp, but less so than when all lamps have power one. This is clear from figure 12.6, which shows the histogram of patch illumination values for all lamp powers one, and for lamp powers ˆp. 12.4 Examples 237 Figure 12.5 A square area divided in a 25 25 grid. The circles show the positions of 10 lamps, the number in parentheses next to each circle is the height of the lamp. The top plot shows the illumination pattern with lamps set to power one. The bottom plot shows the illumination pattern for the lamp powers that minimize the sum square deviation with a desired uniform illumination of one. × 1(4.0m)2(3.5m)3(6.0m)4(4.0m)5(4.0m)6(6.0m)7(5.5m)8(5.0m)9(5.0m)10(4.5m)025m025m0.60.811.21.41(4.0m)2(3.5m)3(6.0m)4(4.0m)5(4.0m)6(6.0m)7(5.5m)8(5.0m)9(5.0m)10(4.5m)025m025m0.60.811.21.4 238 12 Least squares Figure 12.6 Histograms of pixel illumination values using p = 1 (top) and ˆp (bottom). The target intensity value is one. 0.20.40.60.811.21.41.61.8020406080100120IntensityNumberofpixels0.20.40.60.811.21.41.61.8020406080100120IntensityNumberofpixels Exercises Exercises 239 12.1 Approximating a vector as a multiple of another one. In the special case n = 1, the general 2, where least squares problem (12.1) reduces to finding a scalar x that minimizes a and b are m-vectors. (We write the matrix A here in lower case, since it is an m-vector.) 2(sin θ)2, where θ = (a, b). Assuming a and b are nonzero, show that This shows that the optimal relative error in approximating one vector by a multiple of another one depends on their angle. 2 = ax aˆx − − b b b 12.2 Least squares with orthonormal columns. Suppose the m n matrix Q has orthonormal columns and b is an m-vector. Show that ˆx = QT b is the vector that minimizes 2. What is the complexity of computing ˆx, given Q and b, and how does it compare to the complexity of a general least squares problem with an m n coefficient matrix? Qx × − b 12.3 Least angle property of least squares. Suppose the m n matrix A has linearly independent columns, and b is an m-vector. Let ˆx = A†b denote the least squares approximate solution of Ax = b. × × (a) Show that for any n-vector x, (Ax)T b = (Ax)T (Aˆx), i.e., the inner product of Ax and b is the same as the inner product of Ax and Aˆx. Hint. Use (Ax)T b = xT (AT b) and (AT A)ˆx = AT b. (b) Show that when Aˆx and b are both nonzero, we have The left-hand side is the cosine of the angle between Aˆx and b. Hint. Apply part (a) with x = ˆx. (Aˆx)T b b Aˆx Aˆx b = . (c) Least angle property of least squares. The choice x = ˆx minimizes the distance between Ax and b. Show that x = ˆx also minimizes the angle between Ax and b. (You can assume that Ax and b are nonzero.) Remark. For any positive scalar α, x = αˆx also minimizes the angle between Ax and b. 12.4 Weighted least squares. In least squares, the objective (to be minimized) is Ax b − 2 = m (˜aT i x i=1 bi)2, − where ˜aT problem, we minimize the objective i are the rows of A, and the n-vector x is to chosen. In the weighted least squares m i=1 wi(˜aT i x bi)2, − where wi are given positive weights. The weights allow us to assign different weights to the different components of the residual vector. (The objective of the weighted least squares problem is the square of the weighted norm, 2 w, as defined in exercise 3.28.) Ax b − (a) Show that the weighted least squares objective can be expressed as D(Ax for an appropriate diagonal matrix D. This allows us to solve the weighted least 2, squares problem as a standard least squares problem, by minimizing where B = DA and d = Db. Bx − − d b) 2 (b) Show that when A has linearly independent columns, so does the matrix B. (c) The least squares approximate solution is given by ˆx = (AT A)− 1AT b. Give a similar formula for the solution of the weighted least squares problem. You might want to use the matrix W = diag(w) in your formula. 240 12 Least squares 12.5 Approximate right inverse. Suppose the tall m n matrix A has linearly independent columns. It does not have a right inverse, i.e., there is no n m matrix X for which AX = I. So instead we seek the n I has the smallest possible matrix norm. We call this matrix the least squares approximate right inverse of A. Show that the least squares right inverse of A is given by X = A†. Hint. This is a matrix least squares problem; see page 233. m matrix X for which the residual matrix R = AX × × − × 12.6 Least squares equalizer design. (See exercise 7.15.) You are given a channel impulse response, the n-vector c. Your job is to find an equalizer impulse response, the n-vector 2. You can assume that c1 = 0. Remark. h is called an h, that minimizes equalizer since it approximately inverts, or undoes, convolution by c. Explain how to find h. Apply your method to find the equalizer h for the channel c = (1.0, 0.7, 0.1, 0.05). Plot c, h, and h 0.3, e1 − c. h ∗ c − − ∗ 12.7 Network tomography. A network consists of n links, labeled 1, . . . , n. A path through the network is a subset of the links. (The order of the links on a path does not matter here.) Each link has a (positive) delay, which is the time it takes to traverse it. We let d denote the n-vector that gives the link delays. The total travel time of a path is the sum of the delays of the links on the path. Our goal is to estimate the link delays (i.e., the vector d), from a large number of (noisy) measurements of the travel times along different paths. This data is given to you as an N n matrix P , where × Pij = 1 0 link j is on path i otherwise, and an N -vector t whose entries are the (noisy) travel times along the N paths. You can assume that N > n. You will choose your estimate ˆd by minimizing the RMS deviation between the measured travel times (t) and the travel times predicted by the sum of the link delays. Explain how to do this, and give a matrix expression for ˆd. If your expression requires assumptions about the data P or t, state them explicitly. Remark. This problem arises in several contexts. The network could be a computer network, and a path gives the sequence of communication links data packets traverse. The network could be a transportation system, with the links representing road segments. 12.8 Least squares and QR factorization. Suppose A is an m n matrix with linearly independent columns and QR factorization A = QR, and b is an m-vector. The vector Aˆx is the linear combination of the columns of A that is closest to the vector b, i.e., it is the projection of b onto the set of linear combinations of the columns of A. × (a) Show that Aˆx = QQT b. (The matrix QQT is called the projection matrix.) (b) Show that Aˆx b 2 = 2 b QT b 2. (This is the square of the distance between b and the closest linear combination of the columns of A.) − − 12.9 Invertibility of matrix in sparse least squares formulation. Show that the (m+n) (m+n) coefficient matrix appearing in equation (12.11) is invertible if
and only if the columns of A are linearly independent. × 12.10 Numerical check of the least squares approximate solution. Generate a random 30 10 matrix A and a random 30-vector b. Compute the least squares approximate solution 2. (There may be several ˆx = A†b and the associated residual norm squared ways to do this, depending on the software package you use.) Generate three different 2 holds. (This random 10-vectors d1, d2, d3, and verify that shows that x = ˆx has a smaller associated residual than the choices x = ˆx + di, i = 1, 2, 3.) A(ˆx + di) 2 > Aˆx Aˆx × − − − b b b 12.11 Complexity of matrix least squares problem. Explain how to compute the matrix least squares approximate solution of AX = B, given by ˆX = A†B (see (12.12)), in no more than 2mn2 + 3mnk flops. (In contrast, solving k vector least squares problems to obtain the columns of ˆX, in a na¨ıve way, requires 2mn2k flops.) Exercises 241 12.12 Least squares placement. The 2-vectors p1, . . . , pN represent the locations or positions of N objects, for example, factories, warehouses, and stores. The last K of these locations are fixed and given; the goal in a placement problem to choose the locations of the first N K objects. Our choice of the locations is guided by an undirected graph; an edge between two objects means we would like them to be close to each other. In least squares placement, we choose the locations p1, . . . , pN K so as to minimize the sum of the squares of the distances between objects connected by an edge, − − pi1 − where the L edges of the graph are given by (i1, j1), . . . , (iL, jL). piL − pjL pj1 · · · + 2 + 2, (a) Let D be the Dirichlet energy of the graph, as defined on page 135. Show that the sum of the squared distances between the N objects can be expressed as (v), where u = ((p1)1, . . . , (pN )1) and v = ((p1)2, . . . , (pN )2) are N -vectors containing the first and second coordinates of the objects, respectively. (u)+ D D (b) Express the least squares placement problem as a least squares problem, with variK)). In other words, express the objective above (the sum n matrix BT y 2, able x = (u1:(N K), v1:(N of squares of the distances across edges) as A and m-vector b. You will find that m = 2L. Hint. Recall that where B is the incidence matrix of the graph. 2, for an appropriate m × (y) = Ax − D b − − (c) Solve the least squares placement problem for the specific problem with N = 10, K = 4, L = 13, fixed locations p7 = (0, 0), p8 = (0, 1), p8 = (1, 1), p10 = (1, 0), and edges (1, 3), (1, 4), (1, 7), (2, 3), (2, 5), (2, 8), (2, 9), (3, 4), (3, 5), (4, 6), (5, 6), (6, 9), (6, 10). Plot the locations, showing the graph edges as lines connecting the locations. 12.13 Iterative method for least squares problem. Suppose that A has linearly independent 2. columns, so ˆx = A†b minimizes In this exercise we explore an iterative method, due to the mathematician Lewis Richardson, that can be used to compute ˆx. We define x(1) = 0 and for k = 1, 2, . . ., Ax − b x(k+1) = x(k) µAT (Ax(k) b), − − A 2, for example, always works. The iteration is terminated when AT (Ax(k) where µ is a positive parameter, and the superscripts denote the iteration number. This defines a sequence of vectors that converge to ˆx provided µ is not too large; the choice µ = 1/ b) is small enough, which means the least squares optimality conditions are almost satisfied. To implement the method we only need to multiply vectors by A and by AT . If we have efficient methods for carrying out these two matrix-vector multiplications, this iterative method can be faster than algorithm 12.1 (although it does not give the exact solution). Iterative methods are often used for very large scale least squares problems. − (a) Show that if x(k+1) = x(k), we have x(k) = ˆx. (b) Express the vector sequence x(k) as a linear dynamical system with constant dy- namics matrix and offset, i.e., in the form x(k+1) = F x(k) + g. (c) Generate a random 20 10 matrix A and 20-vector b, and compute ˆx = A†b. Run the Richardson algorithm with µ = 1/ to verify that x(k) appears to be converging to ˆx. A 2 for 500 iterations, and plot x(k) ˆx − × 242 12 Least squares 12.14 Recursive least squares. In some applications of least squares the rows of the coefficient matrix A become available (or are added) sequentially, and we wish to solve the resulting family of growing least squares problems. Define the k n matrices and k-vectors  A(k) =   aT 1 ... aT k  = A1:k,1:n, b(k) =  ×    = b1:k, b1 ... bk for k = 1, . . . , m. We wish to compute ˆx(k) = A(k) †b(k), for k = n, n + 1, . . . , m. We will assume that the columns of A(n) are linearly independent, which implies that the columns of A(k) are linearly independent for k = n, . . . , m. We will also assume that m is much larger than n. The na¨ıve method for computing x(k) requires 2kn2 flops, so the total cost for k = n, . . . , m is m k=n 2kn2 = m k=n k (2n2) = m2 − n2 + m + n 2 (2n2) ≈ m2n2 flops. A simple trick allows us to compute x(k) for k = n . . . , m much more efficiently, with a cost that grows linearly with m. The trick also requires memory storage order n2, which does not depend on m. for k = 1, . . . , m, define G(k) = (A(k))T A(k), h(k) = (A(k))T b(k). 1h(k) for k = n, . . . , m. Hint. See (12.8). (a) Show that ˆx(k) = (G(k))− (b) Show that G(k+1) = G(k) + akaT (c) Recursive least squares is the following algorithm. For k = n, . . . , m, compute G(k+1) and h(k+1) using (b); then compute ˆx(k) using (a). Work out the total flop count for this method, keeping only dominant terms. (You can include the cost of computing G(n) and h(n), which should be negligible in the total.) Compare to the flop count for the na¨ıve method. k and h(k+1) = h(k) + bkak, for k = 1, . . . , m 1. − Remark. A further trick called the matrix inversion lemma (which is beyond the scope of this book) can be used to reduce the complexity of recursive least squares to order mn2. 12.15 Minimizing a squared norm plus an affine function. A generalization of the least squares problem (12.1) adds an affine function to the least squares objective, minimize Ax b 2 + cT x + d, − where the n-vector x is the variable to be chosen, and the (given) data are the m n matrix A, the m-vector b, the n-vector c, and the number d. We will use the same assumption we use in least squares: The columns of A are linearly independent. This generalized problem can be solved by reducing it to a standard least squares problem, using a trick called completing the square. Show that the objective of the problem above can be expressed in the form × Ax b 2 + cT x + d = − Ax − b + f 2 + g, for some m-vector f and some constant g. It follows that we can solve the generalized least squares problem by minimizing , an ordinary least squares problem with solution ˆx = A†(b 2 and Hints. Express the norm squared term on the right-hand side as expand it. Then argue that the equality above holds provided 2AT f = c. One possible choice is f = (1/2)(A†)T c. (You must justify these statements.) b) + f (Ax Ax f ). f ) (b − − − − Exercises 243 × 12.16 Gram method for computing least squares approximate solution. Algorithm 12.1 uses the QR factorization to compute the least squares approximate solution ˆx = A†b, where the n matrix A has linearly independent columns. It has a complexity of 2mn2 flops. In m this exercise we consider an alternative method: First, form the Gram matrix G = AT A and the vector h = AT b; and then compute ˆx = G− 1h (using algorithm 11.2). What is the complexity of this method? Compare it to algorithm 12.1. Remark. You might find that the Gram algorithm appears to be a bit faster than the QR method, but the factor is not large enough to have any practical significance. The idea is useful in situations where G is partially available and can be computed more efficiently than by multiplying A and its transpose. An example is exercise 13.21. Chapter 13 Least squares data fitting In this chapter we introduce one of the most important applications of least squares methods, to the problem of data fitting. The goal is to find a mathematical model, or an approximate model, of some relation, given some observed data. 13.1 Least squares data fitting Least squares is widely used as a method to construct a mathematical model from some data, experiments, or observations. Suppose we have an n-vector x, and a scalar y, and we believe that they are related, perhaps approximately, by some function f : Rn R: → f (x). y ≈ The vector x might represent a set of n feature values, and is called the feature vector or the vector of independent variables, depending on the context. The scalar y represents some outcome (also called response variable) that we are interested in. Or x might represent the previous n values of a time series, and y represents the next value. Data. We don’t know f , although we might have some idea about its general form. But we do have some data, given by x(1), . . . , x(N ), y(1), . . . , y(N ), where the n-vector x(i) is the feature vector and the scalar y(i) is the associated value of the outcome for data sample i. We sometimes refer to the pair x(i), y(i) as the ith data pair. These data are also called observations, examples, samples, or measurements, depending on the context. Here we use the superscript (i) to denote the ith data point: x(i) is an n-vector, the ith independent variable; the number x(i) j is the value of jth feature for example i. 246 13 Least squares data fitting Model. We will form a model of the relationship between x and y, given by ˆf (x), y ≈ → where ˆf : Rn R. We write ˆy = ˆf (x), where ˆy is the (scalar) prediction (of the outcome y), given the independent variable (vector) x. The hat appearing over f is traditional notation that suggests that the function ˆf is an approximation of the function f . The function ˆf is called the model, prediction function, or predictor. For a specific value of the feature vector x, ˆy = ˆf (x) is the prediction of the outcome. Linear in the parameters
model. We will focus on a specific form for the model, which has the form ˆf (x) = θ1f1(x) + + θpfp(x), · · · → where fi : Rn R are basis functions or feature mappings that we choose, and θi are the model parameters that we choose. This form of model is called linear in the parameters, since for each x, ˆf (x) is a linear function of the model parameter p-vector θ. The basis functions are usually chosen based on our idea of what f looks like. (We will see many examples of this below.) Once the basis functions have been chosen, there is the question of how to choose the model parameters, given our set of data. Prediction error. Our goal is to choose the model ˆf so that it is consistent with ˆf (x(i)), for i = 1, . . . , N . (There is another goal in the data, i.e., we have y(i) choosing ˆf , that we will discuss in 13.2.) For data sample i, our model predicts the value ˆy(i) = ˆf (x(i)), so the prediction error or residual for this data point is ≈ § (Some authors define the prediction error in the opposite way, as ˆy(i) − will see that this does not affect the methods developed in this chapter.) r(i) = y(i) ˆy(i). − y(i). We Vector notation for outcomes, predictions, and residuals. For our data set and model, we have the observed response y(i), the prediction ˆy(i), and the residual or prediction error r(i), for each example i = 1, . . . , N . We will now use vector notation to express these as N -vectors, yd = (y(1), . . . , y(N )), ˆyd = (ˆy(1), . . . , ˆy(N )), rd = (r(1), . . . , r(N )), (In the notation used above to describe the approximate relation respectively. f (x), and the prediction function between the feature vector and the outcome, y ˆy = ˆf (x), the symbols y and ˆy refer to generic scalar values. With the superscript d (for ‘data’), yd, ˆyd, and rd refer to the N -vectors of observed data values, predicted values, and associated residuals.) ≈ − Using this vector notation we can express the (vector of) residuals as rd = yd ˆyd. A natural measure of how well the model predicts the observed data, or how consistent it is with the observed data, is the RMS prediction error rms(rd). The ratio rms(rd)/ rms(yd) gives a relative prediction error. For example, if the relative prediction error is 0.1, we might say that the model predicts the outcomes, or fits the data, within 10%. 13.1 Least squares data fitting 247 Least squares model fitting. A very common method for choosing the model parameters θ1, . . . , θp is to minimize the RMS prediction error on the given data set, which is the same as minimizing the sum of squares of the prediction errors, rd 2. We now show that this is a least squares problem. Expressing ˆy(i) = ˆf (x(i)) in terms of the model parameters, we have ˆy(i) = Ai1θ1 + · · · + Aipθp, i = 1, . . . , N, where we define the N p matrix A as × Aij = ˆfj(x(i)), i = 1, . . . , N, j = 1, . . . , p, (13.1) and the p-vector θ as θ = (θ1, . . . , θp). The jth column of A is the jth basis function, evaluated at each of the data points x(1), . . . , x(N ). Its ith row gives the values of the p basis functions on the ith data point x(i). In matrix-vector notation we have ˆyd = Aθ. This simple equation shows how our choice of model parameters maps into the vector of predicted values of the outcomes in the N different experiments. We know the matrix A from the given data points, and choice of basis functions; our goal is to choose the p-vector of model coefficients θ. The sum of squares of the residuals is then 2 = rd yd ˆyd 2 = yd − Aθ 2 = Aθ yd 2. − − (In the last step we use the fact that the norm of a vector is the same as the norm of its negative.) Choosing θ to minimize this is evidently a least squares problem, of the same form as (12.1). Provided the columns of A are linearly independent, we can solve this least squares problem to find ˆθ, the model parameter values that minimize the norm of the prediction error on our data set, as (13.2) We say that the model parameter values ˆθ are obtained by least squares fitting on the data set. 1AT yd = A†yd. ˆθ = (AT A)− yd We can interpret each term in 2. The term ˆyd = Aθ is the N -vector Aθ of measurements or outcomes that is predicted by our model, with the parameter vector θ. The term yd is the N -vector of actual observed or measured outcomes. The difference yd 2 is the sum of squares of the prediction errors, also called the residual sum of squares (RSS). This is minimized by the least squares fit θ = ˆθ. Aθ is the N -vector of prediction errors. Finally, Aθ yd − − − yd yd The number Aˆθ 2 is called the minimum sum square error (for the given − Aˆθ 2/N is called the minimum model basis and data set). The number mean square error (MMSE) (of our model, on the data set). Its squareroot is the minimum RMS fitting error. The model performance on the data set can be visualized by plotting ˆy(i) versus y(i) on a scatter plot, with a dashed line showing ˆy = y for reference. Aθ − obtained when the residual or prediction error is defined as ˆyd definition) yd RMS fitting error also agree using this alternate definition of prediction error. 2, the same least squares model parameter is yd instead of (our ˆyd. The residual sum of squares, minimum mean square error, and 2 = Aθ Since yd yd − − − − 248 13 Least squares data fitting Some notation differences from chapter 12. Before proceeding we note some differences in the meanings of symbols used in chapter 12 (on least squares) and in this chapter on data fitting, that the reader will need to keep in mind. In chapter 12, the symbol x denotes a generic variable, the vector that we would like to find, and b refers to the so-called right-hand side, the vector we seek to approximate. In this chapter, in the context of fitting a model to data, the symbol x generically refers to a feature vector; we want to find θ, the vector of coefficients in our model, and the vector we seek to approximate is yd, a vector of (observed) data outcomes. When we use least squares in this chapter, we will need to transcribe the results or formulas from chapter 12 to the current context, as in the formula (13.2). Least squares fit with a constant. We start with the simplest possible fit: We take p = 1, with f1(x) = 1 for all x. In this case the model ˆf is a constant function, with ˆf (x) = θ1 for all x. Least squares fitting in this case is the same as choosing the best constant value θ1 to approximate the data y(1), . . . , y(N ). In this simple case, the matrix A in (13.1) is the N 1 matrix 1, which always has linearly independent columns (since it has one column, which is nonzero). The formula (13.2) is then × ˆθ1 = (AT A)− 1AT yd = N − 11T yd = avg(yd), where we use 1T 1 = N . So the best constant fit to the data is simply its mean, ˆf (x) = avg(yd). The RMS fit to the data (i.e., the RMS value of the optimal residual) is rms(yd − avg(yd)1) = std(yd), the standard deviation of the data. This gives a nice interpretation of the average value and the standard deviation of the outcomes, as the best constant fit and the associated RMS error, respectively. It is common to compare the RMS fitting error for a more sophisticated model with the standard deviation of the outcomes, which is the optimal RMS fitting error for a constant model. A simple example of a constant fit is shown in figure 13.1. In this example we have n = 1, so the data points x(i) are scalars. The green circles in the left-hand plot show the data points; the blue line shows the prediction function ˆf (x) (which has constant value). The right-hand plot shows a scatter plot of the data outcomes y(i) versus the predicted values ˆy(i) (all of which are the same), with a dashed line showing y = ˆy. Independent column assumption. To use least squares fitting we assume that the columns of the matrix A in (13.1) are linearly independent. We can give an interesting interpretation of what it means when this assumption fails. If the columns of A are linearly dependent, it means that one of the columns can be expressed as a linear combination of the others. Suppose, for example, that the last column can be expressed as a linear combination of the first p 1 columns. Using Aij = fj(x(i)), this means − fp(x(i)) = β1f1(x(i)) + + βp 1fp − − · · · 1(x(i)), i = 1, . . . , N. 13.1 Least squares data fitting 249 Figure 13.1 The constant fit ˆf (x) = avg(yd) to N = 20 data points and a scatter plot of ˆy(i) versus y(i). This says that the value of the pth basis function can be expressed as a linear 1 basis functions on the given data set. combination of the values of the first p Evidently, then, the pth basis function is redundant (on the given data set). − 13.1.1 Fitting univariate functions Suppose that n = 1, so the feature vector x is a scalar (as is the outcome y). The relationship y f (x) says that y is approximately a (univariate) function f of x. We can plot the data (x(i), y(i)) as points in the (x, y) plane, and we can plot the model ˆf as a curve in the (x, y)-plane. This allows us to visualize the fit of our model to the data. ≈ Straight-line fit. We take basis functions f1(x) = 1 and f2(x) = x. Our model has the form ˆf (x) = θ1 + θ2x, which is a straight line when plotted. (This is perhaps why ˆf is sometimes called a linear model, even though it is in general an affine, and not linear, function of x.) Figure 13.2 shows an example. The matrix A in (13.1) is given by A =      x(1) 1 x(2) 1 ... ... 1 x(N )      = 1 xd , where in the right-hand side we use xd to denote the N -vector of values xd = (x(1), . . . , x(N )). Provided that there are at least two different values appearing in 00.20.40.60.8100.20.40.60.81xˆf(x)00.20.40.60.8100.20.40.60.81y(i)ˆy(i)=avg(yd) 250 13 Least squares data fitting Figure 13.2 Straight-line fit to 50 points (x(i), y(i)) in a plane. x(1), . . . , x(N ), this matrix has linearly independent columns. The parameters in the optimal straight-line fit to the data are given by θ1 θ2 = (AT A)− 1AT yd. This expression is simple enough for us to work it out explicitly, although there is no co
mputational advantage to doing so. The Gram matrix is The 2-vector AT yd is AT A = N 1T xd 1T xd (xd)T xd . AT y = 1T yd (xd)T yd , so we have (using the formula for the inverse of a 2 ˆθ1 ˆθ2 = 1 N (xd)T xd − (1T xd)2 (xd)T xd 1T xd − 2 matrix) × 1T xd N − 1T yd (xd)T yd . Multiplying the scalar term by N 2, and dividing the matrix and vector terms by N , we can express this as ˆθ1 ˆθ2 = rms(xd)2 1 − avg(xd)2 rms(xd)2 avg(xd) − avg(xd) 1 − avg(yd) (xd)T yd/N . The optimal slope ˆθ2 of the straight line fit can be expressed more simply in terms of the correlation coefficient ρ between the data vectors xd and yd, and their standard xˆf(x) 13.1 Least squares data fitting 251 deviations. We have ˆθ2 = = = N (xd)T yd − N (xd)T xd (1T xd)(1T yd) (1T xd)2 − avg(xd)1)T (yd avg(yd)1) 2 − avg(xd)1 (xd − std(yd) std(xd) − xd ρ. In the last step we used the definitions (xd − ρ = avg(xd)1)T (yd avg(yd)1) N std(xd) std(yd) − , std(xd) = xd − avg(xd)1 √N from chapter 3. From the first of the two normal equations, N θ1+(1T xd)θ2 = 1T yd, we also obtain a simple expression for ˆθ1: Putting these results together, we can write the least squares fit as ˆθ1 = avg(yd) ˆθ2 avg(xd). − ˆf (x) = avg(yd) + ρ std(yd) std(xd) (x − avg(xd)). (13.3) (Note that x and y are generic scalar values, while xd and yd are vectors of the observed data values.) When std(yd) = 0, this can be expressed in the more symmetric form ˆy avg(yd) − std(yd) = ρ x avg(xd) − std(xd) , which has a nice interpretation. The left-hand side is the difference between the predicted response value and the mean response value, divided by its standard deviation. The right-hand side is the correlation coefficient ρ times the same quantity, computed for the dependent variable. The least squares straight-line fit is used in many application areas. Asset α and β in finance. In finance, the straight-line fit is used to predict the return of an individual asset from the return of the whole market. (The return of the whole market is typically taken to be a sum of the individual asset returns, weighted by their capitalizations.) The straight-line model ˆf (x) = θ1 +θ2x predicts the asset return from the market return x. The least squares straight-line fit is computed from observed market returns rmkt and individual asset returns 1 , . . . , rind rind over some period of length T . We therefore take , . . . , rmkt T 1 T xd = (rmkt 1 , . . . , rmkt T ), yd = (rind 1 , . . . , rind T ) in (13.3). The model is typically written in the form ˆf (x) = (rrf + α) + β(x µmkt), − 252 13 Least squares data fitting is the risk-free interest rate over the period and µmkt = avg(xd) is where rrf the average market return. Comparing this formula to the straight-line model ˆf (x) = θ1 + θ2x, we find that θ2 = β, and θ1 = rrf + α βµmkt. The prediction of asset return ˆf (x) has two components: A constant rrf +α, and µmkt). The one that is proportional to the de-meaned market performance, β(x second component, which has average value zero, relates market return fluctuations to the asset return fluctuations, and is related to the correlation of the asset and market returns; see exercise 13.4. The parameter α is the average asset return, over and above the risk-free interest rate. This model of asset return in terms of the market return is so common that the terms ‘Alpha’ and ‘Beta’ are widely used in finance. (Though not always with exactly the same meaning, since there are a few variations on how the parameters are defined.) − − Time series trend. Suppose the data represents a series of samples of a quantity y at time (epoch) x(i) = i. The straight-line fit to the time series data, ˆy(i) = θ1 + θ2i, i = 1, . . . , N, is called the trend line. Its slope, which is θ2, is interpreted as the trend in the quantity over time. Subtracting the trend line from the original time series we get the de-trended time series, yd ˆyd. The de-trended time series shows how the time series compares with its straight-line fit: When it is positive, it means the time series is above its straight-line fit, and when it is negative, it is below the straight-line fit. − An example is shown in figures 13.3 and 13.4. Figure 13.3 shows world petroleum consumption versus year, along with the straight-line fit. Figure 13.4 shows the de-trended world petroleum consumption. Estimation of trend and seasonal component. In the previous example, we used least squares to approximate a time series yd = (y(1), . . . , y(N )) of length N by a sum of two components: yd ˆyd = ˆyconst + ˆylin where ≈ ˆyconst = θ11, ˆylin = θ2      .      1 2 ... N In many applications, the de-trended time series has a clear periodic component, i.e., a component that repeats itself periodically. As an example, figure 13.5 shows an estimate of the road traffic (total number of miles traveled in vehicles) in the US, for each month between January 2000 and December 2014. The most striking aspect of the time series is the pattern that is (approximately) repeated every year, with a peak in the summer and a minimum in the winter. In addition there is a slowly increasing long term trend. The bottom figure shows the least squares fit of a sum of two components yd ≈ ˆyd = ˆylin + ˆyseas, 13.1 Least squares data fitting 253 Figure 13.3 World petroleum consumption between 1980 and 2013 (dots) and least squares straight-line fit (data from www.eia.gov). Figure 13.4 De-trended world petroleum consumption. 198019851990199520002005201060708090YearPetroleumconsumption(millionbarrelsperday)1980198519901995200020052010−20246YearPetroleumconsumption(millionbarrelsperday) 254 13 Least squares data fitting Figure 13.5 Top. Vehicle miles traveled in the US, per month, in the period January 2000 – December 2014 (U.S. Department of Transportation, Bureau of Transportation Statistics, www.transtats.bts.gov). Bottom. Least squares fit of a sum of two time series: A linear trend and a seasonal component with a 12-month period. Jan.200020012002200320042005200620072008200920102011201220132014201522.22.42.6·105MonthMiles(millions)Jan.200020012002200320042005200620072008200920102011201220132014201522.22.42.6·105MonthMiles(millions) 13.1 Least squares data fitting 255 where ˆylin and ˆyseas are defined as ˆylin = θ1      ,      1 2 ... N ˆyseas =      θ2:(P +1) θ2:(P +1) ... θ2:(P +1)      . The second component is periodic or seasonal, with period P = 12, and consists of the pattern (θ2, . . . , θP +1), repeated N/P times (we assume N is a multiple of P ). The constant term is omitted in the model because it would be redundant: It has the same effect as adding a constant to the parameters θ2, . . . , θP +1. The least squares fit is computed by minimizing vector and the matrix A in (13.1) is given by Aθ − yd 2 where θ is a (P +1)- ... P P + 1 P + 2 ... 2P ... P + 1 P + 2 ... N − − N N 1 0 ... 0 1 0 ... 0 ... 1 0 ... 0 0 1 ... 0 0 1 ... 0 ... 0 1 ... ... 1 0 0 ... 1 ... 0 0 ... 1 · · · · · · . . . · · · · · · · · · . . . · · · · · · · · · . . . · · · In this example, N = 15P = 180. The residual or prediction error in this case is called the de-trended, seasonally-adjusted series. Polynomial fit. A simple extension beyond the straight-line fit is a polynomial fit, with 1, so ˆf is a polynomial of degree at most p fi(x) = xi − 1, i = 1, . . . , p, − ˆf (x) = θ1 + θ2x + + θpxp 1. − · · · (Note that here, xi means the generic scalar value x raised to the ith power; x(i) means the ith observed scalar data value.) In this case the matrix A in (13.1) has the form  A =     x(1) 1 x(2) 1 ... ... 1 x(x(1))p (x(2))p ... (x(N ))p 1 − · · · · · · · · · 256 13 Least squares data fitting Figure 13.6 Least squares polynomial fits of degree 2, 6, 10, and 15 to 100 points. i.e., it is a Vandermonde matrix (see (6.7)). Its columns are linearly independent provided the numbers x(1), . . . , x(N ) include at least p different values. Figure 13.6 shows an example of the least squares fit of polynomials of degree 2, 6, 10, and 15 to a set of 100 data points. Since any polynomial of degree less than r is also a polynomial of degree less than s, for r s, it follows that the RMS fit attained ≤ by a polynomial with a larger degree is smaller (or at least, no larger) than that obtained by a fit with a smaller degree polynomial. This suggests that we should use the largest degree polynomial that we can, since this results in the smallest residual and the best RMS fit. But we will see in 13.2 that this is not true, and explore rational methods for choosing a model from among several candidates. § Piecewise-linear fit. A piecewise-linear function, with knot points or kink points < ak, is a continuous function that is affine in between the knot a1 < a2 < points. (Such functions should be called piecewise-affine.) We can describe any · · · xˆf(x)Degree2xˆf(x)Degree6xˆf(x)Degree10xˆf(x)Degree15 13.1 Least squares data fitting 257 Figure 13.7 The piecewise-linear functions (x + 1)+ = max (x 1)+ = max 1, 0 x . x + 1, 0 } { and − { − } piecewise-linear function with k knot points using the p = k + 2 basis functions f1(x) = 1, f2(x) = x, fi+2(x) = (x ai)+, i = 1, . . . , k, − where (u)+ = max { knot points at a1 = knot points is shown in figure 13.8. − . These basis functions are shown in figure 13.7 for k = 2 u, 0 } 1, a2 = 1. An example of a piecewise-linear fit with these 13.1.2 Regression We now return to the general case when x is an n-vector. Recall that the regression model has the form ˆy = xT β + v, where β is the weight vector and v is the offset. We can put this model in our general data fitting form using the basis functions f1(x) = 1, and fi(x) = xi 1, − i = 2, . . . , n + 1, so p = n + 1. The regression model can then be expressed as ˆy = xT θ2:(n+1) + θ1, and we see that β = θ2:n+1 and v = θ1. The N × (n + 1) matrix A in our general data fitting form is given by A = 1 X T , where X is the feature matrix with columns x(1), . . . , x(N ). So the regression model is a special case of our general linear in the parameters model. −3−1130123x(x+1