TITLE: Difference of mapsto and right arrow
QUESTION [22 upvotes]: Could someone please explain to me what is the difference in the two arrows$$\rightarrow$$ and $$\mapsto$$ For example in Probability wih Martingales (Willams) 
Thank you.

REPLY [16 votes]: We can say:$$f:\{1,2,3\}\to\{4, 5, 6\}$$
This is a function from the set $\{1,2,3\}$ to the set $\{4, 5, 6\}$.  Both things on the right and left of the arrow are sets.  
But, if we say:
$$1\mapsto5$$
This says that when we put $1$ into the function/relation/whatnot, we get out a $5$.  Both things on the left and right of the arrow are elements of the the domain/codomain.  
This is not to say that we couldn't have a function like:* $$f:\{\{1, 2\},\{3, 4\},\{5, 6\}\}\to\{4, 5, 6\}\text{ such that:}\\\{1, 2\}\mapsto 4\\\vdots\\\text{etc.}$$
In this case, one of the things on the right/left of the $\mapsto$ is a set.  We could even make both of the things a set; it doesn't matter for $\mapsto$, but $\to$ must have sets on both sides.  The $\mapsto$ is really just specifying what we get out when we put in something.

REPLY [10 votes]: Typically $\to$ is used when specifying the domain and codomain of an arbitrary function while $\mapsto$ is used in explicit definitions. So $f: A \to B$ means that $f$ is a function with domain $A$ and codomain $B$ (note $B$ might not be the range of $f$). Notice this doesn't define a specific $f$ from $A$ to $B$, but instead could represent any such function.
On the other hand, when I say $f: \mathbb{R} \to \mathbb{R}$ is defined by $f: x \mapsto x^2$, the second arrow simply says that this is the function $f(x) = x^2$.