# Functions

This unit covers the following ideas. In preparation for the quiz and exam, make sure you have a lesson plan containing examples that explain and illustrate the following concepts.
1. Describe uses for, and construct graphs of, space curves and parametric surfaces. Find derivatives of space curves, and use this to find velocity, acceleration, and find equations of tangent lines.
2. Describe uses for, and construct graphs of, functions of several variables. For functions of the form $z=f(x,y)$, this includes both 3D surface plots and 2D level curve plots. For functions of the form $w=f(x,y,z)$, construct plots of level surfaces.
3. Describe uses for, and construct graphs of vector fields.
4. If you are given a description of a vector field, curve, or surface (instead of a function or parametrization), explain how to obtain a function for the vector field, or a parametrization for the curve or surface.
You'll have a chance to teach your examples to your peers prior to the exam.

# Function Terminology

A function is a set of instructions involving two sets (called the domain and codomain). A function assigns to each element of the domain $D$ exactly one element in the codomain $R$. We'll often refer to the codomain $R$ as the target space or range. We'll write $$f\colon D\to R$$ when we want to be explicit about the domain and range of $f$.

In this class, we will study what happens when the domain and target space are subsets of ${\RR}^n$ (Euclidean $n$-space). In particular, we will study functions of the form $$f\colon {\RR}^n\to {\RR}^m,$$ when $m$ and $n$ are 3 or less. The number $n$ is the dimension of the input vector (or number of inputs). The number $m$ is the dimension of the output vector (or number of outputs). Our goal is to understand uses for each type of function and be able to construct graphs to represent the function. We will focus most of our time this semester on two- and three-dimensional problems. However, many problems in the real world require a higher number of dimensions.

When you hear the word “dimension”, it does not always represent a physical dimension, such as length, width, or height. If a quantity depends on 30 different measurements, then the problem involves 30 dimensions. As a quick illustration, the formula for the distance between two points depends on 6 numbers, so distance is really a 6-dimensional problem. As another example, if a piece of equipment has a color, temperature, age, and cost, we can think of that piece of equipment being represented by a point in four-dimensional space (where the coordinate axes represent color, temperature, age, and cost).

See Sage or Wolfram Alpha (click the links).
A pebble falls from a 64 ft tall building. Its height (in ft) above the ground $t$ seconds after it drops is given by the function $y=f(t)=64-16t^2$. What are $n$ and $m$ when we write this function in the form $f\colon {\RR}^n\to {\RR}^m$? Construct a graph of this function. How many dimensions do you need to graph this function?

# Parametric Curves: $\vec f\colon \RR \to \RR^m$

See also the Vectors chapter. There's a lot more practice of this idea in 11.1. You'll also find more practice in 13.1: 1-8. See also Larson 10.2. You can also find more practice in Larson 12.1 and 12.3.
A horse runs around an elliptical track. Its position at time $t$ is given by the function $\vec r(t)=(2\cos t, 3\sin t).$ We could alternatively write this as $x=2\cos t, y=3\sin t$.
1. What are $n$ and $m$ when we write this function in the form $\vec r\colon {\RR}^n\to {\RR}^m$?
2. Construct a graph of this function.
3. Label a few points on your graph with the corresponding time $t$. Include an arrow for the horse's direction.
4. How many dimensions do you need to graph this function?

Notice in the problem above that we placed a vector symbol above the function name, as in $\vec r\colon {\RR}^n\to {\RR}^m$. When the target space (codomain) is 2-dimensional or larger, we place a vector above the function name to remind us that the output is a vector, not just a single number.

See Sage or Wolfram Alpha. The text has more practice in 13.1: 1-8. See also Larson 12.3.
Consider the pebble from the problem above. The pebble's height was given by $y=64-16t^2$. We later find out that the pebble also has some horizontal velocity: it's moving at 3 ft/s to the right. If we let the origin be the base of the 64 ft building, then the position of the pebble at time $t$ is given by $\vec r(t) = (3t, 64-16t^2)$.
1. What are $n$ and $m$ when we write this function in the form $\vec r\colon {\RR}^n\to {\RR}^m$?
2. At what time does the pebble hit the ground (the height reaches zero)? Construct a graph of the pebble's path from when it leaves the top of the building until it hits the ground.
3. Find the pebble's velocity and acceleration vectors at $t=1$. Draw these vectors on your graph with their base at the pebble's position at $t=1$.
4. At what speed is the pebble moving when it hits the ground?

In the next problem, we keep the input as just a single number $t$, but the output is now a vector in $\RR^3$.

See Sage or Wolfram Alpha. The text has more practice in 13.1: 9-14.More practice is in Larson 12.1:9–12, 21–24, 27–32.
A jet begins spiraling upwards to gain height. The position of the jet after $t$ seconds is modeled by the equation $\vec r(t)=(2\cos t, 2\sin t, t).$ We could alternatively write this as $x=2\cos t,\, y=2\sin t,\, z=t$.
1. What are $n$ and $m$ when we write this function in the form $\vec r\colon {\RR}^n\to {\RR}^m$?
2. Construct a graph of this function by picking several values of $t$ and plotting the resulting points $(2\cos t, 2\sin t, t)$.
3. Label a few points on your graph with the corresponding time $t$. Include an arrow for the jet's direction.
4. How many dimensions do you need to graph this function?

A key general principle in the problems above (and from our discussion in class) is that to fully represent a function visually, you need to use as many dimensions as the sum of the dimension of the domain and the dimension of the codomain. We can also use an arrow or an animation (i.e., time) to represent one dimension of information.

The text has more practice in 13.1: 19-22.More practice in Larson 12.2:23–30.
Again, a jet spirals upwards. Its position is at time $t$ is $$\vec r(t)=(2\cos t, 2\sin t, t).$$ Graph this function.
1. Find the first and second derivative of $\vec r(t)$.
2. Compute the velocity and acceleration vectors at $t=\pi/2$. Place these vectors on your graph with their tails at the point corresponding to $t=\pi/2$.
3. Give an equation of the tangent line to this curve at $t=\pi/2$.

Here's an interesting parametric curve drawing a cartoon character. You can see that they can get pretty complicated.

# Parametric Surfaces: $\vec f\colon \RR^2 \to \RR^3$

We now increase the number of inputs from 1 to 2. This will allow us to graph many space curves at the same time.

See Sage or Wolfram Alpha. More practice in Larson 15.5:1–6. The jet from the problem above is actually accompanied by several jets flying side by side. As all the jets fly, they leave a smoke trail behind them. The smoke from one jet spreads outwards to mix with the neighboring jet, so that it looks like the jets are leaving a rather wide sheet of smoke behind them as they fly. The position of two of the many other jets is given by $\vec r_3(t)=(3\cos t, 3\sin t, t)$ and $\vec r_4(t)=(4\cos t,4\sin t,t)$. A function which represents the smoke stream is $\vec r(a,t)=(a\cos t, a\sin t, t)$ for $0\leq t\leq 4\pi$ and $2\leq a\leq 4$.
1. What are $n$ and $m$ when we write the function $\vec r(a,t)=(a\cos t, a\sin t, t)$ in the form $\vec r\colon {\RR}^n\to {\RR}^m$?
2. Start by graphing the position of the three jets $\vec r(2,t)=(2\cos t, 2\sin t, t)$, $\vec r(3,t)=(3\cos t, 3\sin t, t)$ and $\vec r(4,t)=(4\cos t,4\sin t,t)$.
3. Let $t=0$ and graph the curve $r(a,0)=(a,0,0)$ for $a\in[2,4]$. Then repeat this for $t=\pi/2,\pi,3\pi/2$.
4. Describe the resulting surface.

The function above is called a parametric surface. Parametric surfaces are formed by joining together many parametric space curves. Most of 3D computer animation is done using parametric surfaces. Woody's entire body in Toy Story is a collection of parametric surfaces. Car companies create computer models of vehicles using parametric surfaces, and then use those parametric surfaces to study collisions. Often the mathematics behind these models is hidden in the software program, but parametric surfaces are at the heart of just about every 3D computer model.

Consider the parametric surface $\vec r(u,v)=(u\cos v, u\sin v, u^2)$ for $0\leq u\leq 3$ and $0\leq v\leq 2 \pi$. Construct a graph of this function. To do so, let $u$ equal a constant (such as 1, 2, 3) and then graph the resulting space curve. Then let $v$ equal a constant (such as 0, $\pi/2$, etc.) and graph the resulting space curve until you can visualize the surface. [Hint: Think satellite dish.]

# Functions of Several Variables: $f\colon \RR^n \to \RR$

In this section we'll focus on functions of the form $f\colon \RR^2\to\RR^1$ and $f\colon \RR^3\to\RR^1$; we'll keep the output as a real number. In the next problem, you should notice that the input is a vector $(x,y)$ and the output is a number $z$. There are two ways to graph functions of this type. The next two problems show you how.

See Larson 13.1:33–40.
A computer chip has been disconnected from electricity and sitting in cold storage for quite some time. The chip is connected to power, and a few moments later the temperature (in Celsius) at various points $(x,y)$ on the chip is measured. From these measurements, statistics is used to create a temperature function $z=f(x,y)$ to model the temperature at any point on the chip. Suppose that this chip's temperature function is given by the equation $z=f(x,y)=9-x^2-y^2$. We'll be creating a 3D model of this function in this problem, so you'll want to place all your graphs on the same $x,y,z$ axes.
1. What is the temperature at $(0,0)$, $(1,2)$, and $(-4,3)$? See 14.1: 1-4.
2. If you let $y=0$, construct a graph of the temperature $z=f(x,0) = 9-x^2-0^2$, or just $z=9-x^2$. In the $xz$ plane (where $y=0$) draw this upside down parabola.
3. Now let $x=0$. Draw the resulting parabola in the $yz$ plane.
4. Now let $z=0$. Draw the resulting curve in the $xy$ plane.
5. Once you've drawn a curve in each of the three coordinate planes, it's useful to pick an input variable (either $x$ or $y$) and let it equal various constants. So now let $x=1$ and draw the resulting parabola in the plane $x=1$. Then repeat this for $x=2$.
6. Describe the shape. Add any extra features to your graph to convey the 3D image you are constructing. See 14.1: 37-48.
See Larson 13.1:45–56.
We'll be using the same function $z=f(x,y)=9-x^2-y^2$ as the previous problem. However, this time we'll construct a graph of the function by only studying places where the temperature is constant. We'll create a graph in 2D of the surface (similar to a topographical map).
1. See 14.1: 13-16 and 31-36.
Which points in the plane have zero temperature? Just let $z=0$ in $z=9-x^2-y^2$. Plot the corresponding points in the $xy$-plane, and write $z=0$ next to this curve. This curve is called a level curve. As long as you stay on this curve, your temperature will remain level, it will not increase nor decrease.
2. Which points in the plane have temperature $z=5$? Add this level curve to your 2D plot and write $z=5$ next to it.
3. Repeat the above for $z=8$, $z=9$, and $z=1$. What's wrong with letting $z=10$?
See 14.1: 37-48.
4. Using your 2D plot, construct a 3D image of the function by lifting each level curve to its corresponding height.
A level curve of a function $z=f(x,y)$ is a curve in the $xy$-plane found by setting the output $z$ equal to a constant. Symbolically, a level curve of $f(x,y)$ is the curve $c=f(x,y)$ for some constant $c$. A 2D plot consisting of several level curves is called a contour plot of $z=f(x,y)$.
See Sage or Wolfram Alpha. More practice is in 14.1: 37-48. See Larson 13.1:45–56.
Consider the function $f(x,y)=x-y^2$.
1. Construct a 3D surface plot of $f$. [So just graph in 3D the curves given by $x=0$ and $y=0$ and then try setting $x$ or $y$ equal to some other constants, like $x=1$, $x=2$, $y=1$, $y=2$, etc.]
2. Construct a contour plot of $f$. [So just graph in 2D the curves given by setting $z$ equal to a few constants, like $z=0$, $z=1$, $z=-4$, etc.]
3. See 14.1: 49-52.
Which level curve passes through the point $(2,2)$? Draw this level curve on your contour plot.

Notice that when we graphed the previous two functions (of the form $z=f(x,y)$) we could either construct a 3D surface plot, or we could reduce the dimension by 1 and construct a 2D contour plot by letting the output $z$ equal various constants. The next function is of the form $w=f(x,y,z)$, so it has 3 inputs and 1 output. We could write $f\colon \RR^3\to\RR^1$. We would need 4 dimensions to graph this function, but graphing in 4D is not an easy task. Instead, we'll reduce the dimension and create plots in 3D to describe the level surfaces of the function.

See Sage. Wolfram Alpha currently does not support drawing level surfaces. You could also use Mathematica or Wolfram Demonstrations. You can access more problems on drawing level surfaces in 12.6:1-44 or 14.1:53-60. See Larson 11.6 and 13.1:69–74, as well as 13.1, Example 6.
Suppose that an explosion occurs at the origin $(0,0,0)$. Heat from the explosion starts to radiate outwards. Suppose that a few moments after the explosion, the temperature at any point in space is given by $w=T(x,y,z)=100-x^2-y^2-z^2.$
1. Which points in space have a temperature of 99? To answer this, replace $T(x,y,z)$ by $99$ to get $99=100-x^2-y^2-z^2$. Use algebra to simplify this to $x^2+y^2+z^2=1$. Draw this object.
2. Which points in space have a temperature of 96? of 84? Draw the surfaces.
3. What is your temperature at $(3,0,-4)$? Draw the level surface that passes through $(3,0,-4)$.
4. The 4 surfaces you drew above are called level surfaces. If you walk along a level surface, what happens to your temperature?
5. As you move outwards, away from the origin, what happens to your temperature?
Talk about graphing functions with 4 or more variables. Show the class OsiriX as an example of graphing a 4d function (where opacity is the density of material. Also, practice sliding a plane through a 3d object to get an idea of what the contour plots are telling us.
See Sage. See Larson 11.6:7–16.
Consider the function $w=f(x,y,z)=x^2+z^2$. This function has an input $y$, but notice that changing the input $y$ does not change the output of the function.
1. Draw a graph of the level surface $w=4$. [When $y=0$ you can draw one curve. When $y=1$, you should draw the same curve. When $y=2$, again you draw the same curve. This kind of graph is called a cylinder, and is important in manufacturing where you extrude an object through a hole.]
2. Graph the surface $9=x^2+z^2$ (so the level surface $w=9$).
3. Graph the surface $16=x^2+z^2$.

Most of our examples of function of the form $w=f(x,y,z)$ can be drawn by using our knowledge about conic sections. We can graph ellipses and hyperbolas if there are only two variables. So the key idea is to set one of the variables equal to a constant and then graph the resulting curve. Repeat this with a few variables and a few constants, and you'll know what the surface is. Sometimes when you set a specific variable equal to a constant, you'll get an ellipse. If this occurs, try setting that variable equal to other constants, as ellipses are generally the easiest curves to draw.

See Sage. Remember you can find more practice in 12.6:1-44 or 14.1: 53-64. See Larson 11.6 and 13.1:69–74, as well as 13.1, Example 6. We'll have a few people present this problem.
Consider the function $w=f(x,y,z)=x^2-y^2+z^2$.
1. Draw a graph of the level surface $w=1$. [You need to graph $1=x^2-y^2+z^2$. Let $x=0$ and draw the resulting curve. Then let $y=0$ and draw the resulting curve. Let either $x$ or $y$ equal some more constants (whichever gave you an ellipse), and then draw the resulting ellipses.]
2. Graph the level surface $w=4$. [Divide both sides by $4$ (to get a 1 on the left) and the repeat the previous part.]
3. Graph the level surface $w=-1$. [Try dividing both sides by a number to get a 1 on the left. If $y=0$ doesn't help, try $y=1$ or $y=2$.]
4. Graph the level surface that passes through the point $(3,5,4)$. [Hint: what is $f(3,5,4)$?]

# Vector Fields: $\vec f\colon \RR^n\to\RR^n$

Now let's consider functions from $\RR^2$ to $\RR^2$ and functions from $\RR^3$ to $\RR^3$. Depending on the application, we may view these functions as either vector fields or transformations of 2d or 3d space. We'll study vector fields in this section and transformations in the next chapter.

A vector field $\vec F(x,y)=(M,N)$ is visualized by putting the vector $(M,N)$ at the point $(x,y)$, so you end up with a picture with a lot of vectors. These are often used to visualize flows of air or liquids. For example, see VisLab, the NOAA visualizations, Tim Urness's research page, or the International Visualization Challenge. There are also lots of other visualizations challenges. Figuring out how to convey information in an asthetic and effective way is a tough challenge.

See Sage or Wolfram Alpha. The computer shrinks the vectors by the same amount so they don't overlap. See 16.2: 39-44 for more practice. See Larson 15.1:1–19.
Consider the vector field $\vec F(x,y)=(2x+y,x+2y)$. In this problem, you will construct a graph of this vector field by hand.
1. Compute $\vec F(1,0)$. Then draw the vector $F(1,0)$ with its base at $(1,0)$.
2. Compute $\vec F(1,1)$. Then draw the vector $F(1,1)$ with its base at $(1,1)$.
3. Repeat the above process for the points $(0,1)$, $(-1,1)$, $(-1,0)$, $(-1,-1)$, $(0,-1),$ and $(1,-1)$. Remember, at each point draw a vector.
Change the Sage code in the link in the last problem to check your work. See 16.2: 39-44 for more practice.
See Larson 15.1:1–19.
Consider the vector field $\vec F(x,y)=(-y,x)$. Construct a graph of this vector field. Remember, the key to plotting a vector field is: at the point $(x,y)$, draw the vector $\vec F(x,y)$ with its base at $(x,y)$. Plot at least 8 vectors (a few in each quadrant), so we can see what this field is doing.

Ask me in class about other ways to visualize 2d vector fields, like streamline plots.

We can also visualize 3d vector fields like $\vec F(x,y,z)=(y,z,x)$ by plotting a grid of 3d vectors in $\RR^3$. Here's an example.

How do we get the equation of a vector field from a description of what the field does? The following problem will help you develop the gravitational vector field.

Use Sage to plot your vector fields. See 16.2: 39-44 for more practice. See Larson 15.1:1–19.
Do the following:
1. Let $P=(x,y,z)$ be a point in space. At the point $P$, let $\vec F(x,y,z)$ be the vector which points from $P$ to the origin. Give a formula for $\vec F(x,y,z)$.
2. Give an equation of the vector field where at each point $P$ in the plane, the vector $\vec F_2(P)$ is a unit vector that points towards the origin.
3. Give an equation of the vector field where at each point $P$ in the plane, the vector $\vec F_3(P)$ is a vector of length 7 that points towards the origin.
4. Give an equation of the vector field where at each point $P$ in the plane, the vector $\vec G(P)$ points towards the origin, and has a magnitude equal to $1/d^2$ where $d$ is the distance to the origin.

# Summary

We've covered the following types of functions in the problems above.

Domain/RangeExampleDescription
$f\colon \RR\to\RR$$y=f(x)single-variable function, like in calculus 1 f\colon \RR\to\RR^2$$\vec r(t)=(x,y)$2D parametric curves
$f\colon \RR\to\RR^3$$\vec r(t)=(x,y,z)3D parametric curves f\colon \RR^2\to\RR^3$$\vec r(u,v)=(x,y,z)$parametric surfaces
$f\colon \RR^2\to\RR$$z=f(x,y)functions of two variables f\colon \RR^3\to\RR$$w=f(x,y,z)$functions of three variables
$\vec F\colon \RR^2\to\RR^2$$\vec F(x,y)=(u,v)2D vector fields \vec F\colon \RR^3\to\RR^3$$\vec F(x,y,z)=(u,v,w)$3D vector fields