Post · 7 min read· pp. 33–39

1.2.3 Cardinality: Countable and Uncountable Sets


Video Available Video Available

Here we need to talk about cardinality of a set, which is basically the size of the set. The cardinality of a set is denoted by ∣A∣|A|. We first discuss cardinality for finite sets and then talk about infinite sets.

Finite Sets:

Consider a set AA. If AA has only a finite number of elements, its cardinality is simply the number of elements in AA. For example, if A={2,4,6,8,10}A=\{2,4,6,8,10\}, then ∣A∣=5|A|=5. Before discussing infinite sets, which is the main discussion of this section, we would like to talk about a very useful rule: the inclusion-exclusion principle. For two finite sets AA and BB, we have

∣A∪B∣=∣A∣+∣B∣−∣A∩B∣.|A \cup B |=|A|+|B|-|A \cap B|.
To see this, note that when we add ∣A∣|A| and ∣B∣|B|, we are counting the elements in ∣A∩B∣|A \cap B| twice, thus by subtracting it from ∣A∣+∣B∣|A|+|B|, we obtain the number of elements in ∣A∪B∣|A \cup B |, (you can refer to Figure 1.16 in Problem 2 to see this pictorially). We can extend the same idea to three or more sets.

Inclusion-exclusion principle:

  1. ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B |= |A|+|B|-|A \cap B|,

  2. ∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|.

Generally, for nn finite sets A1,A2,A3,⋯ ,AnA_1, A_2, A_3,\cdots, A_n, we can write

∣⋃i=1nAi∣=∑i=1n∣Ai∣−∑i<j∣Ai∩Aj∣\biggl|\bigcup_{i=1}^n A_i\biggr|=\sum_{i=1}^n\left|A_i\right|-\sum_{i < j}\left|A_i\cap A_j\right|
       +∑i<j<k∣Ai∩Aj∩Ak∣− ⋯ +(−1)n+1∣A1∩⋯∩An∣.\>\>\>\>\>\>\>+\sum_{i < j < k}\left|A_i\cap A_j\cap A_k\right|-\ \cdots\ + \left(-1\right)^{n+1} \left|A_1\cap\cdots\cap A_n\right|.


Example

In a party,

  • there are $10$ people with white shirts and $8$ people with red shirts;
  • $4$ people have black shoes and white shirts;
  • $3$ people have black shoes and red shirts;
  • the total number of people with white or red shirts or black shoes is $21$.

How many people have black shoes?

  • Solution
    • Let WW, RR, and BB, be the number of people with white shirts, red shirts, and black shoes respectively. Then, here is the summary of the available information:

      ∣W∣=10|W|=10
      ∣R∣=8|R|=8
      ∣W∩B∣=4|W \cap B|=4
      ∣R∩B∣=3|R \cap B|=3
      ∣W∪B∪R∣=21.|W \cup B \cup R|=21.
      Also, it is reasonable to assume that WW and RR are disjoint, ∣W∩R∣=0|W \cap R|=0. Thus by applying the inclusion-exclusion principle we obtain

      ∣W∪R∪B∣|W \cup R \cup B|$ = 21$
      =∣W∣+∣R∣+∣B∣−∣W∩R∣−∣W∩B∣−∣R∩B∣+∣W∩R∩B∣= |W| + |R| + |B|- |W \cap R| - |W \cap B| - |R \cap B| + |W \cap R \cap B|
      =10+8+∣B∣−0−4−3+0=10+8+|B|-0-4-3+0.

      Thus

      ∣B∣=10.|B|=10.

      Note that another way to solve this problem is using a Venn diagram as shown in Figure 1.11.

      Inclusion-exclusion diagram

      Fig.1.11 - Inclusion-exclusion Venn diagram.


Infinite Sets:

What if AA is an infinite set? It turns out we need to distinguish between two types of infinite sets, where one type is significantly "larger" than the other. In particular, one type is called countable, while the other is called uncountable. Sets such as N\mathbb{N} and Z\mathbb{Z} are called countable, but "bigger" sets such as R\mathbb{R} are called uncountable. The difference between the two types is that you can list the elements of a countable set AA, i.e., you can write A={a1,a2,⋯ }A=\{a_1, a_2,\cdots\}, but you cannot list the elements in an uncountable set. For example, you can write

  • N={1,2,3,⋯ }\mathbb{N}=\{1,2,3,\cdots\},
  • Z={0,1,−1,2,−2,3,−3,⋯ }\mathbb{Z}=\{0,1,-1,2,-2,3,-3,\cdots\}.

The fact that you can list the elements of a countably infinite set means that the set can be put in one-to-one correspondence with natural numbers N\mathbb{N}. On the other hand, you cannot list the elements in R\mathbb{R}, so it is an uncountable set. To be precise, here is the definition.

Definition

Set AA is called countable if one of the following is true

  1. if it is a finite set, ∣A∣<∞\mid A \mid < \infty; or
  2. it can be put in one-to-one correspondence with natural numbers N\mathbb{N}, in which case the set is said to be countably infinite. A set is called uncountable if it is not countable.

Here is a simple guideline for deciding whether a set is countable or not. As far as applied probability is concerned, this guideline should be sufficient for most cases.

  • N,Z,Q\mathbb{N}, \mathbb{Z}, \mathbb{Q}, and any of their subsets are countable.
  • Any set containing an interval on the real line such as [a,b],(a,b],[a,b),[a,b], (a,b], [a,b), or (a,b)(a,b), where a<ba < b is uncountable.

The above rule is usually sufficient for the purpose of this book. However, to make the argument more concrete, here we provide some useful results that help us prove if a set is countable or not. If you are less interested in proofs, you may decide to skip them.


Theorem

Any subset of a countable set is countable. Any superset of an uncountable set is uncountable.

Proof

The intuition behind this theorem is the following: If a set is countable, then any "smaller" set should also be countable, so a subset of a countable set should be countable as well. To provide a proof, we can argue in the following way.

Let AA be a countable set and B⊂AB \subset A. If AA is a finite set, then ∣B∣≤∣A∣<∞|B|\leq |A| < \infty, thus BB is countable. If AA is countably infinite, then we can list the elements in AA, then by removing the elements in the list that are not in BB, we can obtain a list for BB, thus BB is countable.

The second part of the theorem can be proved using the first part. Assume BB is uncountable. If B⊂AB \subset A and AA is countable, by the first part of the theorem BB is also a countable set which is a contradiction.


Theorem

If A1,A2,⋯A_1, A_2,\cdots is a list of countable sets, then the set ⋃iAi=A1∪A2∪A3⋯\bigcup_{i} A_i=A_1 \cup A_2 \cup A_3\cdots is also countable.

Proof

It suffices to create a list of elements in ⋃iAi\bigcup_{i} A_i. Since each AiA_i is countable we can list its elements: Ai={ai1,ai2,⋯ }A_i=\{a_{i1},a_{i2},\cdots\}. Thus, we have

  • A1={a11,a12,⋯ }A_1=\{a_{11},a_{12},\cdots\},
  • A2={a21,a22,⋯ }A_2=\{a_{21},a_{22},\cdots\},
  • A3={a31,a32,⋯ }A_3=\{a_{31},a_{32},\cdots\},
  • ...

Now we need to make a list that contains all the above lists. This can be done in different ways. One way to do this is to use the ordering shown in Figure 1.12 to make a list. Here, we can write

⋃iAi={a11,a12,a21,a31,a22,a13,a14,⋯ }(1.1)\bigcup_{i} A_i=\{a_{11}, a_{12},a_{21}, a_{31}, a_{22}, a_{13}, a_{14}, \cdots \} \hspace{100pt} (1.1)

Ordering

Fig.1.12 - Ordering to make a list.

We have been able to create a list that contains all the elements in ⋃iAi\bigcup_{i} A_i, so this set is countable.


Theorem

If AA and BB are countable, then A×BA \times B is also countable.

Proof

The proof of this theorem is very similar to the previous theorem. Since AA and BB are countable, we can write

A={a1,a2,a3,⋯ },A = \{a_1, a_2, a_3, \cdots \},
B={b1,b2,b3,⋯ }.B = \{b_1, b_2, b_3, \cdots \}.
Now, we create a list containing all elements in A×B={(ai,bj)∣i,j=1,2,3,⋯ }A \times B = \{(a_i,b_j) | i,j=1,2,3,\cdots \}. The idea is exactly the same as before. Figure 1.13 shows one possible ordering.

Ordering

Fig.1.13 - Ordering to make a list.


The above arguments can be repeated for any set CC in the form of

C=⋃i⋃j{aij},C=\bigcup_i \bigcup_j \{ a_{ij} \},
where indices ii and jj belong to some countable sets. Thus, any set in this form is countable. For example, a consequence of this is that the set of rational numbers Q\mathbb{Q} is countable. This is because we can write
Q=⋃i∈Z⋃j∈N{ij}.\mathbb{Q}=\bigcup_{i \in \mathbb{Z}} \bigcup_{j \in \mathbb{N}} \{ \frac{i}{j} \}.

The above theorems confirm that sets such as N,Z,Q\mathbb{N}, \mathbb{Z}, \mathbb{Q} and their subsets are countable. However, as we mentioned, intervals in R\mathbb{R} are uncountable. Thus, you can never provide a list in the form of {a1,a2,a3,⋯ }\{a_1, a_2, a_3,\cdots\} that contains all the elements in, say, [0,1][0,1]. This fact can be proved using a so-called diagonal argument, and we omit the proof here as it is not instrumental for the rest of the book.