1 00:00:06,150 --> 00:00:07,720 NIKOLA KAMBUROV: Hi, guys. 2 00:00:07,720 --> 00:00:10,320 Today we're going to see how one can 3 00:00:10,320 --> 00:00:14,620 use linear algebra to describe graphs and networks. 4 00:00:14,620 --> 00:00:17,260 In particular, we'll do the following problem. 5 00:00:17,260 --> 00:00:20,550 We're given this very simple graph here 6 00:00:20,550 --> 00:00:23,270 with five nodes and six edges. 7 00:00:23,270 --> 00:00:25,410 We've already labeled them, and we've 8 00:00:25,410 --> 00:00:27,620 put directions on the edges. 9 00:00:27,620 --> 00:00:31,840 And we are asked to write down the incidence matrix A, 10 00:00:31,840 --> 00:00:36,340 and then to compute its kernel and the kernel of A transpose. 11 00:00:36,340 --> 00:00:38,010 And finally, we're asked to compute 12 00:00:38,010 --> 00:00:39,860 the trace of A transpose A. 13 00:00:39,860 --> 00:00:44,700 I'll give you a few moments to try the problem on your own. 14 00:00:44,700 --> 00:00:46,550 And then you'll see my take on it. 15 00:00:53,740 --> 00:00:55,060 Hello again. 16 00:00:55,060 --> 00:00:59,520 OK, so let's first recall what an incidence matrix is. 17 00:00:59,520 --> 00:01:00,975 So an incidence matrix is supposed 18 00:01:00,975 --> 00:01:05,580 to encode how the nodes connect to the edges. 19 00:01:05,580 --> 00:01:08,710 In particular, it has as many rows 20 00:01:08,710 --> 00:01:13,030 as there are edges and as many columns as there are nodes. 21 00:01:13,030 --> 00:01:19,120 And we're going to fill in the rows. 22 00:01:19,120 --> 00:01:22,270 And we'll fill them out as follows. 23 00:01:22,270 --> 00:01:27,340 So we're going to use only negative 1, 1, and 0. 24 00:01:27,340 --> 00:01:34,070 And we're going to put a negative 1 in entry i and 1 25 00:01:34,070 --> 00:01:42,420 in entry j if the corresponding edge connects node i to node j. 26 00:01:42,420 --> 00:01:44,440 OK, let me just do it concretely. 27 00:01:44,440 --> 00:01:48,160 So let's look at edge number 1. 28 00:01:48,160 --> 00:01:50,850 So it corresponds to the first row. 29 00:01:50,850 --> 00:01:52,560 It connects 1 to 2. 30 00:01:52,560 --> 00:01:58,040 So we have a negative 1 and a 1. 31 00:01:58,040 --> 00:02:06,910 Then edge number 2, it connects node 2 to 3, so negative 1, 1. 32 00:02:06,910 --> 00:02:13,150 Edge number 3 connects node 1 to 3, so negative 1, 1. 33 00:02:13,150 --> 00:02:15,350 And I believe you get the picture, right? 34 00:02:15,350 --> 00:02:19,104 So I'm just going to fill out the rest of the entries. 35 00:02:19,104 --> 00:02:27,450 All right, 4 is: negative 1, to 1. 36 00:02:27,450 --> 00:02:35,980 5 is: well, 4, well, negative 1, 1 here. 37 00:02:35,980 --> 00:02:45,240 And 6 is: negative 1 and 1. 38 00:02:45,240 --> 00:02:46,090 OK. 39 00:02:46,090 --> 00:02:50,660 So we've constructed the matrix A. Now, 40 00:02:50,660 --> 00:02:53,700 we'll compute its null space. 41 00:02:53,700 --> 00:02:56,750 And we're going to do it without performing any row 42 00:02:56,750 --> 00:02:59,260 operations whatsoever. 43 00:02:59,260 --> 00:03:04,620 So in order to do this, it's helpful to look 44 00:03:04,620 --> 00:03:07,670 at the graph as an electric circuit 45 00:03:07,670 --> 00:03:14,310 and to assign to each of the nodes an electric potential. 46 00:03:14,310 --> 00:03:18,380 If we collect all the electric potentials 47 00:03:18,380 --> 00:03:28,660 in a vector x, then A times x is a vector with as many entries 48 00:03:28,660 --> 00:03:33,170 as there are edges and gives precisely 49 00:03:33,170 --> 00:03:39,080 the potential differences across the edges of the graph. 50 00:03:39,080 --> 00:03:45,930 OK, so then if A*x is to be 0, this means that across 51 00:03:45,930 --> 00:03:49,920 the graph, across all the edges of the graph, 52 00:03:49,920 --> 00:03:53,740 all potential differences are 0. 53 00:03:53,740 --> 00:04:02,700 Therefore, all the potentials at all the nodes 54 00:04:02,700 --> 00:04:05,000 need to be equal to a constant number. 55 00:04:05,000 --> 00:04:14,690 So therefore, we conclude that the null space of A 56 00:04:14,690 --> 00:04:22,980 is spanned by constant 1. 57 00:04:22,980 --> 00:04:24,260 OK? 58 00:04:24,260 --> 00:04:27,320 There are five 1's here, corresponding 59 00:04:27,320 --> 00:04:29,820 to the five nodes. 60 00:04:29,820 --> 00:04:33,405 Now what about the null space of A transpose? 61 00:04:36,120 --> 00:04:40,250 Adopt this analogy with electric circuits. 62 00:04:40,250 --> 00:04:44,930 But this time, we're going to look at currents flowing 63 00:04:44,930 --> 00:04:46,705 across the edges of the graph. 64 00:04:49,830 --> 00:04:52,320 Oh, and we are going to adopt the following convention 65 00:04:52,320 --> 00:04:53,270 for the currents. 66 00:04:53,270 --> 00:04:59,330 So a current is going to be positive 67 00:04:59,330 --> 00:05:03,295 if it flows in the direction of the edge and negative 68 00:05:03,295 --> 00:05:05,950 if it flows in the opposite direction. 69 00:05:05,950 --> 00:05:06,620 Right. 70 00:05:06,620 --> 00:05:13,820 So then, what is A transpose y, where 71 00:05:13,820 --> 00:05:24,460 y is a vector, each of whose entries is a current 72 00:05:24,460 --> 00:05:25,690 on the edge? 73 00:05:25,690 --> 00:05:30,945 Well, the entries of A transpose y 74 00:05:30,945 --> 00:05:36,530 are precisely equal to the total current flowing through each 75 00:05:36,530 --> 00:05:38,270 of the nodes of the graph. 76 00:05:38,270 --> 00:05:41,690 So A transpose y being equal to 0 77 00:05:41,690 --> 00:05:45,020 means that there is a balance in the circuit, 78 00:05:45,020 --> 00:05:49,560 that the currents that flow into each node 79 00:05:49,560 --> 00:05:54,210 equal the currents that flow out of it. 80 00:05:54,210 --> 00:05:56,190 Right. 81 00:05:56,190 --> 00:06:00,520 And it's fairly easy to find such a configuration 82 00:06:00,520 --> 00:06:08,340 of currents that satisfies this balance equation. 83 00:06:08,340 --> 00:06:12,370 We do it by flowing around loops of the graph. 84 00:06:12,370 --> 00:06:19,830 So you see, this graph has three loops. 85 00:06:19,830 --> 00:06:26,800 The first one is this triangle up there. 86 00:06:26,800 --> 00:06:29,720 The second one is this square. 87 00:06:29,720 --> 00:06:35,330 And I'm just, by this curled direction, 88 00:06:35,330 --> 00:06:42,050 I'm signifying in which way I'm going to trace the loop. 89 00:06:42,050 --> 00:06:46,350 And there is third loop, is along 90 00:06:46,350 --> 00:06:49,340 the outer contour of the graph. 91 00:06:49,340 --> 00:06:53,780 But in fact, the third one can be 92 00:06:53,780 --> 00:06:57,850 thought of as a superposition of these two, 93 00:06:57,850 --> 00:07:02,630 and I'll explain why in a second. 94 00:07:02,630 --> 00:07:08,580 So let's figure out the configuration of currents 95 00:07:08,580 --> 00:07:10,990 that balances these loops. 96 00:07:10,990 --> 00:07:18,120 So if we flow a current 1 from 1 to 2 97 00:07:18,120 --> 00:07:24,940 and then flow a current of 1 along edge 2, from 2 to 3, 98 00:07:24,940 --> 00:07:28,580 and then we flow a current of negative 1, 99 00:07:28,580 --> 00:07:30,160 mind that the direction is opposite 100 00:07:30,160 --> 00:07:32,280 to the direction of the loop, then 101 00:07:32,280 --> 00:07:36,400 we're going to have a balanced configuration of currents. 102 00:07:36,400 --> 00:07:42,060 So let me write this down. 103 00:07:42,060 --> 00:07:52,430 The following configuration, so 1 along edge 1, 1 along edge 2, 104 00:07:52,430 --> 00:07:59,160 and negative 1 along edge 3, and the rest 0, 105 00:07:59,160 --> 00:08:01,060 is a solution to A transpose y. 106 00:08:03,770 --> 00:08:11,170 Let's see what solution we get by flowing around 107 00:08:11,170 --> 00:08:13,080 the loop in the square. 108 00:08:13,080 --> 00:08:23,170 Well, we flow a current of 1 along edge 4, 109 00:08:23,170 --> 00:08:27,820 current of 1 along edge 5, current of 1 along edge 6, 110 00:08:27,820 --> 00:08:30,980 and current of negative 1 along edge 2. 111 00:08:30,980 --> 00:08:33,929 So let's be careful. 112 00:08:33,929 --> 00:08:40,496 So it was 0, then along edge 2 was negative 1. 113 00:08:40,496 --> 00:08:46,920 Along 3: 0; along 4: 1; along 5: 1; along 6: 1. 114 00:08:49,610 --> 00:08:54,260 Now we can do the same thing with the big loop 115 00:08:54,260 --> 00:08:58,330 and produce a vector corresponding to it. 116 00:08:58,330 --> 00:09:01,770 And I prompt you to do it. 117 00:09:01,770 --> 00:09:06,110 But what you'll see is that the vector that you get 118 00:09:06,110 --> 00:09:10,350 is precisely a sum of these two vectors. 119 00:09:10,350 --> 00:09:12,880 In a way, the big loop is a superposition 120 00:09:12,880 --> 00:09:15,380 of the small loops. 121 00:09:15,380 --> 00:09:21,740 OK, so we figured out what the null space of A transpose is. 122 00:09:21,740 --> 00:09:24,680 And now, let's concentrate our attention 123 00:09:24,680 --> 00:09:28,950 on finding the trace of A transpose A. We're 124 00:09:28,950 --> 00:09:32,480 going to do it right here. 125 00:09:32,480 --> 00:09:38,240 So the trace of a matrix is the sum of its diagonal entries. 126 00:09:38,240 --> 00:09:44,690 And we've seen this many times already, 127 00:09:44,690 --> 00:09:50,550 that the diagonal entries of A transpose A 128 00:09:50,550 --> 00:09:56,730 are precisely the magnitudes squared of the columns of A. 129 00:09:56,730 --> 00:09:59,090 OK? 130 00:09:59,090 --> 00:10:03,870 So the (1, 1) entry is the magnitude 131 00:10:03,870 --> 00:10:05,490 squared of the first column. 132 00:10:05,490 --> 00:10:07,520 The (2, 2) entry is the magnitude 133 00:10:07,520 --> 00:10:10,460 squared of the second column, and so on. 134 00:10:10,460 --> 00:10:13,860 Now what is the magnitude squared 135 00:10:13,860 --> 00:10:17,040 of a column of an incidence matrix? 136 00:10:17,040 --> 00:10:26,940 Well, each entry in a column of an incidence matrix 137 00:10:26,940 --> 00:10:30,970 is either 1, negative 1, or 0. 138 00:10:30,970 --> 00:10:35,630 So when we square these entries, we get 1's or 0's. 139 00:10:35,630 --> 00:10:39,580 And when we add them up, we get precisely a number 140 00:10:39,580 --> 00:10:44,430 which is the nontrivial entries in that column. 141 00:10:44,430 --> 00:10:45,450 OK? 142 00:10:45,450 --> 00:10:47,770 So the magnitude squared of the column 143 00:10:47,770 --> 00:10:49,970 is the number of nontrivial entries in it. 144 00:10:49,970 --> 00:10:53,210 But if we go back to the matrix A, 145 00:10:53,210 --> 00:11:01,230 and we count the number of non-zero entries, 146 00:11:01,230 --> 00:11:07,220 this is precisely the number of edges that connect with a node. 147 00:11:07,220 --> 00:11:11,440 OK, so the number of edges that connects with each node 148 00:11:11,440 --> 00:11:14,580 is called the degree of the node. 149 00:11:14,580 --> 00:11:20,440 In this way, trace of A transpose A 150 00:11:20,440 --> 00:11:25,440 will be just the sum of the degrees 151 00:11:25,440 --> 00:11:28,600 of the graph in the picture. 152 00:11:28,600 --> 00:11:37,410 So we have there are 2 edges connecting to 1, so 2, 153 00:11:37,410 --> 00:11:48,940 plus 3 edges connecting to 2, 3 edges connecting to 3. 154 00:11:48,940 --> 00:11:54,560 And we've got a 2 for the number of edges connecting to 4, 155 00:11:54,560 --> 00:11:57,040 and 2 for the number of edges connecting to 5. 156 00:11:57,040 --> 00:12:01,625 So altogether, we get 12. 157 00:12:04,600 --> 00:12:12,440 So you see, in this problem, we computed certain linear algebra 158 00:12:12,440 --> 00:12:17,980 objects without performing the usual algebraic operations, 159 00:12:17,980 --> 00:12:22,360 but just by looking at the graph and seeing 160 00:12:22,360 --> 00:12:25,520 how the linear algebra is encoded in it. 161 00:12:25,520 --> 00:12:28,260 I hope it was most illuminating. 162 00:12:28,260 --> 00:12:30,092 I'll see you next time.