# Codomain

A codomain in mathematics is the set of "output" values associated with (or mapped to) the domain of "inputs" in a function. For any given function [itex]f\colon A\rightarrow B[itex], the set B is called the codomain of f. X, the set of input values, is called the domain of f, and Y, the set of possible output values, is called the codomain. The range of f is the set of all actual outputs {f(x) : x in the domain}. Beware that sometimes the codomain is incorrectly called the range because of a failure to distinguish between possible and actual values. The codomain is not to be confused with the range f(A), which is in general only a subset of B; in lower-level mathematics education, however, range is often taught as being equivalent to codomain.

## Example

Let the function f be a function on the real numbers:

[itex]f\colon \mathbb{R}\rightarrow\mathbb{R}[itex]

defined by

[itex]f\colon\,x\mapsto x^2.[itex]

The codomain of f is R, but clearly f(x) never takes negative values, and thus the range is in fact the set R+—non-negative reals, i.e. the interval [0,∞):

[itex]0\leq f(x)<\infty.[itex]

One could have defined the function g thus:

[itex]g\colon\mathbb{R}\rightarrow\mathbb{R}^+[itex]
[itex]g\colon\,x\mapsto x^2.[itex]

While f and g have the same effect on a given number, they are not, in the modern view, the same function since they have different codomains.

The codomain can affect whether or not the function is a surjection; in our example, g is a surjection while f is not.

• Art and Cultures
• Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
• Space and Astronomy