# 3d vector fields, introduction

## Video transcript

- [Voiceover] So in the last video, I talked about vector fields in the context of two dimensions, and here, I'd like to do the same but for three-dimensions. So a three-dimensional vector field is given by a function, a certain multi-variable function that has a three-dimensional input given with coordinates x, y and z, and then a three-dimensional vector output that has expressions that are somehow dependent on x, y, and z, I'll just put dots in here for now, but we'll fill this in with an example in just a moment. And the way that this works, just like with the two-dimensinal vector field, you're gonna choose a sample of various points in three-dimensional space. And for each one of those points, you consider what the output of the function is and that's gonna be some three-dimensional vector. And you draw that vector off of the point itself. So to start off, let's take a very simple example, one where the vector that outputs is actually just a constant. So in this case, I'll make that constant the vector, one, zero, zero. So what this vector is, it's just got a unit lenth in the x direction, so this is the x axis. So all of the vectors are gonna end up looking something like this where it's a vector that has length one in the x direction. And when we do this, at every possible point, well not every possible point, but a sample of a whole bunch of points, we get a vector field that looks like this. At any given point in space, we get one of these little blue vectors and all of them are the same, they're just copies of each other, each pointing with unit length in the x direction. So as vector fields go, this is relatively boring, but we can make it a little bit more exciting if we make the input start to depend somehow on the actual input. So what I'll do to start, I'll just make the input y, zero, zero. So they're still just gonna point in the x direction, but now it's gonna depend on the y value. So let's think of a second before I change the image, what that's gonna mean. The y axis is this one here, so now the z axis is pointing straight in our face, that's the y. So as y increases value to one, two, three, the length of these vectors are gonna increase, it's gonna be a stronger vector in the x direction, a very strong vector in the x direction. And if y is negative, these vectors are gonna point in the opposite direction. So let's see what that looks like. Here we go. So in this vector field, color and length are used to indicate the magnitude of the vector. So red vectors are very long, blue vectors are pretty short, and at zero, we don't even see any because those are vectors with zero length. And just like with two dimensional vector fields, when you draw them, you lie a little bit. This one should have a length of one, right? Because when y is equal to one, this should have a unit length, but it's made really, really small. And this one up here, where y is five or six, should be a really long vector, but we're lying a little bit because if we actually drew them to scale, it would really clutter up the image. So a couple things to notice about this one, since the output doesn't depend on x or z, if you move in the x direction, which is back and forth here, the vectors don't change. And if you move in the z direction which is up and down, the vectors also don't change. They only change as you move in the y direction. Okay, so we're starting to get a feel for how the output can depend on the input. Now let's do something a little bit different. Let's say that all three of the components of the input depend on x, y, and z, but I'm just gonna make it kind of an identity function. At a given point x, y, z, you output the vector itself, x, y, z. So let's think about what this would actually mean. And let's say you've got a given point, some point floating off in space. What is the output vector for that? Well the point has a certain x component, a certain y component, and a z component. And the vector that corresponds to x, y, z is gonna be the one from the origin to that point itself. Let me just draw that here from the origin to the point itself. And because of how we do vector fields, you move this so that instead of stemming from the origin, it actually stems from the point. But the main thing to take away from here is it's gonna point directly away from the origin. And the farther away the point is, the longer this vector will be. So with that, let's take a look at the vector field itself. Here we go. So again, you kind of lie when you draw these. Like the vectors, these red guys that are out at the end, they should be really long 'cause this vector should be as long as that point is away from the origin. But to give a cleaner vector field, you scale things down, and notice the blue ones that are close to the center here, are actually really, really short guys. And all of these are pointing directly away from the origin. And this is one of those vector fields that is actually pretty, a good one to have a strong intuition of 'cause it comes up now and then, thinking about what the identity function looks like as a vector field itself. In the next video, I'll talk through another example that's a little bit more complicated than this and can hopefully give an even stronger feel for how the output can depend on x, y, and z.