22

Formally, I learned that a function $f: X \to Y$ is a subset $f \subset X \times Y$ subject to the condition that for every $x \in X$, there is exactly one $y \in Y$ such that $(x, y) \in f$. We write $y = f(x)$.

The graph of a function $f: X \to Y$ is the set $\{(x, f(x)) : x \in X\}$.

Based on these two definitions, the graph of a function is, well, just the function (i.e $\operatorname{graph} f = f$), which makes me wonder why would you consider the "graph" of a function if it doesn't tell you anything new?

user86116
  • 221
  • 4
    One cannot recover $Y$ from the graph, only the image $f(X)$. If all functions were their graphs then they'd all be onto. – coffeemath Jul 13 '13 at 04:13
  • 1
    In some contexts there is no difference: the function is its graph. In most contexts, however, the choice of $Y$ matters, and that cannot be recovered from the set of ordered pairs. Thus, we need to specify both the set of ordered pairs and the codomain $Y$. (For instance, surjectivity is meaningless without both the range and the codomain, and only the former is recoverable from the set of ordered pairs.) And if you allow partial functions, so that the domain need not be all of $X$, but you need to keep track of the ‘source’ set, then you must specify all three of $X,f$, and $Y$. – Brian M. Scott Jul 13 '13 at 08:33
  • 1
    I feel that we have this sort of discussion at least twice a year on the site. – Asaf Karagila Jul 13 '13 at 11:26
  • 1
    @AsafKaragila: History always finds a way to repeat itself? – Metta World Peace Jul 20 '13 at 08:15
  • If the graph of a function are a just a set of ordered pairs, then the graph of the graph of a function are the actual geometric points in the space $\mathbb R^n \times \mathbb R $ (their coordinates are ordered pairs). – john Jan 13 '24 at 00:29

4 Answers4

11

Consider the following two functions: $f:\mathbb R \to \mathbb R$, $f(x)=\sin(x)$, and $g:\mathbb R \to [-1,1]$, $g(x)=\sin (x)$. As functions, these two things are different simply because the codomain of one is different than the codomain of the other. However, since for all $x\in \mathbb R$ it holds that $f(x)=g(x)$, the graphs of both functions are identical.

Some aspects of a function are completely determined just by the graph, but some are not. For instance, injectivity of a function is completely determined by its graph, while surjectivity does not. I.e., $f$ above is not surjective, while $g$ is surjective.

When thinking of a function as a process it is natural to specify its domain (thought of as possible inputs) and its codomain (possible outputs) without committing oneself that every output really is attained. Here is an extreme example. Let $f:\mathbb R \to \mathbb R$ be given by $f(x)=e^{\sin(x)}\cdot\cos(x)$. I just defined the function without worrying about its precise image, which could be a pain to figure out if all I want to do is define the function.

Ittay Weiss
  • 79,840
  • 7
  • 141
  • 236
  • 1
    I agree. Further, I believe a function is completely determined by a specification of a graph and a codomain (since one can recover the domain from the graph). – Eric Auld Jul 13 '13 at 04:29
8

Some people use the definition of function along these lines:

A function from $X$ to $Y$ is an ordered triple $(X,f,Y)$, where $f\subseteq X\times Y$ and for each $x\in X$ there is unique $y\in Y$ fulfilling $(x,y)\in f$.

(Some examples of texts using this definition can be found if you try to search for function ordered triple or something similar in Google Books.)

This is basically the same thing as saying:

We consider two functions $f\colon X\to Y$, $g\colon Z\to W$ to be equal if (and only if) $X=Z$, $Y=W$ and $f(x)=g(x)$ for each $x\in X$.

So for two functions to be equal, they need to have the same codomain.

(A reasonable search query to find some text including this might be "two functions" equal.)

There are many situations where this distinction is unimportant, so the functions $\sin \colon \mathbb R \to \mathbb R$ and $\sin \colon \mathbb R \to [-1,1]$ are often consider the same. (And the are the same according the definition in the OP. If we use the definition as "function is a subset of $X\times Y$ such that...", then a function is indeed equal to its graph.)

But there are also situations where the distinctions is important, for example speaking about surjective functions only makes sense if you specify the codomain. (So if you use the definition from the OP, you would have to consider surjectivity as property of the pair $(f,Y)$, i.e. a function and a set containing the range of this function, rather then a property of the function $f$.)

Wikipedia article also has a section on alternative definitions of a function. Just in the case the article will be reorganized in the future, I am also adding a link to the current revision.

5

Well, of course, even those most hung up on set-theoretic regimentations, don't really, really, believe that functions are identical to their graphs, i.e. identical to sets of tuples (or are identical to set-theoretic triples of domains, codomains and sets of tuples, or whatever).

  1. Which set of pairs implements the function $fx = y$? We can use the set of pairs $\langle x, y \rangle$ but the set of pairs $\langle y, x \rangle$ would do just as well, mutatis mutandis. And which unordered sets implement the ordered pairs? Lots of choices there too. Any implementation of functions as sets involves a number of arbitrary choices. So none can be said to be 'really' the function.
  2. Some functions are "too big" to have graphs according to standard set theories, e.g. the function that maps sets to their singletons.
  3. And in any case, functions belong to a different logical type to objects such as sets (including sets of tuples). A one-place function $f$ takes single arguments and outputs values; a set [so to speak] just sits there. Of course, we can feed $x$ plus $f$'s graph $G$ as two arguments to a new dyadic evaluation function which returns the value $y$ just in case $(x, y) \in G$: but -- on pain of regress -- we can't keep trading in functions for their graphs.

So, the set-theoretic modelling (representation, implementation) of functions by their graphs is just that: modelling or representation or implementation, however you like to put it. And like any modelling, there are different ways to go depending on what features of what you are modelling you really care about representing. What the graph modelling (for workaday functions, if not nasties like $x \mapsto \{x\}$) nicely highlights is extensionality and plenitude (the idea that there is a function for every arbitrary pairing of arguments and values).

Whether you also want to build in codomains to your definition of a function when modelling in set terms will depend on whether that is going to matter, as I think @BrianM.Scott is saying in his comment on another answer. There is surely no question of right or wrong here, just assessments of overall neatness and convenience.

Peter Smith
  • 54,743
4

What’s going on here is that “everybody knows” what a function ought to be, and the definition of a function as being equal to its graph is just a tool for codifying that. I assure you that there’s hardly a working mathematician in the world who thinks of a function as equaling its graph. A perfectly analogous situation is the standard definition of what an ordered pair $(a,b)$ “is”. (Something like $(a,b)=\{\{a\},\{a,b\}\}$, or another equally unintuitive construct.) Giving the “definition” is just giving a set-theoretic construction that is logically sound and delivers the properties that everybody was expecting the concept to satisfy.

Lubin
  • 62,818
  • 1
    but the formal definition of a function is not as its graph, but rather explicitly specifying the domain and codomain. – Ittay Weiss Jul 13 '13 at 04:20
  • 5
    @Ittay: There are two closely related but distinct formal definitions of function, and one of them does identify a function with its graph. I have used both, the choice depending on the context in which I was working. In particular, there most certainly are times when I think of a function as being identical to its graph. – Brian M. Scott Jul 13 '13 at 07:45
  • 1
    @BrianM.Scott point well taken. – Ittay Weiss Jul 13 '13 at 09:19