1 / 52

(CSC 102)

(CSC 102). Discrete Structures. Lecture 19. Previous Lecture Summery. Properties of relations Reflexive, Symmetric and Transitive Relations Equivalence Relations Properties of Congruence Modulo n Transitive closure of a relations Combining Relations Partial Order Relations

Download Presentation

(CSC 102)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. (CSC 102) Discrete Structures Lecture 19

  2. Previous Lecture Summery • Properties of relations • Reflexive, Symmetric and Transitive Relations • Equivalence Relations • Properties of Congruence Modulo n • Transitive closure of a relations • Combining Relations • Partial Order Relations • Hasse Diagrams

  3. Functions

  4. Today’s Lecture • Relations and Functions • Definition of Function • Examples of Functions • One-to-One Function • Onto Function • Bijective Function (One-to-One correspondence) • Inverse Functions

  5. Relations If we want to describe a relationship between elements of two sets A and B, we can use ordered pairs with their first element taken from A and their second element taken from B. Since this is a relation between two sets, it is called a binary relation. Definition:Let A and B be sets. A binary relation R from A to B is a subset of AB. In other words, for a binary relation R we have R  AB. We use the notation aRb to denote that (a, b)R and aRb to denote that (a, b)R.

  6. Relations If we have two sets A = {1,2,3,4,5} and B = {5,6,7,8,9} The cartesian product of A and B is A × B = { (1,5), (1,6), (1,7), (1,8), (1,9), (2,5), (2,6), (2,7), (2,8), (2,9), (3,5), (3,6), (3,7), (3,8), (3,9), (4,5), (4,6), (4,7), (4,8), (4,9), (5,5), (5,6), (5,7), (5,8), (5,9) }. The rule is to add 4: R = { (1,5), (2,6), (3,7), (4,8), (5,9) }. The domain is the set of all values which are first members of the ordered pairs in the relation, i.e., Dom (R) = {1, 2, 3, 4, 5} The range is the set of all values which are second members of the ordered pairs in the relation, i.e., Range (R) = {5, 6, 7, 8, 9}

  7. Relations One to One Relations The Rule is ‘ADD 4’ 1 2 3 4 5 5 6 7 8 9 Dom (R) = {1, 2, 3, 4, 5} Range (R) = {5, 6, 7, 8, 9}

  8. Relations Many to Many relation Has Visited Paris London Dubai New York Cyprus Ahmed Peter Ali Jaweria Hamad     Dom (R) = {Ahmad, Peter, Jaweria, Hamad} Range (R) = {Paris, London, Dubai, New York, Cyprus} Note That: Ali is not in the Domain

  9. Relations (Many to One relation) Person Has A Mass of Kg  Bilal Peter Salman Ali George Aziz 62 64 66      Range (R) = {62, 64, 66} Dom (R) = {Bilal, Peter, Salman, Ali, George,Aziz}

  10. Relations (One to Many relation) Is the length of cm object Pen Pencil Ruler Needle Stick  14 30    Range (R) = {14, 30} Range (R) = {Pen, Pencil, Ruler, Needle, Stick}

  11. Relations • Many to One Relationship One to One Relationship • One to Many Relationship Many to Many Relationship

  12. 1 2 2 4 3 6 4 8 10 5 Set A is the domain Set B is the Codomain Function A functionf from set A to set B is a relation (rule of correspondence) that assigns each element x in the set A to exactly one element y in the set B. No x has more than one y assigned All x’s are assigned 1). Must use all the x’s in A. 2). The x value can only be assigned to one y in B.

  13. Function (Definition)

  14. Function (Arrow diagrams) If X and Y are finite sets, you can define a function f from X to Y by drawing an arrow diagram. You make a list of elements in X and a list of elements in Y, and draw an arrow from each element in X to the corresponding element in Y.

  15. Functions and non functions Which of the arrow diagrams define functions from X = {a, b, c} to Y = {1, 2, 3, 4}?

  16. Function (Inverse Image) Definition

  17. Functions defined by Arrow diagrams

  18. Examples of Functions The Identity Function on a Set Given a set X, define a function IXfrom X to X by IX (x) = x, for all x in X. The function IXis called the identity function on X because it sends each element of X to the element that is identical to it. Thus the identity function can be pictured as a machine that sends each piece of input directly to the output chute without changing it in any way.

  19. Examples of Functions A Function defined on a power Set P(A) denotes the set of all subsets of the set A. Define a function F: P({a, b, c}) →Znonnegas follows: For each X ∈ P({a, b, c}), F(X) = the number of elements in X. Draw an arrow diagram for F.

  20. Examples of Functions A Boolean Function Consider the three-place Boolean function defined from the set of all 3-tuples of 0’s and 1’s to {0, 1} as follows: For each triple (x1, x2, x3) of 0’s and 1’s, f (x1, x2, x3) = (x1 + x2 + x3) mod 2. Describe f using an input/output table. f (1, 1, 1) = (1 + 1 + 1) mod 2 = 3 mod 2 = 1 f (1, 1, 0) = (1 + 1 + 0) mod 2 = 2 mod 2 = 0

  21. Examples of Functions A Boolean Function

  22. Checking Whether a Function Is Well Defined • It can sometimes happen that what appears to be a function defined by a rule is not really a function at all. To give an example, suppose we wrote, “Define a function f : R → R by specifying that for all real numbers x, • f (x) is the real number y such that x2 + y2 = 1. • There are two distinct reasons why this description does not define a function. For almost all values of x, • there is no y that satisfies the given equation • there are two different values of y that satisfy the equation. For instance, when x = 2, there is no real number y such that x2 + y2 = 1, and when x = 0, both y = −1 and y = 1 satisfy the equation x2 + y2 = 1. • In general, we say that a “function” is not well defined if it fails to satisfy at least one of the requirements for being a function.

  23. Checking Whether a Function Is Well Defined A Function That Is Not Well Defined

  24. Sum/difference of Functions Let F: R → R and G: R → R be functions. Define new functions F + G: R → R: For all x ∈ R, (F + G)(x) = F(x) + G(x) F and G must have same Domains and Codomains.

  25. Equality of Functions Theorem: If F: X → Y and G: X → Y are functions, then F = G if, and only if, F(x) = G(x) for allx ∈ X. Example

  26. One-to-One Functions

  27. One-to-One Functions The Rule is ‘ADD 4’ 1 2 3 4 5 5 6 7 8 9 Codomain(R)={5, 6, 7, 8, 9,10} Dom (R) = {1, 2, 3, 4, 5}

  28. One-to-One Functions Identifying One-to-One functions defined on sets

  29. One-to-One Functions on Infinite Sets

  30. One-to-One Functions on Infinite Sets

  31. One-to-One Functions on Infinite Sets

  32. One-to-One Functions on Infinite Sets

  33. Onto Functions on Sets

  34. Onto Functions on Sets

  35. Onto Functions on Sets Identifying Onto Functions

  36. Onto Functions on Infinite Sets

  37. Onto Functions on Infinite Sets

  38. Onto Functions on Infinite Sets To prove that f is onto, you must prove ∀y ∈ Y, ∃x ∈ X such that f (x) = y. • There exists real number x such that y = f(x)? • Does f really send x to y?

  39. Onto Functions on Infinite Sets

  40. Onto Functions on Infinite Sets

  41. Onto Functions on Infinite Sets

  42. One-to-One Correspondence (Bijection)

  43. One-to-One Correspondence (Bijection)

  44. Inverse Functions Theorem The function F-1 is called inverse function.

  45. Finding an Inverse Function The function f : R → R defined by the formula f (x) = 4x − 1, for all real numbers x

More Related