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
Current time:0:00Total duration:5:36

Video transcript

- [Voiceover] So I have here a three-dimensional graph, and that means that it's representing some kind of function that has a two-dimensional input and a one-dimension output. So that might look something like f of x, y equals and then just some expression that has a bunch of x's and y's in it. And graphs are great but they're kinda clunky to draw. I mean, certainly you can't just scribble it down. It typically requires some kind of graphing software and when you take a static image of it it's not always clear what's going on. So here I'm going to describe a way that you can represent these functions and these graphs two-dimensionally just by scribbling down on a two-dimensional piece of paper. This is a very common way that you'll see if you're reading a textbook or if someone is drawing on a blackboard. It's known as a contour plot and the idea of a contour plot is that we're going to take this graph and slice it a bunch of times. So I'm going to slice it with various planes that are all parallel to the x, y plane and let's think for a moment about what these guys represent. So the bottom one here represents the value z is equal to negative two. This is the z-axis over here and when we fix that to be negative two and let x and y run freely we get this whole plane. And if you let z increase, keep it constant, but let it increase by one to negative one we get a new plane, still parallel to the x, y plane but it's distance from the x, y plane is negative one. And the rest of these guys, they're all still constant values of z. Now in terms of our graph, what that means is that these represent constant values of the graph itself. These represent constant values for the function itself. So because we always represent the output of the function as the height off of the x, y plane these represent constant values for the output. What that's going to look like. So what we do is we say, "Where do these slices cut into the graph?" So I'm going to draw on all of the points where those slices cut into the graph and these are called contour lines. We're still in three-dimensions so we're not done yet. So what I'm going to do is take all these contour lines and I'm going to squish them down on to the x, y plane. So what that means, each of them has some kind of z component at the moment, and we're just going to chop it down, squish them all nice and flat, on to the x, y plane. And now we have something two-dimensional, and it still represents some of the outputs of our function. Not all of them, it's not perfect, but it does give a very good idea. I'm going to switch over to a two-dimensional graph here. And this is that same function that we were just looking at. Let's actually move it a little bit more central here. So this is the same function that we were just looking at, but each of these lines represents a constant output of the function so it's important to realize we're still representing a function that has a two-dimensional input and a one-dimensional output. It's just that we're looking in the input space of that function as a whole. So this is still f of x, y and then some expression of those guys but this line might represent the constant value of f when all of the values were at outputs three. Over here, this also, both of these circles together give you all the values where f outputs three. This one over here will tell you where it outputs two and you can't know this just looking at the contour plot so typically if someone's drawing it if it matters that you know the specific values they'll mark it somehow. They'll let you know what value each line corresponds to but as soon as you know that this line corresponds to zero it tells you that every possible input point that sits somewhere on this line will evaluate to zero when you pump it through the function. And this actually gives a very good feel for the shape of things. If you like thinking in terms of graphs you can kind of imagine how these circles and everything would pop out of the page. You can also look, notice how the lines are really close together over here, very, very close together, but they're a little more spaced over here. How do you interpret that? Well, over here this means it takes a very, very small step to increase the value of the function by one, very small step and it increases by one, but over here it takes a much larger step to increase the function by the same value. So over here this kind of means steepness. If you see a very short distance between contour lines it's going to be very steep but over here it's much more shallow. And you can do things like this to kind of get a better feel for the function as whole. The idea of a whole bunch of concentric circles usually corresponds to a maximum or a minimum, and you end up seeing these a lot. Another common thing people will do with contour plots as they represent them is color them. So what that might look like is here where warmer colors like orange correspond to high values and cooler colors like blue correspond to low values. The contour lines end up going along the division between red and green here, between light green and green, and that's another way were colors tell you the output and then the contour lines themselves can be thought of as the borders between different colors. And again a good way to get a feel for a multi-dimensional function just by looking at the input space.