Skip to content

Function

Definition

A function f ⁣:X→Yf\colon X\to Y assigns to every input x∈Xx\in X exactly one output f(x)∈Y.f(x)\in Y\text{.} The phrase "exactly one" is essential: one input cannot be assigned two different outputs, although different inputs may share the same output.

Functions are also called maps. A function is specified by its domain, its codomain, and its assignment rule. Two functions f,g ⁣:X→Yf,g\colon X\to Y with the same domain and codomain are equal, written f=g,f=g\text{,} if f(x)=g(x)f(x)=g(x) for every x∈X;x\in X\text{;} a formula alone therefore does not determine a function.


Interpretation

A function is a rule that answers one question for each allowed input: which output belongs to it? Every input receives exactly one answer, so the output is completely determined by the input.

Two arrow diagrams between sets X and Y: a function, with exactly one arrow out of every input, and a non-function, where one input has two arrows and another has none.

In the left diagram every point of XX has exactly one arrow leaving it. Two inputs share the middle output and the top point of YY is never reached; both are allowed. In the right diagram the top input has two arrows and the middle input has none, so the rule fails in both ways and does not define a function from XX to YY.

The definition therefore makes two demands on every x∈Xx\in X: at least one output, so the rule must make sense on the whole domain, and at most one output. It demands nothing of the elements of YY. Whether every element of YY is reached, and whether it is reached only once, are separate questions, answered by surjectivity and injectivity.

A common slip is to identify a function with its formula. The rule x↦x2x\mapsto x^2 on R\mathbb{R} and the same rule on [0,+∞)[0,+\infty) are different functions: the second is injective, the first is not, since (−1)2=12(-1)^2=1^2. In the same way, ff denotes the function, while f(x)f(x) is a single number, its value at xx.

A sequence (an)(a_n) is itself a function: it assigns a term ana_n to each index nn. The idea returns in later courses too, for example as linear maps between vector spaces in Math II.


Key Results

  • Every function has a domain and a codomain.
  • The range of a function is a subset of its codomain.

Examples

  • f(x)=x2f(x) = x^2 defined on the real numbers R.\mathbb{R}\text{.}
  • f(x)=xf(x) = \sqrt{x} defined on [0,+∞).[0, +\infty)\text{.}

Prerequisites

Sources

Aliases: map, mapping Keywords: transformation Symbols: element of, infinity, real numbers, square root

Last updated: 20 October 2026 03:02