Relations and Their Properties
3249 words
16 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Relations and Their Properties ## ๐ฏ Learning Objectives By the end of this topic, you will be able to: 1. **Compute** the Cartesian product of two or more sets 2.

Relations and Their Properties
๐ฏ Learning Objectives
By the end of this topic, you will be able to:
- Compute the Cartesian product of two or more sets
- Define a binary relation as a subset of a Cartesian product
- Classify relations as reflexive, symmetric, transitive, antisymmetric
- Identify equivalence relations and partition sets into equivalence classes
- Represent relations using ordered pairs, matrices, and graphs
๐ Prerequisites
- Sets and Set Operations โ sets, subsets, elements, set-builder notation
- Arithmetic with integers โ remainders (mod) and factors
๐ Core Content
2.1 Cartesian Product
2.1.1 Intuition: Combining Sets Systematically
Imagine you have two lists: A={Alice,Bob} and B={Pizza,Pasta}. How many possible ways can you pair one person with one dish? Every person can be paired with every dish:
- (Alice, Pizza), (Alice, Pasta)
- (Bob, Pizza), (Bob, Pasta) This all-possible-pairings is the Cartesian product AรB. The order matters: (Alice, Pizza) is different from (Pizza, Alice) โ the first element always comes from A, the second from B.
๐ก Why this matters: In databases, theCROSS JOINof two tables is a Cartesian product. In probability, the sample space of rolling two dice is {1,2,3,4,5,6}ร{1,2,3,4,5,6}.
2.1.2 Formal Definition
The Cartesian product of sets A and B is:
Each element (a,b) is an ordered pair โ the position matters.
Key properties:
- โฃAรBโฃ=โฃAโฃรโฃBโฃ
- AรB๎ =BรA (unless A=B or one is empty)
- Aร(BรC)๎ =(AรB)รC (triples vs. nested pairs)
- โ รA=Aรโ =โ For three sets:
This generalizes to n sets (ordered n-tuples).
2.1.3 Worked Examples
Example 1.1 (Easy): Let A={1,2}, B={3,4}. Compute AรB and BรA.
Step 1: AรB pairs each element of A with each element of B:
Step 2: BรA pairs each element of B with each element of A:
Example 1.2 (Medium): How many elements are in AรBรC if โฃAโฃ=3, โฃBโฃ=4, โฃCโฃ=5?
Step 1: โฃAรBรCโฃ=โฃAโฃรโฃBโฃรโฃCโฃ=3ร4ร5=60
Example 1.3 (Exam-style): Let A={1}, B={2,3}. List all elements of AรBรA.
Step 1: First coordinates from A, second from B, third from A.
AรBรA={(1,2,1),(1,3,1)}
2.2 Binary Relations
2.2.1 Intuition: Connections Between Elements
A relation is simply a rule that connects elements from one set to another. "Alice teaches Mathematics" defines a relation between people and subjects. "5 is less than 10" defines a relation between numbers.
A relation doesn't have to connect every element โ it's a subset of all possible pairings (the Cartesian product).
๐ก Why this matters: Relations are the mathematical foundation for database tables (each row is a tuple), social networks (edges between users), and dependency graphs (prerequisite relationships).
2.2.2 Formal Definition
A binary relation R from set A to set B is a subset of AรB:
If (a,b)โR, we write aRb (read: "a is related to b").
- Domain of R: {aโAโฃโbโB,ย (a,b)โR}
- Range of R: {bโBโฃโaโA,ย (a,b)โR}
- If A=B, we say R is a relation on A. (Diagram)
2.2.3 Examples of Relations
| Set A | Set B | Relation R | RโAรB |
|---|---|---|---|
| Teachers | Courses | t teaches c | {(t,c)โฃtย teachesย c} |
| N | N | aโฃb ( a divides b ) | {(a,b)โฃaโฃb} |
| R | R | a<b | {(a,b)โฃa<b} |
| Students | GPAs | โค8.5 GPA | {(s,g)โฃGPA(s)โค8.5} |
Pythagorean triples as a relation:
Example triples: (3,4,5), (5,12,13), (6,8,10).
2.3 Properties of Relations (on a Set)
When R is a relation on a set A (i.e., RโAรA), we classify it by these properties:
2.3.1 Reflexive
Intuition: Every element is related to itself. "Every number is equal to itself."
Definition: R is reflexive if for every aโA, (a,a)โR.
Examples:
- โค on R: aโคa for all a โ reflexive โ
divideson N: aโฃa for all a>0 โ reflexive โ- < on R: a<a is false โ NOT reflexive โ
2.3.2 Symmetric
Intuition: If a relates to b, then b relates back to a. Like a two-way street.
Definition: R is symmetric if whenever (a,b)โR, then (b,a)โR.
Examples:
=on R: a=bโนb=a โ symmetric โgcd(a,b) = 1on N: gcd(a,b)=1โบgcd(b,a)=1 โ symmetric โ$\leq$on R: 2โค3 does NOT imply 3โค2 โ NOT symmetric โ
2.3.3 Transitive
Intuition: If a relates to b and b relates to c, then a relates to c. Like a chain.
Definition: R is transitive if whenever (a,b)โR and (b,c)โR, then (a,c)โR.
Examples:
- < on R: a<b and b<c implies a<c โ transitive โ
divideson N: aโฃb and bโฃc implies aโฃc โ transitive โ- "is a parent of": NOT transitive (my parent's parent is my grandparent, not my parent) โ
2.3.4 Antisymmetric
Intuition: If a relates to b and b relates to a, then a and b must be the same. No distinct two-way relationships.
Definition: R is antisymmetric if whenever (a,b)โR and (b,a)โR, then a=b.
Examples:
- โค on R: if aโคb and bโคa, then a=b โ antisymmetric โ
divideson N: if aโฃb and bโฃa, then a=b โ antisymmetric โa - b = 2on N: neither symmetric nor antisymmetric โ (Diagram)
2.3.5 Worked Example: Classifying Relations
Example 2.1: R={(a,b)โฃa,bโN,ย aโคb}. Classify R.
| Property | Check | Result |
|---|---|---|
| Reflexive | aโคa for all a ? โ Yes | โ |
| Symmetric | If 2โค3 , does 3โค2 ? No | โ |
| Transitive | If aโคb and bโคc , then aโคc ? โ Yes | โ |
| Antisymmetric | If aโคb and bโคa , then a=b ? โ Yes | โ |
Example 2.2: R={(a,b)โฃa,bโZ,ย โฃaโbโฃ=2}. Classify R.
| Property | Check | Result |
|---|---|---|
| Reflexive | $ | a - a |
| Symmetric | $ | a - b |
| Transitive | (0,2)โR and (2,4)โR , but (0,4)โ/R since $ | 0-4 |
2.4 Equivalence Relations
2.4.1 Intuition: Grouping Similar Things
An equivalence relation captures the idea of "sameness" under some criterion. If we group integers by "remainder when divided by 5", all numbers with remainder 2 are equivalent (like 2, 7, 12, 17, ...). They behave the same way modulo 5.
๐ก Why this matters: Equivalence relations partition data into buckets. In clustering, "same cluster" is an equivalence relation. In cryptography, "same residue class mod n" is fundamental.
2.4.2 Formal Definition
A relation R on a set A is an equivalence relation if it is:
- Reflexive: (a,a)โR for all aโA
- Symmetric: (a,b)โRโบ(b,a)โR
- Transitive: (a,b)โR and (b,c)โRโน(a,c)โR
2.4.3 Equivalence Classes
An equivalence relation partitions A into disjoint subsets called equivalence classes. The equivalence class of aโA is:
Properties:
- Every element belongs to exactly one equivalence class
- [a]=[b] iff (a,b)โR
- Different equivalence classes are disjoint
- The union of all equivalence classes equals A
2.4.4 Worked Examples
Example 3.1 (Easy): Define R on Z by: aRb if amod5=bmod5.
Check reflexive: amod5=amod5 โ โ
Check symmetric: If amod5=bmod5, then bmod5=amod5 โ โ
Check transitive: If amod5=bmod5 and bmod5=cmod5, then amod5=cmod5 โ โ
Equivalence classes (remainders 0, 1, 2, 3, 4):
- [0]={โฆ,โ10,โ5,0,5,10,โฆ}
- [1]={โฆ,โ9,โ4,1,6,11,โฆ}
- [2]={โฆ,โ8,โ3,2,7,12,โฆ}
- [3]={โฆ,โ7,โ2,3,8,13,โฆ}
- [4]={โฆ,โ6,โ1,4,9,14,โฆ}
Example 3.2 (Medium): Let A={1,2,3,4,5,6}. Define R={(a,b)โฃa,bโA,ย aโกb(mod3)}. Find the equivalence classes.
Step 1: Numbers with same remainder modulo 3:
- Remainder 0: {3,6}
- Remainder 1: {1,4}
- Remainder 2: {2,5} Step 2: Verify: every element of A appears in exactly one class. โ
Example 3.3 (Hard): Is "same parity" (both even or both odd) an equivalence relation on Z?
Step 1 โ Reflexive: Every integer has the same parity as itself (evenรeven or oddรodd). โ
Step 2 โ Symmetric: If a and b have same parity, then b and a do too. โ
Step 3 โ Transitive: If a,b have same parity and b,c have same parity, then a,c have same parity. โ
Equivalence classes:
- Even numbers: {โฆ,โ4,โ2,0,2,4,โฆ}
- Odd numbers: {โฆ,โ3,โ1,1,3,5,โฆ}
2.5 Representing Relations
2.5.1 Matrix Representation
For a relation R on a finite set A={a1โ,a2โ,โฆ,anโ}, build an nรn matrix MRโ where:
Example: A={1,2,3}, R={(1,1),(1,2),(2,3),(3,1)}
Properties visible from matrix:
- Reflexive: All diagonal entries are 1
- Symmetric: Matrix is symmetric (MRโ=MRTโ)
- Antisymmetric: If MRโ[i][j]=1 and i๎ =j, then MRโ[j][i]=0
2.5.2 Graph Representation (Directed Graphs)
A relation R on A can be drawn as a directed graph where:
- Elements of A are vertices
- Each (a,b)โR is a directed edge aโb (Diagram) This graph corresponds to the matrix above.
๐ Key Formulas โ Summary Table
| Concept | Formula/Definition | When to Use |
|---|---|---|
| Cartesian product | AรB={(a,b)โฃaโA,bโB} | Generating all ordered pairs |
| Size of product | $\ | A \times B\ |
| Binary relation | RโAรB | Modeling connections |
| Reflexive | โaโA:(a,a)โR | Check diagonal in matrix |
| Symmetric | (a,b)โRโน(b,a)โR | Two-way relationships |
| Transitive | (a,b),(b,c)โRโน(a,c)โR | Chain relationships |
| Antisymmetric | (a,b),(b,a)โRโนa=b | Partial orders |
| Equivalence relation | Reflexive + Symmetric + Transitive | Grouping/classification |
| Equivalence class | [a]={bโฃ(a,b)โR} | Partition of a set |
| Matrix entry | MRโ[i][j]=1 if (aiโ,ajโ)โR | Computing properties |
โ ๏ธ Common Pitfalls
Pitfall 1: Confusing Symmetric with Antisymmetric
Mistake: Thinking a relation cannot be both symmetric and antisymmetric.
Why: A relation CAN be both โ but only if it's a subset of the identity relation. Example: R={(1,1),(2,2)} on {1,2} is both symmetric (each pair has its reverse, which is itself) and antisymmetric (if (a,b) and (b,a) are in R, then a=b).
Most relations are neither symmetric nor antisymmetric. Eg: R={(1,2),(1,3)} is neither.
Pitfall 2: Forgetting That Transitive Requires ALL Chains
Mistake: Checking only one chain and concluding transitivity.
Correct approach: You must check every pair (a,b),(b,c). If ANY chain exists without its corresponding (a,c), the relation is NOT transitive.
Example: R={(1,2),(2,3),(1,3),(3,4)}. Is (1,2),(2,3)โ(1,3) โ. But (1,2),(2,4)? (2,4)โ/R, so no check needed. However (1,3),(3,4)โ(1,4)? (1,4)โ/R โ NOT transitive!
Pitfall 3: Thinking {(1,1),(2,2)} is Reflexive on {1,2,3}
Mistake: Reflexive requires (a,a) for every aโA. If A={1,2,3}, then (3,3) must be present. Without it, the relation is not reflexive.
Correct: Check each element in the set A, not just those that appear in R.
Pitfall 4: Confusing "divides" Relation Domain
Mistake: Thinking 0โฃ5 (0 divides 5) is valid.
Correct: Division by zero is undefined. So the divides relation is defined only on positive integers or non-zero integers. aโฃb requires a๎ =0.
๐ Practice Questions
Q1: Let A={x,y}, B={1,2,3}. Compute AรB.Strategy Hint: List all ordered pairs where first coordinate is from A, second from B.{(x,1),(x,2),(x,3),(y,1),(y,2),(y,3)}โ Q2: Does R={(a,b)โฃa,bโN,ย a<b} satisfy reflexivity?Strategy Hint: Check if any natural number is less than itself.Solution: a<a is false for all a. So R is NOT reflexive.Noโ Q3: Is "is a sibling of" an equivalence relation?Strategy Hint: Check reflexivity, symmetry, transitivity.Reflexive: A person is not their own sibling โ Not reflexive. Symmetric: If X is sibling of Y, then Y is sibling of X โ Yes. Transitive: If X is sibling of Y and Y is sibling of Z, then X is sibling of Z โ Yes (assuming full siblings).But since it's not reflexive, it's NOT an equivalence relation.Noย โย notย reflexiveโ Q4: Find the equivalence classes of R={(a,b)โฃa,bโZ,ย aโกb(mod4)}.Strategy Hint: Group by remainder when dividing by 4.[0]={โฆ,โ8,โ4,0,4,8,โฆ},ย [1]={โฆ,โ7,โ3,1,5,9,โฆ},ย [2]={โฆ,โ6,โ2,2,6,10,โฆ},ย [3]={โฆ,โ5,โ1,3,7,11,โฆ}โ Q5: Is R={(a,b)โฃa,bโR,ย a2=b2} an equivalence relation?Strategy Hint: Check the three properties.Reflexive: a2=a2 โ โ Symmetric: a2=b2โนb2=a2 โ โ Transitive: a2=b2 and b2=c2โนa2=c2 โ โYes! Equivalence classes are {x,โx} for each xโR.Yesย โย equivalenceย classesย areย pairsย {x,โx}โ Q6: Let A={1,2,3}. How many relations exist on A?Strategy Hint: Any relation is a subset of AรA.Step 1: โฃAรAโฃ=3ร3=9 Step 2: Number of subsets = 29=512512ย relationsโ Q7: Draw the directed graph for R={(1,2),(2,3),(3,1),(1,1)} on {1,2,3}.Strategy Hint: Vertices = 1,2,3. Edges = the pairs.pseudo1 โ 2 โ 3 โ โ โโโโโโWith a self-loop at 1.Graphย representation:ย 1โ2โ3โ1,ย plusย 1โ1โ Q8: If โฃAโฃ=3 and โฃBโฃ=4, what is โฃAรBรAโฃ?Strategy Hint: Multiply cardinalities.โฃAรBรAโฃ=3ร4ร3=3636โ Q9: Let R={(1,1),(1,2),(2,1),(2,2),(3,3)} on {1,2,3,4}. Is R reflexive?Strategy Hint: Reflexive requires (4,4).(4,4)โ/R, so NOT reflexive.Noโ Q10: Find the matrix representation of R={(a,b)โฃa,bโ{1,2,3},ย aโฃb}.Strategy Hint: a divides b means b is a multiple of a.
| (a,b) | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 (1|1) | 1 (1|2) | 1 (1|3) |
| 2 | 0 | 1 (2|2) | 0 |
| 3 | 0 | 0 | 1 (3|3) |
>MRโ=โ100โ110โ101โโ>
>MRโ=โ100โ110โ101โโโ>
Q11: If R is symmetric and antisymmetric, prove Rโ{(a,a)โฃaโA}.Strategy Hint: Take any (a,b)โR and deduce a=b.Proof: Let (a,b)โR. By symmetry, (b,a)โR. Since R is antisymmetric, (a,b),(b,a)โRโนa=b. Thus every pair in R has the form (a,a).Provedโ Q12: Show that "same birthday month" is an equivalence relation on the set of all people. How many equivalence classes are there?Strategy Hint: The three properties are straightforward. Classes = 12 months.Reflexive: A person has the same birthday month as themselves. โ Symmetric: If A and B share a month, B and A do too. โ Transitive: If AโผB (same month) and BโผC (same month), then AโผC. โ12 equivalence classes (January through December), possibly with empty classes if no one in the set has that month.Yes,ย 12ย equivalenceย classesโ
๐ Cross-References
- Previous topic: Sets and Set Operations
- Next topic: Functions and Their Types โ a function is a special type of relation
- Across courses: BSMA1003 Maths 2 (linear transformations are relations with special properties); BSMA1002 Stats 1 (random variables are functions from sample space to reals) Join Discord Previous1.1 Sets & OperationsNext1.3 Functions