Introducing Relations
Introducing Relations
A relation connects elements of one set to elements of Imagine a relation between sets "Students" and
another set. It's a collection of ordered pairs where the "Courses." A pair like (John, CS101) would indicate that
first element belongs to the first set, and the second John is enrolled in CS101. This relation can be
element belongs to the second set. represented as a set of such pairs.
Functions: A Special Kind
of Relation
Uniqueness Matters Example: Student ID
In a function, every A function could map each
element in the first set is student to their unique
related to exactly one student ID. Each student
element in the second set. has only one ID, making it
No element can be linked a function. However,
to multiple elements in the multiple students could
second set. share the same course
(many-to-one
relationship), so this is not
a function.
Classifying Relations: Understanding Cardinality
One-to-One Many-to-One
Each element in the first set is linked to a unique element Multiple elements in the first set can be linked to the same
in the second set, and vice versa. element in the second set.
One-to-Many Many-to-Many
One element in the first set can be linked to multiple Multiple elements in the first set can be linked to multiple
elements in the second set. elements in the second set.
Delving Deeper:
Participation and Properties
Onto Into
Every element in the second set Some elements in the second set
has at least one related element in are not related to any element in
the first set. the first set.
Special Types of Relations:
Reflexive, Symmetric, and
Transitive
1 Reflexive
Every element is related to itself.
2 Symmetric
If element a is related to element b, then b is also related to a.
3 Transitive
If a is related to b, and b is related to c, then a is related to c.
Equivalence Relations and
Partitions
Equivalence Relation
A relation that is reflexive, symmetric, and transitive. It
groups elements into equivalence classes.
Equivalence Classes
Groups of elements that are related to each other under an
equivalence relation. They represent sets of similar
elements.
Partitions
Partitions divide a set into non-overlapping equivalence
classes, grouping elements based on their relationships.