2.1    Functions

We often use the words "depends on" in everyday conversation in sentences such as:

1. I don't know when I'll arrive. It depends on how bad the traffic is.
2. The temperature of food depends on how long it has been in the oven.
3. My course grade depends on my score on the final exam tomorrow.
In each case, we are saying that one value depends on another: arrival time depends on traffic, temperature depends on cooking time and letter grade depends on test score. In mathematics we use the term function to represent the notion that the value of one quantity is dependent upon the value of another. Thus the two statements
• My course grade depends on my score on the final exam tomorrow.
• My course grade is a function of my score on the final exam tomorrow.
would express the same idea, although the former is admittedly the more conventional usage.
 In fact all three sentences above might be rephrased using the words "is a function of" instead of "depends on." Then all would have the structure:The value of Y is a function of the value of X.One way we picture this dependence is a "function machine." A value of X is put into the machine and the corresponding value of Y is output. What is hidden inside the machine is the rule that defines the correspondence between X and Y.
From the picture of the "function machine" we can see that important elements of a function are:
• What does X, the quantity we input into the machine, represent? It might be a time, a person, money or just a number.
• What specific values of X are allowed? Perhaps some values of X should be omitted. If X is a time measurement maybe we should leave out negative values.
• What does Y, the quantity put out by the machine, represent?
• What specific values of Y can be output? If Y represents a length or an area it should never be negative.
• Just what is the rule hidden inside the machine.
In mathematics the term function is defined so as to capture the notion of dependence of one value or quantity upon another and address the important aspects listed above.

 A function from the set D into the set C is a rule that assigns a unique element of C to each element of D. The set D is called the domain of the function and C is called the codomain. The set of those elements of C that are assigned to elements of D is called the range.

Notice this definition of function does not use the work "number" since ,in general, rules can be established between two sets even if they are not sets of numbers. If, in fact, only sets of real numbers are involved we use the following wordage.

 A real-valued function defined on a set of real numbers D is a rule that assigns a unique real number to each number in D.

These two examples illustrate numerical versus non-numerical functions.

Example: Let D be the set of all persons living in your town. Let C be the set of all names of hair color. Each person is assigned a hair color. Since each person has a unique hair color this establishes a function. The underlying rule is simply to get everyone's hair color so it's not one we have to make up. The range contains those hair colors that actually appear in your town.

Example: Let D be the set of positive real numbers and C the set of real numbers. Each number x in D can be the side length of an x by x square. Assign to x the area of the square given by the formula x2. Each side length produces a unique area so this is a function. The range also consists of the positive real numbers since the square of a positive number is itself positive.

Whether a function is numerical or not we think of the elements of the domain as "input" values and the corresponding range values as "output." This helps stress the idea that the rule defining the function takes a domain value and from that produces the corresponding range value. There are two ways we commonly write real-valued functions. The differences are purely notational since the same idea of a rule underlies each.

We sometimes use one variable to denote the input and a second variable to denote the output, with a formula to show how the two quantities are related if a formula is known. In the area example above we used x to denote the side length. We could use A to represent the area of the square. In this simple rule we know that A=x2. We say that "A is a function of x." The input variable x is called the independent variable and the output variable A is called the dependent variable. There is nothing special about the choice of letters for the variables and indeed one could even choose words for the variables (as is often done in writing computer code).

A second form of notation differs as follows. We assign a letter, such as f, g, etc., to name the function. As before we choose a letter to denote the input variable. If the function name is f and the input variable is x, then the value of the function at x (i.e. the output) is denoted by f(x) (pronounced "f of x"). If we know a formula relating the output to the input, we also write down that formula. So if we choose f to name the area function for the square we write f(x)= x2. Then, for example, f(3)=32=9.

Whether one uses just a variable name such as y for the output, or the function notation f(x) for the output, they would represent the same range value. In fact we often write y = f(x), combining the two notations. One simple reason for combining the two is this. We have the simplicity of the single variable name y for speaking and manipulating on paper plus the ability to use the f(x) notation to instruct us to evaluate the function at a given value of x. Again using the area example, it is a lot easier to say or write "find f(4)" than to say or write "find the value of y= x2 when x has the value 4." The next exercise asks you do do exactly this evaluation process for a variety of functions given by formula.

In this exercise, you are given a function and asked to find the value of the function at a given value. Please note the form for entering your answer. If you are asked for the value of f(2) and this value happens to be 8 then enter f(2) = 8 as your answer.
Function Values

Before turning to graphing real-valued functions, a note on the word "unique" in the function definition. Once a value is given for an independent variable x there must be only one possible outcome y=f(x). That is the "unique" part of the definition. For this reason an equation of a circle does not represent y as a function of x. Consider the circle of radius 5, given by x2 + y2 = 25. Suppose, for example, x = 3. Then 32 + y2 = 25, so y2 = 25 - 9 = 16. At first glance, we might think that y should be 4. But it could also be -4 since (-4)2 = 16. In other words, there is a value of x for which 2 different y's work. If we want y to be a function of x we would have to select one of the two y values to be the output for the input x = 3.
One such "problematic" value of x is sufficient to violate the requirements of a function but in this circle example there are many more. Check it yourself by substituting values between 0 and 5 for x and finding different y's.

A graph of a function is essentially a drawing in the xy-plane that shows the inputs and corresponding outputs in the following sense. For each x in the domain of the function, and y = f(x) its corresponding output in the range, mark the point (x,y) in the plane. Methods for obtaining the graph of a function are discussed in the next section.
Now go through the next set of examples to get an overview of the concept of functions and their graphs, in particular the types of functions we'll be dealing with in this course.

Overview of Functions and their Graphs

There are two tests we may employ to help us decide whether a given equation describes a function:

• When you're given a graph of an equation, you may determine whether it describes a function by checking whether there is some vertical line that can be drawn that will intersect the graph at more than one point. This is called the vertical line test. If you find such a line, this means that you have found a value of x to which there correspond at least two values of y - so there is not a unique value of the "function". Therefore, the graph is not that of a function.
• The algebraic equivalent of the vertical line test is an algebraic determination whether there is any value for x for which you can find two or more values for y. For example, consider the equation of a circle centered at the origin: x2 + y2 = 8. For the value x = 2, both y = 2 and y = -2 are values that satisfy the equation. Thus this equation does not describe a function.

Is it a function?
Which of these graphs of an equation describes a function?
After you've answered correctly for one, click "Next" to get another question.

Notice that sometimes restricting the possible values of y or x or a modification of the equation can give a function where there was none previously. For example, we may modify the equation of the circle of radius 3 centered at the origin, x2 + y2 = 9, to get y = which is a function whose graph is the upper half of that circle.

The domain of a function, unless explicitly stated, is assumed to be the largest set of real numbers for which the function is defined. To determine the domain may not actually be an easy process. However, most of the functions we will deal with are given by a formula and determining the domain is made easier by remembering the following rules. If the formula for the function has a denominator then any value of the variable that makes the value of the denominator zero cannot be in the domain of the function. If the formula for the function contains a square root, then any value of the variable that makes the quantity under the square root a negative number cannot be in the domain of the function. If the formula for the function contains a square root in the denominator then any value of the variable that makes the quantity under the square root a negative number or zero cannot be in the domain of the function.

 Example: The function f(x)= 1/(x2 +x) has a denominator and so any values of x for which x2+x = 0 will not be in the domain of f. To solve this equation we first factor to get x(x+1) = 0. This equation has solutions 0 and -1. Hence the domain of f is all real numbers except 0 and -1.

Of course, if the formula for a function contains a combination of these types of terms, then you must determine the domain by considering each restriction and finding the common values of x. For example, if you find from one piece of the formula for the function that x > 4 and from another piece that x > 2 then the domain would be x > 4. As another example, suppose two parts of a formula tell you that x > 0 and x < 5, respectively. Then the domain of the function would be 0 < x < 5.

For some other functions you will encounter in these modules, such as logarithmic functions (which we will study later), you will need to know the domain of the basic function as well as any restrictions mentioned here.

What is the domain?
Here are some functions defined by formulas. Determine what the domain of each function is and click in the appropriate box. After you have the right domain for a function, click "Next" to go on to the next function.