Canonical: https://knowlpedia.com/shared-foundations/codomain/

# Codomain

The target set in the definition of a function

A **codomain** is the target set of a function: if \(f:A\to B\) is a [function](https://knowlpedia.com/shared-foundations/function/), then its codomain is the set \(B\).

## Remarks

The [image](https://knowlpedia.com/shared-foundations/image/) of \(f\) is always a [subset](https://knowlpedia.com/shared-foundations/subset/) of the codomain. The function \(f\) is [surjective](https://knowlpedia.com/shared-foundations/surjective-function/) exactly when its image equals its codomain.

## Examples

- For \(f:\mathbb{R}\to\mathbb{R}\) defined by \(f(x)=x^2\), the codomain is \(\mathbb{R}\) even though not every real number occurs as a value of \(f\).
- Define \(p:\mathbb{Z}\to\{0,1\}\) by \(p(n)=0\) if \(n\) is even and \(p(n)=1\) if \(n\) is odd; the codomain is the set \(\{0,1\}\).
