# Does $f:\mathbb{R}\to\mathbb{R}$ mean that $f$ maps to all reals?

This is a quick question. When people write $f:I\to J$ for instance, does $J$ need to be the range of $f$ or can it be any set containing the range of $f?$ For example, is $g(x)=\pi$ an $\mathbb{R}\to\mathbb{R}$ function?

-
It can be any supset. It could be $J=\mbox{range}(f)\cup \mbox{the greek alphabet}$, for instance. – 1015 Mar 14 '13 at 4:57
You might also find my answer here helpful. (See especially the "Important Points" part.) – Cameron Buie Mar 14 '13 at 14:47

$f:X\to\Bbb R$ simply means that all of our function values are real. It doesn't mean that all real values are obtained by our function. ($\Bbb R$ in this case is called a codomain for our function $f$.) Your example $g$ is indeed an $\Bbb R\to\Bbb R$ function (so long as we require that $x$ is real, and allow $x$ to take on any real value), even though it's certainly not the case that all real values are obtained by $g$.

-
+1 Has there every been a more basic question with more obtuse and wrong answers? This one is just right, however. Only thing that would make it clearer is to add that, yes, $f(x)=\pi$ is a function. :) – Thomas Andrews Mar 14 '13 at 4:55
I guess if I am going to complain about obtuseness, I should have been more specific. Yes, $f(x)=\pi$ is a function $\mathbb R\to\mathbb R$. – Thomas Andrews Mar 14 '13 at 5:05
It's somewhat remarkable to me that, as basic as functions are to mathematics, I've found more fundamental disagreement on functions than on any other topic I've discussed on M.SE. – Cameron Buie Mar 14 '13 at 5:10
But some of the answers here were just completely wrong, and others were obtuse, not getting the the heart of the question, which, expressed as a mathematician would, is, are all $f:\mathbb R\to\mathbb R$ onto? For example, when OP is asking a basic question like this, the response should be to use words like "injective" without definition. Even "range" is pointless, because the OP's question indicates he is confused about whether the "range" is the "image" or not. – Thomas Andrews Mar 14 '13 at 5:25
Hah, I hadn't noticed you had used "range," because your answer got to the point of the basic question quickly enough and I was so relieved. :p – Thomas Andrews Mar 14 '13 at 6:00

Usually, $f:A\to B$ means the domain of $f$ is $A$ and $\forall a\in A$, $f(a)\in B$. The map does not have to be injective or surjective. The range of $f$ is usually denoted as img$(f)$ or the image of $f$, which in this case is a subset of $B$.

-
At this point, he probably does not know the words "injective" or "surjective." – Thomas Andrews Mar 14 '13 at 4:51
@ThomasAndrews Or she. – dtldarek Mar 14 '13 at 8:14
Oops, should check the name, yes. @dtldarek – Thomas Andrews Mar 14 '13 at 8:21

Here's a point I would like to stress, though: You don't START with something like $g(x) = \pi$ and ASK if this is a $\mathbb{R} \rightarrow \mathbb{R}$ function. When you write $f:I \rightarrow J$, the sets $I$ and $J$ are part of the DEFINITION of the function.

In other words, I could define a function $g$ by saying $g:\mathbb{R} \rightarrow \mathbb{R}$, $g(x) = \pi$. And I could define a function $h$ by saying $h:\mathbb{R} \rightarrow \{\pi\}$, $h(x) = \pi$. And these are DIFFERENT functions.

-
Yes, this is the problem with defining functions in set theory merely as subsets of $X\times Y$ - there is no way to determine the actual codomain - there isn't even a set of possible codomains. :) This means that you can't say a function is onto, only that is onto some set. – Thomas Andrews Mar 14 '13 at 5:00
-1. I would say that $\sin : \mathbb{R} \to \mathbb{R}$ is the same function as $\sin : \mathbb{R} \to [0,1]$. The $f : X \to Y$ is just a notation convention and serves only to help, it is not required. Moreover, there are better ways to $\color{red}{\text{emphasize}}$ words than ALL CAPS. – dtldarek Mar 14 '13 at 8:31

It can be any set containing the range of $f$. So, your example $g(x)=\pi$ is an $\mathbb{R}\to\mathbb{R}$ function.

If the range of a function $f:A\to B$ is exactly $B$, we call it surjective.

-

$$f:X \to Y \equiv \forall x \in X \quad \exists y \in Y \text{ such that } f(x)=y$$ $$f:X \to Y \land f_\text{ onto/surjective} \equiv \forall y \in Y, \, \exists x \in X \text{ such that } f(x)=y$$ $$f:X \to Y \land f_\text{ 1-1/bijective} \equiv \forall x \in X \quad !\exists y \in Y \text{ such that } f(x)=y$$
Some (and not all) reals to all reals would not be signified by $\Bbb R\to\Bbb R$. – Cameron Buie Mar 14 '13 at 4:48
Yes, this is definitely wrong. It means that the set of values of $f(x)$ is in the reals, but the set of values that $x$ can take must be all the reals. – Thomas Andrews Mar 14 '13 at 4:51
$1-1$ is synonymous with injective, not bijective. Injective and surjective together means bijective. – Thomas Andrews Mar 14 '13 at 8:24