Help with notation $g:\mathbb R \rightarrow\{0,1\}$ and $h:\mathbb R^2\rightarrow \{0,1\}$

46 Views Asked by At

If I have the function $f:\{0,1\}\rightarrow\mathbb R$, I know this could mean $f(0)=12$ or $f(1)=32$, etc. etc.

But, can we also have a function on the following form: $$ g:\mathbb R \rightarrow\{0,1\} \qquad ? $$ For example $g(2.43)=1$?

And also, can we have $$ h:\mathbb R^2\rightarrow \{0,1\} \qquad ? $$ For example, $h(3,4.79)=1$?

Can we also have higher-order, say $n$, so $$ h_2:\mathbb R^n \rightarrow \{0,1\} \qquad ? $$

Please post examples if you have any, thanks!

4

There are 4 best solutions below

0
On

You are right. If $A$ and $B$ are sets, and $f$ is a function from $A$ to $B$, we usually write $$\begin{align} f: A &\longrightarrow B \\ a & \longmapsto b \end{align}$$ or $f:A\to B$ defined by $f(a)=b$, where $a$ is refered to be an element of $A$ and $b$, which is $f(a)$, an element of $B$.

0
On

If $X$ and $Y$ are sets, the notation $f : X \to Y$ means that the function $f$ maps every element $x \in X$ to an element in $Y$. Hence for every $x \in X$, $f(x) \in Y$.

In your example, if we take $g : \mathbb{R} \to \{0,1\}$, then for every $x \in \mathbb{R}$, $g(x) \in \{0,1\}$, so either $g(x) = 0$ or $g(x) = 1$. The analog works in any dimension $n$. If $h_n : \mathbb{R}^n \to \{0,1\}$, then for every $x \in \mathbb{R}^n$, $h_n(x) \in \{0,1\}$ so either $h_n(x) = 0$ or $h_n(x) = 1$. If you want an example, you could define for any $n$ a function $h_n : \mathbb{R}^n \to \{0,1\}$ such that $h_n(0) = 0$ and $h_n(x) = 1$ for $x \neq 0$.

More generally, it would work for any set $X$ in place of $\mathbb{R}^n$.

0
On

I know that this answer should be in the comments part, but I wanted to bring this picture for @JDoeDoe.

As some people already answered you, what you asked is indeed possible. If you consider, for exemple, $g\colon \mathbb{R} \to \{0,1\}$ defined by $g(x) = \left\{ \begin{array}{ll} 0 & x < 0\\ 1 & x \geq 0. \end{array} \right.$

enter image description here

0
On

Functions from any set $X$ to $\{0,1\}$ can be interpreted as a subset of $X$, where $x\in X$ is in this subset iff the function is $1$ at $x$.