1 00:00:00,000 --> 00:00:01,960 2 00:00:01,960 --> 00:00:05,700 Let's try to get our heads around the idea of divergence. 3 00:00:05,700 --> 00:00:07,890 So first, like I did with gradients, I'll show you the 4 00:00:07,889 --> 00:00:10,050 mechanics, which are actually pretty straightforward. 5 00:00:10,050 --> 00:00:12,280 And then I'll try to give you the intuition. 6 00:00:12,279 --> 00:00:14,035 And once you have the intuition, at first it 7 00:00:14,035 --> 00:00:16,820 will seemed very, I don't know, unintuitive, maybe. 8 00:00:16,820 --> 00:00:18,609 But it once you get it, you're like oh, that's it. 9 00:00:18,609 --> 00:00:21,379 So let's see what divergence is. 10 00:00:21,379 --> 00:00:24,869 Let's say I have a vector field. 11 00:00:24,870 --> 00:00:26,920 And let's say this vector field, just for the purposes 12 00:00:26,920 --> 00:00:29,320 of visualization it could be anything, but let's say it 13 00:00:29,320 --> 00:00:34,130 represents the velocity of particles of fluid of any 14 00:00:34,130 --> 00:00:36,650 point in two dimensions. 15 00:00:36,649 --> 00:00:39,689 So it's going to be a two-dimensional vector field. 16 00:00:39,689 --> 00:00:44,859 It's going to be a function of x and y, so the velocity at any 17 00:00:44,859 --> 00:00:50,140 point-- it's a vector field -- let's say it is, and I'm just 18 00:00:50,140 --> 00:00:51,880 going to make up something. 19 00:00:51,880 --> 00:00:57,670 Let's say it's x squared, yi. 20 00:00:57,670 --> 00:01:00,760 21 00:01:00,759 --> 00:01:03,710 So at any point in the x-direction, at any point x 22 00:01:03,710 --> 00:01:06,730 comma y, its velocity in the x-direction will 23 00:01:06,730 --> 00:01:07,859 be x squared, y. 24 00:01:07,859 --> 00:01:11,230 And then its velocity in the y-direction, I don't know 25 00:01:11,230 --> 00:01:14,079 maybe it's just 3y, j. 26 00:01:14,079 --> 00:01:17,920 27 00:01:17,920 --> 00:01:19,239 That's its velocity in the x-direction. 28 00:01:19,239 --> 00:01:20,309 So its velocity in the x-direction is actually 29 00:01:20,310 --> 00:01:21,680 a function of x and y. 30 00:01:21,680 --> 00:01:26,475 its velocity in the y-direction is just a function of y. 31 00:01:26,474 --> 00:01:29,030 So what is the divergence? 32 00:01:29,030 --> 00:01:31,090 So a couple of ways we can write it. 33 00:01:31,090 --> 00:01:35,560 The correct way to write it is the divergence of 34 00:01:35,560 --> 00:01:38,170 our vector field, v. 35 00:01:38,170 --> 00:01:42,609 But a common mnemonic to remember the operation of 36 00:01:42,609 --> 00:01:48,819 diverge and is to write the upside down triangle, which was 37 00:01:48,819 --> 00:01:52,269 the same notation we used for gradient, but take the dot 38 00:01:52,269 --> 00:01:55,629 product of that and the vector. 39 00:01:55,629 --> 00:01:59,979 And if you remember from the gradient discussion, we said 40 00:01:59,980 --> 00:02:04,240 that you can view, although it's kind of an abuse of 41 00:02:04,239 --> 00:02:09,439 notation, but you could view this upside down triangle as 42 00:02:09,439 --> 00:02:16,069 being equal to the partial derivative with respect to x in 43 00:02:16,069 --> 00:02:20,329 the x-direction plus the partial derivative with respect 44 00:02:20,330 --> 00:02:25,320 to y in the y-direction, which is the j-unit vector. 45 00:02:25,319 --> 00:02:27,180 And then if we went to three dimensions, the partial 46 00:02:27,180 --> 00:02:29,170 derivative with respect to z and the k-direction, 47 00:02:29,169 --> 00:02:29,869 et cetera, et cetera. 48 00:02:29,870 --> 00:02:32,590 But we're dealing with a two-dimensional vector here, 49 00:02:32,590 --> 00:02:36,700 so let's just stick with two dimensions, x and y. 50 00:02:36,699 --> 00:02:38,719 So what would this turn out to be? 51 00:02:38,719 --> 00:02:45,520 If you took the dot product of this, which is this upside down 52 00:02:45,520 --> 00:02:48,719 triangle, with this vector field, what would you get? 53 00:02:48,719 --> 00:02:51,650 Well, you would just get the partial derivative of the x 54 00:02:51,650 --> 00:02:56,150 dimension with respect to x, so you would get-- it's actually 55 00:02:56,150 --> 00:02:57,950 pretty straight forward to memorize; you might not even 56 00:02:57,949 --> 00:03:01,359 need this mnemonic right here, this abuse of notation; you 57 00:03:01,360 --> 00:03:04,990 might just know it off hand --the x component, you take the 58 00:03:04,990 --> 00:03:07,683 partial derivative with respect to x, and the y component, you 59 00:03:07,682 --> 00:03:09,469 take the partial derivative with respect to y. 60 00:03:09,469 --> 00:03:11,430 But I'll show you why it looks like the dot product. 61 00:03:11,430 --> 00:03:13,790 So if you took the dot product of that and that, it would be 62 00:03:13,789 --> 00:03:18,310 the partial derivative with respect to x of that 63 00:03:18,310 --> 00:03:26,500 expression, of x squared, y and then plus the partial 64 00:03:26,500 --> 00:03:33,169 derivative with respect to y of that second expression, the y 65 00:03:33,169 --> 00:03:39,929 component of 3y, and then you would evaluate it. 66 00:03:39,930 --> 00:03:42,950 What's the partial derivative of this with respect to x? 67 00:03:42,949 --> 00:03:46,409 We just pretended y is a constant, just a number, so 68 00:03:46,409 --> 00:03:48,669 the derivative of this with respect to x, would be 69 00:03:48,669 --> 00:03:50,339 2x times the constant. 70 00:03:50,340 --> 00:03:58,810 So it'll be 2xy plus-- what's the partial derivative 71 00:03:58,810 --> 00:04:00,460 of 3y with respect to y? 72 00:04:00,460 --> 00:04:02,295 Well, there's nothing else to hold constant, so it's just 73 00:04:02,294 --> 00:04:03,929 like taking the derivative with respect to y 74 00:04:03,930 --> 00:04:06,340 --so it's 2y plus 3. 75 00:04:06,340 --> 00:04:11,069 So this is the divergence at a point x, y. 76 00:04:11,069 --> 00:04:13,289 You could almost view it as a function of x and y. 77 00:04:13,289 --> 00:04:16,170 So you could almost say you know, that the divergence of 78 00:04:16,170 --> 00:04:20,310 v-- I'm going to make up some notation here --as long as you 79 00:04:20,310 --> 00:04:22,870 get the point across, you can say that the divergence 80 00:04:22,870 --> 00:04:25,470 of v, that this is a function of x and y. 81 00:04:25,470 --> 00:04:28,760 That we just have an expression that if you give me a point 82 00:04:28,759 --> 00:04:31,289 anywhere in this vector field, I can tell you the 83 00:04:31,290 --> 00:04:33,430 divergence at that point. 84 00:04:33,430 --> 00:04:36,639 So I think you'll find that the computation of divergence 85 00:04:36,639 --> 00:04:37,909 isn't too difficult. 86 00:04:37,910 --> 00:04:41,260 You just take the partial derivative of the x component 87 00:04:41,259 --> 00:04:44,550 with respect to x, and you add that to the partial derivative 88 00:04:44,550 --> 00:04:46,480 to the y component with respect to y. 89 00:04:46,480 --> 00:04:48,450 And if you had the z, you would do the same thing, 90 00:04:48,449 --> 00:04:50,579 so on and so forth. 91 00:04:50,579 --> 00:04:53,129 Actually, let me do just do one more just hit the point home, 92 00:04:53,129 --> 00:04:54,375 and then we'll work on intuition. 93 00:04:54,375 --> 00:04:57,649 94 00:04:57,649 --> 00:05:02,169 So if I said that I had, I don't know, let's say, my 95 00:05:02,170 --> 00:05:10,455 vector field is cosine of yi plus-- so it's interesting; my 96 00:05:10,454 --> 00:05:14,979 x-direction is dependent on my y-coordinate --plus, I 97 00:05:14,980 --> 00:05:20,040 don't know, e to the xyj. 98 00:05:20,040 --> 00:05:24,780 99 00:05:24,779 --> 00:05:27,819 So then oh, that's difficult because I have these 100 00:05:27,819 --> 00:05:28,209 e's and these cosines. 101 00:05:28,209 --> 00:05:29,769 But we'll see; if you just keep your head straight on 102 00:05:29,769 --> 00:05:32,149 what's constant and what's not, it's not too bad. 103 00:05:32,149 --> 00:05:41,229 So the divergence of v is equal to the partial derivative 104 00:05:41,230 --> 00:05:44,080 of this expression with respect to x. 105 00:05:44,079 --> 00:05:46,050 Well, what's the derivative of this with respect to x? 106 00:05:46,050 --> 00:05:49,199 If y is just a constant, cosine of y is just a number. 107 00:05:49,199 --> 00:05:54,670 So the derivative of this with respect to x is just 0 plus-- 108 00:05:54,670 --> 00:05:57,110 what's the derivative of this with respect to y? 109 00:05:57,110 --> 00:05:59,660 Well, you could just do x, since it's a constant, 110 00:05:59,660 --> 00:06:01,130 as the coefficient on y. 111 00:06:01,129 --> 00:06:05,589 So the derivative of x, y with respect to y is just x. 112 00:06:05,589 --> 00:06:09,829 And then the derivative of e to anything is e to anything. 113 00:06:09,829 --> 00:06:11,669 I just did the chain rule. 114 00:06:11,670 --> 00:06:13,430 e to the x, y. 115 00:06:13,430 --> 00:06:15,100 And so that is the divergence. 116 00:06:15,100 --> 00:06:16,129 So you could just ignore this. 117 00:06:16,129 --> 00:06:18,490 It's x, e to the x, y. 118 00:06:18,490 --> 00:06:21,360 One thing to immediately realize, even before we work on 119 00:06:21,360 --> 00:06:28,400 the intuition, is when we did gradient I gave you a surface 120 00:06:28,399 --> 00:06:31,979 and it gave us a vector field. 121 00:06:31,980 --> 00:06:36,700 Or I gave you a scalar field and you got a vector field. 122 00:06:36,699 --> 00:06:39,250 When you take the divergence of something, you're going in the 123 00:06:39,250 --> 00:06:41,310 opposite direction, in some ways. 124 00:06:41,310 --> 00:06:43,420 You start with the vector field, right? 125 00:06:43,420 --> 00:06:44,170 And what's a factor field? 126 00:06:44,170 --> 00:06:46,770 It's something that if you give me any point x and y, 127 00:06:46,769 --> 00:06:47,810 I'll give you a vector. 128 00:06:47,810 --> 00:06:50,829 So if you wanted to graph it, in the x, y plane you'd have a 129 00:06:50,829 --> 00:06:53,120 bunch of vectors, and I'll show you how that looks in a second 130 00:06:53,120 --> 00:06:55,199 when we go over to intuition. 131 00:06:55,199 --> 00:06:57,039 Well, when you take the divergence of it, you get a 132 00:06:57,040 --> 00:06:59,000 value for any point x, y. 133 00:06:59,000 --> 00:07:02,079 So even though a vector field has all these vectors on it, 134 00:07:02,079 --> 00:07:05,180 the divergence tells you an actual scalar number at 135 00:07:05,180 --> 00:07:08,180 any point in the field. 136 00:07:08,180 --> 00:07:11,949 So let's get a little bit of intuition of what a 137 00:07:11,949 --> 00:07:16,050 divergence actually is. 138 00:07:16,050 --> 00:07:19,040 Let me do it in one dimension. 139 00:07:19,040 --> 00:07:20,770 Or we can even, let's do it in two dimensions, but I'll 140 00:07:20,769 --> 00:07:22,599 make it constant in the y. 141 00:07:22,600 --> 00:07:25,010 So let's say that my-- let me erase this; I'll probably 142 00:07:25,009 --> 00:07:28,269 need some space. 143 00:07:28,269 --> 00:07:30,269 OK, oh, I didn't want to do that dot. 144 00:07:30,269 --> 00:07:35,250 OK let's say the velocity of fluid, or the particles in 145 00:07:35,250 --> 00:07:40,180 fluid, at any point in the x, y plane, let's say it is equal to 146 00:07:40,180 --> 00:07:51,139 5xi plus, I don't know, 0y-- there's never any, sorry --0j, 147 00:07:51,139 --> 00:07:53,509 right? j is the unit vector in the y-direction. 148 00:07:53,509 --> 00:07:56,189 So there's never a y component to the velocity vector. 149 00:07:56,189 --> 00:07:57,250 So what would that look like? 150 00:07:57,250 --> 00:07:59,569 I don't need a computer to draw this. 151 00:07:59,569 --> 00:08:03,480 I can handle this one myself I think. 152 00:08:03,480 --> 00:08:07,250 So if that's the y-axis, that's my x-axis. 153 00:08:07,250 --> 00:08:10,399 154 00:08:10,399 --> 00:08:13,199 So when x is equal-- I'll just sample some points and draw 155 00:08:13,199 --> 00:08:19,740 some vectors --when x is equal to 1-- let's say x is 1 there 156 00:08:19,740 --> 00:08:22,579 --what's the magnitude of this vector? 157 00:08:22,579 --> 00:08:26,740 It'll be 5, right? 158 00:08:26,740 --> 00:08:29,730 Actually, let me make this a different number, because 159 00:08:29,730 --> 00:08:30,620 it'll make it hard to do. 160 00:08:30,620 --> 00:08:33,070 Let's make this 1/2 x. 161 00:08:33,070 --> 00:08:36,980 So when x is 1, the magnitude of my vector is 1/2. 162 00:08:36,980 --> 00:08:37,850 Only in the x-direction. 163 00:08:37,850 --> 00:08:40,480 It has no y component; ignore this right here. 164 00:08:40,480 --> 00:08:42,460 It's 1/2xi plus 0j. 165 00:08:42,460 --> 00:08:45,000 Or you could just say 1/2xi. 166 00:08:45,000 --> 00:08:47,179 And when x is equal to 2-- I could have picked any points, 167 00:08:47,179 --> 00:08:48,599 but I'm just picking the numbers that's easy to 168 00:08:48,600 --> 00:08:52,019 calculate --when x is equal to 2, what is the magnitude 169 00:08:52,019 --> 00:08:52,649 of the vector? 170 00:08:52,649 --> 00:08:55,419 It's 1/2 times 2, which is 1. 171 00:08:55,419 --> 00:08:56,870 So it's going to be twice as big. 172 00:08:56,870 --> 00:09:03,350 173 00:09:03,350 --> 00:09:07,159 And remember, if I have a particle right here in my 174 00:09:07,159 --> 00:09:10,679 fluid, if this is a particle, its velocity in the x-direction 175 00:09:10,679 --> 00:09:14,009 is going to be 1 meter per second to the right. 176 00:09:14,009 --> 00:09:17,850 If I have a particle here, it's velocity in the x-direction 177 00:09:17,850 --> 00:09:20,159 is going to be 1/2 a meter per second to the right. 178 00:09:20,159 --> 00:09:21,719 Let's just do one more point. 179 00:09:21,720 --> 00:09:26,820 So let's say that x is equal to 3. 180 00:09:26,820 --> 00:09:29,740 What's my velocity to the right? 181 00:09:29,740 --> 00:09:31,210 I'll do it in a different color just so that you 182 00:09:31,210 --> 00:09:32,310 don't get confused. 183 00:09:32,309 --> 00:09:34,439 There's going to be 3/2; it's going to be even longer. 184 00:09:34,440 --> 00:09:40,600 185 00:09:40,600 --> 00:09:43,550 But the general idea here, and as we move up in x it 186 00:09:43,549 --> 00:09:44,709 doesn't change much, right? 187 00:09:44,710 --> 00:09:47,340 It doesn't change at all. 188 00:09:47,340 --> 00:09:48,786 Our x value doesn't-- 189 00:09:48,785 --> 00:09:49,659 [COUGHS]. 190 00:09:49,659 --> 00:09:54,279 So for any y, the magnitude of the vector doesn't 191 00:09:54,279 --> 00:09:54,759 change, right? 192 00:09:54,759 --> 00:09:58,090 It's only dependent on x. 193 00:09:58,090 --> 00:10:01,000 And then for example, here, it'll be even longer. 194 00:10:01,000 --> 00:10:03,950 If we draw the vector here it'll be even longer, right? 195 00:10:03,950 --> 00:10:05,150 If you do it here. 196 00:10:05,149 --> 00:10:05,990 I think you get the point. 197 00:10:05,990 --> 00:10:08,830 The further you go to the right, the faster the particles 198 00:10:08,830 --> 00:10:11,259 are moving towards the right. 199 00:10:11,259 --> 00:10:14,029 So now let's try to get a little bit of intuition. 200 00:10:14,029 --> 00:10:16,870 Oh, I just realized that I ran out of time, so I will continue 201 00:10:16,870 --> 00:10:19,370 this in the next video. 202 00:10:19,370 --> 00:10:20,000