19

While I have come to understand that $f:a\mapsto b$ means that for input from the set $a$, the function will return a value from the set $b$, I am curious as to how far one may "drag" this notation. Say $f(x) = x$, would $f: 1 \mapsto 1$ be valid, or does one have to write $f: \mathbb{R} \mapsto \mathbb{R}$? (While I understand that my initial example would seldom prove useful, I am curious as to what is valid notation or not.)

janmarqz
  • 10,538

5 Answers5

22

$\to$ : $$ f:X\to Y $$ where $X,Y$ are sets.
$\mapsto$: $$ f:x\mapsto f(x) $$ where $x\in X$ and $f(x)\in Y$, i.e. this notation says what element $x$ in $X$ is mapped to what element $f(x)$ in $Y$.
Writing $f:x\mapsto f(x)$is equivalent to the previous one, but it is written in terms of elements of the sets, not sets (it implies you have already chosen $X,Y$, o.w. it does not make sense).

Examples:

  1. $\mathbb{R}$ is a set so you may write $$ f:\mathbb{R}\to \mathbb{R} $$ NOT $ f:\mathbb{R}\mapsto \mathbb{R} $.

  2. Say you have $f(x)=x^2$, now this only means that you square a certain element $x$ of...what set???? If you choose $\mathbb{R}=X$ then you know $f(2)=4$ but you may have $4\in\mathbb{R},[0,\infty],[0,\infty),\mathbb{R}^4,\mathbb{C}$, say. These $Y$'s make sense for the function $f$, but a different $Y$ imples a different function! (Try to make examples in terms of injectivity and surjectivity.)

HOWEVER (generally) you should choose where the function is living on first (the sets), then you built up the details of $f$ (whether it is $f(x)=x$ or $f(x)=x^2$).

Rgkpdx
  • 1,498
  • 12
  • 27
  • 4
    Just so you know, the question originally had normal arrows ($\to$) everywhere. The OP edited it in response to some questionable advice from a commenter. – Tim Seguine Jan 25 '14 at 20:35
  • 3
    Thank you for this crucial remark (which makes the question not understandable). – Rgkpdx Jan 25 '14 at 20:43
8

The domain and codomain are part of a function (and a very important part at that). For every set $X$, there exists a function written as $\mbox{Id}_X\colon X\to X$ which is defined by $f(x)=x$ for all $x\in X$. This is known as the identity function on $X$ and is a different function for each $X$. you can only compose functions $f\colon A\to B$ and $g\colon C\to D$ if $B=C$ so that $(g\circ f)\colon A\to B=C\to D$ or more simply $g\circ f\colon A\to D$ and this emphasises why the domain and codomain of a function are important.

To help reinforce how important it is to specify the domain and codomain of a function, here is the definition of function equality.

If $f\colon A\to B$ and $g\colon C\to D$ are functions, then $f$ is equal to $g$, and we write $f=g$, if and only if

$1)$ $A=C$

$2)$ $B=D$

$3)$ For all $x\in A$ we have $f(x)=g(x)$.

If $f\colon \mathbb{R}\to\mathbb{R}$ is given by $f(x)=x^2$ and $g\colon\mathbb{R}\to [0,\infty)$ is given by $g(x)=x^2$ then it is not true that $f$ and $g$ are equal because they do not satisfy the second condition that their codomains are equal, even though they satisfy the other two.

Dan Rust
  • 30,108
  • While I do understand what you are saying, I am still wondering if the notation is exclusively reserved for the domain and codomain. For example, given $f(x) = x^2$, is $f: \mathbb{R} \mapsto [0, \infty)$ the only valid use of the notation? – Andrew Thompson Jan 25 '14 at 19:55
  • 5
    You're doing things in the wrong order. You should first specify the domain and codomain of a function and then define where the function sends elements in the domain. If I just write 'Let $f(x)=x^2$' then you have no way of telling if $f$ is surective, injective, or even well defined. Depending on the domain and codomain of $f$ it can be all of these things, and so we need to specify them before saying what $f$ actually does to elements. – Dan Rust Jan 25 '14 at 19:57
  • I don't follow. I know that $f$ (in this case, $f(x) = x^2$) can take any integer as an input. I know that it will only return numbers in the interval $[0, \infty]$. – Andrew Thompson Jan 25 '14 at 20:03
  • Hopefully my edit helps. It doesn't make sense to only say $f(x)=x^2$ because you haven't finished giving the definition of the function yet. The domain and codomain are parts of the definition of a function and you can not have one without the other. – Dan Rust Jan 25 '14 at 20:07
  • Yes, that made it clear. Thanks for your time. – Andrew Thompson Jan 25 '14 at 20:08
  • You only need $B\subseteq C$, not necessarily $B=C$. – YoTengoUnLCD Feb 26 '16 at 23:19
  • 1
    @YoTengoUnLCD No, technically you need B=C in order to compose functions. If $B\subset C$ then you are implicitly composing (in between $f$ and $g$) with the function $i\colon B \to C$ which is the inclusion map given by $i(b)=b$ for all $b\in B$. – Dan Rust Feb 27 '16 at 00:53
  • +1 for the use of \colon. :):) – manooooh Aug 12 '19 at 12:50
3

To add to the confusion, let me say this: Some standard functions don’t have standard names, so that if we want to talk about, say, the cubing function, we have to choose a letter to represent it, and then say what it does to a typical element of the the domain. Or, we could talk about “the function $x\mapsto x^3\>$” with the understanding that its domain and target-space (codomain) are $\mathbb R$. The more formal way would be to say, “the function $g\colon\mathbb R\to\mathbb R$ by the rule $g(x)=x^3$”.

Lubin
  • 62,818
  • If anything, this cleared things up even further. Thank you. – Andrew Thompson Jan 25 '14 at 21:56
  • You can write $\mathbb{R} \ni x \mapsto x^2 \in \mathbb{R}$ to include all of the data while keeping the function anonymous. (Or $g\colon \mathbb{R} \ni x \mapsto x^2 \in \mathbb{R}$ to name it and still keep it all symbolic.) – Toby Bartels May 24 '19 at 16:44
0

$\mapsto$ notation can be dragged as you mention. You can define function $f$ as follows: $$f:\begin{array}~\{1\}\to\mathbb{R}\\1\mapsto 1\end{array}$$ Function $f$ is defined on singleton $\{1\}$ and returns $1$.

You can also use multiple $\mapsto$ to define the function on its whole domain. For example, you can define function $g$ (absolute value) as follows: $$g:\begin{array}~\mathbb{R}\to\mathbb{R_+}\\x\in\mathbb{R}_+\mapsto x\\x\in\mathbb{R}_-^*\mapsto -x\end{array}$$

0

In my experience, it is much more common to indicate the domains and codomains of functions using \rightarrow, as in $f : A \rightarrow B.$ Likewise, the \mapsto operator is more commonly used to define the rules of functions, such as in $x \mapsto x^2$.