What does the notation $f\colon A\to B$ mean?

I've been doing an online course in discrete mathematics, and the notation $f\colon A\to B$ has come up a few times, and it has not been explained what it means. I tried searching for it on Google, but unfortunately you can't search with characters like $\to$. If anyone could clarify what it means, it would be greatly appreciated!

Edit: There have been a few answers so far about mapping - I'm sorry, but I'm a complete layman when it comes to this. Is there anyway someone could explain it a bit more?


$f:A\to B$ means $f$ is a function from $A$ to $B$.

Example:

$\begin{align*}f:\Bbb R& \to \Bbb R_+\\ x & \mapsto x^2\end{align*}$

You've certainly already seen functions defined as $f(x)=x^2$ but as you start doing more complicated things with functions, you need the "formula" plus two other things: the domain $A$ and the codomain $B$.

The reason fo that is that the function I defined above is not bijective (if I give you $f(x)$, you can not find $x$ because it could be $\sqrt{f(x)}$ or $-\sqrt{f(x)}$) but I can define another function that is bijective:

$\begin{align}g:\Bbb R_+& \to\Bbb R_+\\ x & \mapsto x^2\end{align}$

Because now you know the $x$ I took to form $f(x)$ is in $\Bbb R_+$ so it can not be $-\sqrt{f(x)}$ so it has to be $\sqrt{f(x)}$.

Therefore you can define

$h:\begin{array}{ll}\Bbb R_+& \to& \Bbb R_+\\ x & \mapsto & \sqrt{x}\end{array}$

And $h$ will be the inverse function of $g$ which we write as $g^{-1}=h$. Also note that $f$ does not have an inverse function.


$f:A\to B$ usually refers to a function $f$ with domain $A$ and codomain $B$. For each $x\in A$, the function assigns a value $f(x)\in B$. For example, the function $f:\mathbb R\to\mathbb R$ given by $f(x)=x^2$ sends each real number to its square, and one can plot this on the plane.

If $x\neq y$ implies $f(x)\neq f(y)$ (different values in the domain map to different values in the codomain), $f$ is said to be injective. If for every $y\in B$ there is some $x\in A$ such that $f(x)=y$ (every value in the codomain is mapped from some value in the domain), $f$ is said to be surjective. If $f$ is injective and surjective, it is said to be bijective. The example given above is neither injective nor surjective.


$f$ is a function that maps from $A$ to $B$.

Here, what your function is basically doing is taking an element from set $A$, then applying some process to it (whatever your function is), and then giving you an element in set $B$.

Let's consider the function $f(x) = x$. We can define this function as

$$f(x) : \mathrm{R} \rightarrow \mathrm{R}.$$

This is telling us that the function $f(x)$ maps an element from the set of real numbers to an element from the set of real numbers. If we consider $x = 1 \in \mathrm{R} = A$. Then we see that when we apply the function, we get

$$f(x) = x \implies f(1) = 1$$

and so we see that we have mapped $1$ to $1$.

Think about it as your "input - process - output" thing you might've learnt in school. You're input is your element from your domain. You process it using your function, your output (the element it has been mapped to) is your co-domain.

If we look at this image of a surjective map from Wikipedia:

enter image description here

You can see a little more clearly what it means to "map". Notice how each element in $X$ has been mapped/sent to an element in $Y$. What exactly $B,C,D$ are would depend on the function.