Produced by Charles Wells Revised 20150323. Introduction to this website website TOC website index blog Back to head of functions chapter
Contents

It is essential that you understand many of the images, metaphors and terminology that mathematicians 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.
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 examples of functions chapter contains many examples. The two I give here provide immediate examples.
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.
Let $G$ be the realvalued function defined by the formula $G(x)={{x}^{2}}+2x+5$.
Many mathematical definitions 
This discussion is an oversimplification of the history of mathematics, 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 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 functionasalgorithm. Of course, the study of algorithms is one of the central topics of modern computing science, so the notion of functionasformula (updated to functionasalgorithm) has achieved a new importance in recent years.
To state both the old abstract definition and the modern one, we need a preliminary idea.
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$.
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.
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.
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.
A function $f$ is a mathematical structure consisting of the following objects:
Using arrow notation, this implies that $f:A\to B$.
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.
Suppose we have two setsĀ A andĀ B with $A\subseteq 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.
Some confusion can result because of the presence of these two different definitions.
Some older mathematical papers in complex function theory do not tell you that their functions are multivalued. There was a time when complex function theory was such a Big Deal in research mathematics that the phrase "function theory" meant complex function theory and all the cognoscenti knew that their functions were multivalued. 
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.
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 different 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 multivalued function is not a function!". A stepmother is not a mother, either. See the Handbook article on radial category. 
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.
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 setswithstructure 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 setswithstructure as a means of defining concepts.
This work is licensed under a Creative Commons AttributionShareAlike 2.5 License.