If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

## Multivariable calculus

### Course: Multivariable calculus>Unit 1

Lesson 4: Visualizing vector-valued functions

# 3d vector field example

See an example of how you can start to understand how the formula for a three-dimensional vector field relates to the way it looks.  Created by Grant Sanderson.

## Want to join the conversation?

• On a three-dimensional graph, how are the quadrants named?
• So if I wanted to show gravity as a field could I do something like this:

a * [xz]
[yz]
[zz]

where every vector goes towards the origin and a represents the gravity relative to earth?
• Assume we have a uniform sphere of mass M and radius R and you are at a distance r from the centre.
Gravitational attraction = GM/r^2 if r>R (if you are outside the sphere) and if the centre is our origin then gravitational attraction should have direction opposite to the position vector ( since gravity is an attractive force) . Now we want to write gravity as a vector ( so we want to include direction not only magnitude ) . Can we write gravity = magnitude (that is GM/(x^2+y^2+z^2)) * minus ( since it is opposite to position vector ) * (x,y,z) (which is the position vector) ? No because the magnitude of that vector is multiplied by abs(x,y,z)= sqrt(x^2+y^2+z^2 ) so we have to divide that vector expression with the sqrt . Thus
g = - GM/(x^2+y^2+z^2)^(3/2) * (x,y,z) . Now if r <R ( you are inside the sphere ) then it's the same formula with a small change; instead of M you use the mass of the sphere with radius r because the spherical shell above you is useless ( as you said it attracts you from all directions and the forces cancel out) . So m ( new mass ) = M * ( r/R)^3 (think of it a little bit , I can explain if it's necessary). So the function of gravity g (x,y,z) has a condition with 2 branches .
Earth is neither uniform nor sphere but it's a good approximation .
• Can anyone give a summary of what each type of function (e.g. 2-input, 3-output, parametric, etc.) gives what type of graph (e.g. torus, vector field, etc.)? That would be very helpful. I can't reason each one through myself yet, and I wish I had some comprehensive guidelines.
• Cold you share on, what is the software that is being used for the visualizations shown above?
• This is the free Grapher app which is preinstalled on Macs.
• Hola do I draw vector fields with two components
(1 vote)
• If you are only considering 2D, then yes, you'd draw vector fields with two components. Here, however, 3D vector fields are being considered, which is why they have three components.
(1 vote)
• Is the video missing some part? Does it really finish at ? Because it looked like he was still going to say something.
(1 vote)
• I wonder, in this example there is no vectors where X, Y and Z are negative?
(1 vote)
• Interesting question! No, there aren’t because:
Assume there was a vector where X,Y,Z were negative. So, xy is negative => x and y have different signs, yz is negative => y and z have different signs => x and z have the same sign, so xz is positive!
(1 vote)
• Which program does he use to do things like that?
(1 vote)

## Video transcript

- [Voiceover] So in the last video, I talked about 3-dimensional vector fields. And I finished things off with a sort of identity function example where at an input point x, y, z the output vector is also x, y, z. And here, I want to go through a slightly more intricate example. So I'll go ahead and get rid of this vector field and in this example, the x component of the output will be y times z. The y component of the output will be x times z. And the z component of the output will be x times y. So I'll just show this vector field and then we can start to get a feel for how the function that I just wrote relates to the vectors that you're seeing. So you see some of the vectors are kind of pointing away from the origin. Some are pointing in towards the origin. So how can we understand this vector field in terms of the function itself? And a good step is to just zero in on one of the components. So in this case, I'll choose the z component of the output which is made up of x times y and kind of start to understand what that should be. The z component will represent how much the vector's pointing up or down. This is the z axis and the x-y plane here so I'll point the z axis straight at our face. This is the x axis, this is the y axis. The values of x and y are going to completely determine that z component. So I'm going to go off to the side here and just draw myself a little x-y plane for reference. So this is my x value, this is my y value. And I want to understand the meaning of the term "x times y." So when both x and y are positive, the product is positive. And when both of them are negative, the product is also positive. If x is negative and y is positive, the product is negative, but if x is positive and y is negative, the product is also negative. So what this should mean, in terms of our vector field, is that when we're in this first quadrant, vectors tend to point up in the z direction, same over here in the third quadrant. But over in the other two they should tend to point down. So let's focus in on that first quadrant and try to look at what's going on. So, you see like this vector here applies, this vector. And all of them generally point upwards, they have a positive z component. So that seems in line with what we were predicting. Whereas over here, which corresponds to the fourth quadrant of the x-y plane, the z component of each vector tends to be down. And they're doing other things in terms of the x and y components, it's not just z component action, but right now we're just focusing on up and down. And if you look over in the third quadrant, they tend to be pointing up, and that corresponds to the fact that x times y will be positive. And when you look at it, it all starts to align that way. And because I chose a rather symmetric function you could imagine doing this where you, you analyze also the y component here, you analyze the x component in terms of y and z, and it's actually going to look very similar for understanding when the x component of a vector tends to be positive, like up here, or when it turns out to be negative, like over here, and same with when the y component of the vector tends to be negative, or if the y component tends to be positive. And overall, it's a very complicated image to look at, but you can slowly piece by piece get a feel for it. And just like with 2-dimensional vector fields, the kind of neat thing to do is imagine that this represents a fluid flow. So you imagine like maybe air around you, flowing in towards the origin here, flowing out away from the origin there, it would kind of be rotating around here, and later on in multi-variable calculus, you'll learn about various ways you can study just the function itself and just the variables and get a feel for how that fluid itself would behave, even though it's a very complicated thing to think about, it's even complicated to draw or use graphic software with, but just with analytic tools, you can get very powerful results. And these kind of things come up in physics all the time because you're thinking in 3-dimensional space and it doesn't just have to be fluid flow, it could be a force field like an electric force field or gravitational force field, where each vector tells you how a particle tends to get pushed. And as we continue on with multi-variable calculus, you'll get to see lots more examples. But hopefully this helps give a small feel for how you can go piece by piece and understand something that's kind of a complicated expression.