150 likes | 301 Views
CSNB143 – Discrete Structure. Topic 8 – Function. Topic 8 – Function. Learning Outcomes Students should be able to understand function and know how it maps. Students should be able to identify different type of function and solve it. Topic 8 – Function. Understanding function
E N D
CSNB143 – Discrete Structure Topic 8 – Function
Topic 8 – Function Learning Outcomes • Students should be able to understand function and know how it maps. • Students should be able to identify different type of function and solve it.
Topic 8 – Function Understanding function • Function is a special type of relation • A function f from A to B is written as we write a normal relation f : A B • The rule is for all a Dom (f), f(a) contains just one element of B. If a is not in Dom (f), then f(a) = . • The element a is called an argument of the function f and f(a) is called the value of the function for the argument a and is also referred to as the image of a under f
Topic 8 – Function Understanding function • The rule for f : A B is for all a Dom (f), f(a) contains just one element of B. If a is not in Dom (f), then f(a) = . • Example: Let A = {1, 2, 3, 4} and B = {a, b, c, d} and let f = {(1, a), (2, a), (3, d), (4, c)} We have f(1) = a f(2) = a f(3) = d f(4) = c Since each set f(n) is a single value, f is a function.
Topic 8 – Function Understanding function • Another example: Let A = {1, 2, 3} and B = {x, y, z}. Consider the relations R = {(1, x), (2, x), (3, x)} S = {(1, x), (1, y), (2, z), (3, y)} T = {(1, z), (2, y)} Determine if the relations R, S and T are functions • Relation R is a function with Dom(R) = {1, 2, 3} and Ran(R) = {x}. • Relation S is not a function since S(1) = {x, y}. It shows that element 1 has two images under f. Note that if the elements have two or more images or value, it is not a function. • Relation T is not a function since 3 has no image under f.
Topic 8 – Function Special types of function Let f be a function from A to B,
Topic 8 – Function Special types of function • Example: Let A = {1, 2, 3, 4} and B = {a, b, c, d} and let f = {(1, a), (2, a), (3, d), (4, c)}. Determine the type of function f is
Topic 8 – Function Special types of functions • Another example: Let A = {a1, a2, a3}; B = {b1, b2, b3}; C = {c1, c2} and D = {d1, d2, d3, d4}. Consider the following four functions, from A to B, A to D, B to C, and D to B respectively Identify the types of each function • f = {(a1, b2), (a2, b3), (a3, b1)} • f = {(a1, d2), (a2, d1), (a3, d4)} • f = {(b1, c2), (b2, c2), (b3, c1)} • f = {(d1, b1), (d2, b2), (d3, b1)}
Topic 8 – Function Invertible function • A function f: A B is said to be invertible if its reverse relation, f -1 is also a function • Example: Consider f = {(1, a), (2, a), (3, d), (4, c)}. therefore, f -1 = {(a, 1), (a, 2), (d, 3), (c, 4)} • We can clearly see that f -1 is not a function because f -1 (a) = {1, 2}. So f is not an invertible function. Note that if the elements have two or more images or value, it is not a function.
Topic 8 – Function Permutation Function • This is a part in which set A have a relation to itself. Set A is finite set. • In this case, a function must be ontoand one-to-one. • A bijection from a set A to itself is called a permutation of A. • Example:
Topic 8 – Function Permutation Function • Find a) P4-1 b) P3P2 a) See that P4 is a one-to-one function, we have P4 = {(1, 3), (2, 1), (3, 2)} So, P4-1 = {(3, 1), (1, 2), (2, 3)} b)
Topic 8 – Function Cyclic Permutations • The composition of two permutations is another permutation, usually referred to as the product of these permutations. • If A = {a1, a2, …, an} is a set contained n elements, so there will be n! = n.(n – 1)… 2.1 permutation for A. Let b1, b2, …. br are r elements of set A = {a1, a2, ….. an}. Permutation for P: A A is given by: P(b1) = b2 P(b2) = b3 . . P(br) = b1 P(x) = x if x A, x {b1, b2, … br}
Topic 8 – Function Cyclic Permutations Example: Rule: P(b1) = b2 P(b2)= b3 P(x) = x P(br) = b1
Topic 8 – Function Cyclic Permutations • Example: Let A = {1, 2, 3, 4, 5, 6}. Find: • (4, 1, 3, 5) (5, 6, 3) • (5, 6, 3) (4, 1, 3, 5)