# What is the purpose of the Codomain?

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?

• I didn't like the answers offered. So I'm not accepting any. Oct 13, 2015 at 17:40
• 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. Aug 29, 2021 at 16:55

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.

• 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, 2020 at 6:03

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.

• Why the downvote six years later?
– Ian
Jun 30, 2021 at 17:30

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.

• 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, 2015 at 17:46
• Yeah, I think this answer just regurgitates the definitions, rather than explaining the reasons for the definitions. Sep 21, 2015 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). Sep 21, 2015 at 17:48
• @ChrisLeary: And having the same image isn't the same as being equal. Sep 21, 2015 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. Sep 21, 2015 at 17:51