Class: CSE 16 Subject: computer-science discrete-math Date: 2024-09-27 Teacher: Prof. Musacchio
Sets
Intro
- A set is a collection of things(elements)
- E.g.: A = {1, 2, 3, 4} ⇒ RosterNotation
- If an element is in a set it’s denoted as 1 ∈ A(using prev example)
- Sets are considered equal if they contain the same elements
- E.g.: A = {1, 2, 3, 4}, B = {2, 1, 3, 4} ∴ A = B ⇒ order doesn’t matter( basically a python set)
- Duplicates also don’t affect equivalence
- E.g.: A = {1, 2, 3, 4}, B = {1, 1, 3, 2, 4} ∴ A = B
Special Sets
- Natural Numbers = ℕ = {1,2,3,4,5,6,7,…}
- Integers = ℤ = {…,−3,−2,−1,0,1,2,3,4,…}
- Empty Set = {} or ∅
- Real Numbers = sqrt(2) ∈
- Rational Numbers = Q = {i / n: n ∈ N, i ∈ Z}
Set properties
- Size or cardinality is the number of elements it has, and this number is denoted as |X|.
- E.g.: X = {1, 2, ,3, 4} , |X| = 4
- E.g.: |N| = ∞
- E.g.: |∅| = 0
Question
- If n ∈ Z then n + 1 ∈ Z and n - 1 ∈ Z(False)
- If n ∈ Z then n + 1 ∈ Z(True)
Other Notation
Set builder
- set builder refers to a way to denote a series of elements that cannot be enclosed within {}
- E.g.: E = {…,−6,−4,−2,0,2,4,6,…} (set of all real even numbers)
- Set builder notation = E = {2n : n ∈ Z }
- E.g.: E = {…,−6,−4,−2,0,2,4,6,…} (set of all real even numbers)
- Notation: { _ : condition(s)}
- _ = prototype
- : = read such that
- E.g.: {n: n ∈ N and n ⇐ 5 } ⇒ {1, 2, 3, 4, 5}
Rational Numbers
- E.g.: Q = {i / n: n ∈ N, i ∈ Z}