Navigation
Sets, Relations and Functions
Comprehensive guide to set theory, power sets, set operations, and functional mapping.
Sets, Relations and Functions Sets, Relations and Functions
Set theory is the mathematical language of computer science, used in database theory, formal languages, and algorithm analysis.
1. Basics of Sets
A set is a well-defined collection of distinct objects.
Types of Sets:
- Null Set (Empty Set): A set containing no elements, denoted by $\emptyset$ or ${}$.
- Finite and Infinite Sets: Depending on whether the number of elements is countable or not.
- Power Set: The set of all subsets of a set $A$ is called the power set $P(A)$.
- Rule: If a set $A$ has $n$ elements, then $n(P(A)) = 2^n$.
2. Set Operations
Common operations used to manipulate sets:
A. Union ($A \cup B$)
Elements that are in , or in , or in both.
B. Intersection ($A \cap B$)
Elements that are in both and .
C. Difference ($A - B$)
Elements that are in but not in .
D. Symmetric Difference ($A \Delta B$)
Elements that are in or , but not in their intersection.
3. Relations and Functions
A relation from to is a subset of .
Functions:
A function is a special type of relation where every element in is mapped to exactly one element in .
- Domain: The set $A$.
- Range: The subset of $B$ containing all images of elements in $A$.
Summary
Mastering set operations and functions is essential for understanding data structures and relational databases.
