# Range (mathematics)

(Redirected from Range of a function)
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. The codomain is a set containing the function's output, whereas the image is only the part of the codomain where the elements are outputs of the function. For example, the function $f(x) = x^2$ is often described as a function from the real numbers to the real numbers, meaning that the codomain is R, but its image is the set of non-negative real numbers. Some books say that range of this function is its codomain, the set of all real numbers, reflecting that the function is real-valued. These books call the actual output of the function the image. This is the current usage for range in computer science. Other books say that the range is the function's image, the set of non-negative real numbers, reflecting that a number can be the output of this function if and only if it is a non-negative real number. In this case, the larger set containing the range is called the codomain.[1] This usage is more common in modern mathematics.

## 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

Standard mathematical notation allows a formal definition of range.

In the first sense, 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, 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.

## References

1. Walter Rudin, Functional Analysis, Second edition, p. 99, McGraw Hill, 1991, ISBN 0-07-054236-8
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 7, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.8980754613876343, "perplexity_flag": "head"}