Regarding the notation $f: a \mapsto b$ 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.)
 A: 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.
A: 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$”.
A: $\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: 


*

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

*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$).
A: $\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}$$
A: 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$.
