# Range (mathematics)

For other uses, see Range.
$f$ is a function from domain X to codomain Y. The smaller oval inside Y is the image of $f$. Sometimes "range" refers to the codomain and sometimes to the image.

In mathematics, the range of a function refers to either the codomain or the image of the function, depending upon usage. Modern usage almost always uses range to mean image. The word range may eventually become obsolete.

The codomain of a function is some arbitrary set. In real analysis it is the real numbers. In complex analysis it is the complex numbers.

The image of a function is the set of all outputs of the function. The image is always a subset of the codomain.

Older books, if they use the word "range" at all, tend to use it to mean what is now called the codomain. More modern books, if they use the word "range" at all, tend to use it to mean what is now more often called the image. In a given book, the word will usually be defined the first time it is used.

As an example of the two different usages, consider the function $f(x) = x^2$ as it is used in real analysis, that is, as a function from the real numbers to the real numbers. In this case, its codomain is the set of real numbers R, but its image is the set of non-negative real numbers, since $x^2$ is never negative if $x$ is real. Some books, mostly older books, use the term range for the codomain: R. More modern books usually use the term range for the image: the non-negative real numbers. Even more modern books, including most books published in this century, don't use the word "range" at all.[1]

In computer science, the convention is slightly different. Computer science books still sometimes use Range (computer science) to mean codomain.

## Examples

Let f be a function on the real numbers $f\colon \mathbb{R}\rightarrow\mathbb{R}$ defined by $f(x) = 2x$. This function takes as input any real number and outputs a real number two times the input. In this case, the codomain and the image are the same (i.e. the function is a surjection), so the range is unambiguous; it is the set of all real numbers.

In contrast, consider the function $f\colon \mathbb{R}\rightarrow\mathbb{R}$ defined by $f(x) = \sin(x)$. If the word "range" is used in the first sense given above, we would say the range of f is the codomain, all real numbers; but since the output of the sine function is always between −1 and 1, "range" in the second sense would say the range is the image, the closed interval from −1 to 1.

## Formal definition

In the first sense (i.e., when range is used to mean the codomain), the range of a function must be specified; it is often assumed to be the set of all real numbers, and {y | there exists an x in the domain of f such that y = f(x)} is called the image of f.

In the second sense (i.e., when range is used to mean the image), the range of a function f is {y | there exists an x in the domain of f such that y = f(x)}. In this case, the codomain of f must be specified, but is often assumed to be the set of all real numbers.

In both cases, image f ⊆ range f ⊆ codomain f, with at least one of the containments being equality.