Countability of set of functions from $\mathbb{Q}$ to $\left \{0,1 \right \}$ under some conditions

The question given is check Whether following is countable or not

$$1).$$The set of all the functions from $$\mathbb{Q}$$ to $$\left \{0,1 \right \}$$

$$2).$$The set of all the functions from $$\mathbb{Q}$$ to $$\left \{0,1 \right \}$$ which vanish outside a finite set

solution i tried- In $$1$$ option we can see that number of functions is $$2^{\aleph_0}$$ which is uncountable

But for $$2$$ option i am not getting clue how to proceed further Seems like he is asking about the cardinality of set of compact support functions .

Thank you

• It sounds like you might be misinterpreting (2) as referring to functions with support contained in an interval of finite measure. Such a support can still be infinite, but the intended meaning of (2) is actually that $\{x\mid f(x)=1\}$ is a finite set. – Karl Apr 21 '20 at 16:59
• but we have to find the cardinality of set with that function but in your comment it is cardinality of set of elements which maps to $1$,can you please elaborate? – honey kumar Apr 21 '20 at 17:10
• I wasn't answering (2), just clarifying that you're not meant to count any function that's 1 on infinitely many rational numbers, even if all of those numbers are inside an interval of finite length. – Karl Apr 21 '20 at 17:15
• In other words, don't worry about how the elements of $\Bbb Q$ are arranged on the number line. Just think of $\Bbb Q$ as $\Bbb N$, since $\Bbb Q$ is countable. You can interpret (2) as asking for the cardinality of the collection of all finite subsets of $\Bbb N$. – Karl Apr 21 '20 at 17:29

For each $$n$$, show that the set of functions from $$\mathbb{Q}$$ to $$\{0,1\}$$ that vanish outside a finite set of $$n$$ elements is countable. From here can you conclude that your set is countable?
For example, when $$n=1$$, we're looking for the functions that vanish at all but one point $$x\in \mathbb{Q}$$. Then we can easily see that there are two varieties of a such functions: (1) $$f(y)=0$$ for all $$y\in\mathbb{Q}$$, or (2) $$f(y)=0$$ for all $$y\neq x$$ and $$f(x)=1$$. Thus there are two functions for each $$x\in \mathbb{Q}$$, so this set is countable.
• what is $y$ here? – honey kumar Apr 21 '20 at 17:06
• $x$ was a distinguished element of $\mathbb{Q}$ (the unique element of the finite set in question). I used $y$ to refer to a generic element of $\mathbb{Q}$. – Nathan Lowry Apr 21 '20 at 17:26
• i am still not getting this ,if each $x$ has two functions and $x \in \mathbb{Q}$ then still there are uncountable functions.Please can you elaborate your answer – honey kumar Apr 24 '20 at 8:25
• For $n=1$, the functions are in bijective correspondence with the set $\mathbb{Q}\times \{0,1\}.$ A finite product of countable sets is countable. – Nathan Lowry Apr 24 '20 at 13:48
• Maybe here's a more constructive hint: Show that for each $k$, the functions of this kind are in bijective correspondence with $\mathbb{Q}^k \times \{0,1,\dots, 2^k\}$. – Nathan Lowry Apr 24 '20 at 13:56