Here I have a nice function (also known as $f(x)=\sin (\pi x/2)+1$) that is continuous on the interval $[0,4]$:

sin graph

According to the definitions I've found, $f:A\rightarrow B$ means that $\forall n\in A:f(n)\in B$. Therefore, in describing this function’s domain and range, the most precise thing to do would be to say $f:[1,4]\rightarrow [0,2]$. However, from what I understand, this notation is not the most precise, and the following would also be true:

  • $f:[1,4]\rightarrow [-5,5]$
  • $f:[1,4]\rightarrow\Bbb{R}$
  • $f:[1,2]\rightarrow\Bbb{R}$

Basically, $A$ must include some—but not all of—$f$’s domain but must not include any number for which $f$ is not defined while $B$ can include any numbers so long as it includes the range of $f$ on $A$—which makes sense when looking at the definition of $f:A\rightarrow B$.

All of this research I’ve been doing (I’m only a junior in high school who just started AP Calculus BC) was originally to determine a concise and symbolic way to express that a function is continuous on a certain interval, but now my question has evolved to include something else: how can one clearly and symbolically define the full domain and range of a function without any ambiguity and in one fell swoop?


It has come to my attention that codomain and range are actually different. From what I understand at this point, codomain is a kind of restriction on the range. Here's an example:

Let $f:x\mapsto\sin\left(\dfrac{\pi x}{2}\right) +1$, as shown in red: red

If one wishes to restrict the domain, simply graph $f:[0,4]\rightarrow\Bbb R$ (as shown in blue): blue

Want to restrict the range, too? Go ahead and meddle with the codomain. Here's $f:[0,4]\rightarrow [0.25,1.75]$ in green: green As of right now I'm confused as to whether or not you have to restrict the domain to exclude images of x that would be excluded anyways by restricting the codomain

  • $\begingroup$ Do you know what "type casting" is, in the context of programming? $\endgroup$ – Asaf Karagila Sep 11 '16 at 5:00
  • $\begingroup$ I do not :( @AsafKaragila $\endgroup$ – gen-ℤ ready to perish Sep 11 '16 at 5:01
  • $\begingroup$ A possible description would be $\text{given } f : [0,4] \to [1,2] \text{ surjective and continuous}$. $\endgroup$ – dxiv Sep 11 '16 at 5:05
  • 1
    $\begingroup$ That's one fell swoop BTW. phrases.org.uk/meanings/at-one-fell-swoop.html $\endgroup$ – user4894 Sep 11 '16 at 5:32
  • 1
    $\begingroup$ codomain is a kind of restriction on the range No. The range is the image of the domain, which is always a subset of the codomain. The last graph in your latest edit does not depict a function $f : [0,4]$ because there are points in that interval where $f$ appears to not be defined. Maybe you should clarify what you mean by "the most precise" notation. $\endgroup$ – dxiv Sep 11 '16 at 6:03

The Range of $f:A\to B$ is sometimes denoted $f(A)$. $f(A)$ is defined as $\{f(a) \ | \ a\in A\}$. A well-defined function (i.e. a function) satisfies $f(A)\subseteq B$.

Requiring a function be defined as $f: A\to f(A)$ is too constricting. While this defines in a sense the "best" restriction of any $f:A\to B$, sometimes the set $f(A)$ is unknowable or tedious to describe.

Take for example the function

$$f:\mathbb N\to \mathbb N, \ \ \ \ f(n) = \text{the $n^{th}$ largest prime number}$$

We don't have a formulaic way to describe $f(\mathbb N)$. $\mathbb N$ is simply a good choice for a codomain, rather than say $\mathbb Z$ or $[0,\infty)$ because the others are unncessarily large or complicated.

  • $\begingroup$ Actually, I wouldn't call $f:A\to f(A)$ constricting at all; it's equivalent to $f:A\to V$ (where $V$ is the universe). Of course, if you had some other way of describing the set $f(A)$ then it would give you more information, for example $f:\Bbb N\to\Bbb P$ in your example says $f(\Bbb N)\subseteq\Bbb P$, which is new information, or even $f(\Bbb N)=\Bbb P$ if you specify that $f:\Bbb N\to\Bbb P$ is onto. $\endgroup$ – Mario Carneiro Sep 11 '16 at 16:42

You are wrong when you say that $A$ must include some, but not all of $f$'s domain. The notation $f:A\to B$ is used to denote a function $f$ whose domain is exactly $A$, and whose codomain is exactly $B$. The notation makes no mention whatsoever of the function's range. To specify the range of a function is not the same as specifying the codomain of that function.

When it comes to precision, the notation $A\to B$ is meant to emphasize the domain and codomain of our function, and besides the most simple cases where it is obvious what the range of the function is, it is up to us to be explicit and identify the range of our function where it is necessary.

For a function $A\to B$ you could come up with another function $g:A\to\operatorname{range}f$ defined by $g(a) = f(a)$ for $a \in A$. This function has the same domain as $f$ and its codomain is equal to its range.

  • $\begingroup$ The alternative you present in your last paragraph is not quite correct. If $f:A\to B$, then the codomain is $B$, not $\operatorname{range}f$, which in general is a smaller set. $\endgroup$ – Mariano Suárez-Álvarez Sep 11 '16 at 5:26
  • $\begingroup$ The codomain is an importantt piece of information, different from the range. This is not immediately obvious but nonetheless it is. $\endgroup$ – Mariano Suárez-Álvarez Sep 11 '16 at 5:27
  • $\begingroup$ @MarianoSuárez-Álvarez I addressed that they are not equal as sets. The OP asked as to what is the most concise way to express the domain and range in this $A\to B$ notation. Specifying the range $A\to\operatorname{range}f$ in this notation would be the most concise way to do so if the OP insists on using this notation. Of course, in this case $A\to\operatorname{range}f$ is a bijection. $\endgroup$ – Alex Ortiz Sep 11 '16 at 5:32
  • $\begingroup$ But the well-established meaning of notation $f:A\to B$ is, among other things, that the codomain of $f$ is $B$, so proposing to write $f:A\to \operatorname{range}f$ to mean something else (no matter how much extra verbiage you add) is not going to help anyone! $\endgroup$ – Mariano Suárez-Álvarez Sep 11 '16 at 5:36
  • $\begingroup$ @MarianoSuárez-Álvarez I think you'll agree that it does help in the case that we have a function $f:A\to B$, and we consider some other function $g$. The map $g:A\to\text{range}\,f$ is defined by $g(a) = f(a)$ for $a \in A$. I agree it does not make sense to consider the same function $f$ and write its codomain as its range, but this is better. $\endgroup$ – Alex Ortiz Sep 11 '16 at 5:40

The set-theoretic def'n of a function $f:A\to B$ is that $f$ is a subset of the Cartesian product $A\times B$ such that $\forall x\in A\; \exists ! y\in B\; (\;(x,y)\in f).$ The notation $\exists !y$ means "there exists exactly one $y$" , also said "there exists, uniquely, $y$".

But if any $C$ satisfies $C\supset \{y:\exists x \;(\;(x,y)\in f\}$ then we can also write $f:A\to C.$ So the range $B$ is not uniquely defined.

For any $D\subset A$ we write $f|D$ or, more commonly, $f|_D$ to denote the function $f\cap (D\times B).$ When $D\ne A$ this is called the restriction of $f$ to $D.$

Of course it is convenient to write $y=f(x)$ for $(x,y)\in f.$ For any $D\subset A,$ different authors use different names and notations for the set $\{y:\exists x\in D\;(\;(x,y)\in f\}=\{f(x): x\in D\}.$ E.g., the image of $D$ (under $f$), or $f(D)$ or $fD$ or $f''D.$ The last one, "$f$-double-prime $D$" or "$f$-double-tick $D$" , is favored by many set-theorists, and can be written $f''(D).$

The difficulty with $f(D)$ is that $D$ may be both a subset of and a member of $A=dom (f).$ E.g. $A=\{ \phi, \{\phi\}\}$ and $D=\{\phi \}.$ The problem with $fD$ is that if D is represented by a compound expression and we don't want to introduce another symbol then we will need brackets anyway to avoid ambiguity.(E.g is $fG\cap H$ equal to $f''(G\cap H)$ or to $(f''G)\cap H$ ?). The notation $f(D)$ is common, though, especially in analysis, where it is usually assumed that $dom (f)$ is anti-transitive. (I.e. members of $dom (f)$ are assumed not to be subsets of $dom (f).)$

There is also,as usual, some abuse of notation. E.g. when $dom (f)=[0,1)$: "Extend $f$ to domain $[0,1]$ by letting $f(1)=42$", which really means that we define another function $g$ with $g|_{dom (f)}=f ,$ and $dom (g)=\{1\}\cup dom(f) ,$ and $g(1)=42.$ Or, equivalently, "Let $g=f\cup \{(1,42)\}.$"


For a function $f:A\to B$, the domain is $A$, the codomain is $B$, and the image (range) is $\{f(a)|a\in A\}$.

The domain $A$ is all the values that the function is defined on. The function is not defined on any values not in $A$, and it is defined for all values in $A$.

For every element $a$ in $A$, $f(a)$ must be in the codomain $B$.

The image is all the values $b$ for which there exists a value $a$ in the domain such that $f(a)=b$. This leads to the fact that the image is always an improper subset of the codomain.

As for your edit, you can't really restrict the codomain as you would the domain. If you restrict the codomain to exclude some values, but leave the domain the same, now you have some values in the domain for which the function is not defined. That doesn't work. The only way to restrict a function is to restrict the domain. The image may change, but you can leave the codomain as it is.


One notation that I have seen is

$f([0, 4]) = [0, 2] $.

  • 1
    $\begingroup$ But that means something different. $f:A\to B$ declares $f$ to have domain $A$ and codomain $B$. What you wrote only that the domain of $f$ contains $[0,4]$, and so on. $\endgroup$ – Mariano Suárez-Álvarez Sep 11 '16 at 5:06
  • 1
    $\begingroup$ This only means that the image of $[0,4]$ is $[0,2]$. $\endgroup$ – themightymoose Sep 11 '16 at 5:09

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.