We want a notion for a correspondence between two sets.

A function $f$ (or correspondence, mapping, map) from a set $X$ to a set $Y$ is a relation whose domain is $X$ and whose range is a subset of $Y$, such that for each $x \in X$,

- there exists $y \in Y$ so that $(x, y) \in f$
- if $(x,y) \in f$ and $(x,z) \in f$, then $y = z$; where $y$ and $z$ are in $Y$

We call this unique element $y \in Y$ the
result (or
image) of the function
at the
argument $x$.
We call $Y$ *a*
codomain—notice our use of
the word “a”, since the codomain is not a
property of the function.
If the range is $Y$ we say that $f$ is a
function from $X$ onto
$Y$ (or call $f$ onto,
surjective).
If distinct elements of $X$ are mapped to
distinct elements of $Y$, we say that the
function is one-to-one (or
injective).

We say that the function maps (or takes) elements from the domain to the codomain. Since the word “function” and the verb “maps” connote activity, some authors refer to the set of ordered pairs as the graph of a function and avoid defining the term “function” as we have, in terms of sets.

Given sets $X$ and $Y$, we abbreviate the statement that the object denoted by $f$ is a function whose domain is a set $X$ and whose codomain is a set $Y$ by

\[ f: X \to Y \]

We read the notation aloud as “$f$ from $X$ to $Y$.” We emphasize again that theWe denote by $Y^X$ the set of functions from $X$ to $Y$. This set is contained in the power set $\powerset{(X \times Y)}$. A reasonable but nonstandard notation is $X \to Y$, read as “$A$ to $B$.” All the following three statements have the same meaning:

\[ f: X \to Y, \quad f \in Y^X, \quad f \in (X \to Y). \]

We tend to denote functions by lower case latin letters; especially $f$, $g$, and $h$. $f$ is a mnemonic for function and $g$ and $h$ are nearby in the usual ordering of the Latin letters.

Suppose $f: A \to B$. For each element $a \in A$, we denote the result of applying $f$ to $a$ by $f(a)$, read aloud “f of a.” We sometimes drop the parentheses, and write the result as $f_a$, read aloud as “f sub a.” Let $g: A \times B \to C$. We often write $g(a,b)$ or $g_{ab}$ instead of $g((a,b))$. We read $g(a, b)$ aloud as “g of a and b”. We read $g_{ab}$ aloud as “g sub a b.”

If $X \subset Y$, the function $\Set{(x, y) \in X \times Y}{x = y}$ is the inclusion function of $X$ into $Y$. We often introduce such a function as “the function from $X$ to $Y$ defined by $f(x) = y$”. We mean by this that $f$ is a function and that we are specifying the appropraite ordered pairs using the statement, called argument-value notation. The inclusion function of $X$ into $X$ is called the identity function of $X$. If we view the identity function as a relation on $X$, it is the relation of equality on $X$.

The functions $f: (X \times Y) \to X$ defined by $f(x, y) = x$ is the pair projection of $X \times Y$ ono $X$. Similarly $g: (X \times Y) \to Y$ defined by $g(x, y) = y$ is the pair projection of $X \times Y$ onto $Y$. The identity function is one-to-one and onto, the inclusion functions are one-to-one but not always onto, and the pair projections are usually not one-to-one.