3 Set Theory And Relations

Discrete Structure · Unit 3

Set Theory and Relations

Exam-focused notes for Set Theory and Relations (Discrete Structure, BIT152): what the TU syllabus asks and how it has actually been tested, with 10 solved past questions from this unit.

Set Theory and Relations in short

Sets are the basic language of mathematics, and relations describe how elements of sets are connected. They are used in databases, graph theory and program design.

Set Theory and Relations: notes

Set representation and operations

A set is an unordered collection of distinct objects, called elements or members. We write $x \in A$ if $x$ is in $A$.

There are three ways to represent a set:

  • Roster (tabular) form: list the elements, such as $A = {1, 2, 3, 4, 5}$.
  • Set-builder form: give a rule, such as $A = {x \mid x \text{ is an integer and } 1 \le x \le 5}$.
  • Venn diagram: draw the sets as regions inside a rectangle that stands for the universal set.

Standard sets: $\mathbb{N}$ (natural numbers), $\mathbb{Z}$ (integers), $\mathbb{Q}$ (rational numbers), $\mathbb{R}$ (real numbers). The empty set $\emptyset$ has no elements. The universal set $U$ contains everything under discussion.

$A$ is a subset of $B$ ($A \subseteq B$) if every element of $A$ is in $B$. Two sets are equal if each is a subset of the other.

OperationSymbolMeaning
Union$A \cup B$elements in $A$ or $B$ or both
Intersection$A \cap B$elements in both $A$ and $B$
Difference$A - B$elements in $A$ but not in $B$
Complement$\overline{A}$elements of $U$ not in $A$
Symmetric difference$A \oplus B$elements in exactly one of $A$, $B$

Example. Let $A = {1, 2, 3, 4}$ and $B = {3, 4, 5, 6}$.

  • $A \cup B = {1, 2, 3, 4, 5, 6}$
  • $A \cap B = {3, 4}$
  • $A - B = {1, 2}$
  • $A \oplus B = {1, 2, 5, 6}$

Set identities include De Morgan's laws:

$$\overline{A \cup B} = \overline{A} \cap \overline{B}, \qquad \overline{A \cap B} = \overline{A} \cup \overline{B}$$

Also $|A \cup B| = |A| + |B| - |A \cap B|$.

Bit strings for set operations

Computers store a set as a bit string when the universal set is finite and ordered. Bit $i$ is 1 if the $i$-th element of $U$ is in the set, and 0 if not. Then union is bitwise OR, intersection is bitwise AND, and complement flips every bit.

Example. Let $U = {1, 2, \dots, 10}$, $A = {1, 2, 3, 4, 5}$, $B = {1, 3, 5, 7, 9}$.

$$\begin{aligned} A &= 1111100000 \ B &= 1010101010 \ A \cup B &= 1111101010 = {1, 2, 3, 4, 5, 7, 9} \ A \cap B &= 1010100000 = {1, 3, 5} \end{aligned}$$

Example. Let $U = {0, 1, 2, \dots, 9}$. The set of even numbers ${0, 2, 4, 6, 8}$ is $1010101010$. The set of odd numbers ${1, 3, 5, 7, 9}$ is $0101010101$. The set of numbers not exceeding 5, ${0, 1, 2, 3, 4, 5}$, is $1111110000$.

What this unit covers

  • Set representation and operations
  • Bit strings for set operations
  • Power set
  • Cartesian product
  • Venn diagrams
  • Relations and their representations
  • Relation matrices
  • Directed graphs for relations
  • Equivalence relations
  • Partial ordering

Set representation and operations

2082 · 5 marks

How do you represent set? Explain. [5]

A set is a well-defined collection of distinct objects called elements or members. Sets can be represented in several standard ways. --- All elements of the set are listed explicitly, separated by commas and enclosed in curly braces { }. Example: - Set of vowels: A = {a, e, i, o, u} - Set of even...

Open this answer on its own page →

Venn diagrams

2080 · 10 marks

Explain how set operations can be represented using venn diagram with example.Convert the following sentences using quantifier: a.) Not all good peoples are heroes. b.) Every peoples in our country are loyal. c.) Some people hate good people.[10]

--- A Venn Diagram is a pictorial/graphical representation of sets and their relationships within a universal set U. Sets are represented as circles inside a rectangle (universal set). --- Definition: The union of sets A and B contains all elements that belong to A, or B, or both. A ∪ B = { x x ∈...

Open this answer on its own page →

Relation matrices

2080 · 5 marks

How can you represent relations using matrices? Explain with suitable example. [5]

A relation R from set A to set B can be represented using a zero-one matrix (also called a Boolean matrix or relation matrix), denoted MR. --- Let: - Set A = {a₁, a₂, ..., aₘ} with m elements (rows) - Set B = {b₁, b₂, ..., bₙ} with n elements (columns) The matrix MR is an m × n matrix where each ...

Open this answer on its own page →

2078 · 5 marks

How can you represent relations using matrices? Suppose that $A = {1, 2, 3}$ and $B = {1, 2}$. Let $R$ be the relation from $A$ to $B$ containing $(a, b)$ if $a \in A$, $b \in B$, and $a > b$. What matrix representing $R$ if $a_1 = 1$, $a_2 = 2$, $a_3 = 3$, and $b_1 = 1$ and $b_2 = 2$? [5]

A relation $R$ from a set $A$ (with $m$ elements) to a set $B$ (with $n$ elements) can be represented by an $m \times n$ zero-one (Boolean) matrix $MR = [m{ij}]$, where: $$m{ij} = \begin{cases} 1 & \text{if } (ai, bj) \in R \ 0 & \text{if } (ai, bj) \notin R \end{cases}$$ Rows correspond to elem...

Open this answer on its own page →

Power set

2079 · 5 marks

Define power set. What is the power set of the set A= {1,2, 3, 4}? [5]

Show solved answer

Given Data

  • Set $A = {1, 2, 3, 4}$
  • Number of elements: $n = 4$

STEP 1: Definition of Power Set

The power set of a set $A$ is the set of all subsets of $A$, including the empty set $\emptyset$ and the set $A$ itself.

It is denoted by $P(A)$ or $2^A$.

Key property: If $|A| = n$, then the power set contains $2^n$ subsets, i.e. $$|P(A)| = 2^n$$


STEP 2: Power Set of $A = {1, 2, 3, 4}$

Since $n = 4$, the number of subsets is: $$|P(A)| = 2^4 = 16$$

Listing subsets by size:

SizeSubsets
0$\emptyset$
1${1}, {2}, {3}, {4}$
2${1,2}, {1,3}, {1,4}, {2,3}, {2,4}, {3,4}$
3${1,2,3}, {1,2,4}, {1,3,4}, {2,3,4}$
4${1,2,3,4}$

Count check: $1 + 4 + 6 + 4 + 1 = 16$ ✓ (matches $\binom{4}{0}+\binom{4}{1}+\binom{4}{2}+\binom{4}{3}+\binom{4}{4}$)

Final Answer:

$$ P(A) = {\ \emptyset,\ {1},\ {2},\ {3},\ {4},\ {1,2},\ {1,3},\ {1,4}, $$ $$ {2,3},\ {2,4},\ {3,4},\ {1,2,3},\ {1,2,4},\ {1,3,4},\ {2,3,4},\ {1,2,3,4}\ } $$

Total number of elements in $P(A) = 16$.

Open this answer on its own page →

Equivalence relations

2079 · 5 marks

Define equivalence relation with an example. [5]

A relation R on a set A is called an equivalence relation if and only if it satisfies the following three properties: For every element $a \in A$, we have $(a, a) \in R$. $$\forall a \in A, ; aRa$$ For all $a, b \in A$, if $(a, b) \in R$ then $(b, a) \in R$. $$\forall a, b \in A, ; aRb \Rightar...

Open this answer on its own page →

2080.1 · 5 marks

Define equivalence relation. How do you represent relation? [5]

Show solved answer

Equivalence Relation and Representation of Relations

Definition: Equivalence Relation

A relation R on a set A is called an equivalence relation if it satisfies the following three properties simultaneously:

1. Reflexive

For every element $a \in A$: $$a \mathrel{R} a$$ Every element is related to itself.

2. Symmetric

For all $a, b \in A$: $$a \mathrel{R} b \implies b \mathrel{R} a$$

3. Transitive

For all $a, b, c \in A$: $$a \mathrel{R} b \text{ and } b \mathrel{R} c \implies a \mathrel{R} c$$

Example: Let $A = {1, 2, 3}$ and define $R$ as "has the same remainder when divided by 2." Then $R$ is reflexive, symmetric, and transitive, so it is an equivalence relation.


Representation of Relations

A relation can be represented in the following ways:


1. Set of Ordered Pairs (Roster Method)

List all pairs $(a, b)$ such that $a \mathrel{R} b$.

Example: $$R = {(1,1),\ (2,2),\ (1,2),\ (2,1)}$$


2. Matrix Representation (Boolean Matrix)

Given sets $A = {a_1, a_2, \ldots, a_m}$ and $B = {b_1, b_2, \ldots, b_n}$, define matrix $M_R$ where:

$$M_R[i][j] = \begin{cases} 1 & \text{if } (a_i, b_j) \in R \ 0 & \text{if } (a_i, b_j) \notin R \end{cases}$$

Example: For $A = {1, 2, 3}$ and $R = {(1,1),(1,2),(2,3),(3,1)}$:

$$M_R = \begin{pmatrix} 1 & 1 & 0 \ 0 & 0 & 1 \ 1 & 0 & 0 \end{pmatrix}$$


3. Directed Graph (Digraph) Representation

  • Each element of the set is represented as a node (vertex).
  • A directed edge (arrow) is drawn from node $a$ to node $b$ if $(a, b) \in R$.

Example: For $R = {(1,2),(2,3),(3,1)}$:

$$1 \rightarrow 2 \rightarrow 3 \rightarrow 1$$


4. Arrow Diagram

  • Elements of domain set $A$ are listed on the left.
  • Elements of codomain set $B$ are listed on the right.
  • Arrows are drawn from $a$ to $b$ whenever $(a, b) \in R$.

Summary Table

MethodBest Used For
Ordered PairsSmall, explicit relations
Boolean MatrixComputation and composition
DigraphVisualizing properties (reflexive, symmetric, etc.)
Arrow DiagramFunctions and mappings
Open this answer on its own page →

Cartesian product

2078 · 5 marks

Define cartesian product. Find A3 for the set A = (a, b, c). [5]

  • Set $A = {a, b, c}$, so $A = 3$ - Required: definition of Cartesian product, and $A^3$ --- The Cartesian product of two sets $A$ and $B$, denoted $A \times B$, is the set of all ordered pairs $(a, b)$ such that $a \in A$ and $b \in B$: $$A \times B = {(a, b) \mid a \in A \text{ and } b \in B...
Open this answer on its own page →

Bit strings for set operations

0 · 5 marks

Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. Use bit strings to find the union and intersection of the sets {1, 2, 3, 4, 5} and {1, 3, 5, 7, 9}. [5]

  • Universal set: $U = {1,2,3,4,5,6,7,8,9,10}$ (length 10) - Set A: ${1,2,3,4,5}$ - Set B: ${1,3,5,7,9}$ Bit string convention: position $i$ = 1 if element $i \in$ set, else 0. Positions ordered $1 \to 10$. Positions: $;1;2;3;4;5;6;7;8;9;10$ $$A = 1,1,1,1,1,0,0,0,0,0$$ $$B...
Open this answer on its own page →

Directed graphs for relations

0 · 5 marks

How can we represent a relation using directed graph? Draw a directed graph of the relation R = {(1, 1), (1, 3), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (4, 1)} on the set {1, 2, 3, 4}. [5]

A relation R on a set A can be represented as a directed graph (digraph) where: - Each element of the set A is represented as a node (vertex) - For every ordered pair (a, b) ∈ R, we draw a directed edge (arrow) from node a to node b - If (a, a) ∈ R (i.e., an element is related to itself), we draw...

Open this answer on its own page →