I have been told that two functions $f$ and $g$ are equal if and only if the domain and the subset of the cartesian product of the two functions is the same. My question is, given that a function is a special case of a relation, both $f$ and $g$ are sets, why is it not sufficient to just verify if the cartesian product is the same between the two functions?. In other words, doesn't the third condition implies that both domains are equal?
2 Answers
A function $f:X\to Y$ consists of three pieces of information: the domain $X$, the codomain $Y$, and the graph $G_f\subseteq X\times Y$. So formally, it makes sense to define a function not just as its graph, but as the tuple $(X,Y,G_f)$, and two functions $f=(X,Y,G_f)$ and $g=(V,W,G_g)$ are equal iff $X=V$, $Y=W$, and $G_f=G_g$. In words, two functions are equal iff their domains, codomains and graphs are equal. But we get the domain for free by checking the graphs, since the graphs contain a pair $(x,f(x))$ for every $x\in X$, so we can extract the domain from the graph. So we only need to check the graph and the codomain, but not the domain.

- 13,226
- 2
- 13
- 41
-
1This answer is incredibly misleading. Neither codomain, nor domain are part of the standard definition of a function. The standard definition of a function is simply a set of ordered pairs, where the 1st element of each pair is unique (what you call $G$). Domain is then defined from this definition. Codomain cannot be, but codomain is an add-on to the definition. It isn't standard but can help make annoying technicalities in theorems vanish. Technically we shouldn't call "functions with codomain" functions at all, they should be their own separate object. – Nov 06 '20 at 23:38
-
7@SenZen: I strongly disagree. As a researcher in mathematics, I have never heard that codomains are not "standard but can help make annoying technicalities in theorems vanish." You'll note that Wikipedia, for example, includes the domain and codomain in the definition of a function. – Jacob Manaker Nov 07 '20 at 00:23
-
@Jacob Manaker. That's because research mathematics about just that - research. When we first learn the definition of a function, we learn it without the concept of domain or codomain. You'll note that Wikipedia states that formally speaking, codomain and domain aren't necessary, but that they are commonly used because they make annoying technicalities vanish. – Nov 07 '20 at 01:21
-
6@SenZen I would rather say that what you're saying is incredibly misleading. Elementary properties of functions such as surjectivity depend on the codomain of the function. One doesn't specify the codomain to "make annoying technicalities vanish" but so that basic notions like surjectivity are well-defined. – user159517 Nov 07 '20 at 07:47
-
1@user159517 You can define surjectivity without codomain, in fact it is more natural to do so. The way you do it is by defining subjectivity with respect to a given set $Y$. For example the function ${(1,2),(3,4)}$ is surjective with respect to ${2,4}$. This is much more natural because in reality we only care about functions surjective to $\mathbb{R}$ or $\mathbb{C}$ or some other nice number system. – Nov 07 '20 at 08:36
-
1I think there is merit in discussing whether (co)domains should be part of the definition. But I don't think this comment thread is the right place for it. I suggest either taking this to chat or @SenZen to ask question on their own. First and foremost, we should teach the standard definition to newcomers (such as OP). And there is absolutely no doubt that this answer reflects the standard. – ComFreek Nov 07 '20 at 08:40
-
For example, it is true that $f(x) = x^2$ is surjective to $\mathbb{R}^+$. Now try to show me a theorem (any at all) that I can apply this function to based on it's surjectivity. – Nov 07 '20 at 08:40
-
1
-
1@SenZen There are plenty, e.g. that $f$ admits some post-inverse $g\colon\mathbb{R}^+\to\mathbb{R}$, i.e. $g \circ f = \mathrm{id}_\mathbb{R}$. Well, you not having learnt the standard way first has no implications on whether it is the standard way or not. – ComFreek Nov 07 '20 at 08:45
-
@SenZen: we get an incomplete picture when first learning about a lot of things. Or did you learn that addition and multiplication are part of the definition of the real numbers when you first learned about the reals? Probably not, but they still are. Tbf, it's fine to identify a function and its graph when talking about concepts, since the graph is the thing that carries most of the structure. After all, we talk about elements of a group all the time, even though we mean elements of the underlying set $G$, not the tuple $(G,\cdot,e)$. But we should recognize that it's technically wrong. – Vercassivelaunos Nov 07 '20 at 08:50
-
@SenZen "is surjective with respect to..." is not standard terminology. There is a standard notion for precisely what you want to formalize here, and it's called the codomain of a function. – user159517 Nov 07 '20 at 08:57
-
@Comfreek is right, this is getting to long for comments, I'll make a question later. – Nov 07 '20 at 10:27
In foundations of mathematics, especially set-theoretic foundations, a function is nothing more than a certain kind of set of ordered pairs, from which you can easily extract its domain and its range, and there is no such thing as a codomain of a function. Two functions are equal exactly when they are the same set, which is equivalent to when they have the same domain and the same output on every input from the domain.
This behaviour is very important when you actually want to build foundations of mathematics, especially in a proper proof of a basic recursion theorem, and for a proper proof of the full recursion theorem. In such proofs, you glue together approximations of a desired function by simply taking the union, and there is no need nor benefit in requiring functions to have "codomains" in such foundations.
So if you really want to understand how everything is built based on ZFC, indeed for two functions to be equal it suffices for them to be the same set of ordered pairs, as it implies that their domains are equal.
Concerning the arguments people are having in other comments, I will just say that it is actually standard terminology to say "$f$ surjects onto $T$" when one wants to be consistent with set-theoretic foundations, since "$f$ is a surjection" makes no sense in this setting. Foundationally, "$f : S→T$" simply means that $f$ is a function with domain $S$ whose range is a subset of $T$.
In practice people who do not have a background in foundations of mathematics tend to mean not just that but also that $f$ is 'tagged' with a codomain $T$. Foundationally, we would need to represent such a 'tagged function' by something like a pair $(f,T)$. Then again, I would say that even these people are often inconsistent with their notation, because they frequently define functions without specifying a codomain, and also they consider any function from $ℕ$ to $ℝ^+$ as also a function from $ℕ$ to $ℝ$.

- 57,693
- 9
- 98
- 256
-
1If anyone wants a clear-cut reference, see "Set Theory" by Jech where he not only gives the same precise definitions in line with what I said here, and is careful to always say "is onto something" and never says "is a surjection", but also defines functions by giving only domain and mapping (not giving any codomain) (e.g. Theorem 3.2 and Lemma 3.3). – user21820 Nov 07 '20 at 13:31
-
1Addendum: there are foundations that do associate every function with a domain and codomain, e.g. usual flavors of type theory. There $f\colon S \to T$ really means: $f$ is a term of type $S \to T$. And both the "of type" and function types $_\to_,$ are usually foundational constructs, i.e. they are not just some notation desugaring to "weaker" statements like in ZFC. – ComFreek Nov 07 '20 at 20:36
-
@ComFreek: I am well aware of type theories. But the question here clearly is about functions over a conventional set-theoretic foundation. Furthermore, did you look at the posts I linked to? Can you prove the full recursion theorem in the kind of type theory you are talking about? And that is just recursion along $ℕ$. What about transfinite recursion? Can you prove the well-ordering theorem for arbitrary sets/types, and Zorn's lemma for arbitrary partial orders? Being forced to build functions with fixed output types is terrible, and even dependent types are too inflexible. – user21820 Nov 23 '20 at 08:39
-
1I am not saying one is better than the other. I just wanted to add that some foundations (how usable they may be) do associate a domain and codomain to function declarations $f\colon S \to T$. – ComFreek Nov 23 '20 at 10:11
-
@ComFreek: Sure, and that is why I emphasized that my answer was focused on set-theoretic foundations of mathematics. I still think it is not beneficial to talk about alternative foundations with students who do not even know the basics of the conventional one. It just makes everything seem confusing. It's like if a student asks why a C++ recursive procedure causes stack overflow and we answer like, well actually in other programming languages you can do such recursion and not get stack overflow. But thanks for your clarification anyway! – user21820 Nov 23 '20 at 11:03
-