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
Would Neil deGrasse Tyson Accept a Drone Delivery? | StarTalk
[Music] I don’t want a drone coming outside my window; it’s that simple. If you have a drop point for drones to deliver goods and services, fine. If you got a package, leave it in the back. But don’t come up to my window knocking and say, “Are you in? Ca…
Sleepy Cubs | America's National Parks
A black bear and her cubs – a typical litter of three. For 5 months, she hasn’t stirred. Even as their mother slumbered, the cubs nursed on a rich diet of super fatty milk. Over the winter, her own weight dropped up to 1⁄3. How she survived still stumps u…
The Benefits of Ignoring People
The Book of Genesis recounts how Noah, following God’s orders, built an ark to survive a global flood, a task he was determined to complete. But people met him with ridicule when carrying out his task, as they found it hard to believe such an event could …
Variance and standard deviation of a discrete random variable | AP Statistics | Khan Academy
In a previous video, we defined this random variable (X). It’s a discrete random variable; it can only take on a finite number of values. I defined it as the number of workouts I might do in a week. We calculated the expected value of our random variable …
Witness a humpback whale birth caught on camera in Hawaii | National Geographic
Long before us, great Travelers were crossing our oceans, risking it all to ensure the future of the next generation. This female humpback whale is exhausted; she’s journeyed 3,000 miles to escape the cold, stormy seas of Alaska and find sanctuary here in…
The President as Commander-in-Chief | American civics | US government and civics | Khan Academy
So I’m here with Jeffrey Rosen, head of the National Constitution Center in Philadelphia, and we’re continuing to talk about Article Two of the U.S. Constitution, which talks about the powers of the president. Now we’re going to focus a little bit on the …