Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My book gives the following definition:

A function $f$ from $A$ to $B$ is defined as $f\subseteq A\times B$ such that if $(a,b)\in f$ and $(a,b_1)\in f$ then $b=b_1$ and there exists a $(a,b)\in f$ for each $a \in A$ .

Now according to this definition, the function would be the same even if the codomains are different. Is it true?

share|cite|improve this question
Good question and good answers on it. Keep both possibilities in sight. E.g. in set-theory $f\subset A\times B$ s.t. $\forall a\in A\exists!b\in B\;\left(a,b\right)\in f$ is convenient. E.g. in categories $f=\left(A,G,B\right)$ where $G\subset A\times B$ s.t. $\forall a\in A\exists!b\in B\;\left(a,b\right)\in G$ is convenient. – drhab Jul 19 '14 at 8:59
up vote 5 down vote accepted

Yes. You can change th codomain, and as long as it includes the range of $f$, the function is the same.

For example, $\sin\colon\Bbb R\to\Bbb R$ and $\sin\colon\Bbb R\to[-1,1]$ are the same function. Or $f(1)=1$ is the same whether or not $f\colon\{1\}\to\Bbb N$ to $f\colon\{1\}\to\{0,1\}$.

As the other answers indicate, in some contexts a function is a triplet where the codomain is specified explicitly. It can be useful to know the codomain as part of the function. In set theoretic contexts, it is sometimes better to treat a function as a set of ordered pairs with a certain property.

Why is it useful? For example, it dispenses the need to talk about "canonical injection", and we can just talk about inclusion. Now we can say that $f\subseteq g$ when $g$ is a larger function, or that $f\cap g$ is a function. It allows us to define partial functions more easily, especially in the context of predicate logic: we can define a predicate which is a function on its domain, and it is not necessary this domain is the entire universe of the structure (so the predicate cannot be a function symbol). This is very useful, for example, in computability theory.

share|cite|improve this answer
An example of the use you mention for the codomain: it's often more convenient to say that the sine function "is not surjective", as opposed to saying it's "not surjective onto $\mathbb{R}$". Or one might say that the first sine function you define "is not surjective" and the second one "is surjective". If the codomain isn't part of the function, then trivially every function "is surjective"! – Steve Jessop Jul 19 '14 at 13:43
@Steve: Yes, that is true. If you include the codomain in the definition then it is easier to talk about surjectivity. I don't find that a sufficient reason for doing so, though. :-) – Asaf Karagila Jul 19 '14 at 15:01

If you look at a function as a pure set of ordered pairs, then yes your observation is true. If you look at it as a triple $(A,B,\text{set of ordered pairs})$ then $B$ matters. If you replace $B$ in the triple by the image (some books call it range) of $f$ (some $B' \subseteq B$), then again your observation is true.

Basically, this is a nit you should not worry too much about.

share|cite|improve this answer
Thanks!${}{}{}$ – Theluqfzhluswcpzflabucheecatne Jul 19 '14 at 8:12

Let's stand back a bit -- sometimes it is worth thinking what's behind a convention.

So: start by thinking how, in practice, we informally prove that there's exactly one function that satisfies a certain description --- e.g. is a unique order-isomorphism between $(A, <)$ and $(B,\prec)$. We need to show that there's at least one such function, and that there is at most one. How do we do the second bit? We show that if $f$ and $f'$ are candidates, then they are the same function. And how do we do that? We show that for every $a$ among the objects $A$, $f(a) = f'(a)$. But why does that show that $f$ and $f'$ are the same function?

It only does so on an extensional understanding of what a function is: we are taking it that functions aren't individuated by the rules we give for associating an argument with value but by the resulting association. So, even if we have two different rules of association, if they both generate the same collection of pairings between arguments and values, we count the rules as two different ways of presenting the same function.

Now this doesn't yet warrant defining functions as collections of argument/value pairings; that identification involves another idea beyond extensionality, call it plenitude. This is the further idea that any old association of arguments with values (one value per argument) determines a function, even if that association is beyond any possibility that we could describe it. It is one thing to say that different rules can determine the same function (extensionality), it is another thing to say that there can be functions which have no describable rule that determines their values (that functions are as plenitudinous as arbitrary argument/value pairings). Taking the second step might seem natural in hindsight, but its almost universal acceptance was the result of hard won achievements in 19th century mathematics.

OK: if we go for extensionality and plentitude, it becomes entirely natural to define a function from $A$ into $B$ -- or perhaps we should really say "model" or "implement" a function -- as a set of ordered pairs $(a, b)$ with only one pair for each $a$. That fixes functions as extensional items, and is naturally understood as making the functions as plenitudinous as the relevant sets.

Hence the characterization of functions we find in elementary analysis texts which implements functions as sets of ordered pairs in such a way that changing the co-domain doesn't change the function. That's because what matters in the elementary context is to emphasize an extensional understanding of what functions and to stress that you can have functions associated with no describable rule for associating argument to function.

Now sure, in further non-so-elementary contexts it can be useful to explicitly build into our characterization of a function the domain (if we are going to start seriously dealing with partial functions) and codomain. That refinement doesn't make the implementation in (some of) the elementary texts wrong -- that serves perfectly to make the points the elementary texts need to make.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.