Relations and the Definition of a Function

A function is a rule that assigns to each input exactly one output, while a relation is any set of ordered pairs connecting inputs with outputs. In brief: every function is a relation, but not every relation is a function. The relation {(1, 2), (2, 4), (3, 6)} is a function, whereas {(1, 2), (1, 5)} is not, because the input 1 has two different outputs.

The function concept is the central idea of algebra and calculus. It describes dependence: the price depends on the weight, the distance depends on the time. This guide explains relations, gives the exact definition of a function, shows four ways to test whether a relation is a function and lists the standard notation.

What is a relation?

A relation between two sets is a collection of ordered pairs (x, y), where x comes from the first set and y from the second. For instance, “is a student of” connects people with teachers, and “is less than” connects numbers with larger numbers. In algebra, relations are usually sets of number pairs, listed in a table, shown on a graph or given by an equation such as x + y = 5.

The set of all first coordinates is the domain and the set of all second coordinates is the range.

What is the definition of a function?

A function is a relation in which every element of the domain is paired with exactly one element of the range. The input is called the independent variable and the output the dependent variable, because it depends on the input.

It is allowed that different inputs have the same output. The function y = x2 gives 4 for both x = 2 and x = −2. What is not allowed is that one input leads to two outputs. For this reason y = x2 is a function, but the relation x = y2 is not: the input x = 4 gives y = 2 and y = −2.

How do you check whether a relation is a function?

  1. List of pairs: check whether any x-value appears twice with different y-values.
  2. Mapping diagram: each input should have exactly one arrow leaving it.
  3. Equation: solve for y. If each x gives only one y, the relation is a function.
  4. Graph: use the vertical line test. If every vertical line meets the graph at most once, the graph represents a function.

Example 1: pairs

{(2, 5), (3, 5), (4, 7)}: the inputs 2, 3 and 4 are all different, so this is a function, even though the output 5 appears twice.

Example 2: equation

Does x2 + y2 = 25 define y as a function of x? Solving gives y = ±√(25 − x2). For x = 3 there are two outputs, 4 and −4. So it is not a function. It is a circle, which fails the vertical line test.

Example 3: absolute value

y = |x| is a function: each x gives one nonnegative output. Its graph is a V shape, and every vertical line meets it once.

In which ways can a function be represented?

What does function notation f(x) mean?

The notation f(x) is read “f of x” and means the output of the function f for the input x. It does not mean f multiplied by x. If f(x) = 2x + 3, then f(4) = 2 · 4 + 3 = 11 and f(−1) = 2 · (−1) + 3 = 1. The input can be an expression: f(a + 1) = 2(a + 1) + 3 = 2a + 5.

Other letters are common as well: g, h, or a name that describes the meaning, such as C(n) for cost. The statement “f: A → B” says that f assigns to every element of A an element of B.

Examples: function or not?

Relations and whether they are functions of x
Relation Function? Reason
y = 2x + 1YesOne output for every x
y = x2YesDifferent x may share an output
x = y2Nox = 4 gives y = 2 and y = −2
x2 + y2 = 1NoCircle fails vertical line test
y = √xYesThe root symbol means one value
{(1, 3), (1, 4)}NoInput 1 has two outputs
y = 5YesConstant function

Where does the function concept come from?

Tables of values, such as ancient tables of squares and trigonometric chords, contained the idea of dependence long before the word existed. The term “function” was introduced by Gottfried Wilhelm Leibniz in the late seventeenth century, and Leonhard Euler introduced the notation f(x) in the eighteenth century. The modern definition with sets of ordered pairs was developed in the nineteenth and twentieth centuries, as mathematicians needed a precise and general idea.

Where are functions used today?

A taxi fare, a phone tariff and a postal rate are functions of distance, data volume and weight. In science, the position of a falling object is a function of time, s(t) = 4.9t2 meters in the first seconds. Computer programs are also functions: they transform inputs into outputs, and a spreadsheet formula is a function of its cells.

Which mistakes are common?

Rejecting a function because outputs repeat

Repeated outputs are allowed. Only repeated inputs with different outputs break the rule.

Reading f(x) as a product

f(3) is the value at x = 3, not f · 3.

Applying the vertical line test to the wrong axis

The vertical line test checks whether y is a function of x. A horizontal line test checks something different, namely one-to-one behaviour.

Assuming every equation is a function

An equation relates variables. It defines y as a function of x only if each x gives exactly one y.