Set Cardinality

The cardinality of a set is the number of elements that the set has, i.e., the size of the set. For a set $S$, we denote its cardinality as $|S|$ (

$|S|$
). Examples:

While the cardinality of a finite set is a fixed, nonnegative integer, this of an infinite set is infinity. There are actually different types of infinity, such as countable and uncountable; you'll learn more on those in more advanced CS courses.

Fun Class Activity: What is each of the following equal to?

  1. $|\mathbb{Z}|$
  2. $|\{2n\ |\ 0 \le n \le 5\}|$
  3. $|\emptyset|$