Homework 10 solutions.
Which of the following are countable? Justify your answers.
1. The set of all functions from{0,1} →N. 2. The set of all functionsf :N→ {0,1}.
3. The set of all functions f : N → {0,1} such {n ∈ N : f(n) = 1} is finite (that is, the set of functions that are “eventually 0”).
4. A\B, whereA is uncountable andB ⊂A is countable.
5. The set of all finite subsets ofN.
The setS1 of all functions from{0,1} →Nis countable.
Proof. To show this, we define a mappingg fromS1 to N×Nand show the mapping is a bijection. Letf ∈ §1, that is f is a function from {0,1} →N. Define g(f) = (f(0), f(1)). To show g is surjective: let (a, b) ∈ N×N. Then fa,b : {0,1} → N defined by fa,b(0) = a and fa,b(1) = b satisfies g(f) = (a, b). To show g is injective: if g(f1) = g(f2), then f1(0) = f2(0), andf1(1) =f2(1), sof1=f2. Since|N×N|=|N|, and we have now checked
|S1|=|N×N|, |S1|=|N|.
The setS2 of all functions fromN→ {0,1} is uncountable.
Proof. We use Cantor’s diagonal argument. Suppose S2 were countable.
Enumerate S2 ={f1, f2, ...}; by assumption, every element in S2 is in this list. Definef :N→ {0,1} by
f(n) =
0 iffn(n) = 1 1 iffn(n) = 0.
Then f 6=fn for anyn, because f differs from fn in the nth position; thus the enumeration of the functions could not have been a complete list.
The setS3 of all functions
{f :N→ {0,1} such that{n∈N:f(n) = 1}is finite}
is countable.
1
Proof. We write S3 as the union of a countable number of finite sets. Let Ai ={f :N→ {0,1} s.t. f(n) = 0 ∀ n > i}. Then
S3=
∞
[
i=1
Ai.
To see this, first we show that iff ∈S3,∃isuch thatf ∈Ai. Iff ∈S3, then by definition, there are only a finite number ofm such thatf(m) = 1; pick i to be the largest such m. Then f(j) 6= 1 if j > i, which means f ∈ Ai; this means
S3⊆
∞
[
i=1
Ai.
On the other hand,Ai by definition is a subset of S3, and so [∞
i=1
Ai ⊆S3.
This means S3 = ∪∞i=1Ai (we did not actually need equality, S3 ⊆ ∪∞i=1Ai would have sufficed for the proof of the countability ofS3). EachAi is finite with cardinality 2i, soS3is countable union of finite sets, so is countable.
IfA is uncountable, andB is countable, thenA−B is uncountable.
Proof. A= (A−B)∪B, so ifA−B were countable, thenA would be the countable union of countable sets, and so would also be countable.
The setS5 of finite subsets of Nis countable.
Proof. Again we use the fact that a countable union of countable sets is countable. DefineAi to be the set of subsets of N with at mosti elements.
We need to prove that Ai is countable for all i∈N, and that S5=
∞
[
i=1
Ai.
To showAi is countable, we can define a mapping
g:Ai →
i
z }| { N×N×...×N
2
by setting, for any a⊂Nsuch that |a|=i g(a) = (a1, a2, ..., ai);
here,a1is the smallest element ofa,a2is the next smallest element ofa, and ai is the largest element of a. This is an injection, because if g(x) =g(y), then the smallest element ofxis the same as the smallest element ofy, the second smallest element ofx is the same as the second smallest element of y, and so on, for each of the i elements of x and y. Thus x = y, as they consist of the same elements. ThusAi has the same cardinality as a subset of
i
z }| {
N×N×...×N, which is countable because a finite Cartesian product of countable sets is countable, soAi is countable.
Now to show that
S5= [∞ i=1
Ai.
Ifs∈S5, there is some numbermsuch that |s|=m. Thens∈Am, and so S5⊆
∞
[
i=1
Ai.
On the other hand, eachAi consists of finite subsets of N, so [∞
i=1
Ai ⊆S5,
so the two sets are equal. As before, we did not actually need equality, S5⊆ ∪∞i=1Ai would have sufficed for the proof of the countability ofS5.
3