π Lecture 11 β Relations
π Overview: This lecture introduces the fundamental concept of relations in discrete mathematics, beginning with ordered pairs and n-tuples before progressing to Cartesian products. It defines binary relations, their domain and range, and explores multiple methods for representing relations including coordinate diagrams, arrow diagrams, directed graphs, and matrix representations β essential tools for modeling relationships between sets.
ποΈ Topics Covered
Ordered pairs and ordered n-tuples, Cartesian products of two and more sets, binary relations from one set to another, domain and range of relations, relations on a set, and multiple representation methods including coordinate diagrams, arrow diagrams, directed graphs, and matrix representation of relations.
π Lecture Summary
ORDERED PAIR
An ordered pair (a, b) consists of two elements βaβ and βbβ in which βaβ is the first element and βbβ is the second element. The ordered pairs (a, b) and (c, d) are equal if, and only if, a = c and b = d. Note that (a, b) and (b, a) are not equal unless a = b.
π Definition β Ordered pair: Two elements arranged with a specific order where the first and second positions matter.
π Formula: (a, b) = (c, d) iff a = c and b = d
π Example: Find x and y given (2x, x + y) = (6, 2). Solution: 2x = 6 gives x = 3, then 3 + y = 2 gives y = -1.
ORDERED n-TUPLE
The ordered n-tuple (aβ, aβ, ..., aβ) consists of elements aβ, aβ, ..., aβ together with the ordering: first aβ, second aβ, and so forth up to aβ. In particular, an ordered 2-tuple is called an ordered pair, and an ordered 3-tuple is called an ordered triple. Two ordered n-tuples (aβ, aβ, ..., aβ) and (bβ, bβ, ..., bβ) are equal if and only if each corresponding pair of their elements is equal, i.e., aα΅’ = bβ±Ό, for all i, j = 1, 2, ..., n.
π Definition β Ordered n-tuple: A generalization of ordered pairs to sequences of n elements with fixed ordering.
CARTESIAN PRODUCT OF TWO SETS
Let A and B be sets. The Cartesian product of A and B, denoted by A Γ B (read as βA cross Bβ) is the set of all ordered pairs (a, b), where a is in A and b is in B.
π Definition β Cartesian product A Γ B: {(a, b) | a β A and b β B}
π Formula: If |A| = m and |B| = n, then |A Γ B| = m Γ n
π Example: Let A = {1, 2}, B = {a, b, c}. Then A Γ B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}. B Γ A = {(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)}. A Γ A = {(1, 1), (1,2), (2, 1), (2, 2)}. B Γ B = {(a, a), (a, b), (a, c), (b, a), (b, b), (b, c), (c, a), (c, b), (c, c)}.
π Important remarks: 1. A Γ B β B Γ A for non-empty and unequal sets A and B. 2. A Γ Ο = Ο Γ A = Ο. 3. |A Γ B| = |A| Γ |B|.
CARTESIAN PRODUCT OF MORE THAN TWO SETS
The Cartesian product of sets Aβ, Aβ, ..., Aβ, denoted Aβ Γ Aβ Γ ... Γ Aβ, is the set of all ordered n-tuples (aβ, aβ, ..., aβ) where aβ β Aβ, aβ β Aβ, ..., aβ β Aβ.
π Definition β Cartesian product of n sets: Aβ Γ Aβ Γ ... Γ Aβ = {(aβ, aβ, ..., aβ) | aα΅’ β Aα΅’, for i = 1, 2, ..., n}
BINARY RELATION
Let A and B be sets. The binary relation R from A to B is a subset of A Γ B. When (a, b) β R, we say βaβ is related to βbβ by R, written aRb. Otherwise, if (a, b) β R, we write aRb.
π Definition β Binary relation from A to B: Any subset of the Cartesian product A Γ B.
π Example: Let A = {1, 2}, B = {1, 2, 3}. Then A Γ B = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)}. Relations from A to B include: Rβ = {(1,1), (1,3), (2,2)}, Rβ = {(1,2), (2,1), (2,2), (2,3)}, Rβ = {(1,1)}, Rβ = A Γ B, Rβ = β . All being subsets of A Γ B are relations from A to B.
DOMAIN OF A RELATION
The domain of a relation R from A to B is the set of all first elements of the ordered pairs which belong to R denoted by Dom(R).
π Definition β Domain of R: Dom(R) = {a β A | (a, b) β R}
RANGE OF A RELATION
The range of a relation R from A to B is the set of all second elements of the ordered pairs which belong to R denoted Ran(R).
π Definition β Range of R: Ran(R) = {b β B | (a, b) β R}
π Example: Let A = {1, 2}, B = {1, 2, 3}, define R = {(a, b) β A Γ B | a < b}. Then R = {(1,2), (1,3), (2,3)}. Dom(R) = {1,2} and Ran(R) = {2, 3}. Since (1, 3) β R so 1R3. But (2, 2) β R so 2 is not related to 3 or 2R2.
π Example: Let A = {eggs, milk, corn} and B = {cows, goats, hens}. Define R from A to B by (a, b) β R iff a is produced by b. Then R = {(eggs, hens), (milk, cows), (milk, goats)}. Thus, eggs R hens, milk R cows, etc.
π Example: Find all binary relations from {0,1} to {1}. Let A = {0,1} and B = {1}. Then A Γ B = {(0,1), (1,1)}. All binary relations from A to B are all subsets of A Γ B: Rβ = β , Rβ = {(0,1)}, Rβ = {(1,1)}, Rβ = {(0,1), (1,1)} = A Γ B.
π Remark: If |A| = m and |B| = n, then the number of elements in A Γ B are m Γ n, and the total number of relations from A to B are 2^(m Γ n).
RELATION ON A SET
A relation on a set A is a relation from A to A. In other words, a relation on a set A is a subset of A Γ A.
π Definition β Relation on a set: A subset of A Γ A.
π Example: Let A = {1, 2, 3, 4}. Define R on A as (a,b) β R iff a divides b (a | b). Then R = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4)}.
π Remarks: For any set A: 1. A Γ A is known as the universal relation. 2. β is known as the empty relation.
π Example: Define a binary relation E on the set of integers Z as: for all m,n β Z, m E n β m β n is even. Is 0E0? Yes, since 0-0 = 0 is even. Is 5E2? No, since 5-2 = 3 is not even. Is (6,6) β E? Yes, since 6-6 = 0 is even. Is (-1,7) β E? Yes, since (-1)-7 = -8 is even. For any even integer n, nE0 because n β 0 = n is an even integer.
COORDINATE DIAGRAM (GRAPH) OF A RELATION
A coordinate diagram represents a relation by plotting points on a coordinate system where one axis represents set A and the other represents set B.
π Example: Let A = {1, 2, 3} and B = {x, y}. Let R = {(1, y), (2, x), (2, y), (3, x)}. The relation may be represented by plotting points (1,y), (2,x), (2,y), (3,x) on a coordinate grid with A on horizontal axis and B on vertical axis.
π Example: Draw the graph of the binary relation C from R to R defined as: for all (x, y) β R Γ R, (x, y) β C β xΒ² + yΒ² = 1. All ordered pairs (x, y) in relation C satisfy xΒ² + yΒ² = 1, which gives y = Β±β(1-xΒ²). y is real whenever -1 β€ x β€ 1, and x is real whenever -1 β€ y β€ 1. The graph is a circle with radius 1 centered at the origin, limited to the range -1 β€ x β€ 1 and -1 β€ y β€ 1. Key points include (0,1), (1,0), (0,0), (0,-1), (-1,0).
ARROW DIAGRAM OF A RELATION
An arrow diagram represents a relation by drawing arrows from elements of set A to elements of set B.
π Example: Let A = {1, 2, 3}, B = {x, y} and R = {(1,y), (2,x), (2,y), (3,x)}. The arrow diagram shows elements 1, 2, 3 on the left and x, y on the right, with arrows: 1βy, 2βx, 2βy, 3βx.
DIRECTED GRAPH OF A RELATION
A directed graph represents a relation on a set by drawing vertices for elements and directed edges (arrows) from a to b when (a, b) β R.
π Example: Let A = {0, 1, 2, 3} and R = {(0,0), (1,3), (2,1), (2,2), (3,0), (3,1)}. The directed graph has vertices 0, 1, 2, 3 with directed edges: 0β0 (a loop), 1β3, 2β1, 2β2 (a loop), 3β0, 3β1.
MATRIX REPRESENTATION OF A RELATION
Let A = {aβ, aβ, ..., aβ} and B = {bβ, bβ, ..., bβ}. Let R be a relation from A to B. Define the n Γ m order matrix M by: m(i, j) = 1 if (aα΅’, bβ±Ό) β R, and m(i, j) = 0 if (aα΅’, bβ±Ό) β R, for i=1,2,...,n and j=1,2,...,m.
π Definition β Matrix representation: An n Γ m binary matrix where entry (i,j) is 1 if the ordered pair is in the relation, and 0 otherwise.
π Example: Let A = {1, 2, 3} and B = {x, y}. Let R = {(1,y), (2,x), (2,y), (3,x)}. The matrix M is a 3Γ2 matrix: rows labeled 1, 2, 3 and columns labeled x, y. M = [[0, 1], [1, 1], [1, 0]] meaning (1,x)=0, (1,y)=1, (2,x)=1, (2,y)=1, (3,x)=1, (3,y)=0.
π Example: For matrix M = [[1, 0, 1], [1, 0, 0], [0, 1, 1]] with rows 1, 2, 3 and columns 1, 2, 3 (a relation on set A = {1,2,3}): R = {(1,1), (1,3), (2,1), (3,2), (3,3)}. Its directed graph has vertices 1, 2, 3 with edges: 1β1 (loop), 1β3, 2β1, 3β2, 3β3 (loop).
EXERCISE
Let A = {2, 4} and B = {6, 8, 10}. Define R and S from A to B as: for all (x,y) β A Γ B, x R y β x | y and x S y β y β 4 = x.
π Solution: A Γ B = {(2,6), (2,8), (2,10), (4,6), (4,8), (4,10)}. R = {(2,6), (2,8), (2,10), (4,8)} because 2|6, 2|8, 2|10, 4|8. S = {(2,6), (4,8)} because 6-4=2 and 8-4=4. R βͺ S = {(2,6), (2,8), (2,10), (4,8)} = R. R β© S = {(2,6), (4,8)} = S.
β Key Takeaways
A relation is fundamentally a subset of a Cartesian product, and understanding this definition is essential for all further work. The domain and range of a relation are simply the sets of first and second elements respectively from the ordered pairs. There are four important visual representation methods β coordinate diagrams, arrow diagrams, directed graphs, and matrices β each useful in different contexts. For a set A of size m and B of size n, the total number of possible relations from A to B is 2^(mΓn). A relation on a set A is simply a relation from A to itself (a subset of AΓA), with the two extreme cases being the universal relation (AΓA) and the empty relation (β ).
π§ Quick Revision Questions
- What is the difference between an ordered pair (a,b) and the set {a,b}?
- If A has 4 elements and B has 3 elements, how many elements are in AΓB and how many relations can be defined from A to B?
- For A = {1,2,3} and the relation R = {(1,2), (2,3), (3,1)} on A, what are Dom(R) and Ran(R)?
- How would you construct the matrix representation of a relation R from A = {aβ,aβ} to B = {bβ,bβ,bβ}?
- Given the matrix representation of a relation, how do you construct its directed graph?
π Lecture 12 β Types of Relations
π Overview: This lecture defines and explores the fundamental properties of binary relations: reflexivity, symmetry, and transitivity. Understanding these properties is essential for characterizing relations and forms the basis for more advanced concepts like equivalence relations and congruences.
ποΈ Topics Covered
The lecture covers reflexive relations with their definition, examples, directed graph representation, and matrix representation. It then covers symmetric relations similarly, followed by transitive relations. Multiple exercises test understanding of these properties on various relations including the null relation, universal relation, divides relation, and congruence modulo d. Finally, equivalence relations are introduced as relations that are reflexive, symmetric, and transitive, with congruence modulo 3 proved as an equivalence relation.
π Lecture Summary
REFLEXIVE RELATION
Let R be a relation on a set A. R is reflexive if and only if, for all a β A, (a, a) β R or equivalently aRa. That is, each element of A is related to itself.
π Definition β Reflexive: A relation R on set A is reflexive iff every element of A is related to itself; i.e., (a,a) β R for all a β A.
π Definition β Not Reflexive: R is not reflexive iff there is an element βaβ in A such that (a, a) β R. That is, some element βaβ of A is not related to itself.
π Example: Let A = {1, 2, 3, 4} and define relations Rβ, Rβ, Rβ, Rβ on A as follows: Rβ = {(1, 1), (3, 3), (2, 2), (4, 4)} β reflexive, since (a,a) β Rβ for all aβA. Rβ = {(1, 1), (1, 4), (2, 2), (3, 3), (4, 3)} β not reflexive, because (4, 4) β Rβ. Rβ = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)} β reflexive. Rβ = {(1, 3), (2, 2), (2, 4), (3, 1), (4, 4)} β not reflexive, because (1, 1) β Rβ and (3, 3) β Rβ.
DIRECTED GRAPH OF A REFLEXIVE RELATION: The directed graph of every reflexive relation includes an arrow from every point to the point itself (i.e., a loop).
MATRIX REPRESENTATION OF A REFLEXIVE RELATION: Let A = {aβ, aβ, ..., aβ}. A Relation R on A is reflexive if and only if (aα΅’, aβ±Ό) β R β i=1,2,...,n. Accordingly, R is reflexive if all the elements on the main diagonal of the matrix M representing R are equal to 1.
π Example: The relation R = {(1,1), (1,3), (2,2), (3,2), (3,3)} on A = {1,2,3} represented by the following matrix M, is reflexive.
M = | 1 0 1 |
| 0 1 0 |
| 0 1 1 |
SYMMETRIC RELATION
Let R be a relation on a set A. R is symmetric if, and only if, for all a, b β A, if (a, b) β R, then (b, a) β R. That is, if aRb then bRa.
π Definition β Symmetric: A relation R on set A is symmetric iff whenever (a,b) β R, then (b,a) β R for all a,b β A.
π Definition β Not Symmetric: R is not symmetric iff there are elements a and b in A such that (a, b) β R, but (b, a) β R.
π Example: Let A = {1, 2, 3, 4} and define relations Rβ, Rβ, Rβ, Rβ on A as follows: Rβ = {(1, 1), (1, 3), (2, 4), (3, 1), (4,2)} β symmetric because for every ordered pair (a,b) in Rβ we also have (b,a) in Rβ. Rβ = {(1, 1), (2, 2), (3, 3), (4, 4)} β symmetric (vacuously true). Rβ = {(2, 2), (2, 3), (3, 4)} β not symmetric, because (2,3) β Rβ but (3,2) β Rβ. Rβ = {(1, 1), (2, 2), (3, 3), (4, 3), (4, 4)} β not symmetric because (4,3) β Rβ but (3,4) β Rβ.
DIRECTED GRAPH OF A SYMMETRIC RELATION: For a symmetric directed graph, whenever there is an arrow going from one point of the graph to a second, there is an arrow going from the second point back to the first.
MATRIX REPRESENTATION OF A SYMMETRIC RELATION: Let A = {aβ, aβ, ..., aβ}. The relation R on A is symmetric if and only if for all aα΅’, aβ±Ό β A, if (aα΅’, aβ±Ό) β R then (aβ±Ό, aα΅’) β R. Accordingly, R is symmetric if the elements in the ith row are the same as the elements in the ith column of the matrix M representing R. More precisely, M is a symmetric matrix i.e. M = Mα΅.
π Example: The relation R = {(1,3), (2,2), (3,1), (3,3)} on A = {1,2,3} represented by the following matrix M is symmetric.
M = | 0 0 1 |
| 0 1 0 |
| 1 0 1 |
TRANSITIVE RELATION
Let R be a relation on a set A. R is transitive if and only if for all a, b, c β A, if (a, b) β R and (b, c) β R then (a, c) β R. That is, if aRb and bRc then aRc. In words, if any one element is related to a second and that second element is related to a third, then the first is related to the third. Note: The βfirstβ, βsecondβ and βthirdβ elements need not be distinct.
π Definition β Transitive: A relation R on set A is transitive iff whenever (a,b) β R and (b,c) β R, then (a,c) β R for all a,b,c β A.
π Definition β Not Transitive: R is not transitive iff there are elements a, b, c in A such that (a, b) β R and (b, c) β R but (a, c) β R.
π Example: Let A = {1, 2, 3, 4} and define relations Rβ, Rβ and Rβ on A as follows: Rβ = {(1, 1), (1, 2), (1, 3), (2, 3)} β transitive because (1,1), (1,2) are in Rβ, then to be transitive (1,2) must be there and it belongs to Rβ. Rβ = {(1, 2), (1, 4), (2, 3), (3, 4)} β not transitive since (1,2) and (2,3) β Rβ but (1,3) β Rβ. Rβ = {(2, 1), (2, 4), (2, 3), (3,4)} β transitive.
DIRECTED GRAPH OF A TRANSITIVE RELATION: For a transitive directed graph, whenever there is an arrow going from one point to the second, and from the second to the third, there is an arrow going directly from the first to the third.
EXERCISE ON NULL AND UNIVERSAL RELATIONS
Let A = {1, 2, 3, 4} and define the null relation β and universal relation A Γ A on A.
Reflexive:
- β is not reflexive since (1,1), (2,2), (3,3), (4,4) β β .
- A Γ A is reflexive since (a,a) β A Γ A for all a β A.
Symmetric:
- For the null relation β on A to be symmetric, it must satisfy: if (a,b) β β then (a,b) β β . Since (a,b) β β is never true, the implication is vacuously true or true by default. Hence β is symmetric.
- The universal relation A Γ A is symmetric, for it contains all ordered pairs of elements of A. Thus, if (a,b) β A Γ A then (b,a) β A Γ A for all a,b in A.
Transitive:
- The null relation β on A is transitive, because the implication "if (a,b) β β and (b,c) β β then (a,c) β β " is true by default, since the condition (a,b) β β is always false.
- The universal relation A Γ A is transitive for it contains all ordered pairs of elements of A.
EXERCISE: RELATION ON POSITIVE INTEGERS
Define a relation R on the set of positive integers ZβΊ as follows: for all a, b β ZβΊ, a R b iff a Γ b is odd. Determine whether the relation is reflexive, symmetric, transitive.
Solution: Recall that the product of two positive integers is odd if and only if both of them are odd.
- Reflexive: R is not reflexive, because 2 β ZβΊ but 2 R 2 for 2 Γ 2 = 4 which is not odd.
- Symmetric: R is symmetric, because if a R b then a Γ b is odd or equivalently b Γ a is odd (b Γ a = a Γ b) β b R a.
- Transitive: R is transitive, because if a R b then a Γ b is odd β both βaβ and βbβ are odd. Also bRc means b Γ c is odd β both βbβ and βcβ are odd. Now if aRb and bRc, then all of a, b, c are odd and so a Γ c is odd. Consequently aRc.
EXERCISE: DIVIDES RELATION
Let βDβ be the βdividesβ relation on Z defined as: for all m, n β Z, m D n β m|n. Determine whether D is reflexive, symmetric or transitive.
- Reflexive: Let m β Z, since every integer divides itself. So m|m β m β Z therefore mDm β m β Z. Accordingly D is reflexive.
- Symmetric: Let m, n β Z and suppose m D n. By definition, m|n (i.e. n/m = an integer). Clearly, then it is not necessary that m/n = an integer. Accordingly, if m D n then n D m is not true for all m,n β Z. Hence D is not symmetric.
- Transitive: Let m, n, p β Z and suppose m D n and n D p. Now m D n β m|n β n/m = an integer. Also n D p β n|p β p/n = an integer. We note p/m = (p/n) * (n/m) = (an int) * (an int) = an int β m|p and so mDp. Thus if mDn and nDp then mDp β m,n,p β Z. Hence D is transitive.
EQUIVALENCE RELATION
Let A be a non-empty set and R a binary relation on A. R is an equivalence relation if, and only if, R is reflexive, symmetric, and transitive.
π Definition β Equivalence Relation: A relation R on a non-empty set A is an equivalence relation iff R is reflexive, symmetric, and transitive.
π Example: Let A = {1, 2, 3, 4} and R = {(1,1), (2,2), (2,4), (3,3), (4,2), (4,4)} be a binary relation on A. Note that R is reflexive, symmetric and transitive, hence an equivalence relation.
CONGRUENCES
Let m and n be integers and d be a positive integer. The notation m β‘ n (mod d) means that d | (m β n) {d divides m minus n}. There exists an integer k such that (m β n) = dΒ·k.
π Example: a. Is 22 β‘ 1(mod 3)? Since 22-1 = 21 = 3Γ7. Hence 3|(22-1), and so 22 β‘ 1 (mod 3) b. Is β5 β‘ +10 (mod 3)? Since β5 β 10 = -15 = 3 Γ (-5). Hence 3|((-5)-10), and so -5 β‘ 10 (mod 3) c. Is 7 β‘ 7 (mod 3)? Since 7 β 7 = 0 = 3 Γ 0. Hence 3|(7-7), and so 7 β‘ 7 (mod 3) d. Is 14 β‘ 4 (mod 3)? Since 14 β 4 = 10, and 3 β€ 10 because 10 β 3Β·k for any integer k. Hence 14 β‘ 4 (mod 3).
EXERCISE: CONGRUENCE MODULO 3 IS AN EQUIVALENCE RELATION
Define a relation R on the set of all integers Z as follows: for all integers m and n, m R n β m β‘ n (mod 3). Prove that R is an equivalence relation.
Reflexive: R is reflexive iff for all m β Z, m R m. By definition of R, this means for all m β Z, m β‘ m (mod 3). Since m β m = 0 = 3Γ0, hence 3|(m-m), and so m β‘ m (mod 3) β mRm. Hence R is reflexive.
Symmetric: R is symmetric iff for all m, n β Z, if m R n then n R m. Now mRn β mβ‘n (mod 3) β 3|(m-n) β m-n = 3k for some integer k β n β m = 3(-k), -k β Z β 3|(n-m) β n β‘ m (mod 3) β nRm. Hence R is symmetric.
Transitive: R is transitive iff for all m, n, p β Z, if mRn and nRp then mRp. Now mRn and nRp means m β‘ n (mod 3) and n β‘ p (mod 3) β 3|(m-n) and 3|(n-p) β (m-n) = 3r and (n-p) = 3s for some r,s β Z. Adding: (m β n) + (n β p) = 3r + 3s β m β p = 3(r + s) where r+s β Z β 3|(m β p) β m β‘ p (mod 3) β mRp. Hence R is transitive. R being reflexive, symmetric and transitive, is an equivalence relation.
β Key Takeaways
A relation's propertiesβreflexivity, symmetry, and transitivityβare defined by logical conditions on ordered pairs and are verified by checking all applicable pairs. Reflexivity requires every element to relate to itself; symmetry demands that for every directed pair, the reverse pair also exists; transitivity requires that any two-step path implies a direct connection. These properties can be visually identified from directed graphs (loops for reflexivity, bidirectional arrows for symmetry, shortcuts for transitivity) and from matrices (diagonal ones for reflexivity, symmetry about the diagonal for symmetry). An equivalence relation is a relation that possesses all three properties, and congruence modulo d is a classic example of an equivalence relation on integers.
π§ Quick Revision Questions
- What condition must hold for a relation R on set A to be reflexive?
- If a relation R is not symmetric, what specific pair(s) must exist in R?
- Given the relation R = {(1,1), (1,2), (2,3)} on A = {1,2,3}, why is R not transitive?
- Explain why the null relation on a non-empty set is symmetric and transitive but not reflexive.
- Prove directly that the relation "has the same birthday as" defined on the set of all people is an equivalence relation.
π Lecture 13 β Matrix Representation of Relations
π Overview: This lecture explores matrix representations of relations and examines fundamental properties of binary relations including reflexivity, irreflexivity, symmetry, antisymmetry, and transitivity. It demonstrates how these properties appear in both matrix form and directed graphs, culminating in the definition of partial order relations with multiple examples.
ποΈ Topics Covered
The lecture covers the intersection of reflexive, symmetric, and transitive relations with proofs; irreflexive relations with matrix and directed graph representations; antisymmetric relations with matrix and directed graph representations; partial order relations defined as reflexive, antisymmetric, and transitive; and examples of partial orders including "less than or equal to" on real numbers, subset relation on power sets, divides relation on positive integers, and a relation defined by powers on integers.
π Lecture Summary
EXERCISE: Intersection of Relations
Suppose R and S are binary relations on a set A. We examine whether properties are preserved under intersection.
a. R β© S is reflexive: If R and S are reflexive, then for all a β A, (a,a) β R and (a,a) β S. By definition of intersection, (a,a) β R β© S for all a β A. Therefore R β© S is reflexive.
b. R β© S is symmetric: If R and S are symmetric, suppose (a,b) β R β© S. Then (a,b) β R and (a,b) β S. Since R is symmetric, (b,a) β R. Since S is symmetric, (b,a) β S. Thus (b,a) β R β© S, proving R β© S is symmetric.
c. R β© S is transitive: If R and S are transitive, suppose (a,b) β R β© S and (b,c) β R β© S. Then (a,b) β R, (a,b) β S, (b,c) β R, and (b,c) β S. Since R is transitive, (a,c) β R. Since S is transitive, (a,c) β S. Therefore (a,c) β R β© S, proving R β© S is transitive.
π Definition β Intersection of Relations: The intersection of two relations R and S contains exactly those ordered pairs that belong to both R and S.
π‘ Why this matters: These proofs show that the intersection of two reflexive, symmetric, or transitive relations preserves each respective property β but this is not true for all operations like union.
EXAMPLE: Let A = {1,2,3,4} with R = {(1,2), (1,3), (2,2), (3,3), (4,2), (4,3)} and S = {(2,1), (2,4), (3,3)} both transitive. R βͺ S = {(1,2), (1,3), (2,1), (2,2), (2,4), (3,3), (4,2), (4,3)}. Note (1,2) and (2,1) β RβͺS, but (1,1) β RβͺS. Hence RβͺS is not transitive.
IRREFLEXIVE RELATION
Let R be a binary relation on a set A. R is irreflexive iff for all a β A, (a,a) β R. That is, no element in A is related to itself by R.
REMARK: R is not irreflexive iff there is an element a β A such that (a,a) β R.
EXAMPLE: Let A = {1,2,3,4}. Rβ = {(1,3), (1,4), (2,3), (2,4), (3,1), (3,4)} is irreflexive since no element is related to itself. Rβ = {(1,1), (1,2), (2,1), (2,2), (3,3), (4,4)} is not irreflexive since all elements are self-related. Rβ = {(1,2), (2,3), (3,3), (3,4)} is not irreflexive since (3,3) β Rβ. Note: Rβ is not reflexive either.
NOTE: A relation may be neither reflexive nor irreflexive.
DIRECTED GRAPH OF AN IRREFLEXIVE RELATION
In the directed graph of an irreflexive relation, there is no loop at any point of A.
EXAMPLE: Let A = {1,2,3} and R = {(1,3), (2,1), (2,3), (3,2)}. The directed graph shows arrows between distinct elements with no loops.
π Definition β Irreflexive Relation: A relation R on set A is irreflexive when no element is related to itself, i.e., (a,a) β R for all a β A.
MATRIX REPRESENTATION OF AN IRREFLEXIVE RELATION
For an irreflexive relation R, the matrix representation will contain all 0's in its main diagonal. If any diagonal element is 1, the relation is not irreflexive.
π Matrix condition: A relation is irreflexive β all diagonal entries in its matrix are 0.
EXAMPLE: Let A = {1,2,3} and R = {(1,3), (2,1), (2,3), (3,2)}. Matrix M =
1 2 3
1 [0 0 1]
2 [1 0 1]
3 [0 1 0]
All main diagonal elements are 0, so R is irreflexive.
EXERCISE: Let R be the relation on Z defined as: (a,b) β R β a > b. Is R irreflexive? Solution: For all a β Z, (a,a) β R since a > a is false. Hence R is irreflexive.
ANTISYMMETRIC RELATION
Let R be a binary relation on a set A. R is anti-symmetric iff βa,b β A, if (a,b) β R and (b,a) β R then a = b.
REMARKS:
- R is not anti-symmetric iff there exist a,b β A with (a,b) β R and (b,a) β R but a β b.
- Being symmetric and being anti-symmetric are not negatives of each other.
EXAMPLE: Let A = {1,2,3,4}. Rβ = {(1,1), (2,2), (3,3)} is anti-symmetric and symmetric. Rβ = {(1,2), (2,2), (2,3), (3,4), (4,1)} is anti-symmetric but not symmetric because (1,2) β Rβ but (2,1) β Rβ. Rβ = {(1,3), (2,2), (2,4), (3,1), (4,2)} is not anti-symmetric since (1,3) & (3,1) β Rβ but 1 β 3 (note Rβ is symmetric). Rβ = {(1,3), (2,4), (3,1), (4,3)} is neither anti-symmetric [ (1,3) & (3,1) β Rβ, 1β 3 ] nor symmetric [ (2,4) β Rβ but (4,2) β Rβ ].
π Definition β Anti-symmetric Relation: A relation is anti-symmetric if the only way for both (a,b) and (b,a) to be in the relation is when a = b.
DIRECTED GRAPH OF AN ANTISYMMETRIC RELATION
In the directed graph of an anti-symmetric relation, there is no pair of arrows between two distinct elements of A.
EXAMPLE: Let A = {1,2,3} and R = {(1,1), (1,2), (2,3), (3,1)}. The directed graph shows arrows from 1β2, 2β3, 3β1 with no reverse arrows between any distinct points. R is anti-symmetric.
MATRIX REPRESENTATION OF AN ANTISYMMETRIC RELATION
Let R be an anti-symmetric relation on A = {aβ, aβ, ..., aβ}. If (aα΅’, aβ±Ό) β R for i β j then (aβ±Ό, aα΅’) β R. In the matrix, if the (i,j) entry is 1 (iβ j), then the (j,i) entry must be 0, and vice versa.
EXAMPLE: Let A = {1,2,3} and R = {(1,1), (1,2), (2,3), (3,1)}. Matrix M =
1 2 3
1 [1 1 0]
2 [0 0 1]
3 [1 0 0]
R is anti-symmetric: note (1,2)=1 and (2,1)=0; (2,3)=1 and (3,2)=0; (3,1)=1 and (1,3)=0.
π‘ Why this matters: Matrix representation provides a visual and computational way to verify properties β check diagonals for reflexivity/irreflexivity and symmetric pairs for antisymmetry.
PARTIAL ORDER RELATION
Let R be a binary relation defined on a set A. R is a partial order relation if and only if R is reflexive, antisymmetric, and transitive. The set A together with a partial ordering R is called a partially ordered set or poset.
π Definition β Partial Order: A relation that is simultaneously reflexive, antisymmetric, and transitive.
EXAMPLE: Let R be the set of real numbers with the "less than or equal to" relation (β€). Show β€ is a partial order.
Solution:
- Reflexive: For all x β R, x β€ x since x = x is always true.
- Anti-symmetric: If x β€ y and y β€ x, then by the trichotomy property (exactly one of x<y, x=y, x>y holds), we must have x = y.
- Transitive: If x β€ y and y β€ z, then x β€ z follows from the transitive property of order (if x<y and y<z then x<z).
Thus β€ is a partial order relation on R.
EXERCISE: Let A be a non-empty set and P(A) the power set of A. Define the "subset" relation β as: X β Y β βx, if xβX then xβY. Show β is a partial order.
Solution:
- Reflexive: Every set is a subset of itself, so X β X for all X β P(A).
- Anti-symmetric: If X β Y and Y β X, then by definition of set equality, X = Y.
- Transitive: If X β Y and Y β Z, then by transitive property of subsets, X β Z.
Thus β is a partial order relation on P(A).
EXERCISE: Let "|" be the "divides" relation on a set A of positive integers. That is, a|b β b = kΒ·a for some integer k. Prove | is a partial order.
Solution:
- Reflexive: For all a β A, a = 1Β·a, so a|a.
- Anti-symmetric: Suppose a|b and b|a. Then b = kβΒ·a and a = kβΒ·b for integers kβ, kβ. Substituting: b = kβΒ·(kβΒ·b) = (kβΒ·kβ)Β·b. Dividing by b: 1 = kβΒ·kβ. Since kβ,kβ are positive integers, kβ = kβ = 1. Thus a = 1Β·b = b.
- Transitive: Suppose a|b and b|c. Then b = kβΒ·a and c = kβΒ·b. Substituting: c = kβΒ·(kβΒ·a) = (kβΒ·kβ)Β·a = kβΒ·a (where kβ = kβΒ·kβ is an integer). Thus a|c.
Therefore | is a partial order on A.
EXERCISE: Let R be the relation on Z defined as: aRb iff b = aΚ³ for some positive integer r. Show R is a partial order.
Solution:
- Reflexive: For any a β Z, a = aΒΉ, so aRa.
- Anti-symmetric: Suppose aRb and bRa. Then b = aΚ³ and a = bΛ’ for positive integers r,s. Substituting: a = (aΚ³)Λ’ = aΚ³Λ’, so rs = 1. Since r,s are positive integers, r = s = 1, giving a = bΒΉ = b.
- Transitive: Suppose aRb and bRc. Then b = aΚ³ and c = bΛ’. Substituting: c = (aΚ³)Λ’ = aΚ³Λ’ = aα΅ where t = rs is a positive integer. Thus aRc.
Therefore R is a partial order relation on Z.
β Key Takeaways
The intersection of reflexive, symmetric, or transitive relations preserves those properties, but union does not necessarily preserve transitivity. Irreflexive relations have no self-related elements, appearing as zero diagonals in matrices and no loops in directed graphs. Antisymmetric relations forbid pairs of arrows between distinct elements, appearing as matrices where (i,j)=1 with iβ j forces (j,i)=0. A partial order relation must satisfy three properties simultaneously: reflexivity, antisymmetry, and transitivity, making it a fundamental structure for ordering elements in sets, with examples including β€ on real numbers, β on power sets, and | (divides) on positive integers.
π§ Quick Revision Questions
- If R and S are both reflexive relations on set A, is R βͺ S necessarily reflexive? Explain.
- What condition must the diagonal entries of a matrix satisfy for the relation to be irreflexive?
- Can a relation be both symmetric and anti-symmetric? If so, give an example.
- State the three properties that a relation must satisfy to be a partial order.
- For the divides relation on positive integers, prove that if a|b and b|a then a = b.
π Lecture 14 β Inverse of Relations
π Overview: This lecture explores the concept of inverse relations, including their definition, representation, and properties. It also introduces complementary and composite relations, providing foundational tools for understanding how relations can be manipulated and combined in discrete mathematics.
ποΈ Topics Covered
The lecture covers the definition and examples of inverse relations, their arrow diagram and matrix representations, proofs of how inverse relations preserve reflexivity, symmetry, transitivity, and antisymmetry, the condition for a relation to be symmetric (R = Rβ»ΒΉ), complementary relations and their properties, and composite relations with arrow diagram and matrix representations using Boolean operations.
π Lecture Summary
Inverse of a Relation
Let R be a relation from A to B. The inverse relation Rβ»ΒΉ from B to A is defined as: Rβ»ΒΉ = {(b,a) β BΓA | (a,b) β R}. More simply, the inverse relation Rβ»ΒΉ of R is obtained by interchanging the elements of all the ordered pairs in R.
π Definition β Inverse Relation: Rβ»ΒΉ = {(b,a) β BΓA | (a,b) β R}
Example: Let A = {2, 3, 4} and B = {2,6,8} and let R be the "divides" relation from A to B, i.e., for all (a,b) β AΓB, a R b β a | b (a divides b). Then R = {(2,2), (2,6), (2,8), (3,6), (4,8)} and Rβ»ΒΉ = {(2,2), (6,2), (8,2), (6,3), (8,4)}. In words, Rβ»ΒΉ may be defined as: for all (b,a) β BΓA, b R a β b is a multiple of a.
Arrow Diagram of an Inverse Relation
The relation R = {(2,2), (2,6), (2,8), (3,6), (4,8)} is represented by an arrow diagram from A to B. The inverse of this relation can be obtained simply by changing the directions of the arrows, resulting in an arrow diagram from B to A.
Matrix Representation of Inverse Relation
The relation R = {(2,2), (2,6), (2,8), (3,6), (4,8)} from A = {2,3,4} to B = {2,6,8} is defined by matrix M:
2 6 8
2 [1 1 1]
3 [0 1 0]
4 [0 0 1]
The matrix representation of inverse relation Rβ»ΒΉ is obtained by simply taking its transpose (changing rows by columns and columns by rows):
2 3 4
2 [1 0 0]
6 [1 1 0]
8 [1 0 1]
Thus Rβ»ΒΉ is represented by Mα΅.
Properties of Inverse Relations
Exercise: Let R be a binary relation on a set A. Prove that:
(i) If R is reflexive, then Rβ»ΒΉ is reflexive. Suppose R on A is reflexive. By definition, β a β A, (a,a) β R. Since Rβ»ΒΉ consists of exactly those ordered pairs obtained by interchanging the first and second element of ordered pairs in R, if (a,a) β R then (a,a) β Rβ»ΒΉ. Accordingly, β a β A, (a,a) β Rβ»ΒΉ. Hence Rβ»ΒΉ is reflexive.
(ii) If R is symmetric, then Rβ»ΒΉ is symmetric. Suppose R on A is symmetric. Let (a,b) β Rβ»ΒΉ for a,b β A. By definition of Rβ»ΒΉ, (b,a) β R. Since R is symmetric, (a,b) β R. Then by definition of Rβ»ΒΉ, (b,a) β Rβ»ΒΉ. Thus for all a,b β A, if (a,b) β Rβ»ΒΉ then (b,a) β Rβ»ΒΉ. Accordingly Rβ»ΒΉ is symmetric.
(iii) If R is transitive, then Rβ»ΒΉ is transitive. Suppose R on A is transitive. Let (a,b) β Rβ»ΒΉ and (b,c) β Rβ»ΒΉ. Then by definition of Rβ»ΒΉ, (b,a) β R and (c,b) β R. Since R is transitive, if (c,b) β R and (b,a) β R then (c,a) β R. By definition of Rβ»ΒΉ, (a,c) β Rβ»ΒΉ. Thus for all a,b,c β A, if (a,b) β Rβ»ΒΉ and (b,c) β Rβ»ΒΉ then (a,c) β Rβ»ΒΉ. Accordingly Rβ»ΒΉ is transitive.
(iv) If R is antisymmetric, then Rβ»ΒΉ is antisymmetric. Suppose R on A is antisymmetric. Let (a,b) β Rβ»ΒΉ and (b,a) β Rβ»ΒΉ. Then by definition of Rβ»ΒΉ, (b,a) β R and (a,b) β R. Since R is antisymmetric, if (a,b) β R and (b,a) β R then a = b. Thus if (a,b) β Rβ»ΒΉ and (b,a) β Rβ»ΒΉ then a = b. Accordingly Rβ»ΒΉ is antisymmetric.
Symmetric Relation Criterion
Exercise: Show that the relation R on a set A is symmetric if, and only if, R = Rβ»ΒΉ.
Solution (Forward direction): Suppose R on A is symmetric. Let (a,b) β R. Since R is symmetric, (b,a) β R. By definition of Rβ»ΒΉ, if (b,a) β R then (a,b) β Rβ»ΒΉ. Since (a,b) is arbitrary, R β Rβ»ΒΉ. Next, let (c,d) β Rβ»ΒΉ. By definition of Rβ»ΒΉ, (d,c) β R. Since R is symmetric, (c,d) β R. Hence Rβ»ΒΉ β R. By both inclusions, R = Rβ»ΒΉ.
Solution (Reverse direction): Suppose R = Rβ»ΒΉ. Let (a,b) β R. By definition of Rβ»ΒΉ, (b,a) β Rβ»ΒΉ. Since R = Rβ»ΒΉ, (b,a) β Rβ»ΒΉ = R. Thus if (a,b) β R then (b,a) β R. Accordingly R is symmetric.
Complementary Relation
Let R be a relation from a set A to a set B. The complementary relation RΜ of R is the set of all those ordered pairs in AΓB that do not belong to R.
π Definition β Complementary Relation: RΜ = AΓB - R = {(a,b) β AΓB | (a,b) β R}
Example: Let A = {1,2,3} and R = {(1,1), (1,3), (2,2), (2,3), (3,1)} be a relation on A. Then RΜ = {(1,2), (2,1), (3,2), (3,3)}
Exercise: Let R be the relation R = {(a,b) | a < b} on the set of integers. Find: a) RΜ b) Rβ»ΒΉ
a) RΜ = ZΓZ - R = {(a,b) | a < b} = {(a,b) | a β₯ b} b) Rβ»ΒΉ = {(a,b) | a > b}
Exercise: Let R be a relation on a set A. Prove that R is reflexive iff RΜ is irreflexive.
Solution (Forward): Suppose R is reflexive. Then β a β A, (a,a) β R. By definition of the complementary relation, (a,a) β RΜ , β a β A. Accordingly RΜ is irreflexive.
Solution (Reverse): If RΜ is irreflexive, then (a,a) β RΜ , β a β A. Hence by definition of RΜ , (a,a) β R, β a β A. Accordingly R is reflexive.
Exercise: Suppose R is a symmetric relation on a set A. Is RΜ also symmetric?
Solution: Let (a,b) β RΜ . Then by definition of RΜ , (a,b) β R. Since R is symmetric, if (a,b) β R then (b,a) β R (for (b,a) β R and (a,b) β R would contradict the symmetry property of R). Now (b,a) β R β (b,a) β RΜ . Hence if (a,b) β RΜ then (b,a) β RΜ . Thus RΜ is also symmetric.
π‘ Why this matters: The complementary relation preserves symmetry, which is useful for understanding how properties transfer between a relation and its complement.
Composite Relation
Let R be a relation from a set A to a set B and S a relation from B to a set C. The composite of R and S denoted SβR is the relation from A to C, consisting of ordered pairs (a,c) where a β A, c β C, and for which there exists an element b β B such that (a,b) β R and (b,c) β S.
π Definition β Composite Relation: SβR = {(a,c) | a β A, c β C, β b β B, (a,b) β R and (b,c) β S}
Example: Define R = {(a,1), (a,4), (b,3), (c,1), (c,4)} as a relation from A to B and S = {(1,x), (2,x), (3,y), (3,z)} as a relation from B to C. Hence SβR = {(a,x), (b,y), (b,z), (c,x)}
Composite Relation from Arrow Diagram
Let A = {a,b,c}, B = {1,2,3,4} and C = {x,y,z}. Define relation R from A to B and S from B to C by an arrow diagram. The composite relation SβR can be traced by following paths from A through B to C.
Matrix Representation of Composite Relation
The matrix representation of the composite relation can be found using the Boolean product of the matrices for the relations. If Mα΄Ώ and MΛ’ are the matrices for relations R (from A to B) and S (from B to C), then MΛ’βα΄Ώ = Mα΄Ώ β MΛ’ is the matrix for the composite relation SβR from A to C.
Boolean Arithmetic Rules:
- Boolean Addition: 1 + 1 = 1, 1 + 0 = 1, 0 + 0 = 0
- Boolean Multiplication: 1 Β· 1 = 1, 1 Β· 0 = 0, 0 Β· 0 = 0
Exercise: Find the matrices representing the relations SβR and RβS where the matrices representing R and S are:
[1 0 1] [0 1 0]
M_R = [1 1 0] M_S = [0 0 1]
[0 0 0] [1 0 1]
Solution: The matrix representation for SβR is:
MΛ’βα΄Ώ = Mα΄Ώ β MΛ’
[1 0 1] [0 1 0] [1 1 1]
[1 1 0] β [0 0 1] = [0 1 1]
[0 0 0] [1 0 1] [0 0 0]
The matrix representation for RβS is:
Mα΄ΏβΛ’ = MΛ’ β Mα΄Ώ
[0 1 0] [1 0 1] [1 1 0]
[0 0 1] β [1 1 0] = [0 0 1]
[1 0 1] [0 0 0] [1 0 1]
Exercise: Let R and S be reflexive relations on a set A. Prove SβR is reflexive.
Solution: Since R and S are reflexive relations on A, β a β A, (a,a) β R and (a,a) β S. By definition of the composite relation SβR, (a,a) β SβR β a β A. Accordingly SβR is also reflexive.
β Key Takeaways
The inverse of a relation is formed by swapping the coordinates of each ordered pair, and it preserves key properties including reflexivity, symmetry, transitivity, and antisymmetry. A relation is symmetric if and only if it equals its own inverse. The complementary relation consists of all pairs not in the original relation, and it is irreflexive exactly when the original is reflexive. Composite relations combine two relations through an intermediate set, and their matrix representation uses Boolean product. The composition of reflexive relations is always reflexive.
π§ Quick Revision Questions
- How is the inverse relation Rβ»ΒΉ defined from a given relation R?
- If a relation R is reflexive, what property does Rβ»ΒΉ have?
- What is the condition for a relation R to be symmetric in terms of its inverse?
- How is the complementary relation RΜ defined?
- What is the Boolean product rule for 1 Β· 1 in matrix representation of composite relations?
π Lecture 15 β Functions
π Overview: This lecture introduces the formal definition of a function as a special type of relation, contrasting functions with non-functions through examples and arrow diagrams. It covers fundamental concepts including domain, co-domain, range, well-definedness, image and inverse image of sets, and binary operations, establishing the foundational language for discrete mathematics and computer science.
ποΈ Topics Covered
The lecture covers relations and functions, including the two formal conditions for a function; arrow diagrams and the vertical line test; range of a function; graph of a function; counting functions and binary relations between sets; well-defined functions; image and inverse image of a set; and binary operations as functions from AΓA to A.
π Lecture Summary
RELATIONS AND FUNCTIONS
A function F from a set X to a set Y is a relation from X to Y that satisfies two properties. First, for every element x in X, there is an element y in Y such that (x,y) β F β every element of X is the first element of some ordered pair of F. Second, for all elements x in X and y and z in Y, if (x,y) β F and (x,z) β F, then y = z β no two distinct ordered pairs in F have the same first element.
π Definition β Function: A function f from a set X to a set Y is a relationship between elements of X and elements of Y such that each element of X is related to a unique element of Y, denoted f: X β Y.
Domain of f is X, co-domain of f is Y. The value f(x) is called f of x, or the image of x under f.
π Example: Which relations define functions from X = {2,4,5} to Y={1,2,4,6}? Rβ = {(2,4), (4,1)} β Not a function because 5 β X does not appear as first element Rβ = {(2,4), (4,1), (4,2), (5,6)} β Not a function because (4,1) and (4,2) have same first element but different second elements Rβ = {(2,4), (4,1), (5,6)} β Defines a function because every element of X is first element and no pair has same first with different second
ARROW DIAGRAM OF A FUNCTION
The definition of a function implies the arrow diagram has two properties: (1) Every element of X has an arrow coming out of it. (2) No two arrows from the same element of X point to two different elements of Y.
π Example: Let X = {a, b, c} and Y={1,2,3,4}. A function f from X to Y by arrow diagram has f(a) = 2, f(b) = 4, and f(c) = 2. The diagram satisfies both conditions.
FUNCTIONS AND NONFUNCTIONS
Which arrow diagrams define functions from X = {2,4,5} to Y = {1,2,4,6}? Diagram (a) is Not a function because 5βX has no arrow. Diagram (b) is Not a function because 4βX has two arrows to different elements.
RANGE OF A FUNCTION
Let f: XβY. The range of f consists of those elements of Y that are images of elements of X. Symbolically, Range of f = {y β Y | y = f(x), for some x β X}. The range is always a subset of the co-domain. The range is also called the image of X under f. When y = f(x), x is called the pre-image of y.
π Example: Determine range for functions from X = {2,4,5} to Y = {1,2,4,6}: f: Range = {1, 6}; g = {(2,6), (4,2), (5,1)}: Range = {1, 2, 6}; h(2)=4, h(4)=4, h(5)=1: Range = {1, 4}
GRAPH OF A FUNCTION
Let f be a real-valued function of a real variable, f:RβR. The graph of f is the set of all points (x,y) in the Cartesian coordinate plane with x in the domain and y = f(x).
π Example: Graph of y = xΒ²: Points include (-3,9), (-2,4), (-1,1), (0,0), (1,1), (2,4), (3,9).
VERTICAL LINE TEST FOR THE GRAPH OF A FUNCTION
For a graph to be the graph of a function, any given vertical line in its domain intersects the graph in at most one point.
π Example: The relation x = yΒ² is not a function because a vertical line intersects the graph at two points (e.g., at x=4, points (4,2) and (4,-2)).
π Example: Find all functions from X = {a,b} to Y = {u,v}: There are 4 functions β (1) f(a)=u, f(b)=u; (2) f(a)=u, f(b)=v; (3) f(a)=v, f(b)=u; (4) f(a)=v, f(b)=v.
π Example: Find four binary relations from X = {a,b} to Y = {u,v} that are not functions: (1) No arrow from a; (2) No arrow from b; (3) No arrows from either; (4) a has two arrows.
NUMBER OF FUNCTIONS
π Formula: Number of functions from a set with m elements to a set with n elements = n^m
π Example: How many functions from a set with 3 elements to a set with 4 elements? Each of the 3 elements can map to any of 4 elements: 4 Γ 4 Γ 4 = 4Β³ = 64
π Example: Suppose A has m elements and B has n elements: Number of binary relations from A to B = 2^(mΒ·n) Number of functions from A to B = n^m Fraction of binary relations that are functions = n^m / 2^(mΒ·n)
FUNCTIONS NOT WELL DEFINED
A function f: X β Y is well defined iff β xβ, xβ β X, if xβ = xβ then f(xβ) = f(xβ).
π Example: Determine whether f is a function from Z to R: f(n) = Β±n β Not well defined: each integer has two images +n and -n f(n) = 1/(nΒ²-4) β Not well defined: f(2) and f(-2) are undefined f(n) = β(nΒ²+1) β Not well defined for n<0: imaginary values f(n) = β(nΒ²+1)/2 β Well defined: each integer has unique real image
π Example: Student C defines h: QβQ by h(m/n) = m/n. Student D claims h is not well defined. h(1/2) = (1/2)/2 = 1/4. h(2/4) = (2/4)/4 = 2/16 = 1/8. But 1/2 = 2/4, yet h(1/2) β h(2/4). So h is not well defined.
π Example: Let g: RβRβΊ be defined by g(x) = xΒ²+1. To show g is well defined: If xβ = xβ, then xβΒ² = xβΒ², so xβΒ²+1 = xβΒ²+1, thus g(xβ) = g(xβ). Domain = R, Co-domain = RβΊ. Range = all real numbers β₯ 1, i.e., [1,β) because xΒ² β₯ 0 implies xΒ²+1 β₯ 1.
IMAGE OF A SET
Let f: XβY be a function and A β X. The image of A under f is f(A) = {y β Y | y = f(x), for some x in A}.
π Example: Let X = {1,2,3,4}, Y = {a,b,c}, A = {1,2}, B = {2,3}, with f(1)=a, f(2)=b, f(3)=b, f(4)=c. Then f(A) = {b} and f(B) = {b,c}.
INVERSE IMAGE OF A SET
Let f: XβY be a function and C β Y. The inverse image of C under f is fβ»ΒΉ(C) = {x β X | f(x) β C}.
π Example: Let C = {a}, D = {b,c}, E = {d}. Then fβ»ΒΉ(C) = {1,2}, fβ»ΒΉ(D) = {3,4}, fβ»ΒΉ(E) = β .
SOME RESULTS ON IMAGES AND INVERSE IMAGES
Let f: XβY, A,B β X, C,D β Y:
- If A β B then f(A) β f(B)
- f(AβͺB) = f(A) βͺ f(B)
- f(Aβ©B) β f(A) β© f(B)
- f(A-B) β f(A) - f(B)
- If C β D, then fβ»ΒΉ(C) β fβ»ΒΉ(D)
- fβ»ΒΉ(CβͺD) = fβ»ΒΉ(C) βͺ fβ»ΒΉ(D)
- fβ»ΒΉ(Cβ©D) = fβ»ΒΉ(C) β© fβ»ΒΉ(D)
- fβ»ΒΉ(C-D) = fβ»ΒΉ(C) - fβ»ΒΉ(D)
BINARY OPERATIONS
A binary operation ββ defined on a set A assigns to each ordered pair (a, b) of elements of A, a uniquely determined element ab of A. A binary operation takes two elements of A and maps them to a third element of A.
A binary operation on a set A is a function from A Γ A to A, i.e., *: AΓA β A. (a,b) is more commonly written as ab.
π Example: β+β and βΒ·β are binary operations on N. βββ is not a binary operation on N but is on Z. βΓ·β is a binary operation on Q-{0} but not on Z.
π Example: Set operations union (βͺ), intersection (β©), and set difference (β) are binary operations on the power set P(A) of any set A. Logical connectives β¨, β§, β, β are binary operations on {T, F}. Logic gates OR and AND are binary operations on {0,1}. Logic gate NOT is a unary operation on {0,1}.
π‘ Why this matters: The distinction between functions and general relations is fundamental to computer science β every program function, database query, and circuit must be well-defined and deterministic. Binary operations form the basis of arithmetic, logic gates, and algebraic structures.
β Key Takeaways
A function is a relation where every element of the domain maps to exactly one unique element in the co-domain, which can be tested using arrow diagrams (every element must have exactly one outgoing arrow) or the vertical line test on graphs. The number of functions from an m-element set to an n-element set is n^m. A function is well-defined only if equal inputs always produce equal outputs β a critical property for correctness. The image and inverse image of sets extend functions from individual elements to subsets, with specific algebraic properties.
π§ Quick Revision Questions
- What are the two formal conditions that a relation must satisfy to be considered a function?
- If set A has 5 elements and set B has 3 elements, how many functions exist from A to B? How many binary relations from A to B?
- Why is h(m/n) = m/n not a well-defined function from Q to Q?
- What is the difference between the range and the co-domain of a function?
- What properties hold for the inverse image of a union? fβ»ΒΉ(C βͺ D) = ?