> A set is a collection of _unordered_ elements. > A set cannot contain duplicates. ## Notation ### Set Notation Declaration of a set $A$ with elements $a$, $b$, $c$: $$ A := {a, b, c} $$ ### Cardinality Amount of Elements in a set $A$ Notation: $|A|$ $$ A := {1, 2, 3, 4} \ |A| = 4 $$ ### Well-Known Sets - Empty Set: $emptyset = {}$ - Natural Numbers: $N = {1, 2, 3, ...}$ - Integers: $ZZ = {-2, -1, 0, 1, 2}$ - Rational Numbers: $QQ = {1/2, 22/7 }$ - Real Numbers: $RR = {1, pi, sqrt(2)}$ - Complex Numbers: $CC = {i, pi, 1, sqrt(-1)}$ ### Set-Builder Notation Common form of notation to create sets without explicitly specifying elements. $$ A := {x in N | 0 <= x <= 5} \ A = {1, 2, 3, 4, 5} $$ ### Member of Denote whether $x$ is an element of the set $A$ Notation: $x in A$ Negation: $x in.not A$ ### Subsets | Type | Explanation | Notation | | ------------------------ | ---------------------------------------------------------------------- | ------------------- | | **Subset** | Every element of $A$ is in $B$ | $A subset B$ | | **Subset or equal to** | Every element of $A$ is in $B$, or they are the exactly same set | $A subset.eq B$ | | **Proper subset** | Every element of $A$ is in $B$, but $A$ is definitely smaller than $B$ | $A subset.sq B$
| | **Superset**
| $A$ contains everything that is in $B$ | $A supset B$ | | **Superset or equal to** | $A$ contains everything that is in $B$, or they are identical | $A supset.eq B$ | ## Operations ### Union Notation: $A union B$ Definition: all elements from both sets _without adding duplicates_ $$ A := {1, 2, 3}\ B := {3, 4, 5}\ A union B = {1, 2, 3, 4, 5} $$ ### Intersection Notation:$A inter B$ Definition: all elements _contained in both sets_ $$ A := {1, 2, 3} \ B := {2, 3, 4} \ A inter B = {2, 3} $$ ### Difference Notation: $A backslash B$ Definition: all elements _in $A$ that are not in $B$_ $$ A := {1, 2, 3} \ B := {3, 4, 5} \ A backslash B = {1, 2} $$ ### Symmetric Difference Notation: $A Delta B$ Definition: all elements _only in $A$ or only in $B$_ $$ A := {1, 2, 3} \ B := {2, 3, 4} \ A Delta B = {1, 4} $$ ### Cartesian Product Notation: $A times B$ Definition: all pairs of all elements in $A$ and $B$ $$ A := {1, 2} \ B := {3, 4, 5} \ A times B = {(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)} $$ ### Powerset Notation: $cal(P)(A)$ Definition: all possible _Subsets of A_ $$ A := {1, 2, 3} \ cal(P)(A) = {emptyset, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}} $$