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
Coral Bleaching in the Great Barrier Reef | Years of Living Dangerously
This year is the warmest on record, and with ocean temperatures reaching dangerously high levels, a major coral bleaching event is predicted to hit the Great Barrier Reef. It’s a race against time to document these reefs before climate change alters condi…
Zero-order reactions | Kinetics | AP Chemistry | Khan Academy
Let’s say we have a hypothetical reaction where reactant A turns into products. Let’s say the reaction is zero order with respect to A. If it’s zero order with respect to A, we can write that the rate of the reaction is equal to the rate constant k times …
✈️ The Maddening Mess of Airport Codes! ✈️
There are thousands of airports connecting cities across countries and continents. Yet, with just three letters from AAC and BBI to YYZ and ZZU, both me and you and our bags root round the world as unambiguously as practically possible: airport codes. If…
Adora Cheung Speaks at Female Founders Conference 2015
Hey everyone, thanks Cat. So as Cat said, I am the CEO and co-founder of Homejoy. Um, woo, yeah, okay, this is going to be easy. Um, so Homejoy is the get help button for every home, and Cat said we connect people with home service professionals in the mo…
Early Medieval Trade | World History | Khan Academy
In this video, I want to start to answer the question of how did the environment and how did political factors impact trade. That is a really big question that we’re not going to answer in one video, but I want to use a specific example to illustrate the …
Golden Age of Athens, Pericles and Greek Culture | World History | Khan Academy
In other videos, we’ve already talked about how Classical Greece has had an immeasurable impact, not just on Western Civilization, but on civilization as a whole. In order to understand the period that we call Classical Greece, it’s valuable to place it i…