
Inmathematics, acodomain,counter-domain, orset of destination of afunction is aset into which all of the outputs of the function is constrained to fall. It is the setY in the notationf:X →Y. The termrange is sometimes ambiguously used to refer to either the codomain or theimage of a function.
A codomain is part of a functionf iff is defined as a triple(X,Y,G) whereX is called thedomain off,Y itscodomain, andG itsgraph.[1] The set of all elements of the formf(x), wherex ranges over the elements of the domainX, is called theimage off. The image of a function is asubset of its codomain so it might not coincide with it. Namely, a function that is notsurjective has elementsy in its codomain for which the equationf(x) =y does not have a solution.
A codomain is not part of a functionf iff is defined as just a graph.[2][3] For example, inset theory it is desirable to permit the domain of a function to be aproper classX, in which case there is formally no such thing as a triple(X,Y,G). With such a definition functions do not have a codomain, although some authors still use it informally after introducing a function in the formf:X →Y.[4]
For a function
defined by
the codomain off is, butf does not map to any negative number. Thus the image off is the set; i.e., theinterval[0, ∞).
An alternative functiong is defined thus:
Whilef andg map a givenx to the same number, they are not, in this view, the same function because they have different codomains. A third functionh can be defined to demonstrate why:
The domain ofh cannot be but can be defined to be:
Thecompositions are denoted
On inspection,h ∘f is not useful. It is true, unless defined otherwise, that the image off is not known; it is only known that it is a subset of. For this reason, it is possible thath, when composed withf, might receive an argument for which no output is defined – negative numbers are not elements of the domain ofh, which is thesquare root function.
Function composition therefore is a useful notion only when thecodomain of the function on the right side of a composition (not itsimage, which is a consequence of the function and could be unknown at the level of the composition) is a subset of the domain of the function on the left side.
The codomain affects whether a function is asurjection, in that the function is surjective if and only if its codomain equals its image. In the example,g is a surjection whilef is not. The codomain does not affect whether a function is aninjection.
A second example of the difference between codomain and image is demonstrated by thelinear transformations between twovector spaces – in particular, all the linear transformations from to itself, which can be represented by the2×2matrices with real coefficients. Each matrix represents a map with the domain and codomain. However, the image is uncertain. Some transformations may have image equal to the whole codomain (in this case the matrices withrank2) but many do not, instead mapping into some smallersubspace (the matrices with rank1 or0). Take for example the matrixT given by
which represents a linear transformation that maps the point(x,y) to(x,x). The point(2, 3) is not in the image ofT, but is still in the codomain since linear transformations from to are of explicit relevance. Just like all2×2 matrices,T represents a member of that set. Examining the differences between the image and codomain can often be useful for discovering properties of the function in question. For example, it can be concluded thatT does not have full rank since its image is smaller than the whole codomain.