zettelkasten

Search IconIcon to open search
Dark ModeDark Mode

Counting

Based on 21-127 Concepts of Mathematics

We’re talking about counting how many things are in a set. Not to be confused with counting with finders.

H2 Finite and Infinite Sets

Note [n][n] for some nNn \in \mathbb{N} denotes iZ+in=1,2,3,,n{ i \in \mathbb{Z}^+ \mid i\leq n } = {1, 2, 3, \dots, n}. (Note [0]=[0] = \varnothing)

H3 Finite sets and their sizes

A set XX is finite if we can find a bijection between [n][n] for some nNn \in \mathbb{N} and XX. Think of it as assigning a number to each element of XX. This number assignment is known as an enumeration of XX.

A consequence is that this number nn is unique and is equal to the size of XX. We can write X=n|X| = n. X|X| is called the size or cardinality of XX.

H3 Comparing sizes of finite sets

Let m,nNm, n \in \mathbb{N}

  • If an injective f:[m][n]f: [m] \to [n] exists, then mnm\leq n
  • If a surjective f:[m][n]f: [m] \to [n] exists, then mnm \geq n
  • A bijective f:[m][n]f: [m] \to [n] iff m=nm = n

Since we can biject [m][m] with set XX with X=m|X| = m and [n][n] with set YY with Y=n|Y| = n, we can tweak the previous statement to conclude:

  • If YY finite and an injective f:XNf: X \to N exists, then XX finite and XY|X| \leq |Y|
  • If XX finite and a surjective f:XNf: X \to N exists, then YY finite and XY|X| \geq |Y|
  • Suppose XX or YY finite, then a bijective f:XNf: X \to N exists iff X=Y|X| = |Y|

H3 Size of sets from manipulating finite sets

Let X,YX, Y be finite sets. We have that:

  • XYX \cap Y finite and XYmin(X,Y)|X \cap Y| \leq \mathrm{min}(|X|, |Y|)
  • XYX \cup Y finite and XYmax(X,Y)|X \cup Y| \geq \mathrm{max}(|X|, |Y|) and XY=X+YXY|X \cup Y| = |X| + |Y| - |X \cap Y|.
  • X×YX \times Y finite and X×Y=XY|X \times Y| = |X| \cdot |Y|

H3 Finite partition

A finite partition divides a finite set into subsets that are pairwise disjoint and union to the larger set.

  • pairwise disjoint means the intersection between any two set in the partition is empty.
  • union to the larger set just means all the element in the larger set can be found in one of sets in the partition.

H3 Counting by adding

Take finite set XX and suppose A1,A2,,An{A_{1}, A_{2}, \dots, A_{n}} is a finite partition of XX, then X=i=1nAi\displaystyle |X| = \sum_{i=1}^{n}|A_{i}|.

H3 Counting by multiplying

The multiplication principle allows us to count the number of elements in a finite set XX by specifying a procedure to specify elements in XX uniquely. When done correctly, X|X| will equal the product of the number of choices at each step.

Example:

Let XX be the set of all subsets of [3]=1,2,3[3] = { 1,2,3 }. Then we can specify an element of XX by the following procedure:

  1. Decide if 11 is in the set — 2 choices
  2. Decide if 22 is in the set — 2 choices
  3. Decide if 33 is in the set — 2 choices
    So X=23|X| = 2^3.

H2 Binomial Coefficient

The bionomial coefficient (nk)\displaystyle \binom{n}{k} for any n,kNn, k \in \mathbb{N} is defined by (nk)=U[n]U=k\displaystyle \binom{n}{k} = |{ U \subseteq [n] \mid |U|=k }|. It can be understood as the number of subsets of a set of size nn that have size kk.

We can derive that (can be done by counting!):
(nk)={n!k!(nk)! if kn0 if k>n\left(\begin{array}{l}n \\ k\end{array}\right)= \begin{cases}\frac{n !}{k !(n-k) !} & \text { if } k \leqslant n \\ 0 & \text { if } k>n\end{cases}

H2 Factorial

Instead of defining factorial recursively, we can define it by counting!

Let nNn \in \mathbb{N}, then n!n! is defined as:

  • The number of bijections f:[n][n]f: [n] \to [n]
  • The number of ways to list nn things in an order so that each thing appear exactly once
  • The number of ways to arrange nn things in order

This is kind of nice isn’t it?

H2 Proof by double counting

To prove two expressions are equal, we can define a set XX in a way that we can count X|X| one way to get the RHS expression and another way to get the LHS expression.

H3 Categories of countability

Other than a set being finite (which obviously makes it countable), we can have:

  • A set AA being countably infinite if we can find a bijection f:NAf: \mathbb{N} \to A

  • A set BB being countable if it’s finite or countably infinite

  • A set CC being uncountable if it’s not countable

  • Known countable sets:

    • N\mathbb{N} (of course it bijects itself!)
    • Z\mathbb{Z} (by doing some trick with number assignments, like 0,1,1,2,2,0, 1, -1, 2, -2, \dots)
    • N2\mathbb{N}^2 (we can list things diagonally)
    • Q\mathbb{Q} (we can define surjection f:Z×(Z0)Qf: \mathbb{Z} \times(\mathbb{Z} \setminus {0}) \to \mathbb{Q} via f(a,b)=abf(a,b)=\frac{a}{b})
  • Known uncountable:

    • P(N)\mathscr{P}(\mathbb{N})
    • R\mathbb{R}

H3 Contability by jections

Given a set CC which is countable:

  • If an injective f:XCf: X \to C exists, then XX countable. Think of it as XX being not bigger than a countable set.
  • If an surjective f:CXf: C \to X exists, then XX countable. Think of it as a countable set being not smaller than XX.

H2 Operations on Countable Sets

We can prove that:

  • Cartesian product of finitely many countable sets is countable (imagine going in diagonally in high dimensions where each axis is one component of the cartesian product)
  • Union of countably many countable sets is countable. (imagine putting sets in grid and listing elements diagonally)

H2 Cantor’s Diagonal Argument

This is how we can prove a set is uncountable. To prove XX uncountable, we do:

  1. Let there be function f:NXf: \mathbb{N} \to X. WTS this function cannot be surjective (and thus not bijective)
  2. Construct some bad element bXb \in X in terms of ff in a way that bb and f(n)f(n) disagrees on something for all nNn \in \mathbb{N}
  3. Then show bf(n)b \neq f(n) for any nNn \in \mathbb{N}. This implies not all bXb \in X can be mapped from N\mathbb{N}, hence making ff not surjective.

H2 Cardinality

The cardinality of set XX, denoted X|X|, is a measure of the “size” of XX in terms of how well XX can inject or surject with other sets.

Let X,YX, Y be sets.

  • If there is bijection f:XYf:X\to Y, then X=Y|X|=|Y|
  • If there is injection f:XYf:X\to Y, then XY|X| \leq |Y|
  • If there is injection f:XYf:X\to Y but no surjection g:XYg:X\to Y, then X<Y|X| < |Y|.

It can be easily proven that the cardinality \leq relation is reflexive and transitive.

H3 Cantor–Schröder–Bernstein theorem (let’s call it CSB)

It says \leq is antisymmetric on cardinalities. Therefor, for all sets X,YX, Y, if there exists injection f:XYf : X \to Y and injection g:YXg : Y \to X, we will have XY|X| \leq |Y| and XY|X| \geq |Y|, which will imply X=Y|X| = |Y|.

H3 Cantor’s theorem

Says that the power set of all sets have strictly greater cardinality than the set itself viz. XU,X<P(X)\forall X \in \mathscr{U}, |X|<|\mathscr{P}(X)|.

Proof: we want some injection I:XP(X)I : X \to \mathscr{P}(X) but no surjection S:P(X)XS : \mathscr{P}(X) \to X.
Well, I(x)=xI(x) = {x} for all xXx \in X is surjective.
Suppose there is a surjection S:P(X)XS : \mathscr{P}(X) \to X
Let B=xXxS(x)P(X)B = {x \in X \mid x \notin S(x)} \in \mathscr{P}(X).
So BF(x)B \neq F(x) for any xXx \in X. So SS not surjective.

Fun fact—this statement is provably unprovable: “XU,N<X<R\exists X \in \mathscr{U}, |\mathbb{N}| < |X| < |\mathbb{R}|?”