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.

Main content

Vector fields, introduction

Vector fields let you visualize a function with a two-dimensional input and a two-dimensional output. You end up with, well, a field of vectors sitting at various points in two-dimensional space.  Created by Grant Sanderson.

Want to join the conversation?

  • primosaur ultimate style avatar for user FakePlunk
    The vector fields kind of look like slope fields. Are the two interchangeable, or are they separate in the way that one is the function while the other is derivative?
    (24 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Grant
      You are right that they are similar, but the difference between a vector field and a slope field is the same as the difference between a single vector and a single line. That is, a vector has magnitude and direction, but the line only really gives a direction. In this way, a vector field packs more information than a slope field.
      (53 votes)
  • piceratops seed style avatar for user josejimenezjr18
    can someone explain exactly the fundamental process of knowing that the 2-input and output vectors result to a 4-D model? I'm not sure if i worded that right but its in the beginning of the video.
    (9 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user tyersome
      Maybe it would be helpful to start with simpler functions and work up.

      1 input -> 1 output: to show this as a graph is simple -- you get a 2-D graph
      e.g. a Cartesian x-y plane where y = f(x)

      2 inputs -> 1 output: these were shown in earlier videos as 3-D graphs where z = f(x,y)

      1 input -> 2 outputs: this will also be 3-D, but now you are generating y and z values for
      each value x -- this will (typically) be a parametric curve
      i.e. the vector
      [ f(x) ]
      [ g(x) ]

      where y = f(x) and z = g(x)

      More generally, if you want to graph a function with m inputs and n outputs, then each variable needs its own dimension so the total number of dimensions needed will be m + n.
      (35 votes)
  • piceratops seed style avatar for user Αντζελίνο Μεχμέτι
    In the previous video (Parametric surfaces) you have a function with 2 inputs (t, s) and 3 outputs in a vector kind of way, but each row has both t and s. t and s could have easily been x and y, so i was wondering: how do you distinguish a vector field from a parametric surface? The only difference I see is that in the vector field each input parameter is the only one used in its own output row. Is that it?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user pshin0
      Yeah, I'm still a little bit confused too. The way I'm thinking of it is this: when dealing with parametric surfaces, you're using external information (like time or cost) to determine the exact location in space, whereas when dealing with a vector field, you're using your exact location in space to determine the external information (cost, speed, etc).

      Would this be a correct way to think about this? I'm wondering if we'll have to be told this information beforehand in order to understand what a question is really asking.
      (4 votes)
  • piceratops seed style avatar for user Paul Vargas
    How do you distinguish between a vector field expression and a position vector expression? R (x,y) = x(t) i + y(t) j , a "tradional" position vector expression could be a vector field if we assign a vector R (x,y) = x(t) i + y(t) j for each value of "t" at the point x(t) i + y(t) j.........it seems you have to be told ahead of time that you have one or the other. Thank you for your great work!
    (4 votes)
    Default Khan Academy avatar avatar for user
  • male robot johnny style avatar for user Engineering#1
    is this just a like a linear transformation T from R2 to R2 i.e T: R2 ----> R2
    (2 votes)
    Default Khan Academy avatar avatar for user
    • orange juice squid orange style avatar for user David Gretzschel
      Well if f(x,y) was a linear transformation, the angles of the vectors in the vector field would all have to be the same (ignoring orientation here now). (necessary, but I don't think sufficient condition for it to be a linear transformation; this would be akin to showing paralellity of the transformed grid-lines in a linear transformation; I don't think one could intuitively see or not see the 'evenly-spaced' part from this way of presenting the data, because only "intersection" points are transformed and not whole gridlines.
      (2 votes)
  • male robot hal style avatar for user KEVIN
    1. How long has the study of vector fields been around? I'm asking because most of the resulting images are (seem to be) computer generated. If the study of vector fields is very old, or somewhat old, computer generated results would not have been available, or depending on the era, most likely not yielding the images we see here.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Rutwik Pasani
    Why can't functions having same number of inputs and output variables be represented in a different way?
    Like a parametric curve or a parametric surface for example
    (2 votes)
    Default Khan Academy avatar avatar for user
  • stelly orange style avatar for user Lucas
    How would I find the function for a vector field when working in, say, fluid dynamics?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Junu Lee
    Thanks a lot for your lesson. Could you explain the difference between vector field and vector-valued function. they make me crazy... :'(
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Hexuan Sun 9th grade
    I have a question, which color represents the longest and which color represents the shortest
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

- [Voiceover] Hello everyone, so in this video I'm gonna introduce vector fields. Now these are a concept that come up all the time in multi variable calculus, and that's probably because they come up all the time in physics. It comes up with fluid flow, with electrodynamics, you see them all over the place. And what a vector field is, is its pretty much a way of visualizing functions that have the same number of dimensions in their input as in their output. So here I'm gonna write a function that's got a two dimensional input X and Y, and then its output is going to be a two dimensional vector and each of the components will somehow depend on X and Y. I'll make the first one Y cubed minus nine Y and then the second component, the Y component of the output will be X cubed minus nine X. I made them symmetric here, looking kind of similar they don't have to be, I'm just a sucker for symmetry. So if you imagine trying to visualize a function like this with a graph it would be really hard because you have two dimensions in the input two dimensions in the output so you'd have to somehow visualize this thing in four dimensions. So instead what we do, we look only in the input space. So that means we look only in the X,Y plane. So I'll draw these coordinate axes and just mark it up, this here's our X axis this here's our Y axis and for each individual input point like lets say one,two so lets say we go to one,two I'm gonna consider the vector that it outputs and attach that vector to the point. So lets walk through an example of what I mean by that so if we actually evaluate F at one,two X is equal to one Y is equal to two so we plug in two cubed whoops, two cubed minus nine times two up here in the X component and then one cubed minus nine times Y nine times one, excuse me down in the Y component. Two cubed is eight nine times two is 18 so eight minus 18 is negative 10 negative 10 and then one cubed is one, nine times one is nine so one minus nine is negative eight. Now first imagine that this was if we just drew this vector where we count starting from the origin, negative one, two, three, four, five, six, seven, eight, nine, 10, so its going to have this as its X component and then negative eight, one, two, three, four, five, six, seven, we're gonna actually go off the screen its a very very large vector so its gonna be something here and it ends up having to go off the screen. But the nice thing about vectors it doesn't matter where they start so instead we can start it here and we still want it to have that negative ten X component and the negative eight, negative one, two, three, four, five, six, seven, eight, negative eight as its Y component there and a plan with the vector field is to do this at not just one,two but at a whole bunch of different points and see what vectors attach to them and if we drew them all according to their size this would be a real mess. There'd be markings all over the place and this one might have some huge vector attached to it and this one would have some huge vector attached to it and it would get really really messy. But instead what we do, just gonna clear up the board here we scale them down, this is common you'll scale them down and so that you're kind of lying about what the vectors themselves are but you get a much better feel for what each thing corresponds to. And another thing about this drawing that's not entirely faithful to the original function that we have is that all of these vectors are the same length. I made this one just kind of the same unit this one the same unit, and over here they all just have the same length even though in reality the length of the vectors' output by this function can be wildly different. This is kind of common practice when vector fields are drawn or when some kind of software is drawing them for you so there are ways of getting around this one way is to just use colors with your vectors so I'll switch over to a different vector field here and here color is used to kind of give a hint of length so it still looks organized because all of them have the same length but the difference is that red and warmer colors are supposed to indicate this is a very long vector somehow and then blue would indicate that its very short. Another thing you can do is scale them to be roughly proportional to what they should be so notice all the blue vectors scaled way down to basically be zero red vectors kind of stay the same size even though in reality this might be representing a function where the true vector here should be really long or the true vector should be kind of medium length its still common for people to just shrink them down so its a reasonable thing to view. So in the next video I'm gonna talk about fluid flow a context in which vector fields come up all the time and its also a pretty good way to get a feel for a random vector field that you look at to understand what its all about.