Let XX and YY be sets and P(x,y)P(x,y) be a predicate depending on x∈Xx \in X and y∈Yy \in Y such that ∀x∈X\forall x \in X there is exactly one y∈Yy \in Y for which P(x,y)P(x,y) is true. A function f:X→Yf : X \rightarrow Y defined by P(x,y)P(x,y) maps any input x∈Xx \in X to an output f(x)∈Y.f(x) \in Y.

y=f(x)⇔P(x,y)y=f(x) \Leftrightarrow P(x,y)

XX is the domain and YY is the codomain of the function f.f.

If f:X→Yf: X \rightarrow Y is a function with domain XX and codomain YY and S⊆X,S \subseteq X, the image of SS under f,f, f(S),f(S), is the subset of elements in YY that were mapped from S.S.

f(S):={f(x)∈Y:x∈S}f(S) := \{f(x) \in Y : x \in S\}

If S⊆Y,S \subseteq Y, the inverse image of SS under f,f, f−1(S),f^{-1}(S), is the subset of elements in XX which map to SS by f.f.

f−1(S):={x∈X:f(x)∈S}f^{-1}(S) := \{x \in X : f(x) \in S\}

The term range is sometimes used for the codomain but more often means the image f(X).f(X).

Two functions with the same domain XX and codomain Y,Y, f:X→Yf : X \rightarrow Y and g:X→Y,g : X \rightarrow Y, are equal f=gf=g if and only if f(x)=g(x) ∀x∈X.f(x)=g(x)\, \forall x \in X.

Let f:X→Yf : X \rightarrow Y and g:Y→Zg : Y \rightarrow Z be two functions such that the codomain of ff is the same set as the domain of g.g. The composition g∘f:X→Zg \circ f : X \rightarrow Z of the two functions ff and gg is the function whose output is the output of gg when its input is the output of ff given an input x∈X.x \in X.

(g∘f)(x):=g(f(x))(g \circ f)(x) := g\left(f(x)\right)

If the codomain of ff does not match the domain of g,g, the composition g∘fg \circ f is undefined.

A function f:X→Yf: X \rightarrow Y is injective or “one-to-one” if distinct elements of its domain XX map to distinct elements of its codomain Y.Y.

x≠x′⇒f(x)≠f(x′)x \neq x' \Rightarrow f(x) \neq f(x')

A function f:X→Yf: X \rightarrow Y is surjective or “onto” if every element of its codomain YY is the image f(x)f(x) of at least one element xx of its domain X.X.

∀y∈Y ∃x∈X:f(x)=y\forall y \in Y \, \exists x \in X : f(x) = y

A function f:X→Yf: X \rightarrow Y is bijective or invertible if it is both injective and surjective.

Two sets XX and YY have equal cardinality if and only if there exists a bijection f:X→Y,f : X \rightarrow Y, that is, a function pairing every element of XX with exactly one element of YY and vice versa.

Let N={0,1,2,…}\mathbb{N} = \{0, 1, 2, \ldots\} denote the natural numbers. A set XX has cardinality n∈Nn \in \mathbb{N} if and only if it has equal cardinality with {i∈N:i<n}.\{i \in \mathbb{N} : i < n\} . XX has nn elements if and only if it has cardinality n.n.

A set XX is finite if and only if it has cardinality n∈N.n \in \mathbb{N}. Otherwise, the set is infinite.

A set XX is countably infinite if and only if it has equal cardinality with the natural numbers N.\mathbb{N}. A set is countable if it is finite or countably infinite, and uncountable if it is not countable.