A function is a special kind of relation. Therefore, before you can understand what a function is, you must first understand what relations are.

A **relation** is a diagram, equation, or list that defines a specific relationship between groups of elements. This is a relatively formal definition for a very basic concept. Consider the relation *r* defined as:

Here, *r* expresses a relationship among five pairs of numbers; each pair is defined by a separate set of parentheses. Think of each set of parentheses as an ( *input*, *output*) pairing; in other words, the first number in each pair represents the input, and the second number is the output *r* gives for that input. For example, if you input the number −1 into *r*, the relation gives an output of 3, since the pair (−1,3) appears in the definition of *r*.

The relation *r* is not designed to accept all real numbers as potential inputs. In fact, it will accept inputs only from the set {−1, 0, 1, 2, 3}; these numbers are the first piece of each pair in the definition of *r*. That set of potential inputs is called the **domain** of *r*. The **range** of *r* is the set of possible outputs (the second number from each of the pairings): {2, 3, 5, 7, 9}. It is customary to order the sets from least to greatest.

A **function** is a relation whose every input corresponds with a single output. This is best explained visually. In Figure , you see two relations, expressed as diagrams called **relation maps**. Both have the same domain, { *A, B, C, D*}, and range, {1, 2, 3}, but relation *g* is a function, while *h* is not.

**Figure 1 **Two relations, *g* and *h*, look very similar, but *g* is a function and *h* is not. To see why, examine the mapping paths that lead from *B* in the relations.

Notice that in *h* the input *B* is paired with two different outputs, both 1 and 2. This is not allowed if *h* is to be a function. To be a function, each input is allowed to pair with only one output element. Visually, there can be only one path leading from each member of the domain to a member of the range. You may have noticed that in both relations shown in Figure , the inputs *C* and *D* result in the same output, 3. That is allowed for functions; two roads may lead *to* a single *output*, but two roads cannot lead *from* a single *input*.

A special term is reserved for a function in which every output is the result of a unique input. That is to say, there is only one road leading out from each input and only one road leading into each output. Those functions are said to be **one‐to‐one**.

If all relations were written as ordered pair or visual maps, it would be simple to tell which of them were functions. However, it would also be tedious and inconvenient to write functions that had more than a handful of domain and range elements. Therefore, most functions are written using **function notation**. Take, for example, the function *y* = *x* ^{2}. You know that *y* is a function of *x* because for every number *x* you plug into *x* ^{2}, you can get only one corresponding output. Written in function notation, that function looks like *f*( *x*) = *x* ^{2}.

*Function notation* is handy for two reasons:

- It contains the name of the function

- It's easy to tell the value you're plugging into the function

**Example 1:** Evaluate the function *f*( *x*) = 2 *x* ^{2} + *x* − 3 for *x* = −1.

Evaluating the function at *x* = −1 is the same as finding the value *f*(−1). Plug in −1 everywhere you see an *x*:

Occasionally, you'll encounter **piecewise‐defined** functions. These are functions whose defining rules change based on the value of the input, and are usually written like this:

In *f*( *x*), any input that is less than the value *a* must be plugged into *g*. For instance, if *c* < *a*, then *f*( *c*) = *g*( *c*). On the other hand, if your input is greater than or equal to *a*, *h*( *x*) gives you the correct output for *f*. Remember that the inequality restrictions are based on the number you *input*, not the output of the function.

**Example 2:** Find the following values for

*g*(−2)

The defining rule for *g* changes from *x* + 6 to *x* − 3 once your input is greater than 1. However, because the input is −2, you should stick with the first rule: *x* + 6.

*g*(1)

Note that *g* gets its value from the expression *x* + 6 when the input is less than *or equal to 1*:

*g*(5)

Now that if the input is greater than 1, you use *x* − 3 to get the value for *g*:

You now know enough to determine whether given relations possess the proper characteristics to be classified as functions.

**Example 3:** Explain why, in each of the following relations, *y* is *not* a function of *x*.

*x* ^{2} + *y* ^{2} = 9

Begin by solving for *y*:

Notice that any valid input for *x* (except for *x* = −3, 0, and 3) will result in *two* corresponding outputs. For example, if *x* = 2, then

Remember, functions can allow only one output per input.

When *x* = 0, this function has two outputs. Notice that both conditions in the piecewise definition include 0, so *y* = 3 and −1 when *x* = 0. Because one input cannot have two corresponding outputs, this is not a function.