Main content

## Visualizing scalar-valued functions

# Introduction to 3d graphs

## Video transcript

- [Voiceover] Hello everyone. So what I'd like to do here is to describe how we think about
three-dimensional graphs. Three-dimensional graphs
are a way that we represent certain kind of multi-variable function that kind of has two inputs, or rather a two-dimensional input, and then one-dimensional
of output of some kind. So the one that I have pictured here is f of (x, y) equals x
squared plus y squared. And before talking
exactly about this graph, I think it would be helpful, by analogy, we take a look at the
two-dimensional graphs and kinda remind ourselves how those work, what it is that we do,
because, it's pretty much the same thing in three-dimensions, but it takes a little bit
more of visualization. So the two-dimensional graphs, they have some kind of function, you know, let's see you have f of
x is equal to x squared, and anytime you visualizing
a function, you trying to understand the relationship between the inputs and the outputs. And here those are both just numbers, so you know you input a number like two, and it's gonna output four, you know you input negative
one it's gonna output one. And you're trying to
understand all the possible input-output pairs. And the fact that we can do this, that we can get a pretty
good intuitive feel for every possible input-output
pair is pretty incredible, the way we go about this
with graphs is you think we just plotting these
actual pairs, right? So you're gonna plot the
point, let's say we are gonna plot the point (2,4), so we
may kind of mark our graph, two here, one, two, three, four, so you wanna mark somewhere here (2,4), and that represents an input-output pair. And if you do that with,
you know, negative one, one, you go negative one, one. And when you do this for every
possible input-output pair, what you end up getting, I
might not draw this super well, is some kind of smooth curve. The implication for doing this
is that we typically think of what is on the x-axis as
being where the inputs live, you know, this would be, we
think of as the input one, and this is the input two, and so on, and then you think of the
output as being the height of the graph above each point. But this is kind of a
consequence of the fact where we just listing
all of the pairs here. Now if we go to the world
of multi-variable functions, you know, not gonna show
the graph right now, let's just think we've got
three-dimensional space at out disposal to do with what we will. We still want to understand
the relationship between inputs and outputs of
this guy, but this case, inputs are something that we
think of as pair of points, we might have a pair of points like (1,2), and the output there is gonna be one squared plus two squared,
and that equals is five. So how do we visualize that? Well if we wanna pair these
things together, the natural way to do that is to think of
a triplet of some kind. So in this case, you wanna
plug the triplet (1, 2, 5), and to do that in three-dimensions, we'll take a look over
here, we think of going one in the x direction, this
axis here is the x-axis, so we want to move distance one there, and we want to go two in the y direction, so we kinda think of
going distance two there, and then five up, and then that's gonna give us some
kind of point, right? So we think this point in space and that's a given input-output pair. But we could do this for a lot, right, a couple different
points that you might get if you start plotting
various different ones, look something like this,
and of course there is infinitely many that you can
do and it'll take forever if you try to just draw each
one in three-dimensions, but what's really nice here
is that you know get rid of those lines, if you imagine doing this for all of the infinite
many pairs of inputs that you could possibly have,
you end up drawing a surface. So in this case the surface
kind of looks like a three-dimensional parabola,
that's no coincidence, it has to do with the
fact that we are using x squared and y squared here. And now the inputs like (1,
2), we think of as being on the xy-plane, right? So you think of the inputs living here, and then what corresponds
to the output is that height of a giving point
above the graph, right? So it's very similar to
two-dimensions, you think, you know, we think of the
inputs as being on one axis, and the height gives the output there. So just to give an example of what the consequence of this
is, I want you to think about what might happen if we change
our multi-variable function a little bit, and we multiply
everything by half, right? So I'll draw in red here, let's
see that we have a function, but I'm gonna change it so
that it outputs one half of x squared plus y squared. What's gonna be the shape of
the graph for that function? And what it means is the
height of every point above this xy-plane is gonna
have to get cut in half. So it's actually just the modification of what we already have,
but everything kind of sloops on down to be
about half of what it was. So in this case instead
of that height being five, it'll be two-point-five. You could imagine, let's
say we did this, you know, is even more extreme,
instead of saying one-half, you cut it down by like one-twelfth, maybe I'll use the same
color, by one-twelfth, that would mean that everything, you know, sloops very flat, very flat
and close to the xy-plane. So the graph being very
close to xy-plane like this corresponds to very small outputs. And one thing that I'd like
to caution you against, it's very tempting to try to think of every multi-variable function as a graph, cause we are so used to
graphs in two-dimensions and we are so used to
trying to find analogies between two-dimensions and
three-dimensions directly, but the only reason that
this works is because if you take the number of
dimension in the input, two-dimensions, and then
the number of dimensions in the output, one-dimension,
it was reasonable to fit all of that into
three, which we could do. But imagine if you have
a multi-variable function with, you know, a three-dimensional input, and a two-dimensional
output, that would require a five-dimensional graph,
but we are not very good at visualizing things like that. So there's lots of other
methods, and I think it's very important to
kinda of open you mind to what those might be. In particular, another one
that I'm gonna go through soon, lets us think about 3-D graphs but kind of in a two-dimensional setting,
and we are just gonna look at the input space,
that's called a contour map. Couple of other ones,
like parametric functions, you just look in the output space; things like vector space, you kind of look at the input
space but get all the outputs. There's lots of different
ways, I'll go over those in the next few videos. And that's three-dimensional graphs.