Codomain of a Function

Meaning of the codomain of a function, how it differs from range, and simple examples.

1. What the Codomain Means

The codomain of a function is the set that contains all possible outputs the function is allowed to produce. It is chosen while defining the function — not after seeing what outputs actually appear.

The codomain is about what is permitted, not what is actually produced.

2. Difference Between Codomain and Range

This is a key idea:

  • Codomain is the set we declare as the target set.
  • Range is the set of outputs that the function actually produces.

2.1. Relationship

\text{Range}(f) \subseteq \text{Codomain}(f)

3. Formal Definition

If a function \( f: A \to B \) is defined, then B is the codomain. This is fixed in the function's definition.

3.1. Definition

\text{Codomain}(f) = B

4. Example to See the Difference Clearly

Let a function be defined as:

f : \mathbb{R} \to \mathbb{R}

f(x) = x^2

4.1. Codomain

\text{Codomain} = \mathbb{R}

This means all real numbers are allowed as possible outputs.

4.2. Range

\text{Range} = [0, \infty)

The function actually produces only non-negative numbers.

5. Codomain in Set of Ordered Pairs

If a function is listed as ordered pairs, the codomain is usually mentioned separately. It does not have to match the actual set of second elements.

5.1. Example

Let:

A = \{1,2,3\}, \; B = \{4,5,6,7\}

f = \{(1,4),(2,4),(3,5)\}

Here B is the codomain, even though 6 and 7 never appear as outputs.

6. Codomain Depends on How the Function Is Defined

Two functions can have the same formula but different codomains if defined differently.

6.1. Example

f_1 : \mathbb{R} \to \mathbb{R}, \; f_1(x) = x^2

f_2 : \mathbb{R} \to [0, \infty), \; f_2(x) = x^2

Both use the same rule x², but f1 can have negative outputs allowed (even though not produced), while f2 restricts possible outputs to non-negative values.

7. Why Codomain Matters

The choice of codomain affects how we classify a function. For example, whether a function is “onto” depends on whether its range fills the entire codomain. Codomain also matters when defining inverses or combining functions.