Professional Documents
Culture Documents
1
Introduction to Relations Domain and Range
n A Binary Relation between sets A and B is a n The Domain of a relation R is the set of all first
subset of A × B. In other word, a binary relation is elements of the ordered pair which belong to R,
a collection of ordered pairs from A × B. and the Range of R is the set of second elements.
n If A and B are equal, this relation is called
n A relation is also written as aRb.
Relation on the Set A.
n Example:
n Since relation R is a subset of A × B, any relation
R has a complementary relation R, which is the u If A = {1, 2, 3}, B = {a, b, c}, and R = {(1, b),
complement of the set R relative A × B. (1, c), (3, b)}. For this relation 1Rb, 1Rc, 3Rb,
n (Do Ex. 1 & 2) domain = {1, 3}, range = {b, c}.
n (Do Ex. 3)
n (Do Ex. 4 – 7)
CS218 © Peter Lo 2004 7 CS218 © Peter Lo 2004 8
2
Matrix Representation of a
Properties of Relations
Relation
n Let A be a set with n elements, and let B be a set with m n Reflexive
elements and R be a relation between A and B.
n Symmetric
u A = {a1, a2, … , an}
n Transitive
uB = {b1, b2, … , bm }
n Matrix M is called the Logical Matrix for R if n Irreflexive
True ∀ (ai , b j ) ∈ R n Antisymmetric
M (i, j ) =
False ∀ (ai , b j ) ∉ R
n (Do Ex. 8)
Reflexive Symmetric
n Let R be a subset of A × A. Then R is called a n Let R be a subset of A × A. Then R is called a
Reflexive Relation if ∀x∈A, (a, a)∈R. Symmetric Relation if (a, b)∈R ⇒ (b, a)∈R.
n The direct graph of every reflexive relation n The matrix representation for the symmetric
includes an arrow from every point to the point relations are symmetric with respect to the main
itself. diagonal.
3
Transitive Irreflexive
n A relation R in a set A is called a Transitive n A Relation R on a set S is Irreflexive Relation if
Relation if ((a, b)∈R ∩ (b, c)∈R) ⇒ (a, c)∈R. x R x, ∀x∈R.
n Example: n Example:
u Let W = {a, b, c}, and let u The relation on the set {a, b, c} given by the set
R = {(a, b), (c, b), (b, a), (a, c)}. of order pairs {(a, b), (b, c), (c, a)} is irreflexive,
u Then R is not a transitive relation because
because it does not contain any of the ordered
pairs (a, a), (b, b) and (c, c).
(c, b) ∈R and (b, a) ∈R but (c, a) ∉ R.
4
Equivalence Relations Example
n A relation is an Equivalence Relation if it is n Provide that the relation = of equality on any set S
reflexive, symmetric and transitive and is denoted is an equivalence relation.
as ~. u (1) a = a for every a in S; (Reflexive property)
property)
u Therefore, S is an equivalent relation.
5
Answer Universal and Empty Relations
n By definition, the a|b means that the number b/a is an integer. n Universal Relation
We need to verify reflexivity, antisymmetry, and transitivity.
u Let A be any set, then A × A is known as the
u Reflexivity: ∀n∈Z+ , n|n as n/n is 1
Universal Relation.
u Antisymmetry : If n|m and m|n, then m/n and n/m are
both integers. Since n/m = (m/n)-1, the integer n/m has n Empty Relation
the property that its reciprocal is also an integer. The u Let A be any set, then ∅ is called the Empty
only such positive integer is 1, and so n/m = 1, i.e. n = m. Relation.
u Transitivity: If n|m and m|p, then p/n = (n/m) x (m/n) is
an integer, since it is the product of two other integers.
n It follows that “|” is a partial ordering.
6
Introduction to Functions Elements of a Function
n A Function is an association of exactly one object n Functions are often referred to as Mappings or
Transformations.
from one set (the range) with each object from
n The unique element y = f (x) of B assigned to x∈A by f is
another set (the domain). called the Image of x under f.
n This means that there must be at least one arrow n f: A→B indicate f is a function from A to B. The set A is
leaving each point in the domain, and further that called the Domain of f, and set B is called Codomain of f.
there can be no more than one arrow leaving each n The range of f denoted by f [A], is the set of all images:
point in the domain. f [A] = {f(x) | x ∈A}
n The Pre -image or Inverse Image of a set B contained in
n (Do Ex. 12) the range of f is denoted by f -1(B) and is the subset of the
domain whose members have images in b.
t √(xy) – codmain
7
Types of Functions Injection
n Injections n Let f: A→B be a function. The function f is called
n Surjections an Injective Function, or an Injection if ∀x, y∈A,
n Bijections f (x) = f (y) ⇒ x = y.
n An injective function is also called a One-to-one
or 1-1 Function.
Surjection Bijection
n Let f: A→B be a function. The function f is called n If a function is both 1-1 and Onto, it is called a
a Surjective Function, or a Surjection if ∃ x∈A, Bijective Function, or a Bijection.
∀y∈B, f (x) = y. n A bijection from a set A to itself is called a
n A surjective function is also called an Onto Permutation of the set A.
Function.
8
Example Example
n Use counter example, show the function f: Zà Z n Give f: Z à Z, Show f(x) = (x 2 +1)/2 whether it is or not
is defined by the rule f(x) = 4x2 – 1 for x∈Z is not u 1 to 1 Function
n Answer n Answer
u f(x) is not 1 to 1 function since (-1, 2) and (1,2) ∈ f(x).
u f(x) = 4x2 – 1 is not a 1-to-1 function since (-1,
u f(x) is not onto function since –5 in domain B but no x
3) and (1,3) exist
in domain B.
t -5 = (x 2 +1)/2 => -11 = x 2 => impossible.
9
Operations of Functions Equal Functions
n Equal Functions n Two functions f and g are said to be equal if they
n Sum of Functions have the same domain and codomain, and for all x
n Difference of Functions in the domain, f (x) = g(x).
n Example
n Product of Functions
u Let f (x) = (6x – 4) /2 and g(x) = 3x – 2.
n Quotient of Functions
u Then f = g, since they both have the same
n Composite Functions
domain and codomain, and for all x in the
n Invertible Functions
domain f(x) = g(x).
10
Composite Functions Example
n Since functions are subset of relation, we can form n Let f (x) = 3x + 5 and g(x) = 4x – 3, find (f o g)(x)
the composition of two function into a Composite n (f o g)(x)
Function.
n = f (g(x))
n The composition of two functions f and g relates
an element a to an element c if there is some n = f (4x-3)
element b such that b = f(a) and c = g(b). n = 3(4x – 3) + 5
n Given two functions f and g, the composite n =12x –9 +5
function, denoted by f o g is defined by
n = 12x – 4
(f o g)(x) = f (g(x))
11
Difference between Function and
Relation
n In a function, no two distinct ordered pairs have
the same first element.
12