9
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ Mapping means for every member of the first set you assign a member of the second set. Think of it as a black box where you input a number (element of set A) and it gives you new number (element of set B). Two different input numbers may give the same output number. The rule is static in the sense that for a given input number, the same output number must be given each time. $\endgroup$ – Darren Mar 31 '13 at 16:01
  • 1
    $\begingroup$ I had the same question, though to me the meaning was pretty obvious from context I cannot figure out which "pre-req" class I should have learned this notation in. I did up through multi-dimensional calculus in college without ever seeing it, but when I started a discrete math course online it was taken for granted. $\endgroup$ – KutuluMike Mar 31 '13 at 16:45
16
$\begingroup$

$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.

$\endgroup$
  • $\begingroup$ I should note that one quite confusing thing about the asked notation $f:\mathbf A \to \mathbf B$ is, whether the set $\mathbf A$ is its domain or not. Some books say that $f(x) = 1/x$ is a function $f:\mathbf R \to \mathbf R$, some say that it's wrong and the right way is $f:\mathbf R\setminus\{0\}\to \mathbf R$. (I don't know the right answer (and I don't know if there's one)...) $\endgroup$ – Jeyekomon Mar 31 '13 at 20:35
  • $\begingroup$ In French we have two different words, "fonction" being the general one and "application" being the one that means every element of $A$ has an image by $f$. But in English there doesn't seem to be such a distinction. I googled a bit but couldn't find anything. $\endgroup$ – xavierm02 Mar 31 '13 at 21:49
  • $\begingroup$ But anyway, a function is really just a binary relation with some specific properties. You might want to read this: en.wikipedia.org/wiki/… $\endgroup$ – xavierm02 Mar 31 '13 at 21:55
  • $\begingroup$ By the way, according to this Wikipedia page, a function has an image for all elements in $A$. $\endgroup$ – xavierm02 Mar 31 '13 at 21:58
7
$\begingroup$

$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.

$\endgroup$
5
$\begingroup$

$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.

$\endgroup$
4
$\begingroup$

It is actually really simple, as others have said, it means that a function (let's say $f$) maps $A$ to $B$ (that is, for an element in the set $A$, you apply some rule to it, then you get an element from the set $B$). For example:

$$f:\mathbb{Z} \rightarrow \mathbb{Q}$$

means that your domain are integer but your codomain are the rational numbers.

$$f(n) = \frac{1}{n}$$

where $n$ is an integer. This functions maps every element in $\mathbb{Z}$ (integer) to an element in $\mathbb{Q}$ (rational).

$\endgroup$
2
$\begingroup$

For even more fun, be ready for:

$$\begin{align} f:X & \to Y\\ x & \mapsto y=f(x), \end{align} $$

and

$$X \overset f\to Y.$$

I find myself drawing $X$ and $Y$ as two big blobs, with an arrow with $f$ over it pretty often. Or sometimes $X$ and $Y$ are drawn as magic carpets, when they are surfaces. Or as segments of the real line with a tick mark for the origin.

$\endgroup$
2
$\begingroup$

It might be enlightening to see this in a more general setting than just functions that map some kind of number to some other kind of number. Functions are a very important tool in most programming languages1, where you often work with far more complicated data than just numbers2. For instance, in Haskell,

f :: String -> Int

is a function that takes a character string (e.g. "hullo") and outputs an integer number. This function might be defined3 as

f("How much is 5+6?") = 11
f("How many letters has the alphabet?") = 26
f("What is the answer to life, the universe, and everything?") = 42
f(x) = error("I haven't understood your question. You said: " ++ x)

In an interactive interpreter, this might work as follows:

ghci> let f("How much is 5+6?") = 11; f("How many letters has the alphabet?") = 26; f("What is the answer to life, the universe, and everything?") = 42; f(x) = error("I haven't understood your question. You said: " ++ x)
ghci> f("What is the answer to life, the universe, and everything?")
42
ghci> f("How much is 5+6?")
11
ghci> f("How many years is my age?")
*** Exception: I haven't understood your question. You said: How many years is my age?

However, if I tried to define the function in a way that's not compatible with the type signature4 String -> Int, the interpreter would complain right away.

ghci> let f :: String->Int; f("How do you write out '7'?") = "Seven."

<interactive>:16:56:
    Couldn't match expected type `Int' with actual type `[Char]'
    In the expression: "Seven."
    In an equation for `f': f ("How do you write out '7'?") = "Seven."

because "Seven.", unlike 7, is not actually an integer number but again a character string.


1Most programming languages are very sloppy with their mathematical notation, they have functions with "side-effects", like printing something to the screen or sending an E-Mail to somebody, which doesn't make any sense for mathematical functions. In Haskell, this is generally banned (it has a special "magic trick" to do such stuff) except for error messages (which abort the entire program, so the function doesn't need to bother to actually return a number in the fourth case).

2Of course, you also work with much more complicated data than numbers in mathematics – only, those kind of objects are rather harder to understand than character strings, I reckon.

3Note that you normally wouldn't need to write all those parentheses in Haskell, I just used them so it looks more familiar.

4What's called "types" in programming languages is almost (but not quite) the same as the sets you're dealing with in mathematics.

$\endgroup$

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.