Functions

 

One precise definition of a function is an ordered triple of sets, written (X, Y, F), where X is the domain, Y is the codomain, and F is a set of ordered pairs (a, b). In each of the ordered pairs, the first element a is from the domain, the second element b is from the codomain, and a necessary condition is that every element in the domain is the first element in exactly one ordered pair. The set of all b is known as the image of the function, and need not be the whole of the codomain. Many authors use the term "range" to mean the image, while some use "range" to mean the codomain.

The notation ƒ:XY indicates that ƒ is a function with domain X and codomain Y, and the function f is said to map or associate elements of X to elements of Y.

If the domain and codomain are both the set of real numbers, using the ordered triple scheme we can, for example, write the function y = x2 as

\left( \mathbb{R}, \mathbb{R}, \left\{ \left( x, x^2\right) : x \in \mathbb{R} \right\} \right) ,

In most situations, the domain and codomain are understood from context, and only the relationship between the input and output is given.

In set theory especially, a function f is often defined as a set of ordered pairs, with the property that if (x,a) and (x,b) are in f, then a = b. In this case statements such as (2,3) є f are appropriate when, say, f is defined by f(x) = x + 1, for all x є R.

The graph of a function is its set of ordered pairs. Part of such a set can be plotted on a pair of coordinate axes; for example, (3, 9), the point above 3 on the horizontal axis and to the right of 9 on the vertical axis, lies on the graph of y = x2.

A specific input in a function is called an argument of the function. For each argument value x, the corresponding unique y in the codomain is called the function value at x, output of ƒ for an argument x, or the image of x under ƒ. The image of x may be written as ƒ(x) or as y.

A function can also be called a map or a mapping. Some authors, however, use the terms "function" and "map" to refer to different types of functions. Other specific types of functions include functionals and operators.

A function is a special case of a more general mathematical concept, the relation, for which the restriction that each element of the domain appear as the first element in one and only one ordered pair is removed. In other words, an element of the domain may not be the first element of any ordered pair, or may be the first element of two or more ordered pairs. A relation is "single-valued" when if an element of the domain is the first element of one ordered pair, it is not the first element of any other ordered pair. A relation is "left-total" or simply "total" if every element of the domain is the first element of some ordered pair. Thus a function is a total, single-valued relation.

In some parts of mathematics, including recursion theory and functional analysis, it is convenient to study partial functions in which some values of the domain have no association in the graph; i.e., single-valued relations. For example, the function f such that f(x) = 1/x does not define a value for x = 0, and so is only a partial function from the real line to the real line. The term total function can be used to stress the fact that every element of the domain does appear as the first element of an ordered pair in the graph. In other parts of mathematics, non-single-valued relations are similarly conflated with functions: these are called multivalued functions, with the corresponding term single-valued function for ordinary functions.

Many operations in set theory, such as the power set, have the class of all sets as their domain, and therefore, although they are informally described as functions, they do not fit the set-theoretical definition outlined above, because a class is not necessarily a set.

 

Notation

Formal description of a function typically involves the function's name, its domain, its codomain, and a rule of correspondence. Thus we frequently see a two-part notation, an example being

\begin{align}
f\colon \mathbb{N} &\to \mathbb{R} \\
n &\mapsto \frac{n}{\pi}
\end{align}

where the first part is read:

  • "ƒ is a function from N to R" (one often writes informally "Let ƒ: XY" to mean "Let ƒ be a function from X to Y"), or
  • "ƒ is a function on N into R", or
  • "ƒ is an R-valued function of an N-valued variable",

and the second part is read:

  •  n \, maps to  \frac{n}{\pi}. \,\!

Here the function named "ƒ" has the natural numbers as domain, the real numbers as codomain, and maps n to itself divided by π. Less formally, this long form might be abbreviated

 f(n) = \frac{n}{\pi} , \,\!

where f(n) is read as "f as function of n" or "f of n". There is some loss of information: we no longer are explicitly given the domain N and codomain R.

It is common to omit the parentheses around the argument when there is little chance of confusion, thus: sin x; this is known as prefix notation. Writing the function after its argument, as in x ƒ, is known as postfix notation; for example, the factorial function is customarily written n!, even though its generalization, the gamma function, is written Γ(n). Parentheses are still used to resolve ambiguities and denote precedence, though in some formal settings the consistent use of either prefix or postfix notation eliminates the need for any parentheses.

 

 Functions with multiple inputs and outputs

The concept of function can be extended to an object that takes a combination of two (or more) argument values to a single result. This intuitive concept is formalized by a function whose domain is the Cartesian product of two or more sets.

For example, consider the function that associates two integers to their product: ƒ(x, y) = x·y. This function can be defined formally as having domain Z×Z , the set of all integer pairs; codomain Z; and, for graph, the set of all pairs ((x,y), x·y). Note that the first component of any such pair is itself a pair (of integers), while the second component is a single integer.

The function value of the pair (x,y) is ƒ((x,y)). However, it is customary to drop one set of parentheses and consider ƒ(x,y) a function of two variables, x and y. Functions of two variables may be plotted on the three-dimensional Cartesian as ordered triples of the form (x,y,f(x,y)).

The concept can still further be extended by considering a function that also produces output that is expressed as several variables. For example, consider the integer divide function, with domain Z×N and codomain Z×N. The resultant (quotient, remainder) pair is a single value in the codomain seen as a Cartesian product.

(Wikipedia, 2011b)