# Range of a function

In mathematics, the range of a function may refer to either of two closely related concepts:

${\displaystyle f}$ is a function from domain X to codomain Y. The yellow oval inside Y is the image of ${\displaystyle f}$. Sometimes "range" refers to the image and sometimes to the codomain.

Given two sets X and Y, a binary relation f between X and Y is a (total) function (from X to Y) if for every x in X there is exactly one y in Y such that f relates x to y. The sets X and Y are called domain and codomain of f, respectively. The image of f is then the subset of Y consisting of only those elements y of Y such that there is at least one x in X with f(x) = y.

## Terminology

As the term "range" can have different meanings, it is considered a good practice to define it the first time it is used in a textbook or article. Older books, when they use the word "range", tend to use it to mean what is now called the codomain.[1][2] More modern books, if they use the word "range" at all, generally use it to mean what is now called the image.[3] To avoid any confusion, a number of modern books don't use the word "range" at all.[4]

## Elaboration and example

Given a function

${\displaystyle f\colon X\to Y}$

with domain ${\displaystyle X}$ , the range of ${\displaystyle f}$ , sometimes denoted ${\displaystyle \operatorname {ran} (f)}$  or ${\displaystyle \operatorname {Range} (f)}$ ,[5] may refer to the codomain or target set ${\displaystyle Y}$  (i.e., the set into which all of the output of ${\displaystyle f}$  is constrained to fall), or to ${\displaystyle f(X)}$ , the image of the domain of ${\displaystyle f}$  under ${\displaystyle f}$  (i.e., the subset of ${\displaystyle Y}$  consisting of all actual outputs of ${\displaystyle f}$ ). The image of a function is always a subset of the codomain of the function.[6]

As an example of the two different usages, consider the function ${\displaystyle f(x)=x^{2}}$  as it is used in real analysis (that is, as a function that inputs a real number and outputs its square). In this case, its codomain is the set of real numbers ${\displaystyle \mathbb {R} }$ , but its image is the set of non-negative real numbers ${\displaystyle \mathbb {R} ^{+}}$ , since ${\displaystyle x^{2}}$  is never negative if ${\displaystyle x}$  is real. For this function, if we use "range" to mean codomain, it refers to ${\displaystyle \mathbb {\displaystyle \mathbb {R} ^{}} }$ ; if we use "range" to mean image, it refers to ${\displaystyle \mathbb {R} ^{+}}$ .

In many cases, the image and the codomain can coincide. For example, consider the function ${\displaystyle f(x)=2x}$ , which inputs a real number and outputs its double. For this function, the codomain and the image are the same (both being the set of real numbers), so the word range is unambiguous.