When we have a function $f: \mathbb{R} \to \mathbb{R}$, I can intuitively picture that and think that for every $x \in \mathbb{R}$, we can find a $y \in \mathbb{R}$ such that our function $f$ maps $x$ onto $y$.

I'm confused, however, when we have something like: $g: D \to \mathbb{R}$, where $D$ is the domain of our function such that $D \subset \mathbb{R}$. How can our function output every element in $\mathbb{R}$, when our input was specifically less than the whole set of reals?

  • 2
    $\begingroup$ Take $\tan(x)$ on the domain $(-\pi/2,\pi/2)$. Plot this in say, Desmos. Then you'll see how it can happen. $\endgroup$
    – Michael
    Mar 26 at 1:03
  • 1
    $\begingroup$ Muse on the function $\tan: (-\pi/2,\pi/2)\to {\mathbb R}$. $\endgroup$ Mar 26 at 1:04
  • 4
    $\begingroup$ As a perhaps-simpler example, consider $f(x)=2x$ with domain $[0,1]$ and range $[0,2]$. "Proper subset" doesn't actually mean "less" - this is a big nonintuitive feature that infinity brings to the table! $\endgroup$ Mar 26 at 1:04
  • $\begingroup$ Welcome to the struggle with the mind warping concept that is infinity. I always think of the Schröder-Bernstein theorem: en.wikipedia.org/wiki/Schr%C3%B6der%E2%80%93Bernstein_theorem $\endgroup$ Mar 26 at 1:17

4 Answers 4


Perhaps I'm understanding your question differently than some of the other commenters, but I'll point out that saying you have a function $g: D \to \mathbb{R}$ does NOT mean every element of $\mathbb{R}$ gets outputted. Here, the set that comes after the arrow is something called a codomain which can be larger than the range. If every element of your codomain gets outputted, then your function has a specific property called surjectivity, but not every function will have this. For example, consider the function $f: \mathbb{R} \to \mathbb{R}$ given by $f(x) = x^2$. Here, $\mathbb{R}$ is NOT the range of our function since there is no real number that maps to the number $-1 \in \mathbb{R}$ under $f$.

  • 3
    $\begingroup$ Thanks for explaining this. If I understood you correctly, that would mean that with such notation we tell more about the 'type' of the output (real, complex, etc.) than the actual range of the function. $\endgroup$
    – nocomment
    Mar 26 at 1:13
  • 1
    $\begingroup$ @nocomment Yes that’s exactly the right way to think about the notation! $\endgroup$ Mar 26 at 1:22
  • $\begingroup$ @DavidK thanks for pointing that out, my mistake! Just fixed it $\endgroup$ Mar 26 at 1:23
  • $\begingroup$ @nocomment a standard notation for the set of points that $f:D\rightarrow \mathbb{R}$ can take is $f(D)$, which will always satisfy $f(D) \subseteq \mathbb{R}$ $\endgroup$
    – Joe
    Mar 26 at 9:30

I don't agree with your statement that the range is a larger set than the domain.

I give some counter-examples to illustrate.

If you take any constant function defined as $f: R \rightarrow R$, $f(x) \equiv k$ (fixed value of $k$), then

Domain$(f) = R$

Range$(f) = \{ k \}$

As another example, take the 'sign' function defined as

$g: R \rightarrow R$, where $g(x) = \mbox{sign}(x)$.


Domain($g$) = $R$

Range($g$) = $\{ -1, 0, 1 \}$

(It is a convention to define sign(0) = 0.)

If you define $h: R \rightarrow R$ as $h(x) = | x |$, the absolute value of $x$, then

Domain($h$) = $R$

Range($h$) = non-negative reals, which is a smaller set than $R$.

  • $\begingroup$ What about the function $tan(x)$, when we constrain the domain to $[-pi/2, pi/2]}$ which others have pointed out above? $\endgroup$
    – nocomment
    Mar 26 at 1:23
  • $\begingroup$ Obviously, for different functions, the ranges will be different. You cannot make a general statement that ranges will be larger or smaller than (or same as) the domain of a given function. This is purely the property of a given function. A general statement cannot be made. Thanks! $\endgroup$
    – Dr. Sundar
    Mar 26 at 1:31

The underlying idea of your question is the concept of cardinality. We say that two sets $X$ and $Y$ have the same cardinality iff the exists a bijection $f:X\to Y$ between them. Such relation is an equivalence relation, that is to say, it is reflexive, symmetric and transitive. Hence each cardinality is an equivalent class. We can establish a linear order relation among the possible cardinalities. Finally, we say that that a set $X$ is infinite iff there exists a bijection between $X$ and a proper subset of it.

For example, the set of natural numbers is infinity because $f:\textbf{N}\to P$, where $f(n) = 2n$ is a bijection between $\textbf{N}$ and the set $P := \{n\in\textbf{N} \mid (n = 2k)\wedge(k\in\textbf{N})\}\subset\textbf{N}$.

At the given example, one can consider the function $\tan:(-\pi/2,\pi/2)\to\textbf{R}$ which is bijective (as suggested by @MichaelMorrow). Therefore, even though the interval $(-\pi/2,\pi/2)$ is a proper subset of $\textbf{R}$, they have the same cardinality, hence the set of real numbers $\textbf{R}$ is infinity.

One interesting result is that $\operatorname{card}(\textbf{N}) < \operatorname{card}(\textbf{R})$, but it is not known if there is a cardinality between both. Cantor has conjectured it and such statement is known as the continuum hypothesis.

  • $\begingroup$ Re: the last paragraph, it is in fact known that the usual axioms of mathematics cannot decide the question either way (unless they turn out to be inconsistent, in which case they decide it both ways :P); see here. $\endgroup$ Mar 26 at 1:19
  • $\begingroup$ @NoahSchweber thanks for the reference. $\endgroup$ Mar 26 at 1:56

If $A$ is a finite set, then it is not possible for there to be a function $f:A\to B$ such that the range is a proper superset of the domain. However, this statement is not true for infinite sets, which is just one reason why they are so counter-intuitive. For instance, we can construct a surjective function $f:\mathbb Z^+\to\mathbb Z$ by mapping the odd positive integers to the nonnegative integers, and mapping the even positive integers to the negative integers. Similarly, the function $f:(-\pi/2,\pi/2)\to\mathbb R$ given by $f(x)=\tan x$ is surjective, even though $(-\pi/2,\pi/2)$ is clearly a proper subset of $\mathbb R$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.