What does "$f: \mathbb{R} \to[0,\infty), f(x)=x^2$" mean? What is the co-domain, domain, or range?

The domain is $\Bbb R$. The codomain $[0,\infty)$. The range is $f(\Bbb R)$.

The range is used both for the image, as I have indicated here, and sometimes synonymously with codomain, or target space.


A function has three pieces of information: a domain (where the inputs come from), a codomain (where the outputs live) and a "rule", which is a recipe telling you how each input gets sent to its output.

Typically we write this as $f:A \to B$; here $f$ is the name of the function (the rule), $A$ is the domain and $B$ is called the codomain/target space.

The range/image of a function is slightly different from the codomain. The range of a function $f:A \to B$ is defined as the set of all possible outputs; or more formally $R_f = \{y \in B | \, \, \text{there exists an $x \in A$ such that $y = f(x)$}\}$. So, the range of a function is always a subset of the codomain, but not the other way around.

In your particular question, this is the exact same format. We have $f: \Bbb{R} \to [0, \infty)$, $f(x) = x^2$. Notice that we have given 3 pieces of information here:

  • The domain of the function (the set of inputs/ "the thing before the arrow") is $\Bbb{R}$, which is the set of all real numbers.
  • The codomain/target space is $[0, \infty)$, which is the set of non-negative real numbers.
  • Lastly, we have the name of the function, which we call $f$, and the rule; $f(x) = x^2$. This means for any element $x$ in the domain of the function $f$, the output $f(x)$ is obtained by squaring that number.

Recall that we made a distinction between "codomain" and "range". In general, these two need not be the same sets, (the range is always a subset of codomain, but not necessarily equal to). But in this specific example, the range of $f$ and the codomain of $f$ are both equal to $[0, \infty)$.


Here's another example. Consider $\phi: \Bbb{R} \to \Bbb{R}$ defined by $\phi(x) = x^2$.

  • Here, the domain (the thing before arrow) is $\Bbb{R}$.
  • The codomain (the thing after the arrow) is also $\Bbb{R}$.
  • The rule is the same as above (square the input).
  • The range of $\phi$ however, is $[0, \infty)$, which is different from the codomain.

So, although $f$ and $\phi$ have the same domain and same rule (and same range), we consider them to be different functions because they have different codomains of $[0, \infty)$ and $\Bbb{R}$ respectively.


Here's another example. Define $g: (0, \infty) \to \Bbb{R}$ by $g(x) = \dfrac{1}{\sqrt{x}}$. Then,

  • The domain is $(0, \infty)$.
  • THe codomain is $\Bbb{R}$.
  • The rule for $g$ is as I have defined above.
  • The range is $(0, \infty)$ (showing this requires a small calculation).

So, once again, this example shows that the range of a function need not be equal to the codomain.


Here's a simple/silly example to illustrate that the concept of functions is very general, and there is no need to even talk about numbers. The domain and codomain can be any sets. For example, let $E = \{\ddot{\smile}, \ddot{\frown}\}$ be the set of emotions, of happiness and sadness. Then, we can define a function $\xi: E \to E$ by \begin{align} \xi(\ddot{\smile}) = \ddot{\smile} \quad \text{and} \quad \xi(\ddot{\frown}) = \ddot{\smile} \end{align} In other words, every input gets sent to the happy output. So, here we have

  • The domain is $E$, the set of emotions.
  • The codomain is also $E$.
  • The rule for $\xi$ is as I have defined above.
  • The range of the function $\xi$ is $\{\ddot{\smile}\}$ "the set of happiness".

Hopefully these examples illustrate/clarify some of the terminology involved.