Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm a little confused between the difference between the range & co-domain of a function. Are they not the same thing (i.e. all possible outputs of the function)?

share|improve this question
    
I'am always confused too regarding domain and range of a function because of the fancy notations anad symbols used. –  alok Aug 25 '11 at 9:24

4 Answers 4

up vote 17 down vote accepted

I think your confusion may stem from differing uses of terminology.

For a function $f: X \rightarrow Y$, the codomain is just the set $Y$. For instance, if $f: \mathbb{R} \rightarrow \mathbb{R}$ is $x \mapsto x^2$, then the codomain is $\mathbb{R}$. This terminology is agreed upon by all who use it: i.e., I have never seen anyone use the term "codomain" to mean anything else.

Unfortunately the term range is ambiguous. It is sometimes used exactly as codomain is used above, so some say that $\mathbb{R}$ is the range of the squaring function defined above. However, those who use the term codomain at all usually reserve the term "range" for the subset $\{y \in Y \ | \exists x \in X \text{ such that } f(x) = y\}$, i.e., the subset of values which are actually mapped to by some element in the domain. (Some others use the term image for this instead.) So in the above example the image of the function is $[0,\infty)$. Whether the range is $\mathbb{R}$ (i.e., the codomain) or $[0,\infty)$ (i.e., the image) depends upon your convention, and both are rather prevalent.

In practice, this means that it would be safest never to use the term range, instead using codomain and image. (But most people don't do that either...)

share|improve this answer
1  
Perfect! Thanks for the clarification. –  Ray Aug 24 '11 at 12:56
2  
One important reason for the use of codomain is if discussing properties of functions. $f:\mathbb{R}\to \mathbb{R}$, with $f(x)= x^2$ as above is not 'onto', whilst $f:\mathbb{R}\to [0,\infty)$, with $f(x)= x^2$ is. These two functions have different properties so must be different functions.:-), and the use of language where this point is not taken into account leads to a mess. It is also the case, of course, that domain and codomain then play roles that are nearer being dual to each other. –  Tim Porter Aug 24 '11 at 17:41

To add a bit to Pete's and lhf's answer: assuming we are talking about functions from one set to another, there are two common ways of viewing functions:

  • As sets $f$ such that:

    1. Every element of $f$ is an ordered pair; and
    2. If $(x,y)$ and $(x,y')$ are both elements of $f$, then $y=y'$.

    When viewing functions this way, the domain is the set: $\{x\mid\text{there exists }y\text{ such that }(x,y)\in f\}$.

    We write $f(x)=y$ to mean $(x,y)\in f$. And two functions are equal if and only if they are equal as sets. In this case, when we write $f\colon A\to B$, we mean that $A$ is the domain, and that $B$ is any set such that $\{y\mid \text{there exists }x\text{ such that }(x,y)\in f\}\subseteq B$. Note that the function $f\colon \mathbb{R}\to\mathbb{R}$ and the function $g\colon\mathbb{R}\to\{1,-1\}$ given by $f(x)=g(x)=1$ if $x\geq 0$, $f(x)=g(x)=-1$ if $x\lt 0$ are equal functions, because they are equal as sets.

    One problem with this definition is that it makes no real sense to ask if a question is "surjective", because there is no understood "target set". You have to ask about "surjective onto $B$".

  • As ordered triples $(A,B,f)$, where $A$ and $B$ are sets, and $f\subseteq A\times B$ is a function in the sense above. $A$ is called the domain, $B$ is called the codomain, and two functions are equal if and only if they have the same domain, the same codomain, and the same value at each element of the domain. This is, I believe, the Bourbaki approach. In this case, the two functions $f$ and $g$ I mentioned above are different, because they have different codomains.

    Here, the notion of surjective does make sense, and it provides good duality with the notion of one-to-one (though not complete duality; e.g., "a one-to-one function has a left inverse" only requires you to assume the domain is nonempty, but "an onto function has a right inverse" requires, and in fact is equivalent to, the Axiom of Choice).

This is what leads to the problems of the meaning of "codomain", I think. The codomain of a function only makes sense (in the singular definite article way) in the second definition. The similar set that can be defined uniquely and precisely in the first definition is the image, which would be the dual of the domain: the set $\{y\mid\text{there exists }z\text{ such that }(z,y)\in f\}$. But, being the dual definition, there is a temptation of calling it the "codomain", which clashes with the definition in the second instance.

share|improve this answer
3  
This is a nice answer. Of course mathematics uses both notions of functions in many places, despite the fact that in certain circumstances one definition or the other will get you in trouble. The idea that two functions which are the same except one of them has a larger codomain are not the same function is at times fishy and at times essential. It is also interesting to note that the "codomain" concept does not really appear in the popular description of a function as a "black box" or as an algorithm. –  Pete L. Clark Aug 24 '11 at 17:49
    
@Pete: Thanks for the kind words. –  Arturo Magidin Aug 24 '11 at 18:07

A function $f: X \to Y$ has $X$ as domain and $Y$ as co-domain. The image of $f$ is the subset of $Y$ given by $F(X)=\{ f(x) : x\in X \} \subseteq Y$, that is, the set of values taken by $f$. When $F(X)=Y$, we say that $f$ is surjective. In general, $F(X)\ne Y$. For example, $\sin: \mathbb R \to \mathbb R$ is not surjective but $\sin: \mathbb R \to \mathbb [-1,1]$ is.

As mentioned in wikipedia, some people use range for co-domain, others for image. I think it's best to avoid range altogether.

share|improve this answer

Example: a codomain could be as big as all real numbers, but the range is the exact set of numbers that are given by the domain.

If there was a domain {1,2,3} with a formula 2x, the range would be every number to each input, so {2,4,6}. it is the exact number of outputs given by the formula and inputs. the codomain of that problem I just gave, however, could be Natural numbers, real numbers, whole numbers, any set that contains those elements 2, 4, 6 inside them.

share|improve this answer

Your Answer

 
discard

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.