Unit-3: Counting Principles and Relations
1. Principle of Inclusion-Exclusion, Pigeonhole Principle, and Generalized Pigeonhole Principle
1. Principle of Inclusion-Exclusion (PIE)
The Principle of Inclusion-Exclusion helps count elements in the union of multiple sets, accounting for overlaps.
For Two Sets:
|A ∪ B| = |A| + |B| - |A ∩ B|
For Three Sets:
|A ∪ B ∪ C| = |A| + |B| + |C| - |A ∩ B| - |B ∩ C| - |C ∩ A| + |A ∩ B ∩ C|
Example:
In a class of 40 students:
- 25 study Math
- 20 study Physics
- 10 study both
How many study Math or Physics?
|Math ∪ Physics| = |Math| + |Physics| - |Math ∩ Physics|
= 25 + 20 - 10 = 35
2. Pigeonhole Principle
The Pigeonhole Principle states that if you have more items than containers, at least one container must hold more than one item.
Formal Statement:
If n items are put into m containers, and n > m, then at least one container must contain more than one item.
Example:
If there are 13 pairs of shoes in a closet, at least one pair must share the same month of purchase (12 months, 13 pairs).
3. Generalized Pigeonhole Principle
The Generalized Pigeonhole Principle extends the basic principle:
Formal Statement:
If n items are distributed across m containers, at least one container must contain at least ⌈n/m⌉ items.
Example:
If 50 students are placed into 10 groups, at least one group must have ⌈50/10⌉ = 5 students.
4. Key Takeaways
- Inclusion-Exclusion: Count elements in overlapping sets.
- Pigeonhole Principle: More items than containers → overlap.
- Generalized Pigeonhole Principle: Guarantees a minimum number of items per container.
2. Relations and Their Properties
1. What is a Relation?
A relation is a subset of the Cartesian product of two sets. It defines a connection between elements of one set with elements of another (or the same) set.
Formally, a relation R from set A to set B is a subset of A × B:
R ⊆ A × B
If (a, b) ∈ R, we write aRb, meaning "a is related to b".
Example:
Let A = {1, 2, 3} and B = {2, 3}. A relation R could be:
R = {(1, 2), (2, 3)}
2. Types of Relations
- Empty Relation: R = ∅ (no elements are related).
- Universal Relation: R = A × A (all elements are related).
- Identity Relation: R = {(a, a) | a ∈ A} (each element relates to itself).
- Inverse Relation: R⁻¹ = {(b, a) | (a, b) ∈ R} (swap elements in pairs).
3. Properties of Relations
1. Reflexive
A relation R on set A is reflexive if (a, a) ∈ R for all a ∈ A.
Example: R = {(1, 1), (2, 2), (3, 3)} is reflexive.
2. Symmetric
R is symmetric if (a, b) ∈ R ⇒ (b, a) ∈ R.
Example: R = {(1, 2), (2, 1)} is symmetric.
3. Antisymmetric
R is antisymmetric if (a, b) ∈ R and (b, a) ∈ R ⇒ a = b.
Example: R = {(1, 1), (2, 3)} is antisymmetric.
4. Transitive
R is transitive if (a, b) ∈ R and (b, c) ∈ R ⇒ (a, c) ∈ R.
Example: R = {(1, 2), (2, 3), (1, 3)} is transitive.
4. Types of Special Relations
- Equivalence Relation: Reflexive, symmetric, and transitive.
- Partial Order: Reflexive, antisymmetric, and transitive.
Example:
The "divides" relation (|) on integers is a partial order.
5. Matrix Representation of Relations
A relation can be represented by a matrix M, where:
M[i][j] = 1 if (aᵢ, aⱼ) ∈ R, otherwise 0.
Example:
A = {1, 2, 3}, R = {(1, 2), (2, 3)}
6. Closure of Relations
A closure of a relation is the smallest relation containing R with a specific property:
- Reflexive Closure: Add (a, a) for all a ∈ A.
- Symmetric Closure: Add (b, a) if (a, b) ∈ R.
- Transitive Closure: Add (a, c) if (a, b) ∈ R and (b, c) ∈ R.
Example:
R = {(1, 2), (2, 3)}
Transitive closure: R⁺ = {(1, 2), (2, 3), (1, 3)}
7. Key Takeaways
- Relation: A subset of a Cartesian product.
- Reflexive, Symmetric, Antisymmetric, Transitive: Core properties of relations.
- Equivalence Relation & Partial Order: Special kinds of relations with distinct properties.
- Matrix Representation & Closures: Useful tools to visualize and complete relations.
3. Combining Relations
1. What Does It Mean to Combine Relations?
Given two relations on a set, you can combine them in various ways to create new relations. The main ways to combine relations are:
- Union (R ∪ S)
- Intersection (R ∩ S)
- Composition (R ∘ S)
- Inverse Relation (R⁻¹)
2. Union of Relations (R ∪ S)
The union of two relations R and S on set A is the set of pairs that belong to either R or S (or both):
R ∪ S = {(a, b) | (a, b) ∈ R or (a, b) ∈ S}
Example:
A = {1, 2, 3}
R = {(1, 2), (2, 3)}
S = {(2, 1), (3, 3)}
R ∪ S = {(1, 2), (2, 3), (2, 1), (3, 3)}
3. Intersection of Relations (R ∩ S)
The intersection of two relations is the set of pairs that belong to both R and S:
R ∩ S = {(a, b) | (a, b) ∈ R and (a, b) ∈ S}
Example:
R = {(1, 2), (2, 3)}
S = {(2, 3), (3, 3)}
R ∩ S = {(2, 3)}
4. Composition of Relations (R ∘ S)
The composition of relations R and S combines pairs through an intermediate element:
R ∘ S = {(a, c) | ∃b ∈ A such that (a, b) ∈ R and (b, c) ∈ S}
Example:
R = {(1, 2), (2, 3)}
S = {(3, 4), (2, 5)}
R ∘ S = {(1, 5)}
5. Inverse of a Relation (R⁻¹)
The inverse of a relation R swaps each pair:
R⁻¹ = {(b, a) | (a, b) ∈ R}
Example:
R = {(1, 2), (3, 4)}
R⁻¹ = {(2, 1), (4, 3)}
6. Properties of Combined Relations
- Union and Intersection: Analogous to set operations.
- Composition: Builds multi-step relations.
- Inverse: Reverses direction of relation pairs.
7. Matrix Representation of Combined Relations
Relations can be represented as adjacency matrices, and combination operations can be translated to matrix operations:
- Union: Logical OR of matrices.
- Intersection: Logical AND of matrices.
- Composition: Matrix multiplication.
- Inverse: Transpose of the matrix.
8. Key Takeaways
- Combining relations lets you build more complex structures.
- Composition helps model multi-step processes.
- Inverse relations are useful for reversing connections.
- Matrix representations make computations easier!
4. Representing Relations Using Matrices and Graphs
1. What is a Relation?
A relation R on a set A is a subset of the Cartesian product A × A. It pairs elements of the set based on a certain condition.
Example:
Set A = {1, 2, 3}
Relation R = {(1, 2), (2, 3), (3, 1)}
2. Matrix Representation of a Relation
A relation can be represented using a square matrix, where rows and columns represent elements of the set. The matrix entry is either 0 or 1:
- 1 → if there is a relation between the elements.
- 0 → if there is no relation between the elements.
Matrix Definition:
If A has n elements, the matrix M of relation R is an n × n matrix, where:
M[i][j] = 1 if (aᵢ, aⱼ) ∈ R, else M[i][j] = 0
Example:
Set A = {1, 2, 3}
Relation R = {(1, 2), (2, 3), (3, 1)}
Matrix M(R):
3. Graph Representation of a Relation
A relation can also be represented as a directed graph, where:
- Each element is a vertex (node).
- An edge (arrow) from vertex a to vertex b exists if (a, b) ∈ R.
Example:
For the same relation R = {(1, 2), (2, 3), (3, 1)}:
This forms a cycle in the graph!
4. Key Insights
- Reflexivity: The diagonal entries in the matrix are all 1.
- Symmetry: The matrix is symmetric (M[i][j] = M[j][i]).
- Transitivity: Matrix multiplication helps check transitivity (M² shows paths of length 2).
5. Quick Example for Properties
Relation R = {(1, 1), (2, 2), (1, 2), (2, 1)}
Matrix M(R):
Graph:
1 ↔ 2 (Bidirectional) and self-loops at 1 and 2.
Properties:
- Reflexive: Yes, (1, 1) and (2, 2) are present.
- Symmetric: Yes, (1, 2) and (2, 1) both exist.
- Transitive: Yes, since paths complete cycles.
6. Why Use Matrices and Graphs?
- Efficiency: Matrices make it easy to compute and analyze relations using linear algebra.
- Visualization: Graphs give a clear, visual representation of connections between elements.
- Algorithms: Graph algorithms help with reachability, connected components, and more!
7. Conclusion
Relations can be represented as matrices or graphs, each offering unique advantages for analysis and visualization. Whether you want to prove properties or model real-world systems, these representations are powerful tools!
5. Equivalence Relations
1. What is an Equivalence Relation?
An equivalence relation is a special type of relation that groups elements into subsets, where elements in the same subset are related to each other in a meaningful way.
A relation R on a set A is an equivalence relation if it satisfies three properties:
- Reflexive: (a, a) ∈ R for all a ∈ A.
- Symmetric: If (a, b) ∈ R, then (b, a) ∈ R.
- Transitive: If (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R.
2. Example of an Equivalence Relation
Set A = {1, 2, 3, 4}
Relation R = {(1, 1), (2, 2), (3, 3), (4, 4), (1, 3), (3, 1)}
Checking Properties:
- Reflexive: Yes, (a, a) is present for all elements.
- Symmetric: Yes, (1, 3) and (3, 1) both exist.
- Transitive: Yes, since (1, 3) and (3, 1) imply (1, 1).
This is an equivalence relation!
3. Equivalence Classes
An equivalence class of an element a is the set of all elements related to a:
[a] = {x ∈ A | (a, x) ∈ R}
Example:
For the relation above:
- [1] = {1, 3}
- [3] = {1, 3}
- [2] = {2}
- [4] = {4}
The set of all equivalence classes forms a partition of A.
4. Matrix Representation
You can represent an equivalence relation with a matrix where M[i][j] = 1 if (aᵢ, aⱼ) ∈ R, and 0 otherwise.
Matrix for the Relation:
| 1 | 2 | 3 | 4 |
1 | 1 | 0 | 1 | 0 |
2 | 0 | 1 | 0 | 0 |
3 | 1 | 0 | 1 | 0 |
4 | 0 | 0 | 0 | 1 |
5. Graph Representation
In a graph, elements are vertices, and an edge exists between a and b if (a, b) ∈ R.
- Self-loops show reflexivity.
- Bidirectional edges show symmetry.
- Paths showing indirect connections demonstrate transitivity.
6. Real-World Examples of Equivalence Relations
- Equality ( = ): Every element is only related to itself.
- Congruence Modulo n: a ≡ b (mod n) means a and b have the same remainder when divided by n.
- Parallel Lines: In geometry, parallel lines are an equivalence relation.
- Same Birthdate: People with the same birthday form equivalence classes.
6. Partial and Total Ordering Relations
1. What is a Partial Ordering Relation?
A relation R on a set A is a partial order if it is:
- Reflexive: (a, a) ∈ R for all a ∈ A.
- Antisymmetric: If (a, b) ∈ R and (b, a) ∈ R, then a = b.
- Transitive: If (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R.
If a relation satisfies these three properties, it's called a partial order, and the set A with the relation R is called a partially ordered set (poset).
Example:
Set A = {1, 2, 3}
Relation R = {(1, 1), (2, 2), (3, 3), (1, 2), (2, 3)}
Checking the properties:
- Reflexive: Yes, (a, a) ∈ R for all elements.
- Antisymmetric: Yes, since there's no (2, 1) or (3, 2).
- Transitive: Yes, (1, 2) and (2, 3) ⇒ (1, 3).
This is a partial order!
2. What is a Total (or Linear) Ordering Relation?
A relation R on a set A is a total order if it is a partial order and has the property of comparability:
- Comparability: For all a, b ∈ A, either (a, b) ∈ R or (b, a) ∈ R.
This means every pair of elements is related.
Example:
Set A = {1, 2, 3}
Relation R = {(1, 1), (2, 2), (3, 3), (1, 2), (2, 3), (1, 3)}
Checking the properties:
- Reflexive: Yes, (a, a) ∈ R for all elements.
- Antisymmetric: Yes, there's no (b, a) for distinct elements.
- Transitive: Yes, (1, 2) and (2, 3) ⇒ (1, 3).
- Comparability: Yes, every pair is related.
This is a total order!
3. Visualizing Orders with Hasse Diagrams
A Hasse diagram is a graph that visually represents a partial order:
- Vertices represent elements.
- Edges show direct relations (without reflexive loops or redundant paths).
Example:
For the relation R = {(1, 2), (2, 3)}:
This is a simple chain representing a total order.
4. Key Differences Between Partial and Total Orders
Property |
Partial Order |
Total Order |
Reflexive |
Yes |
Yes |
Antisymmetric |
Yes |
Yes |
Transitive |
Yes |
Yes |
Comparability |
Not required |
Required |
Example |
Subset relation (⊆) |
≤ on real numbers |
5. Real-World Examples
- Partial Order: Subset relation (⊆) on a set.
- Total Order: The ≤ relation on integers or strings alphabetically.
7. Lattices and Sublattices
1. What is a Lattice?
A lattice is a partially ordered set (poset) in which every pair of elements has both a:
- Least Upper Bound (LUB) or Join ( ∨ ) — the smallest element greater than or equal to both elements.
- Greatest Lower Bound (GLB) or Meet ( ∧ ) — the largest element smaller than or equal to both elements.
In simpler terms, a lattice is a poset where we can always "join" and "meet" elements!
Example:
Set A = {1, 2, 3, 6}
Relation: Divides ( | )
Join and Meet:
- 2 ∨ 3 = 6 (Least common multiple)
- 2 ∧ 6 = 2 (Greatest common divisor)
This is a lattice!
2. Types of Lattices
3. Hasse Diagram of a Lattice
A Hasse diagram can visually represent a lattice, where elements are connected if one covers the other.
Example:
Set: {1, 2, 3, 6}
Diagram:
6
/ \
2 3
\ /
1
4. What is a Sublattice?
A sublattice is a subset of a lattice that is itself a lattice under the same meet and join operations.
Example:
Lattice: {1, 2, 3, 6}
Subset: {1, 2, 6}
Checking Sublattice Conditions:
- 2 ∨ 6 = 6 (in the subset)
- 2 ∧ 6 = 2 (in the subset)
This is a sublattice!
5. Real-World Examples
- Set Theory: The power set of a set with union ( ∪ ) and intersection ( ∩ ).
- Divisibility: Natural numbers with GCD ( ∧ ) and LCM ( ∨ ).
- Boolean Algebra: {0, 1} with AND ( ∧ ) and OR ( ∨ ).
8. Hasse Diagram and Its Components
1. What is a Hasse Diagram?
A Hasse diagram is a graphical representation of a finite partially ordered set (poset). It visually shows the elements and their order relations without displaying reflexive or transitive edges explicitly.
Key Points:
- Elements are represented as vertices (dots).
- A directed edge is drawn if one element covers another.
- Edges point upward, so arrows aren’t necessary.
- Reflexive and transitive edges are omitted to keep the diagram simple.
2. Components of a Hasse Diagram
- Vertices: Represent the elements of the set.
- Edges: Show the covering relation between elements.
- Levels: Indicate the hierarchical structure of elements (based on the poset).
- Minimal Elements: Elements with no element below them.
- Maximal Elements: Elements with no element above them.
- Bottom Element (if exists): The least element in the set.
- Top Element (if exists): The greatest element in the set.
3. Example of a Hasse Diagram
Set: A = {1, 2, 3, 6}
Relation: Divides ( | )
Diagram:
6
/ \
2 3
\ /
1
Explanation:
- 1 is the bottom element (divides everything).
- 6 is the top element (divisible by everything).
- Covering pairs: (1, 2), (1, 3), (2, 6), (3, 6)
4. How to Draw a Hasse Diagram
Follow these steps to construct a Hasse diagram:
- Identify the Set and Relation: Choose a set and a partial order relation.
- Create the Poset: List all pairs (a, b) where a ≤ b.
- Remove Reflexive Pairs: Eliminate pairs like (a, a).
- Remove Transitive Pairs: If (a, b) and (b, c) exist, remove (a, c).
- Draw the Graph: Place elements as points and connect them with lines.
- Arrange Vertically: Place lower elements below higher elements.
5. Real-World Examples
- Divisibility Relation: Natural numbers with the divides ( | ) relation.
- Subset Relation (⊆): Power set of a set.
- Task Scheduling: Precedence relations between tasks.
- Boolean Algebra: Logical propositions with implication (⇒).
6. Practice Problem
Set: B = {1, 2, 4, 8}
Relation: Divides ( | )
Question:
- Draw the Hasse diagram for this set and relation.
- Identify the minimal and maximal elements.