What is the difference between a relation and a function?

A relation is any set of inputs and outputs, while a function is a specific type of relation where each input has exactly one output. Think of a relation as a general connection, like a contact list on your phone. One person's name might be connected to two different phone numbers, like a cell and a home line.

A function is much stricter. Think of a function like a student ID system. Each student ID number belongs to exactly one student. You will never punch in one student ID and get two different students' names. In math, this means every xx-value must give you exactly one yy-value.

What is a relation?

In algebra, a relation is simply a relationship between sets of information. It is most commonly represented as a set of ordered pairs (x,y)(x, y). The set of all starting xx-values is called the domain, and the set of all resulting yy-values is called the range.

Any group of points on a graph, any equation, or any table of values is a relation. There are no rules about how the inputs and outputs must connect. The input x=3x=3 could link to y=5y=5, y=10y=10, and y=2y=-2 all at the same time.

What is a function?

A function is a special, well-behaved type of relation. By definition, a function is a relation in which each element of the domain (the input) is paired with exactly one element of the range (the output).

Imagine a vending machine. If you press the button for A1A1, you expect a specific candy bar to drop. If you press A1A1 and it sometimes drops a candy bar and sometimes drops a bag of chips, the machine is broken. In math, we say it is "not a function." A true function gives a consistent, single answer for every input.

How to recognize a function

If you are looking at a list of points or a table, look closely at the xx-values. If any xx-value repeats but has different yy-values, it is not a function. If all the xx-values are unique, or if repeating xx-values give the exact same yy-value, it is a function.

If you are looking at a graph, you can use the Vertical Line Test. Imagine drawing straight vertical lines down through the graph. If any vertical line touches the graph in more than one place, a single xx-value has multiple yy-values. This means the graph represents a relation, but not a function.

Where students slip up

The most common mistake is thinking that each output (yy-value) can only be used once. Functions only restrict the inputs.

Multiple inputs are allowed to map to the exact same output. For example, think about the equation y=x2y = x^2. If you input x=2x = 2, the output is y=4y = 4. If you input x=2x = -2, the output is also y=4y = 4. This is perfectly fine. The vending machine has two buttons that both give water. It is still a function because pressing a specific button only ever does one specific thing.

Worked through

Determine whether the following relation is a function: S={(1,5),(2,3),(3,7),(1,8)}S = \{(1, 5), (2, -3), (3, 7), (1, 8)\}

First, identify all the input values (the xx-values) in the ordered pairs. The xx-values are 1,2,3,1, 2, 3, and 11.

Next, check to see if any xx-value repeats. We can see that the input 11 appears twice.

Finally, look at the outputs (the yy-values) for that repeating input. The input x=1x = 1 is paired with y=5y = 5 in the first point, but it is paired with y=8y = 8 in the last point.

Because a single input (11) maps to two different outputs (55 and 88), this relation is not a function.

Questions students ask

Ask about this topic

Where this comes from: OpenStax College Algebra · Khan Academy: Algebra 1, Functions Unit

See also