The codomain of a function is the set specified as the target of a function. In the notation , the set is the domain and is the codomain: every input belongs to , and its output must belong to . The codomain need not equal the set of outputs actually attained, called the image of the function. This distinction is essential to defining surjectivity, specifying inverse functions, and describing maps between mathematical structures.
Definition and notation
A function
assigns to each element exactly one element . Its image is
Consequently,
The codomain specifies where outputs are allowed to lie; the image records which outputs actually occur. An element of the codomain may have no input mapping to it.
The word range is used inconsistently: some texts use it for the image, while others use it for the codomain. When that terminology is not explicitly defined, “image” and “codomain” provide a clearer distinction.
A rule or formula alone generally does not determine a codomain. For example, can describe functions between several different sets, depending on the specified inputs and target.
Examples
Consider the function on the real numbers
Its codomain is , but its image is
Negative numbers belong to its codomain even though none is an output.
The function
has the same domain and assignment rule, but a different codomain. Every element of this codomain is attained.
Changing the underlying number system can also change the image. The map
has all the complex numbers as both its image and its codomain, since every complex number has a complex square root.
A finite example makes the distinction explicit. Let
with
The codomain is , whereas the image is .
Role in surjectivity and invertibility
A function is surjective, or onto, precisely when its image equals its codomain:
Equivalently,
Surjectivity therefore depends on the specified codomain. The real squaring function is not surjective onto , but it is surjective onto .
By contrast, injectivity depends on whether distinct inputs have distinct outputs:
Changing only the codomain, while retaining the same domain and output assignments, does not change injectivity.
A bijection is both injective and surjective. A two-sided inverse
exists exactly when is bijective. Thus, the codomain helps determine whether an inverse is defined on the whole stated target.
For example,
is bijective, with inverse . If its codomain is enlarged to , keeping the same domain and assignments, it is no longer surjective and has no two-sided inverse on that codomain.
Codomain and the formal definition of a function
There are different conventions for what information constitutes a function.
Under one common convention, a function includes its domain, codomain, and assignment rule. It can be represented as a triple
where
is its graph, a subset of the Cartesian product . On this convention, changing the codomain produces a different function, even if every input retains the same output.
Under another convention in set theory, a function is identified with its graph, subject to the requirement that every input have exactly one output. The graph determines the domain and image, but does not select a unique codomain: any set containing the image can serve as a target.
These conventions describe the same assignments differently. Statements about equality of functions must therefore be interpreted according to whether the codomain is included in the function’s defining data.
Changing the codomain
Suppose , and let satisfy
The same assignments define a function
This operation is called corestriction. It changes the codomain rather than the domain; restricting the domain instead changes the set of permitted inputs.
Every function can be corestricted to its image:
This function is automatically surjective. If is the inclusion map, then
This factorization separates reaching the attained values from including those values in the original codomain.
A set that omits even one attained output cannot be a codomain for the unchanged assignment rule.
Composition and structured target spaces
For composition, the standard notation
gives
The matching intermediate set ensures that is defined at every output of . At the level of evaluating assignments, the weaker condition suffices. In category theory, composition is specified through matching source and target objects.
The codomain can also carry structure relevant to the function:
- A linear map has a specified target vector space . Its image may be a proper linear subspace of .
- For a continuous map , the topology on the target space enters the definition of continuity.
- A measurable function has a target equipped with a specified collection of measurable sets. A real-valued random variable, for example, is ordinarily defined with codomain , even when it takes only finitely many values.
In such settings, the target is not merely a container for output values: its mathematical structure is part of the specification of the map.