Notes@HKU by Jax

Sets and relations

Tuples vs. Sets

Tuples are ordered collections of elements, whereas sets are unordered.

For example: (1,2)(1,2) is different from (2,1)(2,1), but {1,2}\{1,2\} is the same as {2,1}\{2,1\}.

Set notation

SymbolMeaningExample
\emptysetEmpty set\emptyset
UUUniversal setEverything
{}\{\emptyset\}Singleton set{}\{\emptyset\}
{a,b,c}\{a,b,c\}Set with elements{0,1,2}\{0,1,2\}
\inElement of1{0,1,2}1 \in \{0,1,2\}
\notinNot an element of3{0,1,2}3 \notin \{0,1,2\}
\subsetSubset{0,1}{0,1,2}\{0,1\}\subset\{0,1,2\}
S\|S\|Cardinality{0,1,2}=3,S={a,S},S=2\|\{0,1,2\}\| = 3, S=\{a,S\}, \|S\|=2
\cupUnion{0,1}{1,2}={0,1,2}\{0,1\}\cup\{1,2\} = \{0,1,2\}
\capIntersection{0,1}{1,2}={1}\{0,1\}\cap\{1,2\} = \{1\}
×\timesCartesian product{0,1}×{1,2}={(0,1),(0,2),(1,1),(1,2)}\{0,1\}\times\{1,2\} = \{(0,1),(0,2),(1,1),(1,2)\}
\setminus or -Set difference{0,1,2}{1}={0,2}\{0,1,2\}-\{1\} = \{0,2\}
S\overline{S}Complement{0,1,2}=U{0,1,2}\overline{\{0,1,2\}} = U-\{0,1,2\}
i=nmSi\bigcup_{i=n}^{m} S_iGeneralized union (n->m)i=1nSi=S1S2Sn\bigcup_{i=1}^{n}S_i = S_1\cup S_2\cup\ldots\cup S_n
i=nmSi\bigcap_{i=n}^{m} S_iGeneralized intersection (n->m)i=1nSi=S1S2Sn\bigcap_{i=1}^{n}S_i = S_1\cap S_2\cap\ldots\cap S_n

Power set

P({1,2})={,{1},{2},{1,2}}\mathscr{P}(\{1,2\})=\{\emptyset, \{1\}, \{2\}, \{1,2\}\}

P(S)=2S\|\mathscr{P}(S)\|=2^{\|S\|}

Special cases:

  • The power set of the empty set is the set containing the empty set: P()={}\mathscr{P}(\emptyset)=\{\emptyset\}.
  • P(P())=P({})={,{}}\mathscr{P}(\mathscr{P}(\emptyset)) = \mathscr{P}(\{\emptyset\}) = \{\emptyset,\{\emptyset\}\}

Set builder

S={xP(x)}S=\{x | P(x)\} means that SS is the set of all xx such that P(x)P(x) is true.

For example, {xxN,x<5}={0,1,2,3,4}\{x | x \in \mathbb{N}, x < 5\} = \{0,1,2,3,4\}

Number sets

SymbolSetValues
N\mathbb{N}Natural numbers0,1,2,3,0, 1, 2, 3, \ldots
Z\mathbb{Z}Integers,2,1,0,1,2,\ldots, -2, -1, 0, 1, 2, \ldots
Q\mathbb{Q}Rational numbersab\frac{a}{b} where a,bZa, b \in \mathbb{Z}
R\mathbb{R}Real numbers0.1,π,2-0.1, \pi, \sqrt{2}
C\mathbb{C}Complex numbersa+bia + bi where a,bRa, b \in \mathbb{R}

Venn Diagrams

Venn diagrams illustrate concepts like intersections, unions, which is a good way to visualize probabilities. The overlapping regions indicate elements that belong to multiple sets, while non-overlapping regions represent elements unique to specific sets.

In this example, two circles are drawn to represent sets A and B. The overlapping region is labeled as the intersection of sets A and B, denoted by A \cap B.

Relations

Definition of relations

For an arbitrary relation RR on two sets AA and BB, it must be a subset of the Cartesian product A×BA \times B:

RA×BR \subseteq A \times B

Where the relation describes some relation between the elements of the sets.

We can denote a relationship between two elements aAa \in A and bBb \in B as aRb(a,b)RaRb \equiv (a,b) \in R, and ab(a,b)Ra\not{R}b \equiv (a,b) \notin R.

Hence, a relation on a single set is a subset of the Cartesian product A×AA \times A.

Example

Consider RR describes the relation where {(a,b)a divides b}\{(a,b) | a \text{ divides }b\}. For A={2,6}A = \{2, 6\}:

R={(2,2),(2,6),(6,6)}A×AR = \{(2,2), (2,6), (6,6)\} \subset A \times A

Properties of relations

PropertyDefinitionExample A={1,2,3},R=A=\{1,2,3\}, R=Method of prove
Reflexive(a,a)R  aA(a,a) \in R\ \forall\ a \in A{(1,1),(2,2)}\{(1,1), (2,2)\}Pick same element, show both R\in R
Symmetric(a,b)R(b,a)R(a,b) \in R \Rightarrow (b,a) \in R{(1,2),(2,1)}\{(1,2), (2,1)\}Pick (a,b)(a,b) and (b,a)(b,a) and show both R\in R
Anti-symmetric(a,b)R(b,a)Ra=b(a,b) \in R \land (b,a) \in R \Rightarrow a=b{(1,2)}{(1,1),(2,3)}\{(1,2)\} \| \{(1,1), (2,3)\}Pick (a,b)(a,b) and (b,a)(b,a) and show a=ba=b
Transitive(a,b)R(b,c)R(a,c)R(a,b) \in R \land (b,c) \in R \Rightarrow (a,c) \in R{(1,2),(2,3),(1,3)}\{(1,2), (2,3), (1,3)\}Pick (a,b)(a,b) and (b,c)(b,c) and show (a,c)R(a,c) \in R

A \emptyset relation has all the above properties.

Example prove

Show that R={(a,b)(a2b2) is a multiple of 3}R =\{(a,b)|(a^2-b^2)\text{ is a multiple of 3}\} is reflexive, symmetric and transitive.

Reflexive: Picking any two same number aXa \in X, (a2a2)=0(a^2-a^2)=0 is a multiple of 3, so (a,a)R(a,a) \in R.

Symmetric: Consider possible elements in RR: If (a2b2)R(a^2-b^2)\in R (divisible by 3), the symmetric element can be observed to be (b2a2)=(a2b2)R(b^2-a^2)=-(a^2-b^2)\in R (also divisible by 3).

Transitive: Consider the possible elements in RR: If (a,b)(b,c)R(a,b) \land (b,c) \in R, the element (a,c)(a2c2)=(a2b2)+(b2c2)(a,c) \to (a^2-c^2)=(a^2-b^2)+(b^2-c^2) (sum of two multiples of 3 is also a multiple of 3), which implies (a,c)R(a,c) \in R.

Equivalence relations

A relation is said to be equivalence if it is reflexive, symmetric, and transitive.

Equivalence class

The set of all elements related to a given element aa is called the equivalence class of aa, given by:

[a]={xxA,(a,x)R}[a] = \{x | x \in A, (a,x) \in R\}
Example

Consider R={(1,1),(1,2),(2,1),(2,2),(3,3)}R = \{(1,1), (1,2), (2,1), (2,2), (3,3)\}:

[1]={1,2},[2]={1,2},[3]={3}[1] = \{1,2\}, [2] = \{1,2\}, [3] = \{3\}

Composition of relations

The composition of two relations RR and SS is defined as:

RS={(a,c)bB such that (a,b)R(b,c)S}R \circ S = \{(a,c) | \exists b \in B \text{ such that } (a,b) \in R \land (b,c) \in S\}
Example

Consider R={(1,2),(2,3)}R = \{(1,2), (2,3)\} and S={(2,3),(3,4),(5,5)}S = \{(2,3), (3,4), (5,5)\}:

RS={(1,3),(2,4)}R \circ S = \{(1,3), (2,4)\}

We leave out the pair (5,5)(5,5) as it does not have a corresponding pair in RR.

Visualization of relations

Directed graphs

A graph where:

  • Each node represents an element of the set
  • Arrow from node aa to node bb exists if (a,b)(a,b) is in the relation
Example

Consider R={(1,2),(2,3),(3,1)}R = \{(1,2), (2,3), (3,1)\}:

1 -> 2 -> 3
^         |
|_________|

Adjacency matrix

A matrix representation of a relation where:

  • Rows and columns represent elements of the set
  • A cell (row,col)(row,col) is 1 if (a,b)(a,b) is in the relation, 0 otherwise
Example

Consider R={(1,2),(2,3),(3,1)}R = \{(1,2), (2,3), (3,1)\}:

    0 1 0
M = 0 0 1
    1 0 0

Adjaceny matrix and property of relations

PropertyAdjacency matrix
ReflexiveDiagonal elements are 1
SymmetricSymmetric across the diagonal
Anti-symmetricNo symmetric 1-pairs across the diagonal
TransitiveSquare of the matrix is equal to the original matrix

On this page