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.

### Course: Multivariable calculus>Unit 1

Lesson 6: Visualizing multivariable functions (articles)

# Multidimensional graphs

Examples and limitations of graphing multivariable functions.

## What we're building to

• Graphing a function with a two-dimensional input and a one-dimensional output requires plotting points in three-dimensional space.
• This ends up looking like a surface in three-dimensions, where the height of the surface above the $xy$-plane indicates the value of the function at each point.

## Reviewing graphs of single-variable functions

Graphs are, by far, the most familiar way to visualize functions for most students. Before generalizing to multivariable functions, let's quickly review how graphs work for single-variable functions.
Suppose our function looks like this:
$\begin{array}{r}\phantom{\rule{1em}{0ex}}f\left(x\right)=-{x}^{2}+3x+2\end{array}$
To plot a single input, like $x=1$, we first compute $f\left(1\right)$:
$\begin{array}{rl}\phantom{\rule{1em}{0ex}}f\left(1\right)& =-{x}^{2}+3x+2\\ & =-\left(1{\right)}^{2}+3\left(1\right)+2\\ & =4\end{array}$
Then we mark the point $\left(1,f\left(1\right)\right)$ on the $xy$-plane. In this case, that means marking $\left(1,4\right)$.
When we do this for all possible inputs $x$, not just $1$, we see what all the points of the form $\left(x,f\left(x\right)\right)$ look like.
Unless $f\left(x\right)$ is some exotic or sporadic function that gives wildly different values as $x$ changes slightly, the result will be a smooth-looking curve.

So what can we do for functions with a two-dimensional input and a one-dimensional output? Perhaps something like this:
$f\left(x,y\right)=\left(x-2{\right)}^{2}+\left(y-2{\right)}^{2}+2$
Associating inputs with outputs requires three numbers—two for the inputs and one for the output.
Inputs $\left(x,y\right)$Output $f\left(x,y\right)$
$\left(0,0\right)$$10$
$\left(1,0\right)$$7$
$\left(1,2\right)$$3$
$\phantom{\rule{1em}{0ex}}⋮$$⋮$
To represent these associations using a graph, we plot points in three dimensions.
• The association $\left(0,0\right)\to 10$ is plotted with the point $\left(0,0,10\right)$.
• The association $\left(1,0\right)\to 7$ is plotted with the point $\left(1,0,7\right)$.
• In general, the goal is to represent all points of the form $\left(x,y,f\left(x,y\right)\right)$ for some pair of numbers $x$ and $y$.
The resulting graph is shown below. The video shows this graph rotating, which hopefully will help you get a feel for the three-dimensional nature of it. You can also see the $xy$-plane—which is now the input space—below the graph.
This means for any given point $\left(x,y\right)$ on the plane, the vertical distance between that point and the graph indicates the value of $f\left(x,y\right)$. That vertical direction is usually referred to as the $z$-direction, and the third axis which is perpendicular to the $xy$-plane is called the $z$-axis.
As long as the value of $f\left(x,y\right)$ changes continuously as $x$ and $y$ change values, which is almost always the case in functions we deal with in practice, the graph ends up looking like some sort of​ surface.

## Example 1: The bell curve

Function: $f\left(x,y\right)={e}^{-\left({x}^{2}+{y}^{2}\right)}$
Graph:
Let's analyze what's going on with this function. First, let's look inside the exponent of ${e}^{-\left({x}^{2}+{y}^{2}\right)}$ and think about the value ${x}^{2}+{y}^{2}$.
Question: How can you interpret the value ${x}^{2}+{y}^{2}$?

When the point $\left(x,y\right)$ is far from the origin, the function ${e}^{-\left({x}^{2}+{y}^{2}\right)}$ will look like ${e}^{\text{(some big negative number)}}$, which is nearly zero. This means the distance between the graph and the $xy$-plane at those points will be tiny. When $x=0$ and $y=0$, on the other hand, ${e}^{-\left({x}^{2}+{y}^{2}\right)}={e}^{-0}=1$, which is what gives us the bulge in the middle.
Reflection Question: The graph above has rotational symmetry, in the sense that it will look the same if we rotate it in any way about the $z$-axis. Why is this?

## Example 2: Waves

Function: $f\left(x,y\right)=\mathrm{cos}\left(x\right)\cdot \mathrm{sin}\left(y\right)$
Graph:
One way to get an intuition for the function $f\left(x,y\right)=\mathrm{cos}\left(x\right)\mathrm{sin}\left(y\right)$—and multivariable functions in general—is to see what happens when one of the inputs is held constant.
For example, what happens when we fix the value of $x$ to be $2$? Usually, we are plotting all the points that look like this:
By holding $x$ constant at $2$, we are limiting our view to points that look like this:
There is a very nice way to interpret this geometrically:
The points in space where $x=2$, which is to say all the points of the form $\left(2,y,z\right)$, make up a plane. Why? Imagine slicing the graph with this plane. The points where the plane and the graph intersect—drawn in red above—are the points on our graph where $x=2$.
So why would this be helpful for understanding the graph?
We have basically turned the multivariable function $f\left(x,y\right)=\mathrm{cos}\left(x\right)\mathrm{sin}\left(y\right)$ into a single variable function:
$\begin{array}{rl}\phantom{\rule{1em}{0ex}}g\left(y\right)& =\mathrm{cos}\left(2\right)\mathrm{sin}\left(y\right)\\ & \approx -0.42\mathrm{sin}\left(y\right)\end{array}$
In fact, the curve we get from slicing the three-dimensional graph at $x=2$ has the same shape as the two-dimensional graph of $g\left(y\right)$.
In this way, you can understand the three-dimensional graph of a multivariable function one slice at a time by holding one variable constant and looking at the resulting two-dimensional graph.

## Example 3: One input, two outputs

You can also graph a function with a one-dimensional input and a two-dimensional output—although, for whatever reason, this is not commonly done.
Function: $f\left(x\right)=\left({x}^{2},\mathrm{sin}\left(x\right)\right)$
Points plotted: $\left(x,{x}^{2},\mathrm{sin}\left(x\right)\right)$
Graph:
In this case, only $x$ runs freely, while the $y$ and $z$ values on the graph are both dependent on $x$.
If we rotate the image so we can look squarely at the $xy$-plane, the graph looks like $f\left(x\right)={x}^{2}$. Another way to say this is that when we project the graph onto the $xy$-plane, it gives the graph of $f\left(x\right)={x}^{2}$.
Similarly, rotating the image so that we're looking squarely at the $xz$-plane makes the image look like the graph of $f\left(x\right)=\mathrm{sin}\left(x\right)$.
In other words, this function $f\left(x\right)=\left({x}^{2},\mathrm{sin}\left(x\right)\right)$ is a way to combine the two functions $f\left(x\right)={x}^{2}$ and $f\left(x\right)=\mathrm{sin}\left(x\right)$ into one, and its graph captures the information of both in one image.

## Limitations

As soon as you try to apply this process to functions with higher-dimensional inputs or outputs, you'll run out of dimensions which you can comfortably visualize.
For instance, consider the function $f\left(x,y\right)=\left({x}^{2},{y}^{2}\right)$ with a two-dimensional input and a two-dimensional output. Graphing it would require four dimensions of space! This is because we would need to plot all points of the form $\left(x,y,{x}^{2},{y}^{2}\right)$.
In practice, when people think about graphs of higher dimensional functions, like $f\left(x,y,z\right)={x}^{2}+{y}^{2}+{z}^{2}$, they usually start by considering graphs of some simpler function with a two-dimensional input and one-dimensional output like $f\left(x,y\right)={x}^{2}+{y}^{2}$. This is a sort of conceptual prototype.
Such a prototype can help make sense out of certain operations, and can give you a feel for what starts to happen as your input space becomes multidimensional. At the end of the day, the actual computations are performed purely symbolically for the higher dimensional function.

## Want to join the conversation?

• can anyone show me how can i plot these 3d graphs on matlab or mathematica or maxima or scilab or anyother app? :(
• can you make everything a little clearer? I am having trouble understanding
• In order to discriminate what each value (or set of values), when pumped into the function, will return, you must have one dimension per variable.

Take this analogy: you have a bag of apples, and a bag of oranges. You want to express how many you gain per second, at any given second, and make a model of it. So you section the floor into "blocks" and label each block with a time. Then you take however many apples, and however many bananas that you gained and place a apple or banana in that section, respectively.
We can't display how many apples AND bananas we gained by only placing apples in the marked off section: we need both apples AND bananas so people can discriminate between them, right? Same thing with a graph. We can't display two values with only one dimension: we need (at least) one dimension per value.
All is great if we only have 2 or 3 values in total, but what happens when we get to 4? Or 5? Or 100? Can you imagine a 100 dimension grid? I can't.

I hope I helped. Please tell me if I completely missed what you were struggling with.
• In the second paragraph under the header 'Limitations', f(x,y) = (x^2,y^2) is said to be a function of two inputs and one output, while in the third paragraph, f(x,y,) = (x^2 + y^2) is said to be a function of two inputs and one output.

I don't understand the how f(x,y,) can represent either one output, or two. Also, I don't understand why different notation is used between (x^2,y^2) and (x^2 + y^2) if they are both two inputs. Sorry if the question is unclear or doesn't make sense!
• Hi there, do not get confused, output is given in the form of f(x,y) this means that we are getting two outputs by putting the value of x and y in to the function, so this function produces two values one is x and y for each given or certain value of x and y. Eg: F(x,y) = sin(x) , tg (y) here I have independent values x and y this is so clear, to my function I am producing one sin(x) output for x values, and one tg (y) output for any y. Pay attention; If I write F(x,y) = sin(x).tg(y) in this case my function returns only one value for each given x and y. ( dot and semicolon)
• Shouldn’t the function with two outputs and one input, when looked at so only the x and z plane are visible, look like a sinusoidal function whose period decreases as distance from the origin increases?
• In example 3, what would the image look like if we looked at it from the yz plain?
• In the 𝑦𝑧-plane, the points plotted are (𝑥², sin(𝑥)),
which means that the curve would look like the functions
𝑓₁(𝑥) = sin(√𝑥) and 𝑓₂(𝑥) = −sin(√𝑥).
• In example 3, why would f(x) = sin(x) outputs in xz plane ? Why not in xy, like f(x) = x² ?
• because in xy plane only parabola is getting formed do a little math on this you will get it
(1 vote)
• What is the difference between a surface and curve? Thanks
(1 vote)
• The curver is a curved line in the multi-dimentional space, while the surface typically has more dimensions. You've already seen 2-dimentional surfaces above. Also for example there exists an opinion that our universe is a 3-dimentional surface wrapping 4-dimentional sphere of space-time. I hope I gave you a clue :)