Discrete StructureUnit 112 min read
Set Theory & Logic: Fundamentals, Operations, and Applications
Unit 1 of Discrete Structure introduces foundational concepts of set theory—sets, operations, relations, and logic—with definitions, visual proofs, and real-world applications in computing, finance, and algorithms.
TAKEAWAYS:
- Sets are collections of distinct objects, defined by elements and properties, with operations like union, intersection, and complement.
- Cartesian products enable ordered pairs (e.g.,
(a, b)), critical for relations and functions in databases and algorithms. - Venn diagrams visually represent set operations, inclusion-exclusion, and logical relationships.
- Propositional logic uses truth tables and quantifiers to model statements and their validity in programming and AI.
- Predicate logic extends logic to quantified statements (e.g., "All students passed"), used in database queries and theorem proving.
- Applications span from eSewa’s transaction validation (sets) to Daraz’s inventory management (relations) and NTC’s network routing (graphs).
1. Introduction to Sets
A set is a well-defined collection of distinct objects, called elements. Sets are fundamental in discrete mathematics and computer science.
1.1 Definitions and Notation
- Set: Denoted by capital letters (e.g., ).
- Element: Denoted by lowercase letters (e.g., ).
- Subset: if every element of is in .
- Universal Set (): The largest set under consideration.
- Empty Set (): A set with no elements.
1.2 Cartesian Product
The Cartesian product of two sets and is the set of all ordered pairs where and .
Worked Example: Given , find (i.e., ).
A^3 = {
(a, a, a), (a, a, b), (a, a, c),
(a, b, a), (a, b, b), (a, b, c),
(a, c, a), (a, c, b), (a, c, c),
(b, a, a), (b, a, b), (b, a, c),
(b, b, a), (b, b, b), (b, b, c),
(b, c, a), (b, c, b), (b, c, c),
(c, a, a), (c, a, b), (c, a, c),
(c, b, a), (c, b, b), (c, b, c),
(c, c, a), (c, c, b), (c, c, c)
}
Visualization: The Cartesian product can be visualized as a grid where each row represents an element of and each column represents an element of .
1.3 Power Set
The power set of a set , denoted , is the set of all subsets of , including the empty set and itself.
Worked Example: Find the power set of .
P(A) = {
∅,
{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}
}
Note: If has elements, has subsets.
2. Set Operations
Set operations are analogous to logical operations and are visualized using Venn diagrams.
2.1 Basic Operations
| Operation | Symbol | Definition | Venn Diagram (Shaded Area) |
|---|---|---|---|
| Union | All elements in or or both. | ||
| Intersection | Elements common to both and . | ||
| Difference | Elements in but not in . | ||
| Complement | or | Elements in but not in . | |
| Symmetric Difference | Elements in or but not in both. |
2.2 Inclusion-Exclusion Principle
For any two sets and :
Worked Example: Given and , find .
|A| = 4, |B| = 4, |A ∩ B| = 2 (elements 3 and 4)
|A ∪ B| = 4 + 4 - 2 = 6
Visualization: The Venn diagram below shows the inclusion-exclusion principle in action.
2.3 Set Identities
Some useful identities:
3. Relations and Functions
3.1 Relations
A relation from set to set is a subset of the Cartesian product .
Example: Let and . A relation could be:
3.2 Functions
A function is a special type of relation where each element of is mapped to exactly one element of .
Example: Let be defined by . This is a function because each maps to exactly one .
4. Propositional Logic
Propositional logic deals with statements (propositions) that are either true or false.
4.1 Logical Connectives
Based on the TU BIT syllabus for Discrete Structure (BIT152), unit 1.
Discussion
Loading…