# Multivariable Functions

Many people describe a function as “black box” in which something goes in (an input), is transformed, and comes out as something else (an output).

A *multivariable function* takes a *vector* of inputs and returns a *real number* as output. For example, $f(x,y) = x^2 + y^2$ is a multivariable function: if you input the vector $(4,3)$ into the function you get the real number $25$ out.

## Plotting a multivariable function with two inputs

In this special case of a function of two variables, we can create a three-dimensional graph showing the inputs as an $(x,y)$ point on a Cartesian plane, and the output as a vertical $z$ value. In this way, a plot of a multivariable function is a *surface plot*, like the one below:

## Level sets of a multivariable function with two inputs

Another object of interest is the set of all points which have a certain height, or “level.” These are called *level sets*; the level set for some level $z$ can be expressed mathematically as
\(\text{Level set for }z = \{(x,y) | f(x,y) = z\}\)
Visually, if we imagine a horizontal plane with a height of $z$, the level set for $z$ is where that plane intersects the surface plot of the function $f(x,y)$:

## Contour maps of a multivariable function with two inputs

Drawing 3D graphs is hard, and often unimportant after you’ve gotten an initial intuition for what’s going on in three dimensions. We’ll therefore generally visualize the three-dimensional function in our normal two-dimensional space by thinking about a projection of the level sets onto the $x-y$ plane.

To see how this works, click the “Show 2D Projection” box in the diagram above. This draws the level set on the plane; it’s the same as if you shone a light from directly above the graph, and looked at the shadow that fell on the plane.

We can do this for any number of values of $z$, of course, and repeating the process for a number of values of $z$ gives us a *contour map* of the function. This is just like a topographical map of a mountain, which shows the sets of points which share an altitude, displayed on a paper map.