4

On this site, many people have defined a function as a triplet $(X,Y,f)$. What is $f$? A transforming process? Can a distinction be made between $f$ and the function? When defining it, people call $f$ a subset of $X\times Y$, but would you not call the triplet a subset of the sets $X$ and $Y$?

This question came about because of the idea of applying a function. How is it possible to apply a function if it is defined as a triplet?

Joe
  • 19,636
YK2092
  • 49
  • 1
    Usually a function is described $f:X\rightarrow Y$ where $X$ is a set called the "domain," $Y$ is a set called the "target set," and for each $x\in X$ there is a value $f(x) \in Y$. The function is called function $f$. – Michael Aug 05 '23 at 13:45
  • But why do we call the function a triplet then? If f is the function, why does there have to be an X and Y set used in defining it? – YK2092 Aug 05 '23 at 13:49
  • Your user name is YK2092, which is used to refer to you, but I assume there is more to you than just your name. Your name does not define you. – Michael Aug 05 '23 at 13:49
  • 1
    It's an abuse of notation. People use "function" to refer to both the triple $(X,Y,f)$ and the "function graph" $f$. Usually, the context is clear enough to infer what one means. – Sambo Aug 05 '23 at 13:52
  • I see what you are getting at, but it feels like there is an inconsistency beyond convenience here. You described a function as f:X→Y and then called f a function. I know I’m being very nit-picky but it really does confuse me. – YK2092 Aug 05 '23 at 13:55
  • It is like in a computer program when you instantiate a data structure and give it a name. Here $f:X\rightarrow Y$ instantiates a structure that is labeled $f$ and has a domain $X$ and target set (or "codomain") $Y$. This still does not specify the function since you would need to specify values $f(x)$ for each $x \in X$. The computer program would need to define those, say, in some tabular form, to fully specify the function. For example if $X = {green, red, blue}$ we would need to specify values of $f(green), f(red), f(blue)$. – Michael Aug 05 '23 at 13:58
  • 1
    @YK2092 For example, the rule $f$ which takes $x$ to $x^2$ is a different function if on one hand, $X$ is the set of integers and on the other, $X$ is the set of real numbers. – John Douma Aug 05 '23 at 14:02
  • @Sambo That makes sense! But what is the difference between the function graph and the triplet? Which one would it be correct to call the function? – YK2092 Aug 05 '23 at 14:13
  • 1
    It is appropriate to define a function by including its domain. $f = 1/x$ defined on $[1,2]$ has different global properties than if defined on $[-1,1]$, for instance... such as continuity. – David G. Stork Aug 05 '23 at 16:17
  • Regarding the duplicates, this answer is particularly relevant. – Xander Henderson Aug 06 '23 at 15:49

1 Answers1

9

The naive conception of a function $f:X\to Y$ is that it is a "rule" or "transformation" with the following property: to every $x\in X$, there is associated a unique $y\in Y$; this $y$ is denoted as $f(x)$. The set $X$ is called the domain of the function, and $Y$ is called the codomain. The graph of $f:X\to Y$ is the set $$ \{(x,y)\in X\times Y\mid\text{$y=f(x)$}\} \, . $$

Two functions $f:X\to Y$ and $g:A\to B$ are considered equal if and only if:

  • They have the same domain: $X=A$.
  • They have the same codomain: $Y=B$.
  • They have the same values: for all $x\in X$, the equality $f(x)=g(x)$ holds. Equivalently, we could ask that they have the same graph.

Note that we do not require that $f$ has to be expressible by an algebraic formula, or even by one uniform condition that applies to every element of $X$. For example, it is perfectly acceptable to define a function $f:\mathbb R\to\mathbb R$ such that $f(x)=1$ if $x$ is rational and $f(x)=0$ if $x$ is irrational. This means that the term "rule" arguably does not do justice to the modern viewpoint of functions, which is that each $x\in X$ can be associated to any $y\in Y$, and it is irrelevant whether a function can be described by a nice formula (or even be described at all).

Although the naive conception of a function suffices for doing most ordinary mathematics, you might reasonably question whether it is a precise enough notion – just what do we mean by "rule" or "transformation", after all? To allay your discomfort, mathematicians formulated the triple definition, which makes no mention of vague words like "rule" or "transformation". The triple definition might not seem particularly intuitive to you – I will add some further comments about this at the end of my answer. For now, I ask you just to go along with it.

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'$.

We give the following names to the sets $X$, $Y$, and $f$:

  • $X$ is called the domain.
  • $Y$ is called the codomain.
  • $f$ is called the graph.

If $x$ is an arbitrary element of $X$, then it follows from properties (1) and (2) that there is one and only one $y\in Y$ such that $(x,y)\in f$; this $y$ is denoted as $f(x)$.

Earlier, we mentioned that two functions are consider equal if and only if they have the same domain, codomain, and values. The triple definition reflects this.

It is common to refer to the function as $f:X\to Y$ rather than $(X,Y,f)$. This practice should not lead to any confusion, since we are still specifying the three "ingredients" that make up the function. For completeness, we should note that the range (or image) of $f:X\to Y$ is defined as $$ \{y\in Y\mid\text{there is an $x\in X$ such that $f(x)=y$}\} \, . $$ However, this concept does not enter the following discussion.

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. Another way to make sense of this is to use a different letter, say $\mathcal G$, for the graph of the function, and let $f=(X,Y,\mathcal G)$. Then, $f$ is literally the function.

As it happens, you will often hear even more informal statements such as "consider the function $f(x)=x^2$". Such ellipsis only makes sense when the domain and codomain are clear from context. In this case, it is most likely that what is meant is the following: "consider the function $(\mathbb R,\mathbb R,f)$, where $f=\{(x,y)\in\mathbb R\times\mathbb R\mid y=x^2\}$".

Although the triple definition is undoubtedly precise, it is quite normal to find it unsatisfying in a number of ways. For instance, the idea of thinking of a function as a triple, and $f$ as a subset of the cartesian product of two sets, will probably seem quite unnatural to you. Actually, most mathematicians would agree with you. So why is the triple definition the "accepted" way of defining functions? This is quite a difficult question to answer, but I will try my best.

The first thing to note is that few people actually claim to think of a function as a triple. The definition above should not be interpreted as the "correct" way of thinking of functions in practice. Instead, it serves a different purpose: it convinces us that it is possible to give a precise meaning to the naive conception of a function. This helps reassure us that the naive conception will not lead to any contradictions. It also shows that more complicated mathematical objects can be "implemented" in terms of simpler ones, if one so desires.

This phenomenon can be seen throughout pure mathematics. In fact, ordered triples can themselves be defined in terms of ordered pairs $(a,b)$, and ordered pairs can be defined in terms of sets. The prevailing convention in set theory is to define $(a,b)$ as the set $\{\{a\},\{a,b\}\}$! Again, nobody is claiming that this is how they think of ordered pairs in practice. The naive conception of an ordered pair is that it is some object $(x,y)$ such that $(x,y)=(x',y')$ if and only if $x=x'$ and $y=y'$. All the set-theoretic definition does is help convince us that this idea make sense: there is a mathematical object with the aforementioned property. However, for our day-to-day purposes, it is completely irrelevant what an ordered pair is formally defined as: what matters is the properties that it has. In fact, some mathematicians would go as far as saying that $(x,y)=\{\{x\},\{x,y\}\}$ is not really a definition: rather, it is simply how ordered pairs are implemented in a set theory. In practice, we favour the idea that numbers, ordered pairs, functions, and sets etc. all have different "types"; thinking of them all being sets in disguise is rather unnatural and unhelpful.

Useful reading

  • In this post, Asaf Karagila offers some more thoughts about how we should think of functions from a foundational point of view. (By contrast, my answer mainly focuses on how we should think of functions in "ordinary mathematics" – i.e. outside of logic and set theory.) Asaf's answer also mentions a different way that functions are sometimes defined in set theory.
  • The difference between the two definitions of a function is elaborated further in this post by John Bentin. Briefly, if a function is identified with its graph, then the concept of the codomain no longer makes sense: the function $f:\mathbb R\to\mathbb R$ given by $f(x)=x^2$ is identical to the function $g:\mathbb R\to[0,\infty)$ given by $g(x)=x^2$ according to the "set of ordered pairs..." definition.
Joe
  • 19,636
  • Thank you for the intricately thought-of definition. When you provided the definition and called it the graph, could you elaborate on what you meant? – YK2092 Aug 05 '23 at 15:43
  • @YK2092: The graph of $f:X\to Y$ is the set$${(x,y)\in X\times Y\mid\text{there is an $x\in X$ such that $f(x)=y$}}$$Note that when we use the "ordered triple" definition rather than the "naive" conception of a function: the graph of $(f,X,Y)$ is also equal to $f$ (remember we defined $f$ as a subset of $X\times Y$ satisfying blah blah blah...). By contrast, in the naive conception of a function, $f$ is not really thought of as any kind of set: it's just a shorthand for $f:X\to Y$. Does that answer your question? If not, feel free to inquire further. – Joe Aug 05 '23 at 15:59
  • No not exactly. You said, “f is called the graph”. By that, I am assuming you meant as in some process rather than a graph on a Cartesian coordinate-plane since every function cannot be represented by numbers. – YK2092 Aug 05 '23 at 16:07
  • @YK2092: This is just a case of a word having more than one mathematical meaning. In elementary algebra, the graph of a function $\mathbb R\times\mathbb R$ refers to the geometric figure in the Cartesian plane which you know and love. But in set theory and analysis, the graph of a function is the set as I have defined it. There is, however, a connection between the two meanings: if a function is from $\mathbb R$ to $\mathbb R$, then its graph in the elementary sense is a geometric depiction of the graph in the set-theoretic sense. – Joe Aug 05 '23 at 16:13
  • @YK2092: Does that answer your question? (I've also added a few extra comments to my answer which you might be interested in.) – Joe Aug 06 '23 at 13:09
  • @YK2092: Two small errors in my previous comments: the definition of "graph" in my above comment was wrong, since it uses the letter $x$ in two different ways: I've added the correct definition to my answer. Also, my comment should say "In elementary algebra, the graph of a function $\mathbb R\to\mathbb R$ refers..." I wrote $\mathbb R\times\mathbb R$ instead. – Joe Aug 06 '23 at 13:41
  • can you add links to some reliable sources about f=(X,Y,G) (and response in comment - this will notify me) ? – Kamil Kiełczewski Feb 28 '24 at 19:59
  • @KamilKiełczewski: I'm not sure which part of my answer you are referring to, sorry. – Joe Feb 28 '24 at 20:28
  • @Joe I ask about other sources, where authors define function as f=(X,Y,G) like you – Kamil Kiełczewski Feb 28 '24 at 20:30
  • 1
    @KamilKiełczewski: This definition goes back to Bourbaki, I believe, in Théorie des ensembles ("Theory of Sets", 1970). Further definition of the history of the definition of a function can be found in this question on MathOverflow. – Joe Feb 28 '24 at 20:41