# Definition of function

Note: This is a revision of the article on specification and definition of functions from abstractmath.org. Many of the links in this article take you to other articles in abstractmath.org.

 A function is a mathematical object.

To deal with functions as a math object, you need a precise definition of “function”. That is what this article gives you.

• The article starts by giving a specification of “function”.
• After that, we get into the technicalities of the
definitions of the general concept of function.
• Things get complicated because there are several inequivalent definitions of “function” in common use.

## Specification of “function”

A function $f$ is a mathematical object which determines and is completely determined by the following data:

• (DOM) $f$ has a domain, which is a set. The domain may be denoted by $\text{dom} f$.
• (COD) $f$ has a codomain, which is also a set and may be denoted by $\text{cod} f$.
• (VAL) For each element $a$ of the domain of $f$, $f$ has a value at $a$.
• (FP) The value of $f$ at $a$ is
completely determined by $a$ and $f$.
• (VIC) The value of $f$ at $a$ must be an element of the codomain of $f$.

• The value of $f$ at $a$ is most cohttp://www.abstractmath.org/MM/MMonly written $f(a)$, but see Functions: Notation and Terminology.
• To evaluate $f$ at $a$ means to determine $f(a)$. The two examples of functions below show that different functions may have different strategies for evaluating them.
• In the expression “$f(a)$”, $a$ is called the input or (old-fashioned) argument of $f$.
• “FP” means functional property.
• “VIC” means “value in codomain”.

### Examples

I give two examples here. The examples of functions chapter contains many other examples.

#### A finite function

Let $F$ be the function defined on the set $\left\{\text{a},\text{b},\text{c},\text{d}\right\}$ as follows: $F(\text{a})=\text{a},\,\,\,F(\text{b})=\text{c},\,\,\,F(\text{c})=\text{c},\,\,\,F(\text{d})=\text{b}$In this definition, $\text{a},\text{b},\text{c},\text{d}$ are letters of the alphabet, not variables. This is the function called “Finite” in the chapter on examples of functions.

• The definition of $F$ says “$F$ is defined on the set $\left\{\text{a},\,\text{b},\,\text{c},\,\text{d} \right\}$”. The phrase “is defined on”
means that the domain is that set. That is standard terminology.
• The value of $F$ at each element of the domain is given explicitly. The value at
$\text{b}$, for example, is $\text{c}$, because the definition says that $F(\text{b}) = \text{c}$. No other reason needs to be given. Mathematical definitions can be arbitrary.
• The codomain of $F$ is not specified, but must include the set $\{\text{a},\text{b},\text{c}\}$. The codomain of a function is often not specified when it is not important, which is most of the time in freshman calculus (for example).
• The diagram below shows how $F$ obeys the rule that the value of an element $x$ in the domain is completely determined by $x$ and $F$.
• If two arrows had started from the same element of the domain, then $F$ would not be a function. (It would be a multivalued function).
• If there were an element of the domain that no arrow started from, it $F$ would not be a function. (It would be a partial function.)
• In this example, to evaluate $F$ at $b$ (to determine the value of $F$ at $b$) means to look at the definition of $F$, which says among other things that the value is $c$ (or alternatively, look at the diagram above and see what letter the arrow starting at $b$ points to). In this case, “evaluation” does not imply calculating a formula.

#### A real-valued function

Let $G$ be the real-valued function defined by the formula $G(x)={{x}^{2}}+2x+5$.

• The definition of $G$ gives the value at each element of the domain by a formula. The value at $3$, for example, is obtained by calculating $G(3)=3^2+2\cdot3+5=20$
• The definition of $G$
does not specify the domain. The convention in the case of functions defined on the real numbers by a formula is to take the domain to be all real numbers at which the formula is defined. In this case, that is every real number, so the domain is $\mathbb{R}$.
• The definition of $G$ does not specify the codomain, either. However, the codomain must include all real numbers greater than or equal to $4$. (Why?)
• So if an author wrote, “Let $H(x)=\frac{1}{x}$”, the domain would be the set of all real numbers except $0$. But a careful author would write, “Let $H(x)=\frac{1}{x}$ ($x\neq0$).”

### What the specification means

• The specification guarantees that a function satisfies all five of the properties listed.
• The specification does not define a mathematical structure in the way mathematical structures have been defined in the past: In particular, it does not require a function to be one or more sets with structure.
• Even so, it is useful to have the specification, because:

 Many mathematical definitions introduce extraneous technical elements which clutter up your thinking about the object they define.

## History

The discussion below is an over­simpli­fication of the history of mathe­matics, which many people have written thick books about. A book relevant to these ideas is Plato’s Ghost, by Jeremy Gray.

Until late in the nineteenth century, functions were usually thought of as defined by formulas (including infinite series). Problems arose in the theory of harmonic analysis which made mathematicians require a more general notion of function. They came up with the concept of function as a set of ordered pairs with the functional property (discussed below), and that understanding revolutionized our understanding of math.

In particular, this definition, along with the use of set theory, enabled abstract math (ahem) to become a cohttp://www.abstractmath.org/MM/MMon tool for understanding math and proving theorems. It is conceivable that some readers may wish it hadn’t. Well, tough.

The modern definition of function given here (which builds on the ordered pairs with functional property definition) came into use beginning in the 1950’s. The modern definition became necessary in algebraic topology and is widely used in many fields today.

The concept of function as a formula never disappeared entirely, but was studied mostly by logicians who generalized it to the study of function-as-algorithm. Of course, the study of algorithms is one of the central topics of modern computing science, so the notion of function-as-formula (updated to function-as-algorithm) has achieved a new importance in recent years.

To state both the definition, we need a preliminary idea.

## The functional property

A set $P$ of ordered pairs has the functional property if two pairs in $P$ with the same first coordinate have to have the same second coordinate (which means they are the same pair). In other words, if $(x,a)$ and $(x,b)$ are both in $P$, then $a=b$.

#### How to think about the functional property

The point of the functional property is that for any pair in the set of ordered pairs, the first coordinate determines what the second one is (which is just what requirement FP says in the specification). That’s why you can write “$G(x)$” for any $x$ in the domain of $G$ and not be ambiguous.

#### Examples

• The set $\{(1,2), (2,4), (3,2), (5,8)\}$ has the functional property, since no two different pairs have the same first coordinate. Note that there are two different pairs with the same second coordinate. This is irrelevant to the functional property.
• The set $\{(1,2), (2,4), (3,2), (2,8)\}$ does not have the functional property. There are two different pairs with first coordinate 2.
• The empty set $\emptyset$ has the function property vacuously.

#### Example: graph of a function defined by a formula

In calculus books, a picture like this one (of part of $y=x^2+2x+5$) is called a graph. Here I use the word “graph” to denote the set of ordered pairs
$\left\{ (x,{{x}^{2}}+2x+5)\,\mathsf{|}\,x\in \mathbb{R } \right\}$
which is a mathematical object rather than some ink on a page or pixels on a screen.

The graph of any function studied in beginning calculus has the functional property. For example, the set of ordered pairs above has the functional property because if $x$ is any real number, the formula ${{x}^{2}}+2x+5$ defines a specific real number.

• if $x = 0$, then ${{x}^{2}}+2x+5=5$, so the pair $(0, 5)$ is an element of the graph of $G$. Each time you plug in $0$ in the formula you get 5.
• if $x = 1$, then ${{x}^{2}}+2x+5=8$.
• if $x = -2$, then ${{x}^{2}}+2x+5=5$.

You can measure where the point $\{-2,5\}$ is on the (picture of) the graph and see that it is on the blue curve as it should be. No other pair whose first coordinate is $-2$ is in the graph of $G$, only $(-2, 5)$. That is because when you plug $-2$ into the formula ${{x}^{2}}+2x+5$, you get $5$ and nothing else. Of course, $(0, 5)$ is in the graph, but that does not contradict the functional property. $(0, 5)$ and $(-2, 5)$ have the same second coordinate, but that is OK.

## Mathematical definition of function

A function $f$ is a
mathematical structure consisting of the following objects:

• A set called the domain of $f$, denoted by $\text{dom} f$.
• A set called the codomain of $f$, denoted by $\text{cod} f$.
• A set of ordered pairs called the graph of $f$, with the following properties:
• $\text{dom} f$ \text{dom} fis the set of all first coordinates of pairs in the graph of $f$.
• Every second coordinate of a pair in the graph of $f$ is in $\text{cod} f$ (but $\text{cod} f$ may contain other elements).
• The graph of $f$ has the functional property.

Using arrow notation, this implies that $f:\text{dom}f\to\text{cod} f$.

#### Remark

The main difference between the specification of function given previously and this definition is that the definition replaces the statement “$f$ has a value at $a$” by introducing a set of ordered pairs (the graph) with the functional property.

• This set of ordered pairs is extra structure introduced by the definition mainly in order to make the definition a classical sets-with-structure.
• This makes the graph, which should be a concept derived from the concept of function, appear to be a necessary part of the function.
• That suggests incorrectly that the graph is more of a primary intuition that other intuitions such as function as map, function as transformer, and other points of view discussed in the article Images and meta­phors for functions.
• The concept of graph of a function is indeed an important intuition, and is discussed with examples in the articles Graphs of continuous functions and Graphs of finite functions.
• Nevertheless, the fact that the concept of graph appears in the definition of function does not make it the most important intuition.

### Examples

• Let $F$ have graph $\{(1,2), (2,4), (3,2), (5,8)\}$ and define $A = \{1, 2, 3, 5\}$ and $B = \{2, 4, 8\}$. Then $F:A\to B$ is a function. In speaking, we would usually say, “$F$ is a function from $A$ to $B$.”
• Let $G$ have graph $\{(1,2), (2,4), (3,2), (5,8)\}$ (same as above), and define $A = \{1, 2, 3, 5\}$ and $C = \{2, 4, 8, 9, 11, \pi, 3/2\}$. Then $G:A\to C$ is a (admittedly ridiculous) function. Note that all the second coordinates of the graph are in the codomain $C$, along with a bunch of miscellaneous suspicious characters that are not second coordinates of pairs in the graph.
• Let $H$ have graph $\{(1,2), (2,4), (3,2), (5,8)\}$. Then $H:A\to \mathbb{R}$ is a function, since $2$, $4$ and $8$ are all real numbers.
• Let $D = \{1, 2, 5\}$ and $E = \{1, 2, 3, 4, 5\}$. Then there is no function $D\to A$ and no function $E\to A$ with graph $\{(1,2), (2,4), (3,2), (5,8)\}$. Neither $D$ nor $E$ has exactly the same elements as the first coordinates of the graph.

### Identity and inclusion

Suppose we have two sets  A and  B with $A\subseteq B$.

• The identity function on A is the function ${{\operatorname{id}}_{A}}:A\to A$ defined by ${{\operatorname{id}}_{A}}(x)=x$ for all $x\in A$. (Many authors call it ${{1}_{A}}$).
• When $A\subseteq B$, the inclusion function from $A$ to $B$ is the function $i:A\to B$ defined by $i(x)=x$ for all $x\in A$. Note that there is a different function for each pair of sets $A$ and $B$ for which $A\subseteq B$. Some authors call it ${{i}_{A,\,B}}$ or $\text{in}{{\text{c}}_{A,\,B}}$.

The identity function and an inclusion function for the same set $A$ have exactly the same graph, namely $\left\{ (a,a)|a\in A \right\}$. More about this below.

## Other definitions of function

### Original abstract definition of function

#### Definition

• A function $f$ is a set of ordered pairs with the functional property.
• If $f$ is a function according to this definition, the domain of $f$ is the set of first coordinates of all the pairs in $f$.
• If $x\in \text{dom} f$, then we define the value of $f$ at $x$, denoted by $f(x)$, to be the second coordinate of the only ordered pair in $f$ whose first coordinate is $x$.

#### Remarks

• This definition is still widely used in mathematical writing.
• Many authors do not tell you which definition they are using.
• For many purposes (including freshman calculus for the most part) it does not matter which definition is used.
• In some branches of math, the modern definition adds great clarity to many complicated situations; using the older definition can even make it difficult to describe some important constructions. There is more about this in New Approaches below.

#### Possible confusion

Some confusion can result because of the presence of these two different definitions.

• For example, since the identity function ${{\operatorname{id}}_{A}}:A\to A$ and the inclusion function ${{i}_{A,\,B}}:A\to B$ have the same graph, users of the older definition are required in theory to say they are the same function.
• Also it requires you to say that the graph of a function is the same thing as the function.
• In my observation, this does not make a problem in practice, unless there is a very picky person in the room.
• It also appears to me that the modern definition is (quite rightly) winning and the original abstract definition is disappearing.

### Multivalued function

The phrase multivalued function refers to an object that is like a function $f:S\to T$ except that for $s\in S$, $f(s)$ may denote more than one value.

#### Examples

• Multivalued functions arose in considering complex functions. In cohttp://www.abstractmath.org/MM/MMon practice, the symbol $\sqrt{4}$ denoted $2$, although $-2$ is also a square root of $4$. But in complex function theory, the square root function takes on both the values $2$ and $-2$. This is discussed in detail in Wikipedia.
• The antiderivative is an example of a multivalued operator. For any constant $C$, $\frac{x^3}{3}+C$ is an antiderivative of $x^2$, so that $\frac{x^3}{3}$, $\frac{x^3}{3}+42$, $\frac{x^3}{3}-1$ and $\frac{x^3}{3}+2\pi$ are among the infinitely many antiderivatives of $x^2$.

A multivalued function $f:S\to T$ can be modeled as a function with domain $S$ and codomain the set of all subsets of $T$. The two meanings are equivalent in a strong sense (naturally equivalent). Even so, it seems to me that they represent two differ­ent ways of thinking about
multivalued functions. (“The value may be any of these things…” as opposed to “The value is this whole set of things.”)

Some older mathematical papers in com­plex func­tion theory do not tell you that their functions are multi­valued. There was a time when com­plex func­tion theory was such a Big Deal in research mathe­matics that the phrase “func­tion theory” meant complex func­tion theory and every mathe­ma­tician with a Ph. D. knew that complex functions were multi­valued.

### Partial function

A partial function $f:S\to T$ is just like a function except that its input may be defined on only a subset of $S$. For example, the function $f(x):=\frac{1}{x}$ is a partial function from the real numbers to the real numbers.

This models the behavior of computer programs (algorithms): if you consider a program with one input and one output as a function, it may not be defined on some inputs because for them it runs forever (or gives an error message).

In some texts in computing science and mathematical logic, a function is by
convention a partial function, and this fact may not be mentioned explicitly, especially in research papers.

The phrases “multivalued function” and “partial function” upset some picky types who say things like, “But a multi­valued func­tion is not a func­tion!”. A hot dog is not a dog, either. I once had a Russian teacher who was Polish and a German teacher who was Hungarian. So what? See the Hand­book (click on

## New approaches to functions

All the definitions of function given here produce mathematical structures, using the traditional way to define mathematical objects in terms of sets. Such definitions have disadvantages.

Mathematicians have many ways to think about functions. That a function is a set of ordered pairs with a certain property (functional) and possibly some ancillary ideas (domain, codomain, and others) is not the way we usually think about them$\ldots$Except when we need to reduce the thing we are studying to its absolutely most abstract form to make sure our proofs are correct.
That most abstract form is what I have called the rigorous view or the dry bones and it is when that reasoning is needed that the sets-with-structure approach has succeeded.

Our practice of abstraction has led us to new approaches to talking about functions. The most important one currently is category theory. Roughly, a category is a bunch of objects together with some arrows going between them that can be composed head to tail. Functions between sets are examples of this: the sets are the objects and the functions the arrows. But arrows in a category do not have to be functions; in that way category theory is an abstraction of functions.

This abstracts the idea of function in a way that brings out common ideas in various branches of math. Research papers in many branches of mathematics now routinely use the language of category theory. Categories now appear in some undergraduate math courses, meaning that Someone needs to write a chapter on category theory for abstractmath.org.

Besides category theory, computing scientists have come up with other abstract ways of dealing with functions, for example type theory. It has not come as far along as category theory, but has shown recent signs of major progress.

Both category theory and type theory define math objects in terms of their effect on and relationship with other math objects. This makes it possible to do abstract math entirely without using sets-with-structure as a means of defining concepts.

## References

• Functions in Wikipedia. This is an extensive and mostly well-done description of the use of functions in mathematics.

Send to Kindle

# Representations of functions III

## Introduction to this post

I am writing a new abstractmath chapter called Representations of Functions. It will replace some of the material in the chapter Functions: Images, Metaphors and Representations. This post is a draft of the sections on representations of finite functions.

The diagrams in this post were created using the Mathematica Notebook Constructions for cographs and endographs of finite functions.nb.
You can access this notebook if you have Mathematica, which can be bought, but is available for free for faculty and students at many universities, or with Mathematica CDF Player, which is free for anyone and runs on Windows, Mac and Linux.

Like everything in abstractmath.org, the notebooks are covered by a Creative Commons ShareAlike 3.0 License.

## Graphs of finite functions

When a function is continuous, its graph shows up as a curve in the plane or as a curve or surface in 3D space. When a function is defined on a set without any notion of continuity (for example a finite set), the graph is just a set of ordered pairs and does not tell you much.

A finite function $f:S\to T$ may be represented in these ways:

• Its graph $\{(s,f(s))|s\in S\}$. This is graph as a mathematical object, not as a drawing or as a directed graph — see graph (two meanings)).
• A table, rule or two-line notation. (All three of these are based on the same idea, but differ in presentation and are used in different mathematical specialties.)
• By using labels with arrows between them, arranged in one of two ways:
• A cograph, in which the domain and the codomain are listed separately.
• An endograph, in which the elements of the domain and the codomain are all listed together without repetition.

All these techniques can also be used to show finite portions of infinite discrete functions, but that possibility will not be discussed here.

### Introductory Example

Let $\text{f}:\{a,b,c,d,e\}\to\{a,b,c,d\}$ be the function defined by requiring that $f(a)=c$, $f(b)=a$, $f(c)=c$, $f(d)=b$, and $f(e)=d$.

#### Graph

The graph of $f$ is the set
$(a,c),(b,a),(c,c),(d,b),(e,d)$
As with any set, the order in which the pairs are listed is irrelevant. Also, the letters $a$, $b$, $c$, $d$ and $e$ are merely letters. They are not variables.

#### Table

$\text{f}$ is given by this table:

This sort of table is the format used in databases. For example, a table in a database might show the department each employee of a company works in:

#### Rule

The rule determined by the finite function $f$ has the form

$(a\mapsto b,b\mapsto a,c\mapsto c,d\mapsto b,e\mapsto d)$

Rules are built in to Mathematica and are useful in many situations. In particular, the endographs in this article are created using rules. In Mathematica, however, rules are written like this:

$(a\to b,b\to a,c\to c,d\to b,e\to d)$

This is inconsistent with the usual math usage (see barred arrow notation) but on the other hand is easier to enter in Mathematica.

In fact, Mathematica uses very short arrows in their notation for rules, shorter than the ones used for the arrow notation for functions. Those extra short arrows don’t seems to exist in TeX.

#### Two-line notation

Two-line notation is a kind of horizontal table.

$\begin{pmatrix} a&b&c&d&e\\c&a&c&b&d\end{pmatrix}$

The three notations table, rule and two-line do the same thing: If $n$ is in the domain, $f(n)$ is shown adjacent to $n$ — to its right for the table and the rule and below it for the two-line.

Note that in contrast to the table, rule and two-line notation, in a cograph each element of the codomain is shown only once, even if the function is not injective.

#### Cograph

To make the cograph of a finite function, you list the domain and codomain in separate parallel rows or columns (even if the domain and codomain are the same set), and draw an arrow from each $n$ in the domain to $f(n)$ in the codomain.

This is the cograph for $\text{f}$, represented in columns

and in rows (note that $c$ occurs only once in the codomain)

Pretty ugly, but the cograph for finite functions does have its uses, as for example in the Wikipedia article composition of functions.

In both the two-line notation and in cographs displayed vertically, the function goes down from the domain to the codomain. I guess functions obey the law of gravity.

##### Rearrange the cograph

There is no expectation that in the cograph $f(n)$ will be adjacent to $n$. But in most cases you can rearrange both the domain and the codomain so that some of the structure of the function is made clearer; for example:

The domain and codomain of a finite function can be rearranged in any way you want because finite functions are not continuous functions. This means that the locations of points $x_1$ and $x_2$ have nothing to do with the locations of $f(x_1)$ and $f(x_2)$: The domain and codomain are discrete.

#### Endograph

The endograph of a function $f:S\to T$ contains one node labeled $s$ for each $s\in S\cup T$, and an arrow from $s$ to $s’$ if $f(s)=s’$. Below is the endograph for $\text{f}$.

The endograph shows you immediately that $\text{f}$ is not a permutation. You can also see that with whatever letter you start with, you will end up at $c$ and continue looping at $c$ forever. You could have figured this out from the cograph (especially the rearranged cograph above), but it is not immediately obvious in the cograph the way it in the endograph.

There are more examples of endographs below and in the blog post
A tiny step towards killing string-based math. Calculus-type functions can also be shown using endographs and cographs: See Mapping Diagrams from A(lgebra) B(asics) to C(alculus) and D(ifferential) E(quation)s, by Martin Flashman, and my blog posts Endographs and cographs of real functions and Demos for graph and cograph of calculus functions.

### Example: A permutation

Suppose $p$ is the permutation of the set $\{0,1,2,3,4,5,6,7,8,9\}$given in two-line form by
$\begin{pmatrix} 0&1&2&3&4&5&6&7&8&9\\0&2&1&4&5&3&7&8&9&6\end{pmatrix}$

#### Endograph

Again, the endograph shows the structure of the function much more clearly than the cograph does.

The endograph consists of four separate parts (called components) not connected with each other. Each part shows that repeated application of the function runs around a kind of loop; such a thing is called a cycle. Every permutation of a finite set consists of disjoint cycles as in this example.

#### Disjoint cycle notation

Any permutation of a finite set can be represented in disjoint cycle notation: The function $p$ is represented by:

$(0)(1,2)(3,4,5)(6,7,8,9)$

Given the disjoint cycle notation, the function can be determined as follows: For a given entry $n$, $p(n)$ is the next entry in the notation, if there is a next entry (instead of a parenthesis). If there is not a next entry, $p(n)$ is the first entry in the cycle that $n$ is in. For example, $p(7)=8$ because $8$ is the next entry after $7$, but $p(5)=3$ because the next symbol after $5$ is a parenthesis and $3$ is the first entry in the same cycle.

The disjoint cycle notation is not unique for a given permutation. All the following notations determine the same function $p$:

$(0)(1,2)(4,5,3)(6,7,8,9)$
$(0)(1,2)(8,9,6,7)(3,4,5)$
$(1,2)(3,4,5)(0)(6,7,8,9)$
$(2,1)(5,3,4)(9,6,7,8)$
$(5,3,4)(1,2)(6,7,8,9)$

Cycles such as $(0)$ that contain only one element are usually omitted in this notation.

### Example: A tree

Below is the endograph of a function $t:\{0,1,2,3,4,5,6,7,8,9\}\to\{0,1,2,3,4,5,6,7,8,9\}$

This endograph is a tree. The graph of a function $f$ is a tree if the domain has a particular element $r$ called the root with the properties that

• $f(r)=r$, and
• starting at any element of the domain, repreatedly applying $f$ eventually produces $r$.

In the case of $t$, the root is $4$. Note that $t(4)=4$, $t(t(7))=4$, $t(t(t(9)))=4$, $t(1)=4$, and so on.

The endograph

shown here is also a tree.

See the Wikipedia article on trees for the usual definition of tree as a special kind of graph. For reading this article, the definition given in the previous paragraph is sufficient.

### The general form of a finite function

This is the endograph of a function $t$ on a $17$-element set:

It has two components. The upper one contains one $2$-cycle, and no matter where you start in that component, when you apply $t$ over and over you wind up flipping back and forth in the $2$-cycle forever. The lower component has a $3$-cycle with a similar property.

This illustrates a general fact about finite functions:

• The endograph of any finite function contains one or more components $C_1$ through $C_k$.
• Each component $C_k$ contains exactly one $n_k$ cycle, for some integer $n_k\geq 1$, to which are attached zero or more trees.
• Each tree in $C_k$ is attached in such a way that its root is on the unique cycle contained in $C_k$.

In the example above, the top component has three trees attached to it, two to $3$ and one to $4$. (This tree does not illustrate the fact that an element of one of the cycles does not have to have any trees attached to it).

You can check your understanding of finite functions by thinking about the following two theorems:

• A permutation is a finite function with the property that its cycles have no trees attached to them.
• A tree is a finite function that has exactly one component whose cycle is a $1$-cycle.

Send to Kindle

# A proof by diagram chasing

In Rigorous proofs, I went through the details of a medium-easy epsilon-delta proof in great detail as a way of showing what is hidden by the wording of the proof. In this post, I will do the same for an easy diagram-chasing proof in category theory. This theorem is stated and proved in Category Theory for Computing Science, page 365, but the proof I give here maximizes the diagram-chasing as a way of illustrating the points I want to make.

Theorem (J. Lambek) Let $F$ be a functor from a category to itself and let $\alpha:Fa\to a$ be an algebra for $F$ which is initial. Then $\alpha$ is an isomorphism.

Proof

1. $F\alpha:FFa\to Fa$ is also an $F$-algebra.
2. Initiality means that there is a unique algebra morphism $\eta:a\to Fa$ from $\alpha:Fa\to a$ to $F\alpha:FFa\to Fa$ for which this diagram commutes:

3. To that diagram we can adjoin another (obviously) commutative square:

4. Then the outside rectangle in the diagram above also commutes.
5. This means that $\alpha\circ\eta:a\to a$ is an $F$-algebra morphism from $\alpha:Fa\to a$ to itself.
6. Another such $F$-algebra morphism is $\text{id}_{A}$.
7. Initiality of $\alpha$ means that the diagram below commutes:

8. Because the upper bow and the left square both commute we are justified in inserting a diagonal arrow as below.

9. Now we can read off the diagram that $F\alpha\circ F(\eta)=\text{id}_{Fa}$ and $\eta\circ\alpha=\text{id}_a$. By definition, then, $\eta$ is a two-sided inverse to $\alpha$, so $\alpha$ is an isomorphism.

## Analysis of the proof

This is an analysis of the proof showing what is not mentioned in the proof, similar to the analysis in Rigorous proofs.

• An $F$-algebra is any arrow of the form $\alpha:Fa\to a$. This definition directly verifies statement (1). You do need to know the definition of “functor” and that the notation $Fa$ means $F(a)$ and $FFa$ means $F(F(a))$.
• When I am chasing diagrams, I visualize the commutativity of the diagram in (2) by thinking of the red path and the blue path as having the same composites in this graph:

In other words, $F\alpha\circ F\eta=\eta\circ\alpha$. Notice that the diagram carries all the domain and codomain information for the arrows, whereas the formula “$F\alpha\circ F\eta=\eta\circ\alpha$” requires you to hold the domains and codomains in your head.

• (Definition of morphism of $F$-algebra) The reader needs to know that a morphism of $F$ algebras is any arrow $\delta:c\to d$ for which

commutes.
• (Definition of initial $F$-algebra) $\alpha$ is an initial $F$-algebra means that for any algebra $\beta:Fb\to b$, there is a unique arrow $\delta$ for which the diagram above commutes.
• (2) is justified by the last two definitions.
• Pulling a “rabbit out of a hat” in a proof means introducing something that is obviously correct with no motivation, and then checking that it results in a proof. Step (9) in the proof given in Rigorous proofs has an example of adding zero cleverly. It is completely OK to pull a rabbit out of a hat in a proof, as long as the result is correct, but it makes students furious.
• In statement (3) of the proof we are considering here, the rabbit is the trivially commutative diagram that is adjoined on the right of the diagram from (2).
• Statement (4) uses a fact known to all diagram chasers: Two joined commutative squares make the outside rectangle commute. You can visualize this by seeing that the three red paths shown below all have the same composite. When I am chasing a complicated diagram I trace the various paths with my finger, or in my head.

You could also show it by pointing out that $\alpha\circ F\alpha\circ F\eta=\alpha\circ\eta\circ\alpha$, but to check that I think most of us would go back and look at the diagram in (3) to see why it is true. Why not work directly with the diagram?

• The definition of initiality requires that there be only one $F$-algebra morphism from $\alpha:Fa\to a$ to itself. This means that the upper and lower bows in (7) commute.
• The diagonal identity arrow in (8) is justified by the fact that the upper bow is exactly the same diagram as the upper triangular diagram in (8). It follows that the upper triangle in (8) commutes. I visualize this as moving the bow down and to the left with the upper left node $Fa$ as a hinge, so that the two triangles coincide. (It needs to be flipped, too.) I should make an interactive diagram that shows this.
• The lower triangle in (8) also commutes because the square in (2) is given to be commutative.
• (Definition of isomorphism in a category) An arrow $f:a\to b$ in a category is an isomorphism if there is an arrow $g:b\to a$ for which these diagrams commute:

xx

This justifies statement (9).

Remark: I have been profligate in using as many diagrams as I want because this can be seen on a screen instead of on paper. That and the fact that much more data about domains and codomains are visible because I am using diagrams instead of equations involving composition means that the proof requires the readers to carry much less invisible data in their heads.

Send to Kindle

# The definition of “function”

This is the new version of the abstractmath article on the definition of function. I had to adapt the formatting and some of it looks weird, but legible. It is prettier on abstractmath.org.

I expect to announce new revisions of other abmath articles on this blog, with links, but not to publish them here. This article brings out a new point of view about defining functions that I wanted to call attention to, so I am publishing it here, as well.

# FUNCTIONS: SPECIFICATION AND DEFINITION

It is essential that you understand many of the images, metaphors and terminology that mathe­maticians use when they think and talk about functions. For many purposes, the precise mathematical definition of "function" does not play much of a role when you are trying to understand particular kinds of functions. But there is one point of view about functions that has resulted in fundamental progress in math:

A function is a mathematical object.

To deal with functions in that way you need a precise definition of "function". That is what this article gives you.

• The article starts by giving a specification of "function".
• After that, we get into the technicalities of the definitions of the general concept of function.
• Things get complicated because there are several inequivalent definitions of "function" in common use.

## Specification of "function"

A function $f$ is a mathematical object which determines and is completely determined by the following data:

(DOM) $f$ has a domain, which is a set. The domain may be denoted by $\text{dom} f$.

(COD) $f$ has a codomain, which is also a set and may be denoted by $\text{cod} f$.

(VAL) For each element $a$ of the domain of $f$, $f$ has a value at $a$, denoted by $f(a)$.

(FP) The value of $f$ at $a$ is completely determined by $a$ and $f$.

(VIC) The value of $f$ at $a$ must be an element of the codomain of $f$.

• The operation of finding $f(a)$ given $f$ and $a$ is called evaluation.
• "FP" means functional property.
• "VIC" means "value in codomain".

### Examples

The examples of functions chapter contains many examples. The two I give here provide immediate examples.

#### A finite function

Let $F$ be the function defined on the set $\left\{1,\,2,3,6 \right\}$ as follows: $F(1)=3,\,\,\,F(2)=3,\,\,\,F(3)=2,\,\,\,F(6)=1$. This is the function called "Finite'' in the chapter on examples of functions.

• The definition of $F$ says "$F$ is defined on the set $\left\{1,\,2,\,3,\,6 \right\}$". That phrase means that the domain is that set.
• The value of $F$ at each element of the domain is given explicitly. The value at 3, for example, is 2, because the definition says that $F(2) = 3$. No other reason needs to be given. Mathematical definitions can be arbitrary.
• The codomain of $F$ is not specified, but must include the set $\{1,2,3\}$. The codomain of a function is often not specified when it is not important — which is most of the time in freshman calculus (for example).

#### A real-valued function

Let $G$ be the real-valued function defined by the formula $G(x)={{x}^{2}}+2x+5$.

• The definition of $G$ gives the value at each element of the domain by a formula. The value at $3$, for example, is $G(3)=3^2+2\cdot3+5=20$.
• The definition of $G$ does not specify the domain. The convention in the case of functions defined on the real numbers by a formula is to take the domain to be all real numbers at which the formula is defined. In this case, that is every real number, so the domain is $\mathbb{R}$.
• The definition does not specify the codomain, either. However, must include all real numbers greater than or equal to 4. (Why?)

### What the specification means

• The specification guarantees that a function satisfies all five of the properties listed.
• The specification does not define a mathematical structure in the way mathematical structures have been defined in the past: In particular, it does not require a function to be one or more sets with structure.
• Even so, it is useful to have the specification, because:

Many mathematical definitions
introduce extraneous technical elements

## History

Until late in the nineteenth century, functions were usually thought of as defined by formulas (including infinite series). Problems arose in the theory of harmonic analysis which made mathematicians require a more general notion of function. They came up with the concept of function as a set of ordered pairs with the functional property (discussed below), and that understanding revolutionized our understanding of math.

This discussion is an over­simpli­fication of the history of mathe­matics, which many people have written thick books about. A book relevant to these ideas is Plato's Ghost, by Jeremy Gray.

In particular, this definition, along with the use of set theory, enabled abstract math (ahem) to become a common tool for understanding math and proving theorems. It is conceivable that some of you may wish it hadn't. Well, tough.

The more modern definition of function given here (which builds on the older definition) came into use beginning in the 1950's. The strict version became necessary in algebraic topology and is widely used in many fields today.

The concept of function as a formula never disappeared entirely, but was studied mostly by logicians who generalized it to the study of function-as-algorithm. Of course, the study of algorithms is one of the central topics of modern computing science, so the notion of function-as-formula (updated to function-as-algorithm) has achieved a new importance in recent years.

To state both the old abstract definition and the modern one, we need a preliminary idea.

## The functional property

A set $P$ of ordered pairs has the functional property if two pairs in $P$ with the same first coordinate have to have the same second coordinate (which means they are the same pair). In other words, if $(x,a)$ and $(x,b)$ are both in $P$, then $a=b$.

#### How to think about the functional property

The point of the functional property is that for any pair in the set of ordered pairs, the first coordinate determines what the second one is. That's why you can write "$G(x)$'' for any $x$ in the domain of $G$ and not be ambiguous.

#### Examples

• The set $\{(1,2), (2,4), (3,2), (5,8)\}$ has the functional property, since no two different pairs have the same first coordinate. Note that there are two different pairs with the same second coordinate. This is irrelevant to the functional property.
• The set $\{(1,2), (2,4), (3,2), (2,8)\}$ does not have the functional property. There are two different pairs with first coordinate 2.
• The empty set $\emptyset$ has the function property vacuously.

#### Example: graph of a function defined by a formula

In calculus books, a picture like this one (of part of $y=x^2+2x+5$) is called a graph. Here I use the word "graph" to denote the set of ordered pairs $\left\{ (x,{{x}^{2}}+2x+5)\,\mathsf{|}\,x\in \mathbb{R } \right\}$ which is a mathematical object rather than some ink on a page or pixels on a screen.

The graph of any function studied in beginning calculus has the functional property. For example, the set of ordered pairs above has the functional property because if $x$ is any real number, the formula ${{x}^{2}}+2x+5$ defines a specific real number.

• if $x = 0$, then ${{x}^{2}}+2x+5=5$, so the pair $(0, 5)$ is an element of the graph of $G$. Each time you plug in $0$ in the formula you get 5.
• if $x = 1$, then ${{x}^{2}}+2x+5=8$.
• if $x = -2$, then ${{x}^{2}}+2x+5=5$.

You can measure where the point $\{-2,5\}$ is on the (picture of) the graph and see that it is on the blue curve as it should be. No other pair whose first coordinate is $-2$ is in the graph of $G$, only $(-2, 5)$. That is because when you plug $-2$ into the formula ${{x}^{2}}+2x+5$, you get $5$ and nothing else. Of course, $(0, 5)$ is in the graph, but that does not contradict the functional property. $(0, 5)$ and $(-2, 5)$ have the same second coordinate, but that is OK.

## Modern mathematical definition of function

A function $f$ is a mathematical structure consisting of the following objects:

• A set called the domain of $f$, denoted by $\text{dom} f$.
• A set called the codomain of $f$, denoted by $\text{cod} f$.
• A set of ordered pairs called the graph of $f$, with the following properties:
• $\text{dom} f$ is the set of all first coordinates of pairs in the graph of $f$.
• Every second coordinate of a pair in the graph of $f$ is in $\text{cod} f$ (but $\text{cod} f$ may contain other elements).
• The graph of $f$ has the functional property.

Using arrow notation, this implies that $f:A\to B$.

#### Remark

The main difference between the specification of function given previously and this definition is that the definition replaces the statement "$f$ has a value at $a$" by introducing a set of ordered pairs (the graph) with the functional property.

• This set of ordered pairs is extra structure introduced by the definition mainly in order to make the definition a classical sets-with-structure, which makes the graph, which should be a concept derived from the concept of function, into an apparently necessary part of the function.
• That suggests incorrectly that the graph is more of a primary intuition that other intuitions such as function as relocator, function as transformer, and other points of view discussed in the article Intuitions and metaphors for functions.

### Examples

• Let $F$ have graph $\{(1,2), (2,4), (3,2), (5,8)\}$ and define $A = \{1, 2, 3, 5\}$ and $B = \{2, 4, 8\}$. Then $F:A\to B$ is a function. In speaking, we would usually say, "$F$ is a function from $A$ to $B$."
• Let $G$ have graph $\{(1,2), (2,4), (3,2), (5,8)\}$ (same as above), and define $A = \{1, 2, 3, 5\}$ and $C = \{2, 4, 8, 9, 11, \pi, 3/2\}$. Then $G:A\to C$ is a (admittedly ridiculous) function. Note that all the second coordinates of the graph are in $C$, along with a bunch of miscellaneous suspicious characters that are not second coordinates of pairs in the graph.
• Let $H$ have graph $\{(1,2), (2,4), (3,2), (5,8)\}$. Then $H:A\to \mathbb{R}$ is a function, since $2$, $4$ and $8$ are all real numbers.
• Let $D = \{1, 2, 5\}$ and $E = \{1, 2, 3, 4, 5\}$. Then there is no function $D\to A$ and no function $E\to A$ with graph $\{(1,2), (2,4), (3,2), (5,8)\}$. Neither $D$ nor $E$ has exactly the same elements as the first coordinates of the graph.

### Identity and inclusion

Suppose we have two sets  A and  B with $A\subseteq B$.

• The identity function on A is the function ${{\operatorname{id}}_{A}}:A\to A$ defined by ${{\operatorname{id}}_{A}}(x)=x$ for all $x\in A$. (Many authors call it ${{1}_{A}}$).
• When $A\subseteq B$, the inclusion function from $A$ to $B$ is the function $i:A\to B$ defined by $i(x)=x$ for all $x\in A$. Note that there is a different function for each pair of sets $A$ and $B$ for which $A\subseteq B$. Some authors call it ${{i}_{A,\,B}}$ or $\text{in}{{\text{c}}_{A,\,B}}$.

The identity function and an inclusion function for the same set $A$ have exactly the same graph, namely $\left\{ (a,a)|a\in A \right\}$. More about this below.

## Other definitions of function

### Multivalued function

Some older mathematical papers in com­plex func­tion theory do not tell you that their functions are multi­valued. There was a time when com­plex func­tion theory was such a Big Deal in research mathe­matics that the phrase "func­tion theory" meant complex func­tion theory and all the cogno­scenti knew that their functions were multi­valued.

The phrase multivalued function refers to an object that is like a function $f:S\to T$ except that for $s\in S$, $f(s)$ may denote more than one value.

#### Examples

• Multivalued functions arose in considering complex functions. In common practice, the symbol $\sqrt{4}$ denoted $2$, although $-2$ is also a square root of $4$. But in complex function theory, the square root function takes on both the values $2$ and $-2$. This is discussed in detail in Wikipedia.
• The antiderivative is an example of a multivalued operator. For any constant $C$, $\frac{x^3}{3}+C$ is an antiderivative of $x^2$.

A multivalued function $f:S\to T$ can be modeled as a function with domain $S$ and codomain the set of all subsets of $T$. The two meanings are equivalent in a strong sense (naturally equivalent}). Even so, it seems to me that they represent two differ­ent ways of thinking about multivalued functions. ("The value may be any of these things…" as opposed to "The value is this whole set of things.")

The phrases "multivalued function" and "partial function" upset some picky types who say things like, "But a multi­valued func­tion is not a func­tion!". A step­mother is not a mother, either. See the Hand­book article on radial category.

### Partial function

A partial function $f:S\to T$ is just like a function except that its input may be defined on only a subset of $S$. For example, the function $f(x)=\frac{1}{x}$ is a partial function from the real numbers to the real numbers.

This models the behavior of computer programs (algorithms): if you consider a program with one input and one output as a function, it may not be defined on some inputs because for them it runs forever (or gives an error message).

In some texts in computing science and mathematical logic, a function is by convention a partial function, and this fact may not be mentioned explicitly, especially in research papers.

## New approaches to functions

All the definitions of function given here produce mathematical structures, using the traditional way to define mathematical objects in terms of sets. Such definitions have disadvantages.

Mathematicians have many ways to think about functions. That a function is a set of ordered pairs with a certain property (functional) and possibly some ancillary ideas (domain, codomain, and others) is not the way we usually think about them$\ldots$Except when we need to reduce the thing we are studying to its absolutely most abstract form to make sure our proofs are correct. That most abstract form is what I have called the rigorous view or the dry bones and it is when that reasoning is needed that the sets-with-structure approach has succeeded.

Our practice of abstraction has led us to new approaches to talking about functions. The most important one currently is category theory. Roughly, a category is a bunch of objects together with some arrows going between them that can be composed head to tail. Functions between sets are examples of this: the sets are the objects and the functions the arrows.

This abstracts the idea of function in a way that brings out common ideas in various branches of math. Research papers in many branches of mathematics now routinely use the language of category theory. Categories now appear in some undergraduate math courses, meaning that Someone needs to write a chapter on category theory for abstractmath.org.

Besides category theory, computing scientists have come up with other abstract ways of dealing with functions, for example type theory. It has not come as far along as category theory, but has shown recent signs of major progress.

Both category theory and type theory define math objects in terms of their effect on and relationship with other math objects. This makes it possible to do abstract math entirely without using sets-with-structure as a means of defining concepts.

Send to Kindle

# Function and codomain

I recently posted the following information in the talk page of the Wikipedia article on functions, where they were arguing about whether "function" means a set of ordered pairs with the functional property or a structure with a domain $D$, a codomain $C$, and a graph $G$ which is a subset of $D\times C$ with the functional property.

I collected data from some math books published since 2000 that contain a definition of function; they are listed below.  In this list, "typed" means  function was defined as going from a set A to a set B, A was called the domain, and B was not given a name. If "typed" is followed by a word (codomain, range or target) that was the name given the codomain. One book defined a function essentially as a partial function. Some that did not name the codomain defined "range" in the sense of image. Some of them emphasized that the range/image need not be the same as the codomain.

As far as I know, none of these books said that if two functions had the same domain and the same graph but different codomains they had to be different functions.  But I didn't read any of them extensively.

My impression is that modern mathematical writing at least at college level does distinguish the domain, codomain, and image/range of a function, not always providing a word to refer to the codomain.

If the page number as a question mark after it that means I got the biblio data for the book from Amazon and the page number from Google books, which doesn't give the edition number, so it might be different.

I did not look for books by logicians or computing scientists.  My experience is that logicians tend to use partial functions and modern computing scientists generally require the codomain to be specified.

Opinion:  If you don't distinguish functions as different if they have different codomains, you lose some basic intuition (a function is a map) and you mess up common terminology.  For example the only function from {1} to {1} is the identity function, and is surjective.  The function from {1} to the set of real numbers (which is a point on the real line) is not the identity function and is not surjective.

THE LIST

Mathematics for Secondary School Teachers
By Elizabeth G. Bremigan, Ralph J. Bremigan, John D. Lorch, MAA 2011
p. 6 (typed)

Oxford Concise Dictionary of Mathematics, ed. Christopher Clapham and James Nicholson,  Oxford University Press, 4th ed., 2009.
p. 184, (typed, codomain)

Math and Math-in-school: Changes in the Treatment of the Function Concept in …
By Kyle M. Cochran, Proquest, 2011
p74  (partial function)

Discrete Mathematics: An Introduction to Mathematical Reasoning
By Susanna S. Epp, 4th edition, Cengage Learning, 2010
p. 294? (typed, co-domain)

Teaching Mathematics in Grades 6 – 12: Developing Research-Based …
By Randall E. Groth, SAGE, 2011
p236 (typed, codomain)

Essentials of Mathematics, by Margie Hale, MAA, 2003.
p. 38 (typed, target).

By Steven G. Krantz, 3rd ed., Chapman and Hall, 2012
p79? (typed, range)

Bridge to Abstract Mathematics
By Ralph W. Oberste-Vorth, Aristides Mouzakitis, Bonita A. Lawrence, MAA 2012
p76 (typed, codomain)

The Road to Reality by Roger Penrose, Knopf, 2005.
p. 104 (typed, target)

Precalculus: Mathematics for Calculus
By James Stewart, Lothar Redlin, Saleem Watson, Cengage, 2011
p. 143.  (typed)

The Mathematics that Every Secondary School Math Teacher Needs to Know
By Alan Sultan, Alice F. Artzt , Routledge, 2010.
p.400 (typed)

Send to Kindle

# More about the definition of function

Maya Incaand commented on my post Definition of "function":

Why did you decide against "two inequivalent descriptions in common use"?  Is it no longer true?

This question concerns [1], which is a draft article.  I have not promoted it to the standard article in abstractmath because I am not satisfied with some things in it.

More specifically, there really are two inequivalent descriptions in common use.  This is stated by the article, buried in the text, but if you read the beginning, you get the impression that there is only one specification.  I waffled, in other words, and I expect to rewrite the beginning to make things clearer.

Below are the two main definitions you see in university courses taken by math majors and grad students.  A functional relation has the property that no two distinct ordered pairs have the same first element.

Strict definition: A function consists of a functional relation with specified codomain (the domain is then defined to be the set of first elements of pairs in the relation).  Thus if $A$ and $B$ are sets and $A\subseteq B$, then the identity function $1_A:A\to A$ and the inclusion function $i:A\to B$  are two different functions.

Relational definition: A function is a functional relation.  Then the identity and inclusion functions are the same function.  This means that a function and its graph are the same thing (discussed in the draft article).

These definitions are subject to variations:

Variations in the strict definition: Some authors use "range" for "codomain" in the definition, and some don't make it clear that two functions with the same functional relation but different codomains are different functions.

Variations in the relational definition: Most such definitions state explicitly that the domain and range are determined by the relation (the set of first coordinates and the set of second coordinates).

### Formalism

There are many other variations in the formalism used in the definition.  For example, the strict definition can be formalized (as in Wikipedia) as an ordered triple $(A, B, f)$ where $A$ and $B$ are sets and $f$ is a functional relation with the property thar every element of $A$ is the first element of an ordered pair in the relation.

You could of course talk about an ordered triple $(A,f,B)$ blah blah.  Such definitions introduce arbitrary constructions that have properties irrelevant to the concept of function.  Would you ever say that the second element of the function $f(x)=x+1$ on the reals is the set of real numbers?  (Of course, if you used the formalism $(A,f,B)$ you would have to say the second element of the function is its graph! )

It is that kind of thing that led me to use a specification instead of a definition.  If you pay attention to such irrelevant formalism there seems to be many definitions of function.  In fact, at the university level there are only two, the strict definition and the relational definition.  The usage varies by discipline and age.  Younger mathematicians are more likely to use the strict definition.  Topologists use the strict definition more often than analysts (I think).

### Usage

There is also variation in usage.

• Most authors don't tell you which definition they use, and it often doesn't matter anyway.
• If an author defines a function using a formula, there is commonly an implicit assumption that the domain includes everything for which the formula is well-defined.  (The "everything" may be modified by referring to it as an integer, real, or complex function.)

### Definitions of function on the web

Below are some definitions of function that appear on the web.  I have excluded most definitions aimed at calculus students or below; they often assume you are talking about numbers and formulas.  I have not surveyed textbooks and research papers.  That would have to be done for a proper scholarly article about mathematical usage of "function". But most younger people get their knowledge from the web anyway.

1. Abstractmath draft article: Functions: Specification and Definition.  (Note:  Right now you can't get to this from the Table of Contents; you have to click the preceding link.)
2. Gyre&Gimble post: Definition of "function"
3. Intmath discussion of function  Function as functional relation between numbers, with induced domain and range.
4. Mathworld definition of function Functional-relation definition.  Defines $F:A\to B$ in a way that requires $B$ to be the image.
5. Planet Math definition of function Strict definition.
6. Prime Encyclopedia of Mathematics Functional-relation definition.
7. Springer Encyclopedia of Math definition of function  Strict definition, except not clear if different codomains mean different functions.
8. Wikipedia definition of function Discusses both definitions.
9. Wisconsin Department of Public Instruction Definition of function  Function as functional relation.
Send to Kindle

# The Mathematical Definition of Function

### Introduction

This post is a completely rewritten version of the abstractmath article on the definition of function. Like every part of abstractmath, the chapter on functions is designed to get you started thinking about functions. It is no way complete. Wikipedia has much more complete coverage of mathematical functions, but be aware that the coverage is scattered over many articles.

The concept of function in mathematics is as important as any mathematical idea. The mathematician’s concept of function includes the kinds of functions you studied in calculus but is much more abstract and general. If you are new to abstract math you need to know:

• The precise meaning of the word “function” and other concepts associated with functions. That’s what this section is about.
• Notation and terminology for functions. (That will be a separate section of abstractmath.org which I will post soon.)
• The many different kinds of functions there are. (See Examples of Functions in abmath).
• The many ways mathematicians think about functions. The abmath article Images and Metaphors for Functions is a stub for this.

I will use two running examples throughout this discussion:

• ${F}$ is the function defined on the set ${\left\{1,\,2,3,6 \right\}}$ as follows: ${F(1)=3,\,\,\,F(2)=3,\,\,\,F(3)=2,\,\,\,F(6)=1}$. This is a function defined on a finite set by explicitly naming each value.
• ${G}$ is the real-valued function defined by the formula ${G(x)={{x}^{2}}+2x+5}$.

### Specification of function

We start by giving a specification of “function”. (See the abstractmath article on specification.) After that, we get into the technicalities of the definitions of the general concept of function.

Specification: A function ${f}$ is a mathematical object which determines and is completely determined bythe following data:

• ${f}$ has a domain, which is a set. The domain may be denoted by ${\text{dom }f}$.
• ${f}$ has a codomain, which is also a set and may be denoted by ${\text{cod }f}$.
• For each element ${a}$ of the domain of ${f}$, ${f}$ has a value at ${a}$, denoted by ${f(a)}$.
• The value of ${f}$ at ${a}$ is completely determined by ${a}$ and ${f}$ .
• The value of ${f}$ at ${a}$ must be an element of the codomain of ${f}$.

The operation of finding ${f(a)}$ given ${f}$ and ${a}$ is called evaluation.

#### Examples

• The definition above of the finite function ${F}$ specifies that the domain is the set ${\left\{1,\,2,\,3,\,6 \right\}}$. The value of ${F}$ at each element of the domain is given explicitly. The value at 3, for example, is 2, because the definition says that ${F(2) = 3}$. The codomain of ${F}$ is not specified, but must include the set ${\{1,2,3\}}$.
• The definition of ${G}$ above gives the value at each element of the domain by a formula. The value at 3, for example, is ${G(3)=3^2+2\cdot3+5=20}$. The definition does not specify the domain or the codomain. The convention in the case of functions defined on the real numbers by a formula is to take the domain to be all real numbers at which the formula is defined. In this case, that is every real number, so the domain is ${{\mathbb R}}$. The codomain must include all real numbers greater than or equal to 4. (Why?)

Comment: The formula above that defines the function $G$ in fact defines a function of complex numbers (even quaternions).

### Definition of function

In the nineteenth century, mathematicians realized that it was necessary for some purposes (particularly harmonic analysis) to give a mathematical definition of the concept of function. A stricter version of this definition turned out to be necessary in algebraic topology and other fields, and that is the one I give here.

To state this definition we need a preliminary idea.

#### The functional property

A set R of ordered pairs has the functional property if two pairs in R with the same first coordinate have to have the same second coordinate (which means they are the same pair).

Examples

• The set ${\{(1,2), (2,4), (3,2), (5,8)\}}$ has the functional property, since no two different pairs have the same first coordinate. It is true that two of them have the same second coordinate, but that is irrelevant.
• The set ${\{(1,2), (2,4), (3,2), (2,8)\}}$ does not have the functional property. There are two different pairs with first coordinate 2.
• The graphs of functions in beginning calculus have the functional property.
• The empty set ${\emptyset}$ has the functional property .

#### Example: Graph of a function defined by a formula

The graph of the function ${G}$ given above has the functional property. The graph is the set

$\displaystyle \left\{ (x,{{x}^{2}}+2x+5)\,\mathsf{|}\,x\in {\mathbb R} \right\}.$

If you repeatedly plug in one real number over and over, you get out the same real number every time. Example:

• if ${x = 0}$, then ${{{x}^{2}}+2x+5=5}$.  You get 5 every time you plug in 0.
• if ${x = 1}$, then ${{{x}^{2}}+2x+5=8}$.
• if ${x =-2}$, then ${{{x}^{2}}+2x+5=5}$.

This set has the functional property because if ${x}$ is any real number, the formula ${{{x}^{2}}+2x+5}$ defines a specific real number. (This description of the graph implicitly assumes that ${\text{dom } G={\mathbb R}}$.)  No other pair whose first coordinate is ${-2}$ is in the graph of ${G}$, only ${(-2, 5)}$. That is because when you plug ${-2}$ into the formula ${{{x}^{2}}+2x+5}$, you get ${5}$ every time. Of course, ${(0, 5)}$ is in the graph, but that does not contradict the functional property. ${(0, 5)}$ and ${(-2, 5)}$ have the same second coordinate, but that is OK.

How to think about the functional property

The point of the functional property is that for any pair in the set of ordered pairs, the first coordinate determines what the second one is. That’s why you can write “${G(x)}$” for any ${x }$ in the domain of ${G}$ and not be ambiguous.

### Mathematical definition of function

A function${f}$ is a mathematical structure consisting of the following objects:

• A set called the domain of ${f}$, denoted by ${\text{dom } f}$.
• A set called the codomain of ${f}$, denoted by ${\text{cod } f}$.
• A set of ordered pairs called the graph of ${ f}$, with the following properties:
• ${\text{dom } f}$ is the set of all first coordinates of pairs in the graph of ${f}$.
• Every second coordinate of a pair in the graph of ${f}$ is in ${\text{cod } f}$ (but ${\text{cod } f}$ may contain other elements).
• The graph of ${f}$ has the functional property. Using arrow notation, this implies that ${f:A\rightarrow B}$.

### Examples

• Let ${F}$ have graph ${\{(1,2), (2,4), (3,2), (5,8)\}}$ and define ${A = \{1, 2, 3, 5\}}$ and ${B = \{2, 4, 8\}}$. Then ${F:A\rightarrow B}$ is a function.
• Let ${G}$ have graph ${\{(1,2), (2,4), (3,2), (5,8)\}}$ (same as above), and define ${A = \{1, 2, 3, 5\}}$ and ${C = \{2, 4, 8, 9, 11, \pi, 3/2\}}$. Then ${G:A\rightarrow C}$ is a (admittedly ridiculous) function. Note that all the second coordinates of the graph are in ${C}$, along with a bunch of miscellaneous suspicious characters that are not second coordinates of pairs in the graph.
• Let ${H}$ have graph ${\{(1,2), (2,4), (3,2), (5,8)\}}$. Then ${H:A\rightarrow {\mathbb R}}$ is a function.

According to the definition of function, ${F}$, ${G}$ and ${H}$ are three different functions.

### Identity and inclusion

Suppose we have two sets A and B with ${A\subseteq B}$.

• The identity function on A is the function ${{{\text{id}}_{A}}:A\rightarrow A}$ defined by ${{{\text{id}}_{A}}(x)=x}$ for all${x\in A}$. (Many authors call it ${{{1}_{A}}}$).
• The inclusion function from A to B is the function ${i:A\rightarrow B}$ defined by ${i(x)=x}$ for all ${x\in A}$. Note that there is a different function for each pair of sets A and B for which ${A\subseteq B}$. Some authors call it ${{{i}_{A,\,B}}}$ or ${\text{in}{{\text{c}}_{A,\,B}}}$.

Remark The identity function and an inclusion function for the same set A have exactly the same graph, namely ${\left\{ (a,a)|a\in A \right\}}$.

### Graphs and functions

• If ${f}$ is a function, the domain of ${f}$ is the set of first coordinates of all the pairs in ${f}$.
• If ${x\in \text{dom } f}$, then ${f(x)}$ is the second coordinate of the only ordered pair in ${f}$ whose first coordinate is ${x}$.

#### Examples

The set ${\{(1,2), (2,4), (3,2), (5,8)\}}$ has the functional property, so it is the graph of a function. Call the function ${H}$. Then its domain is ${\{1,2,3,5\}}$ and ${H(1) = 2}$ and ${H(2) = 4}$. ${H(4)}$ is not defined because there is no ordered pair in H beginning with ${4}$ (hence ${4}$ is not in ${\text{dom } H}$.)

I showed above that the graph of the function ${G}$, ordinarily described as “the function ${G(x)={{x}^{2}}+2x+5}$”, has the functional property. The specification of function requires that we say what the domain is and what the value is at each point. These two facts are determined by the graph.

### Other definitions of function

Because of the examples above, many authors define a function as a graph with the functional property. Now, the graph of a function ${G}$ may be denoted by ${\Gamma(G)}$.  This is an older, less strict definition of function that doesn’t work correctly with the concepts of algebraic topology, category theory, and some other branches of mathematics.

For this less strict definition of function, ${G=\Gamma(G)}$, which causes a clash of our mental images of “graph” and “function”. In every important way except the less-strict definition, they ARE different!

A definition is a device for making the meaning of math technical terms precise. When a mathematician think of “function” they think of many aspects of functions, such as a map of one shape into another, a graph in the real plane, a computational process, a renaming, and so on. One of the ways of thinking of a function is to think about its graph. That happens to be the best way to define the concept of function.  (It is the less strict definition and it is a necessary concept in the modern definition given here.)

The occurrence of the graph in either definition doesn’t make thinking of a function in terms of its graph the most important way of visualizing  it. I don’t think it is even in the top three.

Send to Kindle