What Is the Codomain of a Function? (Math Concept)

The codomain of a function is the set the function is declared to map into. In notation (f:A\to B), the codomain is (B), while the range is the set of values the rule actually produces. The range must lie inside the codomain. They match exactly only when the function is onto, or surjective.

A function is easier to understand when you can see both where inputs come from and where outputs are allowed to go. The codomain names that destination set. But it does not tell you which values the rule actually reaches. Keeping those ideas separate makes function notation clearer and helps you avoid mistakes when checking whether a function is onto.

I use a simple three-part check: read the arrow, work out the actual outputs, then compare the two sets. The examples below show how to do that with numbers and finite sets.

Function Notation and the Codomain

A function is often written (f:A\to B). Here, (A) is the domain, (B) is the codomain, and (f) is the rule that assigns an output to each input. The arrow means that the function maps elements of (A) into the set (B).

The codomain is not found by looking at the formula alone. It is part of how the function is defined. Read the full notation, including the sets on both sides of the arrow.

How do you identify the codomain?

The codomain is the set written after the arrow in (f:A\to B). The set before the arrow is the domain. For example, in (g:\mathbb Z\to\mathbb Z), the domain and codomain are both the integers, (\mathbb Z). The formula for (g) tells you how inputs are mapped.

Consider this notation:

[ f:\mathbb R\to\mathbb R,\qquad f(x)=x^2 ]

Read it in order:

  • (f) is the name of the function.
  • (\mathbb R), before the arrow, is the domain: the real numbers that may be used as inputs.
  • (\mathbb R), after the arrow, is the codomain: the declared set for the outputs.
  • (f(x)=x^2) is the rule: square the input.

The arrow does not say that every real number will appear as an output. It says that the function sends each allowed input to a value in the stated codomain.

A useful way to picture the notation is as a map between two sets. The domain is the starting set; the codomain is the destination set. The rule determines where each individual input lands.

Codomain, Range, and Worked Examples

The range, also called the image, is the set of outputs a function actually produces from its domain. The codomain is the declared destination set. The range must be a subset of the codomain, but it may be smaller. This difference is central to understanding function definitions and whether a function is onto.

How do you find the range?

To find the range, apply the function rule to every allowed input, or determine all possible outputs if the domain is infinite. Collect those outputs into a set. Then compare that set with the codomain named in the function notation. The codomain cannot be inferred from the formula alone.

For (f:\mathbb R\to\mathbb R), where (f(x)=x^2), square each real input. A square is never negative, and every nonnegative real number can be written as the square of a real number. So the range is ([0,\infty)), even though the codomain is (\mathbb R).

This means:

[ \operatorname{range}(f)=[0,\infty)\subset\mathbb R ]

The inclusion is proper because negative real numbers belong to the codomain but are not outputs. For instance, no real number (x) satisfies (x^2=-1).

Compare that with (h:\mathbb R\to[0,\infty)), where (h(x)=x^2). The formula and actual outputs have not changed. The declared codomain has. Now the range equals the codomain.

Function definition Codomain Range Onto?
(f:\mathbb R\to\mathbb R,\ f(x)=x^2) (\mathbb R) ([0,\infty)) No
(h:\mathbb R\to[0,\infty),\ h(x)=x^2) ([0,\infty)) ([0,\infty)) Yes
(p:\mathbb R\to\mathbb R,\ p(x)=x) (\mathbb R) (\mathbb R) Yes

The first two rows are a key comparison. The same rule can have different codomains when it is defined as a different function. That change can also change whether the function is onto.

What do the domain and codomain look like for finite sets?

For a function on a finite domain, calculate the output for each input. List the distinct results to find the range, then compare that list with the codomain. A function can send several inputs to the same output, and some codomain elements may not be reached.

For example, define (q:{1,2,3}\to{a,b,c,d}) by (q(1)=a), (q(2)=c), and (q(3)=c). The domain is ({1,2,3}); the codomain is ({a,b,c,d}); and the range is ({a,c}). The values (b) and (d) are allowed destinations, but this rule does not reach them.

Now define (r:{1,2,3}\to{a,b,c}) by (r(1)=a), (r(2)=b), and (r(3)=c). Its range is ({a,b,c}), which matches its codomain. Therefore, (r) is onto. These examples show why you must name the domain, codomain, and range separately.

Common Errors and How to Check Your Answer

Many mistakes come from treating the codomain as if it were the list of outputs. It is not. The codomain is part of the declared function; the range comes from applying the rule. A careful answer states both sets and checks that every output belongs to the codomain.

What is a reliable way to check a function?

Use the same sequence each time: read the function notation, identify the permitted inputs, determine the outputs, and compare the range with the codomain. This prevents you from guessing the codomain from a formula or calling an unused destination an actual output.

Follow these steps:

  1. Parse the notation. In (f:A\to B), write down (A) as the domain and (B) as the codomain.
  2. Check the rule. Confirm that every input in (A) has exactly one output.
  3. Find the range. Work out the outputs produced by inputs in (A).
  4. Check containment. Verify that each output lies in (B), so (\operatorname{range}(f)\subseteq B).
  5. Test whether it is onto. Decide whether the range equals (B).

A function must assign exactly one output in the codomain to each input in the domain. If a rule sends an allowed input outside the stated codomain, the proposed mapping is not a function from (A) to (B) as written.

For example, (s:\mathbb R\to\mathbb R), (s(x)=1/x), is not defined at (x=0), even though zero is in the stated domain. To make a valid function with this rule, the domain must exclude zero, such as (\mathbb R\setminus{0}). This illustrates why checking the full definition matters, not just the formula.

A common error is to say that the codomain of (x^2) is ([0,\infty)) without reading the declared mapping. That set is the range when the domain is (\mathbb R). It is also a possible codomain if the function is explicitly defined to map into ([0,\infty)). State which one you mean.

Why Codomains Matter in Inverses and Further Mathematics

The codomain affects how a function is classified and whether it has an inverse function. In particular, a function can be onto for one declared codomain and not onto for another. Naming the codomain is therefore part of the mathematical information, not a decorative label.

How does the codomain relate to surjectivity and inverses?

A function is surjective, or onto, when every element of its codomain is an output. In set terms, its range equals its codomain. This condition matters for inverse functions: an inverse that maps every codomain element back to an input requires the original function to be onto and one-to-one.

Return to (f:\mathbb R\to\mathbb R), (f(x)=x^2). It is not onto because its range misses all negative real numbers in the codomain. If we instead define (h:\mathbb R\to[0,\infty)), (h(x)=x^2), it is onto because every nonnegative real number is reached.

However, (h) is not one-to-one: (h(2)=4) and (h(-2)=4). So it does not have an inverse function on its full domain that assigns one input to each output. If we restrict its domain to ([0,\infty)), then each output has exactly one nonnegative input, and the inverse is (h^{-1}(y)=\sqrt y).

This example separates two checks:

  • Onto: Does the range cover the whole codomain?
  • One-to-one: Do different inputs ever produce the same output?

For a function to have an inverse function from its codomain back to its domain, it must satisfy both conditions. Changing the codomain can fix an onto problem, but it does not by itself fix repeated outputs.

A quick review before submitting an answer is to write four labels: domain, codomain, range, and onto? Fill in each one from the definition and rule. This format makes it harder to confuse the declared target with the values actually attained.

Frequently Asked Questions

These short answers review the distinctions that matter most: where the codomain appears, how it differs from the range, and how to use both sets when checking a function. For each question, read the stated mapping first, then apply the rule only to the inputs in its domain.

Is the codomain the set of all outputs?

No. The codomain is the declared set of possible destinations in the function definition. The range is the set of values the rule actually produces. The range is always contained in the codomain, but it may not include every element of that set.

Where is the codomain in function notation?

In (f:A\to B), the codomain is (B), the set written after the arrow. The domain is (A), before the arrow. The function rule, often written as a formula after the notation, tells you how inputs from (A) map into (B).

Can a function’s codomain be larger than its range?

Yes. For (f:\mathbb R\to\mathbb R), (f(x)=x^2), the codomain is all real numbers, but the range is only the nonnegative real numbers. The negative numbers belong to the codomain but are never produced by the rule.

Can the same formula have different codomains?

Yes. The formula (x^2) can define (f:\mathbb R\to\mathbb R) or (h:\mathbb R\to[0,\infty)). The actual outputs are nonnegative in both cases, but the declared codomain differs. As a result, (f) is not onto, while (h) is.

Is the codomain always equal to the range?

No. They are equal only when the function reaches every element in its codomain. When the range is a proper subset of the codomain, some declared destinations are not attained, and the function is not onto.

How do you know whether a function is onto?

Compare the range with the codomain. A function is onto, or surjective, exactly when those sets are equal. It is not enough for every output to belong to the codomain; every element of the codomain must also be reached.

Can a function map an input outside its codomain?

Not as a function with the stated mapping. In (f:A\to B), every input in (A) must have exactly one output, and that output must belong to (B). If it does not, the rule fails to define a function from (A) to (B).

Does changing the codomain change the formula’s outputs?

No. If the domain and rule stay the same, the actual outputs stay the same. But changing the declared codomain can change whether the function is onto, because surjectivity depends on whether the range equals that codomain.

(This article was written by one of our staff writers, Nathan Sterling. Visit our Meet the Team page.)

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *