# How does the common definition of a function satisfy the precise definition of a function?

Before my reading on Linear Algebra by Hoffman/Kunze, I was under the impression that a function was "a rule (or mathematical object) that maps/assigns each $$x \in X$$ (domain) to an element $$y \in Y$$ (codomain)". However, stumbling across Hoffman/Kunze's LA book, in the appendix, it defines a functions as a mathematical object which consists of:

• Domain $$\longrightarrow$$ set of possible inputs
• Co-domain $$\longrightarrow$$ set of possible values outputted
• Rule $$\longrightarrow$$ associates each element in the domain to a single element in the codomain

This got me confused as I previously interpreted the rule being the whole function, not being only a part of the function. This changed my understanding because functions were no longer just "a rule that maps..." but instead an object that consisted of a rule and other parts. I did some researching and stumbled across a few "more precise" (but less common) definitions where it also stated that function as three parts. For example, Joe's answer here states that a function is...

Definition. A function is an (ordered) triple ($$X$$, $$Y$$, $$f$$), where $$X$$ and $$Y$$ are sets, and $$f$$ is a subset of $$X \times Y$$ satisfying the following properties:

1. For every $$x \in X$$, there is a $$y \in Y$$ such that ($$x$$, $$y$$) $$\in f$$.
2. For every $$x \in X$$, and for all $$z$$, $$z' \in Y$$, if ($$x$$, $$z$$) $$\in f$$ and ($$x$$, $$z'$$) $$\in f$$ then $$z=z'$$.

Additionally, a few other sources (that I could find online) define it nearly the same way (with a few saying $$f$$ is a graph instead of a rule), such as Asaf Karangila's answer, Reed College's Math 111 Lecture Note, Topoi by Robert Goldblatt, etc.

Eventually, I concluded my search and problems by accepting the ordered triple definition of the function. I told myself that the reason why the less precise definition of the function defined it as a rule was because of something that Joe and my LA book mentioned in common. Taken from the same answer by Joe, it says:

Commentary. If our definition is to be taken seriously, then $$f$$ is not the function: rather it is the graph of the function. Nevertheless, it is conventional to abuse notation and refer to the triple ($$X$$, $$Y$$, $$f$$) as $$f$$ for short.

Similarly, in Hoffman/Kunze's LA book, it comments:

If ($$X$$, $$Y$$, $$f$$) is a function, we shall also say $$f$$ is a function from $$X$$ into $$Y$$. This is a bit sloppy, since it is not $$f$$ which is the function; $$f$$ is the rule of the function. However, this use of the same symbol for the function and its rule provides one with a much more tractable way of speaking about functions.

To clarify, I told/convinced myself that functions are commonly defined as rules because people would "sloppily" abuse the notation $$f$$ and refer it to both the function and its rule, which therefore caused an adaptation to the definition of a function being a rule.

However, I still feel that my reasoning isn't perfect and in some way, still don't understand whether the definition of a function as a rule is correct or not and why people define it like that. Is it saying something different from the precise definition of a function, or am I not understanding something correctly? Are there any flaws to the rule definition of the function?

• Whether you use "rule" or "graph" or "map" or "ordered pairs" depends on which formalism you are using, and there are several different approaches. Understanding and misunderstanding of functions existed before the formalisms (a function being a "graph" would once have been thought to mean a continuous pencil line, before people considered that discontinuous functions were possible); the formalisms were designed to fit the idea of a function rather than the other way round. Sep 28 at 23:34
• @manooooh Your definition of a function as "just" the set of ordered pairs is not right if you honor the distinction between the codomain and the range. In many contexts you want the function with "rule" $f(x)) = 1$ for all real $x$ to be a function from $\mathbb{R}$ to $\mathbb{R}$, not to the set $\{1\}$. Sep 28 at 23:55
• This definitional discrepancy/ambiguity/sloppiness is very widespread. It has been a pet peeve of mine since approximately the 7th grade, when I first discovered it by missing a standardized test question about surjectivity. It is straightforward to see that the concept of surjectivity can only be defined with respect to the ordered-triple definition of a function, not the rule-only definition. Sep 29 at 7:57
• The important thing here is to recognise the asymmetry between the concepts of domain and codomain. The domain X is entirely determined by the rule; only the codomain cannot be determined uniquely from the rule. For instance, if Y is a subset of Z, then any function with domain X and codomain Y can trivially be extended into a function with domain X and codomain Z and the same rule. So the distinction between the two definitions (just the rule, or the triplet domain-codomain-rule) only matters if you care about the codomain.
– Stef
Sep 29 at 17:58

The codomain sometimes matters. For example, in linear algebra you want the function $$F$$ with domain $$\mathbb{R}^n$$ that maps every vector to the zero vector to be a function from $$\mathbb{R}^n$$ to itself. If all you care about is the rule then it might be a function from $$\mathbb{R}^n$$ to the one element set $$\{(0,0,\ldots,0)\}$$.

Most of the time, as here, the right codomain is obvious from the context and you can just think about the "rule". The formal three part definition is there in the background if you need it.

Edited in response to the comments.

I added the word "sometimes" to the first sentence. When I first studied mathematics many decades ago there were no explicit codomains in first courses in linear and abstract algebra. When the unnamed codomain mattered it was obvious and unstated.

• Or rather, the codomain sometimes matters, and so it needs to be in the "machinery". Other times it's sufficient to have a function from $\mathbb{R}^n$ to some subset of itself, and then you don't need to know the codomain (or can safely take the codomain to be the range). Sep 29 at 11:13
• And some times, the codomain truly doesn't matter. Kenneth Kunen's book on set theory (at least the 1st edition) defines functions to have just domains and no codomains. Sep 29 at 23:49
• @Arthur: That’s not just Kunen — defining functions as just the set of input-output pairs (which fixes the domain, but leaves the codomain ambiguous) is the older and longer-established formal definition. Before the $f : A \to B$ notation became standard, $f(A) \subset B$ was common. Considering the codomain as specified is now more standard in many areas of maths — particularly those that have adopted even a minimal amount of category-theoretic language as an organising framework — but set theory is very much on the conservative side in that respect. Sep 30 at 16:00

You might look here for a discussion of the history of the concept of function. The idea of function as "rule" is closer to the usage of a few centuries ago, but not the modern view. There certainly does not have to be a "rule" in the sense of something that can, in principle, be written down on a piece of paper: there are just too many functions (in the sense of cardinality) and too few rules for that. Moreover, it is quite possible that different rules result in the same function, i.e. the same collection of ordered pairs.

• Given $f$ as graph, the rule is simply "table lookup", find the ordered pair starting with $x$, return the second element $y$. Of course usually a "rule" is understood to be an arithmetic expression, which restricts its applicability as described above. Sep 29 at 10:30

We could write down the following definitions:

Rule Definition

Let $$X$$ and $$Y$$ be sets. Let $$f\subseteq X \times Y$$. We speak of the function $$f$$ with domain $$X$$ and codomain $$Y$$ (and may abbreviate this as $$f:X\to Y$$) if (1 and 2 copy-pasted from your Q)

1. For every $$x \in X$$, there is a $$y \in Y$$ such that ($$x$$, $$y$$) $$\in f$$.
2. For every $$x \in X$$, and for all $$z$$, $$z' \in Y$$, if ($$x$$, $$z$$) $$\in f$$ and ($$x$$, $$z'$$) $$\in f$$ then $$z=z'$$.

(Often, we slip into simply calling this "the function $$f$$", but this has dangers--see below.)

But formalistically, some may not consider the above to be a "definition", because we fail to attach any mathematical object to the name "function $$f$$ with domain $$X$$ and codomain $$Y$$". So, to address this concern, we may prefer the following:

Ordered Triple Definition

Let $$X$$ and $$Y$$ be sets. We call $$(X,Y,f)$$ the function $$f$$ with domain $$X$$ and codomain $$Y$$ if

1. Same as above.
2. Same as above.

(Often, we slip into simply calling this "the function $$f$$", but this has dangers--see below.)

There isn't any difference between the two definitions (except very formalistically).

The Ordered Triple Definition is simply more explicit in (1) attaching a mathematical object to a new term we are defining; and (2) including the domain and codomain in the definition of the function.

In the Rule Definition, it's also important to explicitly state what the domain and codomain are.

Dangers of Referring to "the Function $$f$$"

Suppose we have $$f\subseteq X \times Y$$ where 1 and 2 are satisfied.

Now suppose $$Z$$ is some superset of $$Y$$.

Under the Rule Definition, "the function $$f$$ with domain $$X$$ and domain $$Y$$" (or $$f:X\to Y$$) is different from "the function $$f$$ with domain $$X$$ and domain $$Z$$" (or $$f:X\to Z$$).

But this point may not be sufficiently clear. Especially because we tire of repeatedly stating in full "the function $$f$$ with domain $$X$$ and domain $$Y$$" and sometimes slip into speaking simply of "the function $$f$$". In which case, it may not be clear that we are talking about "the function $$f:X\to Y$$" and not "the function $$f:X\to Z$$"

So, to make this point clearer, we may instead prefer the Ordered Triple Definition.

But under the Ordered Triple Definition, we sometimes also slip into referring to "the function $$f$$" too and so the exact same problem arises.

• Actually, with the first rule definition, the function does not know about its codomain, so eg an inclusion $X \to Y$ is equal to the identity function of $X$. This is not an important distinction except when dealing with foundations (and even then I'm not sure exactly where this is important). Sep 29 at 8:21
• Or to put it another way, in the second definition, the function with domain {0} that maps 0 to 1 with codomain {1} is a different function from the function with domain {0} that maps 0 to 1 with codomain $\mathbb{N}$. In the first definition they are the same function, and calling it "a function with domain X and codomain Y" could be misleading, if doing so suggests that Y is unique for the function. Sep 29 at 11:05
• @ronno The intended codomain can be extremely relevant in contexts beyond foundations. For example, if a subset $N \subset M$ of a smooth manifold $M$ is identified as an embedded submanifold with the inclusion map $i : N \to M$ an embedding, the nature of the pullback map $i^*$ on differential forms is very different whether one thinks of $i$ as having codomain $N$ or $M$. Sep 29 at 14:11
• @jawheele Good point, but you could also think of that situation as the map $i \mapsto i^*$ depending on that extra data of the codomain and not $i$ itself. That is, there are different pullbacks $C^\infty(N, M) \to \operatorname{Hom}(\Omega^\bullet M, \Omega^\bullet N)$ and $C^\infty(N, N) \to \operatorname{Hom}(\Omega^\bullet N, \Omega^\bullet N)$ and they do not agree on $C^\infty(N, N) \subset C^\infty(N, M)$. Sep 29 at 16:36
• @MartinArgerami if you think of functions as not knowing about their codomains then surjectivitity is a property of pairs (function, codomain), not of just the function. Sep 30 at 10:38

The point these definitions are making is the that function $$f(x) = x^2$$ on the real numbers is not the same object as the function $$g(x) = x^2$$ on the space of $$2 \times 2$$ integer matrices. Both of these sets do have multiplication operations allowing you to write down a rule ($$x^2$$) on them that has the same form. But it's not really the "rule" that's the function; it's the relationship that the rule yields. And perhaps "relationship" is too imprecise. What it really is is the set of ordered pairs, along with an understanding of what the codomain is chosen to be.

Another perspective: you can think of the domain and codomain as "metadata". If you don't specify them, you have not specified the function. But if you have two different functions from $$X$$ to $$Y$$, you don't think of them as two triples $$(X, Y, f)$$ and $$(X, Y, g)$$ unless you're being super pedantic.

This is actually a common move in mathematical definitions. Whenever you are trying to define an object that always has to have certain other objects associated to it, you can define it as a tuple where one of the items is the "main one" and the others are the "metadata". They are properties that the main object has.