Skip to main content
CIT 5920 — Fall 2025
Sli.do Ed Discussion PrairieLearn Panopto Gradescope Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Lecture 1: Sets - Basic operations

Sets - Basic operations

  • A set is a collection of things called elements.
  • The order of elements does not matter. [Sli.do]
  • Repetition does not matter (some people do not allow repetition). [Sli.do]
  • When discussing the number of elements in a set, it refers to the distinct elements. [Sli.do]

Teaching Tips

  • Clarify that {…} in set notation implies the pattern continues indefinitely. [Sli.do]
  • Emphasize that roster notation lists all elements, while set builder notation describes a rule for membership. [Sli.do]
  • Explain that nested sets don’t need to have the same characteristics as the primary set. [Sli.do]

Examples

  • A set of countries: {“Brazil”, “India”, “Nigeria”, “Japan”}
  • A set of languages: {“Spanish”, “Mandarin”, “Arabic”, “Swahili”}
  • A set of diverse names: {“Aaliyah”, “Haruki”, “Ximena”, “Youssef”}
  • A nested set: {“Cat”, {“Banana”, “Cherry”}}

Notation

  • If $S$ is a set and $x$ is an element, we write $x \in S$.
  • Set-roster notation lists elements between braces, e.g., {1, 2, 3}.
  • Conventional variables: uppercase for sets (S, T), lowercase for elements (x, y).
  • The empty set (containing nothing) is denoted by $\emptyset$.

Teaching Tips

  • Clarify the difference between {0} (a set) and 0 (a number). [Sli.do]
  • Explain that the number of elements in a nested set doesn’t affect the outer set’s cardinality.
  • Discuss whether quotation marks are needed for elements like colors. [Sli.do]

Examples

  • {“Caracas”, {“Bogotá”, “Lima”}} has 2 elements: a city and a set of cities.
  • {“طعام”, ∅} is a set containing an Arabic word for “food” and the empty set.
  • {“red”, “green”, “blue”} is a set of colors without quotation marks.

The special sets

  • $\mathbb{N}$ - natural numbers: {0, 1, 2, …}
  • $\mathbb{Z}$ - integers: {…, -2, -1, 0, 1, 2, …}
  • $\mathbb{R}$ - real numbers
  • $\mathbb{Q}$ - rational numbers: $\frac{p}{q}$ where $p,q \in \mathbb{Z}, q \neq 0$

Teaching Tips

  • Discuss why $\pi, e, \sqrt{2}$ are real but not rational.
  • Explain superscript notation for positive/negative subsets, e.g., $\mathbb{Z}^+, \mathbb{R}^-$.
  • Clarify why 0 is included in $\mathbb{N}$ despite being neither positive nor negative. [Sli.do]
  • Discuss whether 0 belongs to $\mathbb{Z}^+$ or $\mathbb{Z}^-$. [Sli.do]
  • Explain why all these sets have the same infinite cardinality. [Sli.do]

Set-builder notation

  • Specifies a set by starting with a universal set and applying conditions.
  • Example: ${x \in \mathbb{Z} | -2 < x < 5} = {-1, 0, 1, 2, 3, 4}$

Teaching Tips

  • Clarify that “in between” is inclusive of the endpoints. [Sli.do]
  • Explain why {2, 4, …, 10} is roster notation, not set-builder. [Sli.do]
  • Discuss why set-builder notation can represent infinite sets.

Examples

  • ${x \in \mathbb{R} | 0 \leq x \leq 1}$ represents numbers between 0 and 1 inclusive.
  • ${x \in \mathbb{Z} | x \text{ is even}}$ represents all even integers.
  • ${x \in \mathbb{N} | x \text{ is a multiple of 3}}$ represents multiples of 3 in $\mathbb{N}$. [Sli.do]

Subset

  • $A \subseteq B$ means every element of $A$ is also an element of $B$.
  • If $x \in A$, then $x \in B$.
  • $A \subseteq B$ does not imply $B \subseteq A$.

Teaching Tips

  • Clarify the difference between $\in$ (element of) and $\subseteq$ (subset of). [Sli.do]
  • Explain that $\mathbb{Q} \subseteq \mathbb{R}$ but $\mathbb{R} \not\subseteq \mathbb{Q}$.
  • Discuss why {1,2,3} $\subseteq$ {1,2,3,4,5} but not $\in$. [Sli.do]

Examples

  • {“Mumbai”, “Delhi”} $\subseteq$ {“Mumbai”, “Delhi”, “Kolkata”, “Chennai”}
  • {“사과”, “바나나”} $\subseteq$ {“사과”, “바나나”, “오렌지”} (Korean fruits)
  • {1,3,5,…} $\subseteq \mathbb{N}$ (odd numbers are a subset of natural numbers)

Venn diagrams

  • Pictorial representation of sets.
  • Universe (U) contains all sets being discussed.
  • $B \subseteq A$ is represented by B inside A.

Teaching Tips

  • Explain that the empty set is a subset of every set. [Sli.do]
  • Clarify that the empty set is an element of the set in the example. [Sli.do]

Examples

  • Venn diagram showing {“Nairobi”, “Lagos”} $\subseteq$ {“Nairobi”, “Lagos”, “Cairo”, “Johannesburg”}
  • Venn diagram illustrating $\mathbb{Q} \subseteq \mathbb{R}$
  • Venn diagram for $S = {1, \emptyset}$ where $\emptyset \in S$

Set operations

  • Union ($A \cup B$): elements in A or B (or both)
  • Intersection ($A \cap B$): elements in both A and B
  • Difference ($B - A$): elements in B but not A
  • Complement ($\bar{A}$): elements in U but not A

Teaching Tips

  • Provide mathematical definitions using set-builder notation.
  • Explain that $A \cap \emptyset = \emptyset$ and $A \cup U = U$. [Sli.do]

Examples

  • ${1,2,3} \cup {2,4,6} = {1,2,3,4,6}$
  • ${“red”,“blue”} \cap {“blue”,“yellow”} = {“blue”}$
  • ${“dog”,“cat”,“bird”} - {“bird”} = {“dog”,“cat”}$
  • $\overline{{“apple”,“banana”,“orange”}} = {x \in U | x \notin {“apple”,“banana”,“orange”}}$

Properties and De Morgan’s Laws

  • Commutative, associative, and distributive properties
  • Identity and domination laws
  • De Morgan’s Laws: $\overline{(A \cup B)} = \bar{A} \cap \bar{B}$ and $\overline{(A \cap B)} = \bar{A} \cup \bar{B}$

Examples

  • ${“张伟”,“李娜”} \cup {“王芳”} = {“王芳”} \cup {“张伟”,“李娜”}$ (Chinese names)
  • $\overline{{“Juan”,“Maria”,“Carlos”} \cap {“Juan”,“Pedro”,“Ana”}} = {“Maria”,“Carlos”} \cup {“Pedro”,“Ana”}$
  • Prove $\overline{\bar{A} \cap U} = A$ and $(A \cap B) \cup \overline{(A \cup \bar{B})} = B$

Cardinality and Power Set

  • Cardinality ($|A|$): number of elements in a finite set A
  • Power set ($P(A)$): set of all subsets of A, including $\emptyset$ and A itself

Teaching Tips

  • Emphasize that for $S = {{1},{1,2}}$, $|S| = 2$ (not 3) [Sli.do]
  • Discuss the relationship between $|A|$ and $|P(A)|$
  • Clarify that $\emptyset$ and $A$ are both elements of $P(A)$

Examples

  • $|{“Chandra”,“Asha”,“Rahul”}| = 3$
  • $P({“red”,“green”,“blue”}) = {\emptyset, {“red”}, {“green”}, {“blue”}, {“red”,“green”}, {“red”,“blue”}, {“green”,“blue”}, {“red”,“green”,“blue”}}$
  • $|P({“Nairobi”,“Lagos”,“Cairo”})| = 2^3 = 8$

CS application: Databases

  • SQL queries use set operations like UNION, EXCEPT (difference)
  • Examples:
    • Find employees close to retirement at two companies
    • Compare items eaten for lunch vs. dinner