Consider the function $f:\mathbb R\to \mathbb R$ and $g:\mathbb R\to \mathbb R^+$ (in that question $\mathbb R^+$ is a set of nonnegative real numbers). And let define for any $x$ in domains of this functions $f(x)=x^2$ and $g(x)=x^2$. And if we look at set-theoretical definition of function it seems this functions must be equal, because $f$ contains all elements of $g$ and vice versa. But $f$ is not surjective but $g$ is. Isn't it a contradiction ? Or maybe I made a mistake and this functions are not equal, so are this functions equal ?
-
1See the similar post : What is the right way to define a function ? – Mauro ALLEGRANZA Jul 10 '18 at 08:16
-
2There are probably more duplicates, but I was only allowed to put in so many. – Asaf Karagila Jul 10 '18 at 08:37
5 Answers
In my book (Kunen's set theory), functions are sets of pairs fulfilling certain properties (specifically, no first component appears twice), along with a domain, consisting only of points which appear as the first component of the pairs. A codomain is not part of that definition, so any codomain you choose (as long as it contains the image) will result in an equal function.
Edit: Reviewing the definition (I.6.3 in the second edition), he doesn't even require a domain to define a function. Merely that it is a set of ordered pairs fulfilling the functional property. However, relations (such as functions) may be restricted to a product $A\times B$, and in so doing you get a domain and a codomain.

- 199,419
-
Yes, and now the problem is property of surjectivity makes no sense because of the fact that codomain can be any set containing image of domain. – Юрій Ярош Jul 10 '18 at 08:29
-
2That is true. If you don't include codomain as part of your function definition, then you can't define surjectivity in any meaningful way. – Arthur Jul 10 '18 at 08:30
-
From what I can remember in set theory we define function as a special case of relation, which is defined to be a subset of the Cartesian product of 2 sets, those 2 sets are the domain and codomain, so it does include (not directly) the domain and codomain, or maybe my memory is wrong? – ℋolo Jul 10 '18 at 08:38
-
@Holo I don't know whether you're wrong (I don't know what book you used), but Kunen defines a (binary) relation as a set of pairs, without any reference to an ambient product. – Arthur Jul 10 '18 at 08:40
-
I see, it makes sense, yet annoying, that the little definitions are not universal... I'll have to check with which conventions we worked and will review that part, hopefully today – ℋolo Jul 10 '18 at 08:42
A function $h : A \to B$ is defined as a subset $h \subseteq A \times B$ such that for every $x \in A$ there exists a unique $y \in B$ such that $(x,y) \in h$.
Your functions $f$ and $g$ are in this sense both equal to $$\{(x, x^2) : x \in \mathbb{R}\}$$
so $f = g$.

- 46,490
The functions are not equal, since their codomains are different !

- 77,394
-
But if you look at this functions as sets, it seems this sets should be equal. – Юрій Ярош Jul 10 '18 at 08:16
-
@ЮрійЯрош Just the domain and the image of the functions are equal. The codomains are not. – Bilbottom Jul 10 '18 at 08:19
-
@BillWallis If you look at the set theoretical definition of a function, it is a set of ordered pairs (or a subset of a cartesian product of domain and codomain ), and the problem is both $f$ and $g$ will end up being the same sets. – Юрій Ярош Jul 10 '18 at 08:26
-
@ЮрійЯрош Then, as Arthur mentioned, the set-theoretic definition does not give surjectivity any sensible meaning. – Bilbottom Jul 10 '18 at 08:34
The mathematical definition of a function does not only consist of how it maps ($f(x)=\dots$) but also of from where to where it maps. So your functions are different as one can indeed see from the fact that one is surjective and the other is not.
A function is defined using 3 things: domain, mapping, codomain.
Those 3 need to be always given at the definition, and 2 functions are equal if and only if all of those things are equal.
We have that the mapping and the domain are equal but the codomain is not equal (even though the images of the 2 are equal, only one of them is surjective)

- 10,006