5

If the Domain of a function is all acceptable inputs, and the image of a function is the output, what is the point of using the word Codomain?

For example, I could say the cosine function maps R to R which means that the domain is R, and the codomain is R. The image however of cosine, would be the numbers between -1 and 1 inclusive, so of course they are within the real numbers.

Any thoughts?

  • 1
    I didn't like the answers offered. So I'm not accepting any. – user1742566 Oct 13 '15 at 17:40
  • 1
    Your judgement is good; the cleanest rigorous approach does not at all care about codomains. See this post for more details, and as I commented there the standard text "Set Theory" by Jech takes exactly the same approach as I do. – user21820 Aug 29 '21 at 16:55

3 Answers3

5

Images don't "behave" well enough. For example, if you want to sum two real-valued functions, you take functions $f:\mathbb{R} \rightarrow \mathbb{R}$ and $g: \mathbb{R} \rightarrow \mathbb{R}$ and sum their outputs. If you restricted to image, you would have to keep track of it every time you did this.

  • 1
    Interesting answer (+1), but this objection only holds if you specify a codomain at all. What do you think of the view of specifying a function entirely by its domain and graph (in which case the object does not include a codomain at all)? Surely in that case, there is nothing to "keep track" of? – Ben Jul 22 '20 at 06:03
4

Sometimes we don't know what the range is, but we do know that it's contained in some other set. In this case we can specify a valid domain and codomain even though we don't know what the range is.

We are often interested in surjectivity. Surjectivity is fundamentally tied to the codomain of a function. Concretely, if we have a surjective function $f : A \to B$ and a set $C \supsetneq B$, we can define a function $g : A \to C$, with $g(x)=f(x)$. Then $g$ is not surjective even though $f$ is. So if we drop the distinction between "codomain" and "range", then the notion of surjectivity becomes trivial.

Sometimes we want to study all functions with some fixed domain and codomain (or perhaps a certain large collection of such functions). For instance, all one-variable calculus is about functions from $\mathbb{R}$ to $\mathbb{R}$. Such functions are related to one another even when they have different ranges.

Ian
  • 101,645
1

I might have misunderstood what your question is, but anyway, hopefully the following is helpful.

What is a function?

A function is a "rule" that assigns to each element in a set $D$ (called the domain) exactly one element in a set $E$ (called the codomain).

The condomain is just the set where the values of the function are. All functions have domains and codomains. It is part of the definition of a function.

From the comments below, it seems like you might be asking why one can't just take the range as the codomain. The answer, I believe, is in the logic order. We can't ask about the range of a function without having a function. If we have a function, then we already have a codomain.

Now, if you have a function $f: D \to E$ with domain $D$ and codomain $E$, then you can define another function $f': D \to f(D)$ by $f'(x) = f(x)$. If $f$ us surjective, then $f = f'$ otherwise you have two different functions.

The range/image of a function $h: D \to E$ is the subset of the codomain $\{h(x) \in E : x\in D\}$. If the range and codomain are equal as sets, then we call the function surjective.

For example $f: \mathbb{R} \to \mathbb{R}$ given by $f(x) = x^2$ and $g:\mathbb{R} \to [0,\infty)$ given by $g(x) = x^2$ are two different functions because they have different codomains. For example, $f$ is not surjective, while $g$ is surjective.

If I meet you on the street and you tell me about this function called cosine. Then I can ask you what the domain and codomain is. You, technically, don't compute the codomain or the domain. They always follow the function. It makes no sense to talk about a function without the two accompanying sets.

Now in calculus, the codomain is usually assumed to be the real numbers. So here it makes sense to ask about what the range is. We have problems that ask for the domain, but what we usually mean is, as you say: find the set of real numbers where the expressions is defined.

Thomas
  • 43,555
  • 6
    I think the point of the question is "why do we not treat every function as having a codomain equal to its range?" So while this is correct, in a sense it is repeating what the OP already knows. – Ian Sep 21 '15 at 17:46
  • 2
    Yeah, I think this answer just regurgitates the definitions, rather than explaining the reasons for the definitions. – Thomas Andrews Sep 21 '15 at 17:47
  • We can approach this question from the definition of equality of functions. Two functions are equal if they have the same domain, the same codomain, and agree on their common domain (that is, they have the same image). – Chris Leary Sep 21 '15 at 17:48
  • @ChrisLeary: And having the same image isn't the same as being equal. – Thomas Sep 21 '15 at 17:49
  • @Ian: I think the point is that we can't even ask about the range/image of a function without having a codomain. – Thomas Sep 21 '15 at 17:51
  • @ThomasAndrews: I added a bit more. – Thomas Sep 21 '15 at 17:54
  • @Thomas Not exactly. In set theory, we can encode a function as a set of ordered pairs $(x,y)$, where we interpret a pair as meaning $f(x)=y$. In this case the only way to define the codomain is that it is equal to the image. Of course we can also explicitly encode the codomain, but we are not forced to do so. – Ian Sep 21 '15 at 17:54
  • @Thomas https://en.wikipedia.org/wiki/Axiom_schema_of_replacement – Aloizio Macedo Sep 21 '15 at 17:55
  • @Ian: But to define what a function is, don't you have to start with two sets (domain and codomain)? – Thomas Sep 21 '15 at 17:57
  • @Thomas Nah. I can define a function $f$ as a subset $F$ of a Cartesian product $A \times B$ such that if $(x,y) \in F$ and $(x,z) \in F$ then $y=z$. Having done that, looking at $F$ I can't tell what $B$ originally was, except that it was some superset of the range of $f$. – Ian Sep 21 '15 at 17:58
  • @Ian: And then the codomain of $F$ is $B$? – Thomas Sep 21 '15 at 18:00
  • @Thomas Then $B$ is "a codomain" of $f$, but $F$ "doesn't know that anymore". For example, $f : \mathbb{R} \to \mathbb{R},f(x)=1$ can be represented by $F={ (x,1) : x \in \mathbb{R} }$. $F$ doesn't know that you wanted the codomain to be $\mathbb{R}$, all it knows is that the codomain has to contain $1$. – Ian Sep 21 '15 at 18:03
  • Why do you all keep tagging me? Oh, there are two Thomas's here. – Thomas Andrews Sep 21 '15 at 18:04
  • @Ian: All I am trying to say is that you have to start with a codomain (and domain) to have a function. Yes? – Thomas Sep 21 '15 at 18:05
  • That's how we define things now. But we could define things the way I've described, where a function is just a set of ordered pairs satisfying a certain requirement. To me, the point of this question is "why don't we do that?" – Ian Sep 21 '15 at 18:06
  • @Thomas Please read the wiki link I posted. – Aloizio Macedo Sep 21 '15 at 18:06
  • @AloizioMacedo: When I get a bit of time, I will give a study. – Thomas Sep 21 '15 at 18:07
  • @Ian: Ok, I think I get it. (1) The question is about why we have defined a function like we have when one could define it another way? So, what is the motivation? (2) Now, in your example, doesn't the $1$ have to be a member of a set? I mean, you can just take $1$ from nowhere. So, in that case, $F \subseteq \mathbb{R}\times {1}$ and ${1}$ is the ecodomain. – Thomas Sep 21 '15 at 18:10
  • (1) Yes, that is my understanding of the question. (2) The point is that my $F$ can be identified as $f : \mathbb{R} \to A$ for any set $A$ which contains $1$. $F$ itself doesn't contain enough information to tell me whether $A$ should be ${ 1 }$, $\mathbb{R}$, $\mathbb{R}_+$, or whatever. – Ian Sep 21 '15 at 18:11
  • @Thomas - Right. Equality requires same domain, same codomain, and same image. Perhaps my parenthetical muddled rather than clarified what I was saying. – Chris Leary Sep 22 '15 at 18:31
  • I'm not familiar with any of this set theory stuff. I'm a programmer, so I think of all of this with that kind of mindset.

    The way I'm thinking about it is this. The domain is all acceptable inputs. The image is all possible outputs that are possible from those inputs. The codomain is the set of numbers that contain the image. What is the purpose of the codomain?

    – user1742566 Sep 26 '15 at 22:05
  • @user1742566: There are two ways to understand and reply to your question. (1) I could try to tell you about the motivation for having codomains. Why might we, for example, want to not just have the codomain as the image of the function? The answers that take this approach are in the other answers. (2) The second way to reply to your question is by stating what the codomain is without worrying about the motivation. Why do we have a codomain? This is the approach that I take. Here the answer is simply that a codomain is part of a function. – Thomas Sep 26 '15 at 23:20
  • @user1742566: (cont,) The point I am trying to make is that when you define what a function is, you start with two sets. One of those sets is the codomain. So, it is just part of the definition. Asking about the purpose of things in mathematics can in this way be answers by saying that it is necessary in the definition. – Thomas Sep 26 '15 at 23:23
  • @user1742566: See this question/answer(s) for support for my answer: http://math.stackexchange.com/questions/1473169/what-is-the-right-way-to-define-a-function – Thomas Oct 10 '15 at 13:26