Different arrows in set theory: $\rightarrow$ and $\mapsto$ [duplicate]
Solution 1:
When referring to functions, $\rightarrow$ points from the domain of the function to its codomain. When we write $f:A\to B$, we mean that $f$ takes things in $A$ and maps them to thing in $B$. The symbol $\mapsto$ points from an element of the domain to its image in the codomain. $f:x\mapsto y$ means that $f(x)=y$.
Solution 2:
In programming parlance, $\to$ is part of a type signature, while $\mapsto$ is part of a function definition.
The expression $$x \mapsto \operatorname{floor}(1/x)$$ denotes the function that takes in a number and spits out the floor of its reciprocal.
There are many different type signatures that can be consistently assigned to this function. If you drop in numbers between $0$ and $1$, the function will spit out positive integers, so $$(0, 1) \to \mathbb{N}$$ is one valid type signature.
As M. Vinay noted, it's not unusual to combine these notations in a function definition. For example, I could declare a function $g$ with the definition and type signature above by writing $$\begin{align*} g \colon (0,1) & \to \mathbb{N} \\ x & \mapsto \operatorname{floor}(1/x). \end{align*}$$
Solution 3:
For sets $X$ and $Y$, $f\colon X \to Y$ is a function "from $X$ to $Y$", meaning that $f$ has domain $X$ and codomain $Y$. If $y = f(x)$, then we may write $x \mapsto y$, read as "$x$ maps to $y$". This is used only when the function that maps $x$ to $y$ is clear from the context. Sometimes, you may see a function defined as \begin{align*} f\colon\ & \mathbb R \to \mathbb R\\ & x \mapsto 4x^3 \end{align*} instead of $f(x) = 4x^3$.
See here.