# Relations and Functions

Let’s start by saying that a **relation** is simply a set or collection of ordered pairs. Nothing really special about it. An ordered pair, commonly known as a point, has two components which are the [latex]x[/latex] and [latex]y[/latex] coordinates.

This is an example of an ordered pair.

## Main Ideas and Ways How to Write or Represent Relations

As long as the numbers come in pairs, then that becomes a relation. If you can write a bunch of points (ordered pairs) then you already know how a relation looks like. For instance, here we have a relation that has five ordered pairs written in set notation using curly braces.

**Relation in set notation**:

However, aside from set notation, there are other ways to write this same relation. We can show it in a table, plot it on the [latex]xy[/latex]-axis, and express it using a mapping diagram.

**Relation in table**

**Relation in graph**

**Relation in mapping diagram**

We can also describe the domain and range of a given relation.

- The
**domain**is the set of all [latex]x[/latex] or input values. We may describe it as the collection of the*first values*in the ordered pairs. - The
**range**is the set of all [latex]y[/latex] or output values. We may describe it as the collection of the*second values*in the ordered pairs.

So then in the relation below

our domain and range are as follows:

When listing the elements of both domain and range, get rid of duplicates and write them in increasing order.

## What Makes a Relation a Function?

On the other hand, a **function** is actually a “special” kind of relation because it follows an extra rule. Just like a relation, a function is also a set of ordered pairs; however, every [latex]x[/latex]-value must be associated to only one [latex]y[/latex]-value.

Suppose we have two relations written in tables,

- A relation that is
**not a function**

Since we have repetitions or duplicates of [latex]x[/latex]-values with different [latex]y[/latex]-values, then this relation ceases to be a function.

- A relation that is
**a function**

This relation is definitely a function because every [latex]x[/latex]-value is unique and is associated with only one value of [latex]y[/latex]. Because of this specific property, a relation behaves well. As a result, a function can be thought of as a **well-behaved relation**.

So for a quick summary, if you see any duplicates or repetitions in the [latex]x[/latex]-values, the relation is not a function. How about this example though? Is this not a function because we have repeating entries in [latex]x[/latex]?

Be very careful here. Yes, we have repeating values of [latex]x[/latex] but they are associated with the same value of [latex]y[/latex]. The point (1,5) shows up twice, while the point (3,-8) is written three times. This table can be cleaned up by writing a single copy of the repeating ordered pairs.

The relation is now clearly a function!

So in summary, every function is a relation but **not** all relations are functions. I hope the diagram below clearly illustrates the concept.

### Examples of How to Determine if a Relation is also a Function

Let’s go over a few more examples by identifying if a given relation is a function or not.

**Example 1:** Is the relation expressed in the mapping diagram a function?

Each element of the domain is being traced to one and only element in the range. However, it is okay for two or more values in the domain to share a common value in the range. That is, even though the elements 5 and 10 in the domain share the same value of 2 in the range, this relation is still a function.

**Example 2:** Is the relation expressed in the mapping diagram a function?

What do you think? Does each value in the domain point to a single value in the range? Absolutely! There’s nothing wrong when four elements coming from the domain are sharing a common value in the range. This is a great example of a function as well.

**Example 3:** Is the relation expressed in the mapping diagram a function?

Messy? Yes! Confusing? Not really. The only thing I am after is to observe if an element in the domain is being “greedy” by wanting to be paired with more than one element in the range. The element [latex]15[/latex] has two arrows pointing to [latex]7[/latex] and [latex]9[/latex]. This is a clear violation of the requirement to be a function. A function is well behaved, that is, each element in the domain must point to one element in the range. Therefore, this relation is **not a function**.

**Example 4:** Is the relation expressed in the mapping diagram a function?

If you think example #3 was bad, this example is the absolute worst! A single element in the domain is paired with four elements in the range. Remember, if an element in the domain is associated with more than one element in the range, the relation is automatically disqualified as a function. Thus, this relation is absolutely **not a function**.