yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Contour plots | Multivariable calculus | Khan Academy


4m read
·Nov 11, 2024

So I have here a three-dimensional graph, um, and that means that it's representing some kind of function that has a two-dimensional input and a one-dimensional output. So that might look something like f(x, y) = and then just some expression that has a bunch of x's and y's in it. Graphs are great, but they're kind of 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 in these graphs two-dimensionally just by scribbling down on a two-dimensional piece of paper. Um, and 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. The idea of a contour plot is that we're going to take this graph and slice it a bunch of times.

Okay, so I'm going to slice it with various planes that are all parallel to the XY plane, and let's think for a moment about what these guys represent. So the bottom one here, um, represents the value Z is equal to -2. Okay, so this is the z-axis over here, and when we fix that to be -2 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 -1, we get a new plane still parallel to the XY plane. It's got a, uh, but its distance from the XY plane is now 1, 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 XY plane, these represent constant values for the output. So 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 onto the XY plane. Uh, 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 and squish them all nice and flat onto the XY plane. 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.

So let's, I'm going to switch over to a two-dimensional graph here. Um, and this is that same, same function that we were just looking at. Let actually move it a little bit more central here. So this is the same function that we were just looking at, but, um, 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, you know, f(x, y) and then some expression of those guys. But, you know, this line might represent the constant value of f when all of the values where it outputs three. Um, over here, this also, like both of these circles together give you all the values where f outputs three. Um, this one over here would 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, you know 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.

You know, if you like thinking in terms of graphs, you can kind of imagine how these circles and everything would pop out of the page. Um, you can also look, you know, 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, um, it's going to be very steep, but over here, it's much more shallow. Uh, and you can do things like this to kind of get a better feel for the function as a whole. The idea of a whole bunch of concentric circles usually corresponds to a maximum or a minimum, um, and you end up seeing these a lot.

Another common thing people will do with contour plots is represent them as color them. So what that might look like is here, where, you know, warmer colors like orange correspond to high values and cooler colors like blue correspond to low values. And the contour lines end up going along, you know, the division between red and green here, between light green and green, and that's another way where colors tell you the output.

And then the contour lines themselves can be thought of as the borders between different colors. Um, and again, a good way to get a feel for a multi-dimensional function just by looking at the input space.

More Articles

View All
Subject-verb agreement | Syntax | Khan Academy
Hello Grim marians! Today we’re going to talk about subject-verb agreement. What this is, is the idea that you want your subject and your verb to get along in a sentence. What agreement is in grammar is the art of making sure that sentence parts connect w…
Lewis diagrams | Atoms, isotopes, and ions | High school chemistry | Khan Academy
In this video, we’re going to introduce ourselves to a new way of visualizing atoms. As you can imagine from the title here, that’s going to be Lewis diagrams. But before I even get into that, let’s do a little bit of review of what we already know about …
Worked example: calculating ion charge | High school chemistry | Khan Academy
So we’re asked what is the charge of a calcium ion with 18 electrons. So pause this video and see if you can work that on your own. I will give you a little bit of a tip: a periodic table of elements might be useful to see where calcium sits on that perio…
Kathryn Minshew at Startup School NY 2014
Next you’re gonna hear from Kathryn Minshew. Kathryn is the CEO and founder of The Muse. So, The Muse is a job discovery tool that’s helping one million people a month find the career, find careers at awesome companies. So, Kathryn has heard me say this b…
ALUX Builds School for 60,000 People
We want to leverage our platform to help people in the communities that need it most. When we asked you about it, you said Uganda, so we’re here. Ladies and gentlemen, welcome to Interview International Airport. By the local time, it’s 25 minutes past whe…
Steve Jobs Secrets of Life
The thing I would say is when you grow up, you tend to get told that the world is the way it is and your life is just to live your life inside the world. Try not to bash into the walls too much. Uh, try to have a nice family life, have fun, save a little …