Forgive me if this does not belong here.

All throughout primary school I've seen the notation $f(x)$ to denote a function, that is, if we are talking about the squaring function, we would write

$$ f(x) = x^2 $$

to denote/define the function (IIRC this notation was invented by Euler).

However, in the past few years I've been introduced to the notation

$$ x \mapsto x^2 $$

when talking about an anonymous function that we don't need to give a name (and as someone who does functional programming I find it very intuitive and useful).

My question is, should we prefer

$$ f(x) = x^2 $$


$$ f \colon x \mapsto x^2 $$

when defining a function with a name. It seems to me the former is more common, but wouldn't it make sense to use the latter to be consistent with anonymous functions? What's the standard in professional mathematics (e.g. papers)? Does anyone think one is more readable than the other?

Oh, and I've also seen

$$ f(x) := x^2 $$

as another alternative.

  • 1
    $\begingroup$ Your second option is not very often seen in papers. $\endgroup$ – Mariano Suárez-Álvarez Jul 10 '14 at 6:02
  • 1
    $\begingroup$ @MarianoSuárez-Alvarez ... especially in the full form $f\colon \mathbb R\to\mathbb R, x\mapsto x^2$. The most important thing to notice is that one should never write "Let $f(x)$ be a function ..." because $f$ and not $f(x)$ is the function. The "$\mapsto$" is often a good way to avoid this bad style. $\endgroup$ – Hagen von Eitzen Jul 10 '14 at 6:08
  • $\begingroup$ What I do is $f:x\in X\mapsto x^2\in X$, because I really dislike the two step thing :-) $\endgroup$ – Mariano Suárez-Álvarez Jul 10 '14 at 6:15
  • $\begingroup$ A possible compromise between the two styles is $x\overset{f}{\mapsto}x^{2}$. $\endgroup$ – Mark Jan 16 '17 at 10:52

The problem with all of these notations is that they don't indicate the domain or codomain of the function. I would introduce a function in two parts, first I would write $f : X \to Y$ which indicates the domain and codomain, then write either $f(x) = \dots$ or $x \mapsto \dots$ , both are acceptable.

Example: I would write either $f : \Bbb{R} \to \Bbb{R}$, $x \mapsto x^2$ or $f : \Bbb{R} \to \Bbb{R}$, $f(x) = x^2$.

In both cases, the first part tells you the name of the function, its domain, and its codomain, while the second tells you how it acts on an element of the domain.


I don't think there's anything inherently bad about either notation (used properly).

The less common notation is useful in some cases, e.g.:

  • Let $\alpha$ be a permutation. Let $\alpha'$ be the map defined by $\alpha(i) \overset{\alpha'}{\longmapsto} i$. We see that $i \overset{\alpha}{\longmapsto} \alpha(i) \overset{\alpha'}{\longmapsto} i$ and $\alpha(i) \overset{\alpha'}{\longmapsto} i \overset{\alpha}{\longmapsto} \alpha(i)$, and so $\alpha\alpha'=\alpha'\alpha$ is the identity map.

  • If $\theta$ is a permutation of a group $(G,+)$, then $\theta$ is an orthomorphism if $g \mapsto \theta(g)-g$ is also an permutation of $G$.

Here's an image from a paper I'm currently writing where I use the notation element-by-element:

enter image description here

In this example, it would be cumbersome to use e.g. $\theta\big((0,0,0)\big)=(1,1,1)$ and $\theta^2\big((0,0,0)\big)=(2,2,2)$.


There is also an "historical" motivation behind.

Functions in mathematics originated form the idea of "recipe" or "procedure" which, taking an input $x$ "produce" an output $y$.

Paradigmatic examples are the simple mathematical functions like : "double of __" (i.e. $y = 2 \times x$), "square of __" (i.e. $y = x^2$).

This origin explains the "old" symbolism :


where we write in the RHS a "formula" which express the way to calculate the value of the function for an "input" whatever : i.e. the "law" formalized by the mathematical expression.

With the modern mathematics, starting form Dirichelet, an abstract concept of function emerged : a corerspondance between values from two sets whatever : the doamin and the codomain (or range).

In this case, we need - as answered above - more informations to define the function : the indication of domain and codomain.

But also, we have "general" functions, where we are nor more able to "specify" with a simple mathematical expression the "law" defining the correspondance.

  • $\begingroup$ Both $f(x) = ...$ and $f \colon x \mapsto$ are equally expressive (or non-expressive) in this regard. There are many reasonable functions that can not be written in this form, i.e. let $\chi(G)$ be the minimum number of colors it takes to color a graph $G$. It is interesting that functions used to denote a recipe that could be followed to obtain the output; this is now obsolete with the formal definition of a function, however this is now what we could call an algorithm! The difference being the algorithms can be quite more complex, with loops and conditionals and memory. $\endgroup$ – gardenhead Jul 11 '14 at 0:10

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.