functions
play

Functions Aritra Hazra Department of Computer Science and - PowerPoint PPT Presentation

Functions Aritra Hazra Department of Computer Science and Engineering, Indian Institute of Technology Kharagpur, Paschim Medinipur, West Bengal, India - 721302. Email: aritrah@cse.iitkgp.ac.in Autumn 2020 Aritra Hazra (CSE, IITKGP) CS21001 :


  1. Properties of Functions Number of Functions: Let A = { a 1 , . . . , a m } ( |A| = m ) and B = { b 1 , . . . , b n } ( |B| = n ). f : A → B is described as, { ( a 1 , x 1 ) , ( a 2 , x 2 ) , . . . , ( a m , x m ) } . So, Total Count = n m = |B| |A| (by rule-of-product). Image of Subset: If f : A → B and A ′ ⊆ A , then f ( A ′ ) = { b ∈ B | b = f ( a ) } (for some a ∈ A ′ ), and f ( A ′ ) is called the image of A ′ under f . Restriction: If f : A → B and A ′ ⊆ A , then f | A ′ : A ′ → B is called the restriction of f to A ′ if f | A ′ ( a ) = f ( a ) for all a ∈ A ′ . Extension: Let A ′ ⊆ A and f : A ′ → B . If g : A → B and g ( a ) = f ( a ) for all a ∈ A ′ , then g is called an extension of f to A . Let f : A → B , with A 1 , A 2 ⊆ A . Then, (i) If A 1 ⊂ A 2 ⇒ f ( A 1 ) ⊆ f ( A 2 ), (ii) f ( A 1 ∪ A 2 ) = f ( A 1 ) ∪ f ( A 2 ), and (iii) f ( A 1 ∩ A 2 ) ⊆ f ( A 1 ) ∩ f ( A 2 ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 17

  2. Properties of Functions Number of Functions: Let A = { a 1 , . . . , a m } ( |A| = m ) and B = { b 1 , . . . , b n } ( |B| = n ). f : A → B is described as, { ( a 1 , x 1 ) , ( a 2 , x 2 ) , . . . , ( a m , x m ) } . So, Total Count = n m = |B| |A| (by rule-of-product). Image of Subset: If f : A → B and A ′ ⊆ A , then f ( A ′ ) = { b ∈ B | b = f ( a ) } (for some a ∈ A ′ ), and f ( A ′ ) is called the image of A ′ under f . Restriction: If f : A → B and A ′ ⊆ A , then f | A ′ : A ′ → B is called the restriction of f to A ′ if f | A ′ ( a ) = f ( a ) for all a ∈ A ′ . Extension: Let A ′ ⊆ A and f : A ′ → B . If g : A → B and g ( a ) = f ( a ) for all a ∈ A ′ , then g is called an extension of f to A . Let f : A → B , with A 1 , A 2 ⊆ A . Then, (i) If A 1 ⊂ A 2 ⇒ f ( A 1 ) ⊆ f ( A 2 ), (ii) f ( A 1 ∪ A 2 ) = f ( A 1 ) ∪ f ( A 2 ), and (iii) f ( A 1 ∩ A 2 ) ⊆ f ( A 1 ) ∩ f ( A 2 ). Proof: (ii) For each b ∈ B , b ∈ f ( A 1 ∩ A 2 ) ⇒ b = f ( a ), for some a ∈ ( A 1 ∩ A 2 ) ⇒ [ b = f ( a ) for some a ∈ A 1 ] ∧ [ b = f ( a ) for some a ∈ A 2 ] ⇒ b ∈ f ( A 1 ) ∧ b ∈ f ( A 2 ) ⇒ b ∈ f ( A 1 ) ∩ f ( A 2 ), implying the result. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 17

  3. Properties of Functions Number of Functions: Let A = { a 1 , . . . , a m } ( |A| = m ) and B = { b 1 , . . . , b n } ( |B| = n ). f : A → B is described as, { ( a 1 , x 1 ) , ( a 2 , x 2 ) , . . . , ( a m , x m ) } . So, Total Count = n m = |B| |A| (by rule-of-product). Image of Subset: If f : A → B and A ′ ⊆ A , then f ( A ′ ) = { b ∈ B | b = f ( a ) } (for some a ∈ A ′ ), and f ( A ′ ) is called the image of A ′ under f . Restriction: If f : A → B and A ′ ⊆ A , then f | A ′ : A ′ → B is called the restriction of f to A ′ if f | A ′ ( a ) = f ( a ) for all a ∈ A ′ . Extension: Let A ′ ⊆ A and f : A ′ → B . If g : A → B and g ( a ) = f ( a ) for all a ∈ A ′ , then g is called an extension of f to A . Let f : A → B , with A 1 , A 2 ⊆ A . Then, (i) If A 1 ⊂ A 2 ⇒ f ( A 1 ) ⊆ f ( A 2 ), (ii) f ( A 1 ∪ A 2 ) = f ( A 1 ) ∪ f ( A 2 ), and (iii) f ( A 1 ∩ A 2 ) ⊆ f ( A 1 ) ∩ f ( A 2 ). Proof: (ii) For each b ∈ B , b ∈ f ( A 1 ∩ A 2 ) ⇒ b = f ( a ), for some a ∈ ( A 1 ∩ A 2 ) ⇒ [ b = f ( a ) for some a ∈ A 1 ] ∧ [ b = f ( a ) for some a ∈ A 2 ] ⇒ b ∈ f ( A 1 ) ∧ b ∈ f ( A 2 ) ⇒ b ∈ f ( A 1 ) ∩ f ( A 2 ), implying the result. (i) and (ii) Left for You as an Exercise! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 17

  4. One-to-One or Injective Functions One-to-one (Injective) Function: f : A → B is a one-to-one (or injective) function, if each element in B appears at most once as image of an element of A . For arbitrary sets A , B , f : A → B is one-to-one if and only if ∀ a 1 , a 2 ∈ A , f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 17

  5. One-to-One or Injective Functions One-to-one (Injective) Function: f : A → B is a one-to-one (or injective) function, if each element in B appears at most once as image of an element of A . For arbitrary sets A , B , f : A → B is one-to-one if and only if ∀ a 1 , a 2 ∈ A , f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 . If f : A → B is one-to-one with A , B finite, then |A| ≤ |B| . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 17

  6. One-to-One or Injective Functions One-to-one (Injective) Function: f : A → B is a one-to-one (or injective) function, if each element in B appears at most once as image of an element of A . For arbitrary sets A , B , f : A → B is one-to-one if and only if ∀ a 1 , a 2 ∈ A , f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 . If f : A → B is one-to-one with A , B finite, then |A| ≤ |B| . Examples: (i) f : R → R where f ( x ) = 2 x + 1 , ∀ x ∈ R is one-to-one; because for all x 1 , x 2 ∈ R , we have f ( x 1 ) = f ( x 2 ) ⇒ 2 x 1 + 1 = 2 x 2 + 1 ⇒ x 1 = x 2 . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 17

  7. One-to-One or Injective Functions One-to-one (Injective) Function: f : A → B is a one-to-one (or injective) function, if each element in B appears at most once as image of an element of A . For arbitrary sets A , B , f : A → B is one-to-one if and only if ∀ a 1 , a 2 ∈ A , f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 . If f : A → B is one-to-one with A , B finite, then |A| ≤ |B| . Examples: (i) f : R → R where f ( x ) = 2 x + 1 , ∀ x ∈ R is one-to-one; because for all x 1 , x 2 ∈ R , we have f ( x 1 ) = f ( x 2 ) ⇒ 2 x 1 + 1 = 2 x 2 + 1 ⇒ x 1 = x 2 . (ii) g : R → R where g ( x ) = x 2 + x , ∀ x ∈ R is NOT one-to-one; because g ( − 1) = 0 and g (0) = 0. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 17

  8. One-to-One or Injective Functions One-to-one (Injective) Function: f : A → B is a one-to-one (or injective) function, if each element in B appears at most once as image of an element of A . For arbitrary sets A , B , f : A → B is one-to-one if and only if ∀ a 1 , a 2 ∈ A , f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 . If f : A → B is one-to-one with A , B finite, then |A| ≤ |B| . Examples: (i) f : R → R where f ( x ) = 2 x + 1 , ∀ x ∈ R is one-to-one; because for all x 1 , x 2 ∈ R , we have f ( x 1 ) = f ( x 2 ) ⇒ 2 x 1 + 1 = 2 x 2 + 1 ⇒ x 1 = x 2 . (ii) g : R → R where g ( x ) = x 2 + x , ∀ x ∈ R is NOT one-to-one; because g ( − 1) = 0 and g (0) = 0. Number of Injective Functions: Let A = { a 1 , . . . , a m } ( |A| = m ) and B = { b 1 , . . . , b n } ( |B| = n ) ( m ≤ n ). f : A → B is described as, { ( a 1 , x 1 ) , ( a 2 , x 2 ) , . . . , ( a m , x m ) } . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 17

  9. One-to-One or Injective Functions One-to-one (Injective) Function: f : A → B is a one-to-one (or injective) function, if each element in B appears at most once as image of an element of A . For arbitrary sets A , B , f : A → B is one-to-one if and only if ∀ a 1 , a 2 ∈ A , f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 . If f : A → B is one-to-one with A , B finite, then |A| ≤ |B| . Examples: (i) f : R → R where f ( x ) = 2 x + 1 , ∀ x ∈ R is one-to-one; because for all x 1 , x 2 ∈ R , we have f ( x 1 ) = f ( x 2 ) ⇒ 2 x 1 + 1 = 2 x 2 + 1 ⇒ x 1 = x 2 . (ii) g : R → R where g ( x ) = x 2 + x , ∀ x ∈ R is NOT one-to-one; because g ( − 1) = 0 and g (0) = 0. Number of Injective Functions: Let A = { a 1 , . . . , a m } ( |A| = m ) and B = { b 1 , . . . , b n } ( |B| = n ) ( m ≤ n ). f : A → B is described as, { ( a 1 , x 1 ) , ( a 2 , x 2 ) , . . . , ( a m , x m ) } . n ! So, Total Count = n ( n − 1) · · · ( n − m + 1) = ( n − m )! = P ( |B| , |A| ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 17

  10. One-to-One or Injective Functions One-to-one (Injective) Function: f : A → B is a one-to-one (or injective) function, if each element in B appears at most once as image of an element of A . For arbitrary sets A , B , f : A → B is one-to-one if and only if ∀ a 1 , a 2 ∈ A , f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 . If f : A → B is one-to-one with A , B finite, then |A| ≤ |B| . Examples: (i) f : R → R where f ( x ) = 2 x + 1 , ∀ x ∈ R is one-to-one; because for all x 1 , x 2 ∈ R , we have f ( x 1 ) = f ( x 2 ) ⇒ 2 x 1 + 1 = 2 x 2 + 1 ⇒ x 1 = x 2 . (ii) g : R → R where g ( x ) = x 2 + x , ∀ x ∈ R is NOT one-to-one; because g ( − 1) = 0 and g (0) = 0. Number of Injective Functions: Let A = { a 1 , . . . , a m } ( |A| = m ) and B = { b 1 , . . . , b n } ( |B| = n ) ( m ≤ n ). f : A → B is described as, { ( a 1 , x 1 ) , ( a 2 , x 2 ) , . . . , ( a m , x m ) } . n ! So, Total Count = n ( n − 1) · · · ( n − m + 1) = ( n − m )! = P ( |B| , |A| ). f : A → B , with A 1 , A 2 ⊆ A . Then, f ( A 1 ∩ A 2 ) = f ( A 1 ) ∩ f ( A 2 ), if f is one-to-one. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 17

  11. Onto or Surjective Functions Onto (Surjective) Function: f : A → B is a onto (or surjective) function, if f ( A ) = B , i.e. for all b ∈ B there is at least one a ∈ A with f ( a ) = b . For arbitrary sets A , B , f : A → B is onto if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 17

  12. Onto or Surjective Functions Onto (Surjective) Function: f : A → B is a onto (or surjective) function, if f ( A ) = B , i.e. for all b ∈ B there is at least one a ∈ A with f ( a ) = b . For arbitrary sets A , B , f : A → B is onto if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b . If f : A → B is onto with A , B finite, then |A| ≥ |B| . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 17

  13. Onto or Surjective Functions Onto (Surjective) Function: f : A → B is a onto (or surjective) function, if f ( A ) = B , i.e. for all b ∈ B there is at least one a ∈ A with f ( a ) = b . For arbitrary sets A , B , f : A → B is onto if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b . If f : A → B is onto with A , B finite, then |A| ≥ |B| . Examples: (i) f : R → R where f ( x ) = x 3 + 1 , ∀ x ∈ R is onto; √ y − 1. because for each y = x 3 + 1 ∈ R , there is an x = 3 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 17

  14. Onto or Surjective Functions Onto (Surjective) Function: f : A → B is a onto (or surjective) function, if f ( A ) = B , i.e. for all b ∈ B there is at least one a ∈ A with f ( a ) = b . For arbitrary sets A , B , f : A → B is onto if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b . If f : A → B is onto with A , B finite, then |A| ≥ |B| . Examples: (i) f : R → R where f ( x ) = x 3 + 1 , ∀ x ∈ R is onto; √ y − 1. because for each y = x 3 + 1 ∈ R , there is an x = 3 (ii) f : R → R where f ( x ) = x 2 , ∀ x ∈ R is NOT onto; because for an y = − 4 ∈ R , we get x = √ y = 2 i or − 2 i �∈ R . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 17

  15. Onto or Surjective Functions Onto (Surjective) Function: f : A → B is a onto (or surjective) function, if f ( A ) = B , i.e. for all b ∈ B there is at least one a ∈ A with f ( a ) = b . For arbitrary sets A , B , f : A → B is onto if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b . If f : A → B is onto with A , B finite, then |A| ≥ |B| . Examples: (i) f : R → R where f ( x ) = x 3 + 1 , ∀ x ∈ R is onto; √ y − 1. because for each y = x 3 + 1 ∈ R , there is an x = 3 (ii) f : R → R where f ( x ) = x 2 , ∀ x ∈ R is NOT onto; because for an y = − 4 ∈ R , we get x = √ y = 2 i or − 2 i �∈ R . Number of Onto Functions: Counting is non-trivial and will be addressed later! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 17

  16. Onto or Surjective Functions Onto (Surjective) Function: f : A → B is a onto (or surjective) function, if f ( A ) = B , i.e. for all b ∈ B there is at least one a ∈ A with f ( a ) = b . For arbitrary sets A , B , f : A → B is onto if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b . If f : A → B is onto with A , B finite, then |A| ≥ |B| . Examples: (i) f : R → R where f ( x ) = x 3 + 1 , ∀ x ∈ R is onto; √ y − 1. because for each y = x 3 + 1 ∈ R , there is an x = 3 (ii) f : R → R where f ( x ) = x 2 , ∀ x ∈ R is NOT onto; because for an y = − 4 ∈ R , we get x = √ y = 2 i or − 2 i �∈ R . Number of Onto Functions: Counting is non-trivial and will be addressed later! One-to-one & Onto (Bijective) Function: f : A → B is bijective if it is both one-to-one (injective) and onto (surjective). For arbitrary sets A , B , f : A → B is bijective if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b and ∀ a ′ ( � = a ) ∈ A , f ( a ′ ) � = b . If f : A → B is bijective with A , B finite, then |A| = |B| . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 17

  17. Onto or Surjective Functions Onto (Surjective) Function: f : A → B is a onto (or surjective) function, if f ( A ) = B , i.e. for all b ∈ B there is at least one a ∈ A with f ( a ) = b . One−to−one and Onto For arbitrary sets A , B , f : A → B is onto if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b . If f : A → B is onto with A , B finite, then |A| ≥ |B| . Examples: (i) f : R → R where f ( x ) = x 3 + 1 , ∀ x ∈ R is onto; One−to−one, √ y − 1. because for each y = x 3 + 1 ∈ R , there is an x = but not Onto 3 (ii) f : R → R where f ( x ) = x 2 , ∀ x ∈ R is NOT onto; because for an y = − 4 ∈ R , we get x = √ y = 2 i or − 2 i �∈ R . Onto, but not One−to−one Number of Onto Functions: Counting is non-trivial and will be addressed later! One-to-one & Onto (Bijective) Function: f : A → B is bijective if it is both one-to-one (injective) and onto (surjective). Neither One−to−one, nor Onto For arbitrary sets A , B , f : A → B is bijective if and only if ∀ b ∈ B , ∃ a ∈ A , so that f ( a ) = b and ∀ a ′ ( � = a ) ∈ A , f ( a ′ ) � = b . If f : A → B is bijective with A , B finite, then |A| = |B| . Not a Function (but a Relation) Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 17

  18. (Binary) Operations and Properties Definition Binary Operation: For non-empty sets, A , B , any function f : A × A → B is called a binary operation on A . If B ⊆ A then the binary operation is closed on (Count: |B| |A| 2 ) A (also A is closed under f ). Unary Operation: A function g : A → A is called unary (or monary) operation on A . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 17

  19. (Binary) Operations and Properties Definition Binary Operation: For non-empty sets, A , B , any function f : A × A → B is called a binary operation on A . If B ⊆ A then the binary operation is closed on (Count: |B| |A| 2 ) A (also A is closed under f ). Unary Operation: A function g : A → A is called unary (or monary) operation on A . Properties: Let f : A × A → B is a binary operation. Commutativity: If ∀ ( x , y ) ∈ A × A , f ( x , y ) = f ( y , x ) then f is commutative. Associativity: If f is closed and ∀ x , y , z ∈ A , f ( f ( x , y ) , z ) = f ( x , f ( y , z )), then f is associative. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 17

  20. (Binary) Operations and Properties Definition Binary Operation: For non-empty sets, A , B , any function f : A × A → B is called a binary operation on A . If B ⊆ A then the binary operation is closed on (Count: |B| |A| 2 ) A (also A is closed under f ). Unary Operation: A function g : A → A is called unary (or monary) operation on A . Properties: Let f : A × A → B is a binary operation. Commutativity: If ∀ ( x , y ) ∈ A × A , f ( x , y ) = f ( y , x ) then f is commutative. Associativity: If f is closed and ∀ x , y , z ∈ A , f ( f ( x , y ) , z ) = f ( x , f ( y , z )), then f is associative. Example g : Z + × Z + → Z defined as g ( x , y ) = x − y , is a binary operation on Z which is 1 NOT closed as g (1 , 2) = − 1 �∈ Z + , though 1 , 2 ∈ Z + . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 17

  21. (Binary) Operations and Properties Definition Binary Operation: For non-empty sets, A , B , any function f : A × A → B is called a binary operation on A . If B ⊆ A then the binary operation is closed on (Count: |B| |A| 2 ) A (also A is closed under f ). Unary Operation: A function g : A → A is called unary (or monary) operation on A . Properties: Let f : A × A → B is a binary operation. Commutativity: If ∀ ( x , y ) ∈ A × A , f ( x , y ) = f ( y , x ) then f is commutative. Associativity: If f is closed and ∀ x , y , z ∈ A , f ( f ( x , y ) , z ) = f ( x , f ( y , z )), then f is associative. Example g : Z + × Z + → Z defined as g ( x , y ) = x − y , is a binary operation on Z which is 1 NOT closed as g (1 , 2) = − 1 �∈ Z + , though 1 , 2 ∈ Z + . h : R + → R + defined as h ( x ) = 1 x is an unary operation on R + . 2 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 17

  22. (Binary) Operations and Properties Definition Binary Operation: For non-empty sets, A , B , any function f : A × A → B is called a binary operation on A . If B ⊆ A then the binary operation is closed on (Count: |B| |A| 2 ) A (also A is closed under f ). Unary Operation: A function g : A → A is called unary (or monary) operation on A . Properties: Let f : A × A → B is a binary operation. Commutativity: If ∀ ( x , y ) ∈ A × A , f ( x , y ) = f ( y , x ) then f is commutative. Associativity: If f is closed and ∀ x , y , z ∈ A , f ( f ( x , y ) , z ) = f ( x , f ( y , z )), then f is associative. Example g : Z + × Z + → Z defined as g ( x , y ) = x − y , is a binary operation on Z which is 1 NOT closed as g (1 , 2) = − 1 �∈ Z + , though 1 , 2 ∈ Z + . h : R + → R + defined as h ( x ) = 1 x is an unary operation on R + . 2 f : Z × Z → Z defined as f ( x , y ) = x − y , is a closed binary operation on Z which 3 is neither commutative nor associative. (Why?) Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 17

  23. (Binary) Operations and Properties Definition Binary Operation: For non-empty sets, A , B , any function f : A × A → B is called a binary operation on A . If B ⊆ A then the binary operation is closed on (Count: |B| |A| 2 ) A (also A is closed under f ). Unary Operation: A function g : A → A is called unary (or monary) operation on A . Properties: Let f : A × A → B is a binary operation. Commutativity: If ∀ ( x , y ) ∈ A × A , f ( x , y ) = f ( y , x ) then f is commutative. Associativity: If f is closed and ∀ x , y , z ∈ A , f ( f ( x , y ) , z ) = f ( x , f ( y , z )), then f is associative. Example g : Z + × Z + → Z defined as g ( x , y ) = x − y , is a binary operation on Z which is 1 NOT closed as g (1 , 2) = − 1 �∈ Z + , though 1 , 2 ∈ Z + . h : R + → R + defined as h ( x ) = 1 x is an unary operation on R + . 2 f : Z × Z → Z defined as f ( x , y ) = x − y , is a closed binary operation on Z which 3 is neither commutative nor associative. (Why?) f : Z × Z → Z defined as f ( a , b ) = a + b − ab is both commutative and associative. 4 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 17

  24. More Properties of Binary Operation Properties: Let f : A × A → B is a binary operation. Identity: x ∈ A is an identity (or identity element) for f if f ( a , x ) = f ( x , a ) = a , ∀ a ∈ A . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 17

  25. More Properties of Binary Operation Properties: Let f : A × A → B is a binary operation. Identity: x ∈ A is an identity (or identity element) for f if f ( a , x ) = f ( x , a ) = a , ∀ a ∈ A . Property: If f has an identity, then that identity is unique . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 17

  26. More Properties of Binary Operation Properties: Let f : A × A → B is a binary operation. Identity: x ∈ A is an identity (or identity element) for f if f ( a , x ) = f ( x , a ) = a , ∀ a ∈ A . Property: If f has an identity, then that identity is unique . ( Proof: Let two identities, x 1 , x 2 ∈ A . Then, by definition f ( x 1 , x 2 ) = x 1 = f ( x 2 , x 1 ) = x 2 , leading to contradiction!) Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 17

  27. More Properties of Binary Operation Properties: Let f : A × A → B is a binary operation. Identity: x ∈ A is an identity (or identity element) for f if f ( a , x ) = f ( x , a ) = a , ∀ a ∈ A . Property: If f has an identity, then that identity is unique . ( Proof: Let two identities, x 1 , x 2 ∈ A . Then, by definition f ( x 1 , x 2 ) = x 1 = f ( x 2 , x 1 ) = x 2 , leading to contradiction!) Example: f : Z × Z → Z defined as f ( a , b ) = a + b − ab has 0 as the unique identity, because f ( a , 0) = a + 0 + a . 0 = a = 0 + a + 0 . a = f (0 , a ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 17

  28. More Properties of Binary Operation Properties: Let f : A × A → B is a binary operation. Identity: x ∈ A is an identity (or identity element) for f if f ( a , x ) = f ( x , a ) = a , ∀ a ∈ A . Property: If f has an identity, then that identity is unique . ( Proof: Let two identities, x 1 , x 2 ∈ A . Then, by definition f ( x 1 , x 2 ) = x 1 = f ( x 2 , x 1 ) = x 2 , leading to contradiction!) Example: f : Z × Z → Z defined as f ( a , b ) = a + b − ab has 0 as the unique identity, because f ( a , 0) = a + 0 + a . 0 = a = 0 + a + 0 . a = f (0 , a ). Projection: For sets A , B , if C ⊆ A × B , then – (i) π A : C → A defined by π A ( a , b ) = a , is called the projection on the first coordinate. (ii) π B : C → B defined by π B ( a , b ) = b , is called the projection on the second coordinate. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 17

  29. More Properties of Binary Operation Properties: Let f : A × A → B is a binary operation. Identity: x ∈ A is an identity (or identity element) for f if f ( a , x ) = f ( x , a ) = a , ∀ a ∈ A . Property: If f has an identity, then that identity is unique . ( Proof: Let two identities, x 1 , x 2 ∈ A . Then, by definition f ( x 1 , x 2 ) = x 1 = f ( x 2 , x 1 ) = x 2 , leading to contradiction!) Example: f : Z × Z → Z defined as f ( a , b ) = a + b − ab has 0 as the unique identity, because f ( a , 0) = a + 0 + a . 0 = a = 0 + a + 0 . a = f (0 , a ). Projection: For sets A , B , if C ⊆ A × B , then – (i) π A : C → A defined by π A ( a , b ) = a , is called the projection on the first coordinate. (ii) π B : C → B defined by π B ( a , b ) = b , is called the projection on the second coordinate. Property: If C = A × B , then π A and π B both are onto functions. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 17

  30. More Properties of Binary Operation Properties: Let f : A × A → B is a binary operation. Identity: x ∈ A is an identity (or identity element) for f if f ( a , x ) = f ( x , a ) = a , ∀ a ∈ A . Property: If f has an identity, then that identity is unique . ( Proof: Let two identities, x 1 , x 2 ∈ A . Then, by definition f ( x 1 , x 2 ) = x 1 = f ( x 2 , x 1 ) = x 2 , leading to contradiction!) Example: f : Z × Z → Z defined as f ( a , b ) = a + b − ab has 0 as the unique identity, because f ( a , 0) = a + 0 + a . 0 = a = 0 + a + 0 . a = f (0 , a ). Projection: For sets A , B , if C ⊆ A × B , then – (i) π A : C → A defined by π A ( a , b ) = a , is called the projection on the first coordinate. (ii) π B : C → B defined by π B ( a , b ) = b , is called the projection on the second coordinate. Property: If C = A × B , then π A and π B both are onto functions. Example: Let A = B = R and C ⊆ A × B where C = { ( x , y ) | y = x 2 , x , y ∈ R } representing the Euclidean plane that contains points on the parabola y = x 2 . Here, π A (3 , 9) = 3 and π B (3 , 9) = 9. Note that, π A ( C ) = R and hence π A is onto (and one-to-one as well). Whereas, π B ( C ) = [0 , + ∞ ] ⊂ R and hence π B is NOT onto (nor it is one-to-one as π B (2 , 4) = 4 = π B ( − 2 , 4)). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 17

  31. Equal, Identity and Composite Functions Identity Function: The function, 1 A : A → A defined by 1 A ( a ) = a ( ∀ a ∈ A ), is called the identity function for A . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 17

  32. Equal, Identity and Composite Functions Identity Function: The function, 1 A : A → A defined by 1 A ( a ) = a ( ∀ a ∈ A ), is called the identity function for A . Equal Functions: Two functions f , g : A → B are said to be equal (denoted as f = g ) if f ( a ) = g ( a ) , ∀ a ∈ A . Note : Domain and Codomain of f , g must also be the same! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 17

  33. Equal, Identity and Composite Functions Identity Function: The function, 1 A : A → A defined by 1 A ( a ) = a ( ∀ a ∈ A ), is called the identity function for A . Equal Functions: Two functions f , g : A → B are said to be equal (denoted as f = g ) if f ( a ) = g ( a ) , ∀ a ∈ A . Note : Domain and Codomain of f , g must also be the same! � x , if x ∈ Z Example: f , g : R → Z are defined as, f ( x ) = and ⌊ x ⌋ + 1 , if x ∈ R − Z g ( x ) = ⌈ x ⌉ , then f ( x ) = g ( x ) for every x ∈ R (Why?). So, f = g . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 17

  34. Equal, Identity and Composite Functions Identity Function: The function, 1 A : A → A defined by 1 A ( a ) = a ( ∀ a ∈ A ), is called the identity function for A . Equal Functions: Two functions f , g : A → B are said to be equal (denoted as f = g ) if f ( a ) = g ( a ) , ∀ a ∈ A . Note : Domain and Codomain of f , g must also be the same! � x , if x ∈ Z Example: f , g : R → Z are defined as, f ( x ) = and ⌊ x ⌋ + 1 , if x ∈ R − Z g ( x ) = ⌈ x ⌉ , then f ( x ) = g ( x ) for every x ∈ R (Why?). So, f = g . Composite Function: If f : A → B and g : B → C , we define the composite function, g ◦ f : A → C by ( g ◦ f )( a ) = g ( f ( a )) , ∀ a ∈ A . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 17

  35. Equal, Identity and Composite Functions Identity Function: The function, 1 A : A → A defined by 1 A ( a ) = a ( ∀ a ∈ A ), is called the identity function for A . Equal Functions: Two functions f , g : A → B are said to be equal (denoted as f = g ) if f ( a ) = g ( a ) , ∀ a ∈ A . Note : Domain and Codomain of f , g must also be the same! � x , if x ∈ Z Example: f , g : R → Z are defined as, f ( x ) = and ⌊ x ⌋ + 1 , if x ∈ R − Z g ( x ) = ⌈ x ⌉ , then f ( x ) = g ( x ) for every x ∈ R (Why?). So, f = g . Composite Function: If f : A → B and g : B → C , we define the composite function, g ◦ f : A → C by ( g ◦ f )( a ) = g ( f ( a )) , ∀ a ∈ A . Range of f ⊆ Domain of g – sufficient for Function Composition! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 17

  36. Equal, Identity and Composite Functions Identity Function: The function, 1 A : A → A defined by 1 A ( a ) = a ( ∀ a ∈ A ), is called the identity function for A . Equal Functions: Two functions f , g : A → B are said to be equal (denoted as f = g ) if f ( a ) = g ( a ) , ∀ a ∈ A . Note : Domain and Codomain of f , g must also be the same! � x , if x ∈ Z Example: f , g : R → Z are defined as, f ( x ) = and ⌊ x ⌋ + 1 , if x ∈ R − Z g ( x ) = ⌈ x ⌉ , then f ( x ) = g ( x ) for every x ∈ R (Why?). So, f = g . Composite Function: If f : A → B and g : B → C , we define the composite function, g ◦ f : A → C by ( g ◦ f )( a ) = g ( f ( a )) , ∀ a ∈ A . Range of f ⊆ Domain of g – sufficient for Function Composition! For two identity functions 1 A : A → A and 1 B : B → B , f ◦ 1 A = f = 1 B ◦ f . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 17

  37. Equal, Identity and Composite Functions Identity Function: The function, 1 A : A → A defined by 1 A ( a ) = a ( ∀ a ∈ A ), is called the identity function for A . Equal Functions: Two functions f , g : A → B are said to be equal (denoted as f = g ) if f ( a ) = g ( a ) , ∀ a ∈ A . Note : Domain and Codomain of f , g must also be the same! � x , if x ∈ Z Example: f , g : R → Z are defined as, f ( x ) = and ⌊ x ⌋ + 1 , if x ∈ R − Z g ( x ) = ⌈ x ⌉ , then f ( x ) = g ( x ) for every x ∈ R (Why?). So, f = g . Composite Function: If f : A → B and g : B → C , we define the composite function, g ◦ f : A → C by ( g ◦ f )( a ) = g ( f ( a )) , ∀ a ∈ A . Range of f ⊆ Domain of g – sufficient for Function Composition! For two identity functions 1 A : A → A and 1 B : B → B , f ◦ 1 A = f = 1 B ◦ f . Example: Let f , g : R → R defined as, f ( x ) = x 2 and g ( x ) = x + 1. Then, ( f ◦ g )( x ) = x 2 + 2 x + 1 and ( g ◦ f )( x ) = x 2 + 1. So, ( f ◦ g )( x ) � = ( g ◦ f )( x ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 17

  38. Equal, Identity and Composite Functions Identity Function: The function, 1 A : A → A defined by 1 A ( a ) = a ( ∀ a ∈ A ), is called the identity function for A . Equal Functions: Two functions f , g : A → B are said to be equal (denoted as f = g ) if f ( a ) = g ( a ) , ∀ a ∈ A . Note : Domain and Codomain of f , g must also be the same! � x , if x ∈ Z Example: f , g : R → Z are defined as, f ( x ) = and ⌊ x ⌋ + 1 , if x ∈ R − Z g ( x ) = ⌈ x ⌉ , then f ( x ) = g ( x ) for every x ∈ R (Why?). So, f = g . Composite Function: If f : A → B and g : B → C , we define the composite function, g ◦ f : A → C by ( g ◦ f )( a ) = g ( f ( a )) , ∀ a ∈ A . Range of f ⊆ Domain of g – sufficient for Function Composition! For two identity functions 1 A : A → A and 1 B : B → B , f ◦ 1 A = f = 1 B ◦ f . Example: Let f , g : R → R defined as, f ( x ) = x 2 and g ( x ) = x + 1. Then, ( f ◦ g )( x ) = x 2 + 2 x + 1 and ( g ◦ f )( x ) = x 2 + 1. So, ( f ◦ g )( x ) � = ( g ◦ f )( x ). Commutativity of Function Compositions: Does NOT Hold! Function Composition is NOT Commutative, that is, we shall NOT always have f ◦ g ( x ) � = g ◦ f ( x ) for any two functions, f , g : A → A (and x ∈ A ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 17

  39. Composite Function Properties Associativity of Function Compositions If f : A → B , g : B → C and h : C → D , then ( h ◦ g ) ◦ f = h ◦ ( g ◦ f ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 17

  40. Composite Function Properties Associativity of Function Compositions If f : A → B , g : B → C and h : C → D , then ( h ◦ g ) ◦ f = h ◦ ( g ◦ f ). (h o g) o f Proof: For every x ∈ A , we can show, h o g A B C D ( h ◦ g ◦ f )( x ) = ( h ◦ g ) ◦ f ( x ) = ( h ◦ g )( f ( x )) g f h g o f = h ( g ( f ( x ))) = h ( g ◦ f ( x )) = h ◦ ( g ◦ f )( x ). h o (g o f) Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 17

  41. Composite Function Properties Associativity of Function Compositions If f : A → B , g : B → C and h : C → D , then ( h ◦ g ) ◦ f = h ◦ ( g ◦ f ). (h o g) o f Proof: For every x ∈ A , we can show, h o g A B C D ( h ◦ g ◦ f )( x ) = ( h ◦ g ) ◦ f ( x ) = ( h ◦ g )( f ( x )) g f h g o f = h ( g ( f ( x ))) = h ( g ◦ f ( x )) = h ◦ ( g ◦ f )( x ). h o (g o f) Recursive Compositions of Functions Let f : A → A . Then, f 1 = f , and for n ∈ Z + , f n +1 = f ◦ ( f n ) = ( f n ) ◦ f . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 17

  42. Composite Function Properties Associativity of Function Compositions If f : A → B , g : B → C and h : C → D , then ( h ◦ g ) ◦ f = h ◦ ( g ◦ f ). (h o g) o f Proof: For every x ∈ A , we can show, h o g A B C D ( h ◦ g ◦ f )( x ) = ( h ◦ g ) ◦ f ( x ) = ( h ◦ g )( f ( x )) g f h g o f = h ( g ( f ( x ))) = h ( g ◦ f ( x )) = h ◦ ( g ◦ f )( x ). h o (g o f) Recursive Compositions of Functions Let f : A → A . Then, f 1 = f , and for n ∈ Z + , f n +1 = f ◦ ( f n ) = ( f n ) ◦ f . Bijective Nature of Function Compositions If f : A → B and g : B → C both are one-to-one , then g ◦ f : A → C is one-to-one. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 17

  43. Composite Function Properties Associativity of Function Compositions If f : A → B , g : B → C and h : C → D , then ( h ◦ g ) ◦ f = h ◦ ( g ◦ f ). (h o g) o f Proof: For every x ∈ A , we can show, h o g A B C D ( h ◦ g ◦ f )( x ) = ( h ◦ g ) ◦ f ( x ) = ( h ◦ g )( f ( x )) g f h g o f = h ( g ( f ( x ))) = h ( g ◦ f ( x )) = h ◦ ( g ◦ f )( x ). h o (g o f) Recursive Compositions of Functions Let f : A → A . Then, f 1 = f , and for n ∈ Z + , f n +1 = f ◦ ( f n ) = ( f n ) ◦ f . Bijective Nature of Function Compositions If f : A → B and g : B → C both are one-to-one , then g ◦ f : A → C is one-to-one. Proof: Let a 1 , a 2 ∈ A . ( g ◦ f )( a 1 ) = ( g ◦ f )( a 2 ) ⇒ g ( f ( a 1 )) = g ( f ( a 2 )) ⇒ f ( a 1 ) = f ( a 2 ) (as g is one-to-one). Again, f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 (as f is one-to-one). Hence, g ◦ f is one-to-one. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 17

  44. Composite Function Properties Associativity of Function Compositions If f : A → B , g : B → C and h : C → D , then ( h ◦ g ) ◦ f = h ◦ ( g ◦ f ). (h o g) o f Proof: For every x ∈ A , we can show, h o g A B C D ( h ◦ g ◦ f )( x ) = ( h ◦ g ) ◦ f ( x ) = ( h ◦ g )( f ( x )) g f h g o f = h ( g ( f ( x ))) = h ( g ◦ f ( x )) = h ◦ ( g ◦ f )( x ). h o (g o f) Recursive Compositions of Functions Let f : A → A . Then, f 1 = f , and for n ∈ Z + , f n +1 = f ◦ ( f n ) = ( f n ) ◦ f . Bijective Nature of Function Compositions If f : A → B and g : B → C both are one-to-one , then g ◦ f : A → C is one-to-one. Proof: Let a 1 , a 2 ∈ A . ( g ◦ f )( a 1 ) = ( g ◦ f )( a 2 ) ⇒ g ( f ( a 1 )) = g ( f ( a 2 )) ⇒ f ( a 1 ) = f ( a 2 ) (as g is one-to-one). Again, f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 (as f is one-to-one). Hence, g ◦ f is one-to-one. If f : A → B and g : B → C both are onto, then g ◦ f : A → C is onto. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 17

  45. Composite Function Properties Associativity of Function Compositions If f : A → B , g : B → C and h : C → D , then ( h ◦ g ) ◦ f = h ◦ ( g ◦ f ). (h o g) o f Proof: For every x ∈ A , we can show, h o g A B C D ( h ◦ g ◦ f )( x ) = ( h ◦ g ) ◦ f ( x ) = ( h ◦ g )( f ( x )) g f h g o f = h ( g ( f ( x ))) = h ( g ◦ f ( x )) = h ◦ ( g ◦ f )( x ). h o (g o f) Recursive Compositions of Functions Let f : A → A . Then, f 1 = f , and for n ∈ Z + , f n +1 = f ◦ ( f n ) = ( f n ) ◦ f . Bijective Nature of Function Compositions If f : A → B and g : B → C both are one-to-one , then g ◦ f : A → C is one-to-one. Proof: Let a 1 , a 2 ∈ A . ( g ◦ f )( a 1 ) = ( g ◦ f )( a 2 ) ⇒ g ( f ( a 1 )) = g ( f ( a 2 )) ⇒ f ( a 1 ) = f ( a 2 ) (as g is one-to-one). Again, f ( a 1 ) = f ( a 2 ) ⇒ a 1 = a 2 (as f is one-to-one). Hence, g ◦ f is one-to-one. If f : A → B and g : B → C both are onto, then g ◦ f : A → C is onto. Proof: For any z ∈ C , ∃ y ∈ B (as g is onto) and y ∈ B , ∃ x ∈ A (as f is onto). So, z = g ( y ) = g ( f ( x )) = ( g ◦ f )( x ) and Range of ( g ◦ f ) = C = Codomain of ( g ◦ f ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 17

  46. Composite Function Properties Bijective Nature of Function Compositions Let f : A → B and g : B → C and the composition g ◦ f : A → C is a one-to-one (injective) function. Then, f is one-to-one (however, g need NOT be one-to-one). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 17

  47. Composite Function Properties Bijective Nature of Function Compositions Let f : A → B and g : B → C and the composition g ◦ f : A → C is a one-to-one (injective) function. Then, f is one-to-one (however, g need NOT be one-to-one). Explanation: f is one-to-one (Proof): Assuming f is NOT one-to-one, implies ∃ x 1 , x 2 ∈ A such that f ( x 1 ) = f ( x 2 ). So, g ◦ f ( x 1 ) = g ◦ f ( x 2 ), contradicting g ◦ f is injective! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 17

  48. Composite Function Properties Bijective Nature of Function Compositions Let f : A → B and g : B → C and the composition g ◦ f : A → C is a one-to-one (injective) function. Then, f is one-to-one (however, g need NOT be one-to-one). Explanation: f is one-to-one (Proof): Assuming f is NOT one-to-one, implies ∃ x 1 , x 2 ∈ A such that f ( x 1 ) = f ( x 2 ). So, g ◦ f ( x 1 ) = g ◦ f ( x 2 ), contradicting g ◦ f is injective! g is not one-to-one (Example): f , g : R → R are defined as, f ( x ) = e x and g ( x ) = x 2 ( x ∈ R ). Here, g ◦ f : R → R is defined as, g ◦ f ( x ) = e 2 x . So, ( g ◦ f ) is one-to-one, but g is NOT (note that, f is one-to-one as proven)! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 17

  49. Composite Function Properties Bijective Nature of Function Compositions Let f : A → B and g : B → C and the composition g ◦ f : A → C is a one-to-one (injective) function. Then, f is one-to-one (however, g need NOT be one-to-one). Explanation: f is one-to-one (Proof): Assuming f is NOT one-to-one, implies ∃ x 1 , x 2 ∈ A such that f ( x 1 ) = f ( x 2 ). So, g ◦ f ( x 1 ) = g ◦ f ( x 2 ), contradicting g ◦ f is injective! g is not one-to-one (Example): f , g : R → R are defined as, f ( x ) = e x and g ( x ) = x 2 ( x ∈ R ). Here, g ◦ f : R → R is defined as, g ◦ f ( x ) = e 2 x . So, ( g ◦ f ) is one-to-one, but g is NOT (note that, f is one-to-one as proven)! Let f : A → B and g : B → C and the composition g ◦ f : A → C is a onto (surjective) function. Then, g is onto (however, f need NOT be onto). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 17

  50. Composite Function Properties Bijective Nature of Function Compositions Let f : A → B and g : B → C and the composition g ◦ f : A → C is a one-to-one (injective) function. Then, f is one-to-one (however, g need NOT be one-to-one). Explanation: f is one-to-one (Proof): Assuming f is NOT one-to-one, implies ∃ x 1 , x 2 ∈ A such that f ( x 1 ) = f ( x 2 ). So, g ◦ f ( x 1 ) = g ◦ f ( x 2 ), contradicting g ◦ f is injective! g is not one-to-one (Example): f , g : R → R are defined as, f ( x ) = e x and g ( x ) = x 2 ( x ∈ R ). Here, g ◦ f : R → R is defined as, g ◦ f ( x ) = e 2 x . So, ( g ◦ f ) is one-to-one, but g is NOT (note that, f is one-to-one as proven)! Let f : A → B and g : B → C and the composition g ◦ f : A → C is a onto (surjective) function. Then, g is onto (however, f need NOT be onto). Explanation: g is onto (Proof): As ( g ◦ f ) is onto, for any z ∈ C , ∃ x ∈ A such that, z = g ◦ f ( x ) = g ( f ( x )), implying that z has a pre-image defined as f ( x ) ∈ B – thus making g onto. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 17

  51. Composite Function Properties Bijective Nature of Function Compositions Let f : A → B and g : B → C and the composition g ◦ f : A → C is a one-to-one (injective) function. Then, f is one-to-one (however, g need NOT be one-to-one). Explanation: f is one-to-one (Proof): Assuming f is NOT one-to-one, implies ∃ x 1 , x 2 ∈ A such that f ( x 1 ) = f ( x 2 ). So, g ◦ f ( x 1 ) = g ◦ f ( x 2 ), contradicting g ◦ f is injective! g is not one-to-one (Example): f , g : R → R are defined as, f ( x ) = e x and g ( x ) = x 2 ( x ∈ R ). Here, g ◦ f : R → R is defined as, g ◦ f ( x ) = e 2 x . So, ( g ◦ f ) is one-to-one, but g is NOT (note that, f is one-to-one as proven)! Let f : A → B and g : B → C and the composition g ◦ f : A → C is a onto (surjective) function. Then, g is onto (however, f need NOT be onto). Explanation: g is onto (Proof): As ( g ◦ f ) is onto, for any z ∈ C , ∃ x ∈ A such that, z = g ◦ f ( x ) = g ( f ( x )), implying that z has a pre-image defined as f ( x ) ∈ B – thus making g onto. f is not onto (Example): f , g : Z → Z are defined as, f ( x ) = 2 x and g ( x ) = ⌊ x 2 ⌋ ( x ∈ Z ). Here, g ◦ f : Z → Z is defined as, g ◦ f ( x ) = x . So, ( g ◦ f ) is onto, but f is NOT (note that, g is onto as proven)! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 17

  52. Inverse Functions and Invertibility Inverse Functions: For a function f : A → B , if f − 1 , f − 1 : B → A are defined such that L R f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B , then f − 1 and f − 1 are called the left L R L R inverse and right inverse of f , respectively. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 17

  53. Inverse Functions and Invertibility Inverse Functions: For a function f : A → B , if f − 1 , f − 1 : B → A are defined such that L R f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B , then f − 1 and f − 1 are called the left L R L R inverse and right inverse of f , respectively. Invertible Functions: A function f : A → B is said to be invertible if there exist a function f − 1 : B → A such that f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B . f − 1 is called the inverse function of f . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 17

  54. Inverse Functions and Invertibility Inverse Functions: For a function f : A → B , if f − 1 , f − 1 : B → A are defined such that L R f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B , then f − 1 and f − 1 are called the left L R L R inverse and right inverse of f , respectively. Invertible Functions: A function f : A → B is said to be invertible if there exist a function f − 1 : B → A such that f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B . f − 1 is called the inverse function of f . Unique Inverse: An invertible function f : A → B has a unique inverse f − 1 : B → A . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 17

  55. Inverse Functions and Invertibility Inverse Functions: For a function f : A → B , if f − 1 , f − 1 : B → A are defined such that L R f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B , then f − 1 and f − 1 are called the left L R L R inverse and right inverse of f , respectively. Invertible Functions: A function f : A → B is said to be invertible if there exist a function f − 1 : B → A such that f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B . f − 1 is called the inverse function of f . Unique Inverse: An invertible function f : A → B has a unique inverse f − 1 : B → A . ( Proof: Assume two inverses, f − 1 and f − 1 . Using the definition, we get, 1 2 f − 1 = f − 1 ◦ 1 B = f − 1 ◦ ( f ◦ f − 1 ) = ( f − 1 ◦ f ) ◦ f − 1 = 1 A ◦ f − 1 = f − 1 .) 1 1 1 2 1 2 2 2 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 17

  56. Inverse Functions and Invertibility Inverse Functions: For a function f : A → B , if f − 1 , f − 1 : B → A are defined such that L R f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B , then f − 1 and f − 1 are called the left L R L R inverse and right inverse of f , respectively. Invertible Functions: A function f : A → B is said to be invertible if there exist a function f − 1 : B → A such that f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B . f − 1 is called the inverse function of f . Unique Inverse: An invertible function f : A → B has a unique inverse f − 1 : B → A . ( Proof: Assume two inverses, f − 1 and f − 1 . Using the definition, we get, 1 2 f − 1 = f − 1 ◦ 1 B = f − 1 ◦ ( f ◦ f − 1 ) = ( f − 1 ◦ f ) ◦ f − 1 = 1 A ◦ f − 1 = f − 1 .) 1 1 1 2 1 2 2 2 Examples: (1) Let f , g : Z → Z are defined as f ( x ) = 2 x and g ( x ) = ⌊ x +1 2 ⌋ ( x ∈ Z ). So, g ◦ f , f ◦ g : Z → Z are defined by, g ◦ f ( x ) = g (2 x ) = x � x + 1 , if x is odd and f ◦ g ( x ) = f ( ⌊ x +1 if x is even . So, g ◦ f = 1 Z 2 ⌋ ) = x , meaning g is the left inverse of f , but f ◦ g � = 1 Z meaning g is NOT the right inverse of f . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 17

  57. Inverse Functions and Invertibility Inverse Functions: For a function f : A → B , if f − 1 , f − 1 : B → A are defined such that L R f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B , then f − 1 and f − 1 are called the left L R L R inverse and right inverse of f , respectively. Invertible Functions: A function f : A → B is said to be invertible if there exist a function f − 1 : B → A such that f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B . f − 1 is called the inverse function of f . Unique Inverse: An invertible function f : A → B has a unique inverse f − 1 : B → A . ( Proof: Assume two inverses, f − 1 and f − 1 . Using the definition, we get, 1 2 f − 1 = f − 1 ◦ 1 B = f − 1 ◦ ( f ◦ f − 1 ) = ( f − 1 ◦ f ) ◦ f − 1 = 1 A ◦ f − 1 = f − 1 .) 1 1 1 2 1 2 2 2 Examples: (1) Let f , g : Z → Z are defined as f ( x ) = 2 x and g ( x ) = ⌊ x +1 2 ⌋ ( x ∈ Z ). So, g ◦ f , f ◦ g : Z → Z are defined by, g ◦ f ( x ) = g (2 x ) = x � x + 1 , if x is odd and f ◦ g ( x ) = f ( ⌊ x +1 if x is even . So, g ◦ f = 1 Z 2 ⌋ ) = x , meaning g is the left inverse of f , but f ◦ g � = 1 Z meaning g is NOT the right inverse of f . (2) Let f , g : R → R are defined as f ( x ) = 2 x and g ( x ) = x 2 ( x ∈ R ). So, g ◦ f , f ◦ g : R → R are defined by, g ◦ f ( x ) = g (2 x ) = x and f ◦ g ( x ) = f ( x 2 ) = x . So, g ◦ f = f ◦ g = 1 R meaning g is inverse of f . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 17

  58. Properties of Invertible Functions Properties f : A → B is invertible if and only if it is bijective (one-to-one + onto). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 17

  59. Properties of Invertible Functions Properties f : A → B is invertible if and only if it is bijective (one-to-one + onto). Proof: [ If ] f is invertible means inverse function f − 1 : B → A exists. f − 1 ◦ f = 1 A and 1 A is injective, so f is injective. f ◦ f − 1 = 1 B and 1 B is surjective, so f is surjective. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 17

  60. Properties of Invertible Functions Properties f : A → B is invertible if and only if it is bijective (one-to-one + onto). Proof: [ If ] f is invertible means inverse function f − 1 : B → A exists. f − 1 ◦ f = 1 A and 1 A is injective, so f is injective. f ◦ f − 1 = 1 B and 1 B is surjective, so f is surjective. [Only-If] Since f is bijective, y ∈ B has one and only one pre-image x ∈ A . We define f − 1 : B → A as f − 1 ( y ) = x (pre-image of y under f ), y ∈ B . So, f − 1 ◦ f ( x ) = f − 1 ( y ) = x and f ◦ f − 1 ( y ) = f ( x ) = y , implying f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B ⇒ f is invertible. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 17

  61. Properties of Invertible Functions Properties f : A → B is invertible if and only if it is bijective (one-to-one + onto). Proof: [ If ] f is invertible means inverse function f − 1 : B → A exists. f − 1 ◦ f = 1 A and 1 A is injective, so f is injective. f ◦ f − 1 = 1 B and 1 B is surjective, so f is surjective. [Only-If] Since f is bijective, y ∈ B has one and only one pre-image x ∈ A . We define f − 1 : B → A as f − 1 ( y ) = x (pre-image of y under f ), y ∈ B . So, f − 1 ◦ f ( x ) = f − 1 ( y ) = x and f ◦ f − 1 ( y ) = f ( x ) = y , implying f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B ⇒ f is invertible. If f : A → B , g : B → C are invertible, then g ◦ f : A → C is invertible and ( g ◦ f ) − 1 = f − 1 ◦ g − 1 . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 17

  62. Properties of Invertible Functions Properties f : A → B is invertible if and only if it is bijective (one-to-one + onto). Proof: [ If ] f is invertible means inverse function f − 1 : B → A exists. f − 1 ◦ f = 1 A and 1 A is injective, so f is injective. f ◦ f − 1 = 1 B and 1 B is surjective, so f is surjective. [Only-If] Since f is bijective, y ∈ B has one and only one pre-image x ∈ A . We define f − 1 : B → A as f − 1 ( y ) = x (pre-image of y under f ), y ∈ B . So, f − 1 ◦ f ( x ) = f − 1 ( y ) = x and f ◦ f − 1 ( y ) = f ( x ) = y , implying f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B ⇒ f is invertible. If f : A → B , g : B → C are invertible, then g ◦ f : A → C is invertible and ( g ◦ f ) − 1 = f − 1 ◦ g − 1 . Proof: f , g are invertible implies that f , g are bijective functions. So, ( g ◦ f ) is also bijective and hence invertible (using above property). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 17

  63. Properties of Invertible Functions Properties f : A → B is invertible if and only if it is bijective (one-to-one + onto). Proof: [ If ] f is invertible means inverse function f − 1 : B → A exists. f − 1 ◦ f = 1 A and 1 A is injective, so f is injective. f ◦ f − 1 = 1 B and 1 B is surjective, so f is surjective. [Only-If] Since f is bijective, y ∈ B has one and only one pre-image x ∈ A . We define f − 1 : B → A as f − 1 ( y ) = x (pre-image of y under f ), y ∈ B . So, f − 1 ◦ f ( x ) = f − 1 ( y ) = x and f ◦ f − 1 ( y ) = f ( x ) = y , implying f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B ⇒ f is invertible. If f : A → B , g : B → C are invertible, then g ◦ f : A → C is invertible and ( g ◦ f ) − 1 = f − 1 ◦ g − 1 . Proof: f , g are invertible implies that f , g are bijective functions. So, ( g ◦ f ) is also bijective and hence invertible (using above property). ( f − 1 ◦ g − 1 ) ◦ ( g ◦ f ) = f − 1 ◦ ( g − 1 ◦ g ) ◦ f = f − 1 ◦ 1 B ◦ f = f − 1 ◦ f = 1 A . ( g ◦ f ) ◦ ( f − 1 ◦ g − 1 ) = 1 B . So, ( f − 1 ◦ g − 1 ) is the inverse of ( g ◦ f ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 17

  64. Properties of Invertible Functions Properties f : A → B is invertible if and only if it is bijective (one-to-one + onto). Proof: [ If ] f is invertible means inverse function f − 1 : B → A exists. f − 1 ◦ f = 1 A and 1 A is injective, so f is injective. f ◦ f − 1 = 1 B and 1 B is surjective, so f is surjective. [Only-If] Since f is bijective, y ∈ B has one and only one pre-image x ∈ A . We define f − 1 : B → A as f − 1 ( y ) = x (pre-image of y under f ), y ∈ B . So, f − 1 ◦ f ( x ) = f − 1 ( y ) = x and f ◦ f − 1 ( y ) = f ( x ) = y , implying f − 1 ◦ f = 1 A and f ◦ f − 1 = 1 B ⇒ f is invertible. If f : A → B , g : B → C are invertible, then g ◦ f : A → C is invertible and ( g ◦ f ) − 1 = f − 1 ◦ g − 1 . Proof: f , g are invertible implies that f , g are bijective functions. So, ( g ◦ f ) is also bijective and hence invertible (using above property). ( f − 1 ◦ g − 1 ) ◦ ( g ◦ f ) = f − 1 ◦ ( g − 1 ◦ g ) ◦ f = f − 1 ◦ 1 B ◦ f = f − 1 ◦ f = 1 A . ( g ◦ f ) ◦ ( f − 1 ◦ g − 1 ) = 1 B . So, ( f − 1 ◦ g − 1 ) is the inverse of ( g ◦ f ). Example f : R → R is defined by f ( x ) = 3 x + 1 ( x ∈ R ). Note that, f is bijective (Why?) and hence invertible. Now, f − 1 : R → R defined by f − 1 ( y ) = y − 1 3 , y ∈ R . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 17

  65. Properties with Direct and Inverse Images Direct Image: Let f : A → B and (non-empty) A ′ ⊆ A . The direct image of A ′ under f is f ( A ′ ) ⊆ B given by, f ( A ′ ) = { f ( x ) | x ∈ A ′ } . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 17

  66. Properties with Direct and Inverse Images Direct Image: Let f : A → B and (non-empty) A ′ ⊆ A . The direct image of A ′ under f is f ( A ′ ) ⊆ B given by, f ( A ′ ) = { f ( x ) | x ∈ A ′ } . Inverse Image: Let f : A → B and (non-empty) B ′ ⊆ B . The inverse image (pre-image) of B ′ under f is f − 1 ( B ′ ) ⊆ A given by, f − 1 ( B ′ ) = { x | f ( x ) ∈ B ′ } . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 17

  67. Properties with Direct and Inverse Images Direct Image: Let f : A → B and (non-empty) A ′ ⊆ A . The direct image of A ′ under f is f ( A ′ ) ⊆ B given by, f ( A ′ ) = { f ( x ) | x ∈ A ′ } . Inverse Image: Let f : A → B and (non-empty) B ′ ⊆ B . The inverse image (pre-image) of B ′ under f is f − 1 ( B ′ ) ⊆ A given by, f − 1 ( B ′ ) = { x | f ( x ) ∈ B ′ } . Example: f : R → R is defined by f ( x ) = x 2 ( x ∈ R ). Let P = { x ∈ R | x ∈ [0 , 2] } . The direct image f ( P ) = { y | y ∈ [0 , 4] } ( y ∈ R ) and the inverse image of set f ( P ) is f − 1 ( f ( P )) = { x | x ∈ [ − 2 , 2] } . So, f − 1 ( f ( P )) � = P and f is not a bijection / invertible. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 17

  68. Properties with Direct and Inverse Images Direct Image: Let f : A → B and (non-empty) A ′ ⊆ A . The direct image of A ′ under f is f ( A ′ ) ⊆ B given by, f ( A ′ ) = { f ( x ) | x ∈ A ′ } . Inverse Image: Let f : A → B and (non-empty) B ′ ⊆ B . The inverse image (pre-image) of B ′ under f is f − 1 ( B ′ ) ⊆ A given by, f − 1 ( B ′ ) = { x | f ( x ) ∈ B ′ } . Example: f : R → R is defined by f ( x ) = x 2 ( x ∈ R ). Let P = { x ∈ R | x ∈ [0 , 2] } . The direct image f ( P ) = { y | y ∈ [0 , 4] } ( y ∈ R ) and the inverse image of set f ( P ) is f − 1 ( f ( P )) = { x | x ∈ [ − 2 , 2] } . So, f − 1 ( f ( P )) � = P and f is not a bijection / invertible. Properties: (RECAP) Let f : A → B , with A 1 , A 2 ⊆ A . Then, (i) If A 1 ⊂ A 2 ⇒ f ( A 1 ) ⊂ f ( A 2 ), (ii) f ( A 1 ∪ A 2 ) = f ( A 1 ) ∪ f ( A 2 ), and (iii) f ( A 1 ∩ A 2 ) ⊂ f ( A 1 ) ∩ f ( A 2 ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 17

  69. Properties with Direct and Inverse Images Direct Image: Let f : A → B and (non-empty) A ′ ⊆ A . The direct image of A ′ under f is f ( A ′ ) ⊆ B given by, f ( A ′ ) = { f ( x ) | x ∈ A ′ } . Inverse Image: Let f : A → B and (non-empty) B ′ ⊆ B . The inverse image (pre-image) of B ′ under f is f − 1 ( B ′ ) ⊆ A given by, f − 1 ( B ′ ) = { x | f ( x ) ∈ B ′ } . Example: f : R → R is defined by f ( x ) = x 2 ( x ∈ R ). Let P = { x ∈ R | x ∈ [0 , 2] } . The direct image f ( P ) = { y | y ∈ [0 , 4] } ( y ∈ R ) and the inverse image of set f ( P ) is f − 1 ( f ( P )) = { x | x ∈ [ − 2 , 2] } . So, f − 1 ( f ( P )) � = P and f is not a bijection / invertible. Properties: (RECAP) Let f : A → B , with A 1 , A 2 ⊆ A . Then, (i) If A 1 ⊂ A 2 ⇒ f ( A 1 ) ⊂ f ( A 2 ), (ii) f ( A 1 ∪ A 2 ) = f ( A 1 ) ∪ f ( A 2 ), and (iii) f ( A 1 ∩ A 2 ) ⊂ f ( A 1 ) ∩ f ( A 2 ). Note: In general, f ( A 1 ∩ A 2 ) � = f ( A 1 ) ∩ f ( A 2 ). Consider, f : R → R as f ( x ) = x 2 and A 1 = { 0 , 1 , 1 2 , 1 3 , . . . } , A 2 = { 0 , − 1 , − 1 2 , − 1 3 , . . . } . Here, f ( A 1 ∩ A 2 ) = { 0 } � = { 0 , 1 , 1 2 2 , 1 3 2 } = f ( A 1 ) ∩ f ( A 2 ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 17

  70. Properties with Direct and Inverse Images Direct Image: Let f : A → B and (non-empty) A ′ ⊆ A . The direct image of A ′ under f is f ( A ′ ) ⊆ B given by, f ( A ′ ) = { f ( x ) | x ∈ A ′ } . Inverse Image: Let f : A → B and (non-empty) B ′ ⊆ B . The inverse image (pre-image) of B ′ under f is f − 1 ( B ′ ) ⊆ A given by, f − 1 ( B ′ ) = { x | f ( x ) ∈ B ′ } . Example: f : R → R is defined by f ( x ) = x 2 ( x ∈ R ). Let P = { x ∈ R | x ∈ [0 , 2] } . The direct image f ( P ) = { y | y ∈ [0 , 4] } ( y ∈ R ) and the inverse image of set f ( P ) is f − 1 ( f ( P )) = { x | x ∈ [ − 2 , 2] } . So, f − 1 ( f ( P )) � = P and f is not a bijection / invertible. Properties: (RECAP) Let f : A → B , with A 1 , A 2 ⊆ A . Then, (i) If A 1 ⊂ A 2 ⇒ f ( A 1 ) ⊂ f ( A 2 ), (ii) f ( A 1 ∪ A 2 ) = f ( A 1 ) ∪ f ( A 2 ), and (iii) f ( A 1 ∩ A 2 ) ⊂ f ( A 1 ) ∩ f ( A 2 ). Note: In general, f ( A 1 ∩ A 2 ) � = f ( A 1 ) ∩ f ( A 2 ). Consider, f : R → R as f ( x ) = x 2 and A 1 = { 0 , 1 , 1 2 , 1 3 , . . . } , A 2 = { 0 , − 1 , − 1 2 , − 1 3 , . . . } . Here, f ( A 1 ∩ A 2 ) = { 0 } � = { 0 , 1 , 1 2 2 , 1 3 2 } = f ( A 1 ) ∩ f ( A 2 ). Let f : A → B be an onto mapping, with B 1 , B 2 ⊆ B . Then, (i) If B 1 ⊂ B 2 ⇒ f − 1 ( B 1 ) ⊂ f − 1 ( B 2 ), (ii) f − 1 ( B 1 ) = f − 1 ( B 1 ), (iii) f − 1 ( B 1 ∪ B 2 ) = f − 1 ( B 1 ) ∪ f − 1 ( B 2 ), and (iv) f − 1 ( B 1 ∩ B 2 ) = f − 1 ( B 1 ) ∩ f − 1 ( B 2 ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 17

  71. Properties with Direct and Inverse Images Direct Image: Let f : A → B and (non-empty) A ′ ⊆ A . The direct image of A ′ under f is f ( A ′ ) ⊆ B given by, f ( A ′ ) = { f ( x ) | x ∈ A ′ } . Inverse Image: Let f : A → B and (non-empty) B ′ ⊆ B . The inverse image (pre-image) of B ′ under f is f − 1 ( B ′ ) ⊆ A given by, f − 1 ( B ′ ) = { x | f ( x ) ∈ B ′ } . Example: f : R → R is defined by f ( x ) = x 2 ( x ∈ R ). Let P = { x ∈ R | x ∈ [0 , 2] } . The direct image f ( P ) = { y | y ∈ [0 , 4] } ( y ∈ R ) and the inverse image of set f ( P ) is f − 1 ( f ( P )) = { x | x ∈ [ − 2 , 2] } . So, f − 1 ( f ( P )) � = P and f is not a bijection / invertible. Properties: (RECAP) Let f : A → B , with A 1 , A 2 ⊆ A . Then, (i) If A 1 ⊂ A 2 ⇒ f ( A 1 ) ⊂ f ( A 2 ), (ii) f ( A 1 ∪ A 2 ) = f ( A 1 ) ∪ f ( A 2 ), and (iii) f ( A 1 ∩ A 2 ) ⊂ f ( A 1 ) ∩ f ( A 2 ). Note: In general, f ( A 1 ∩ A 2 ) � = f ( A 1 ) ∩ f ( A 2 ). Consider, f : R → R as f ( x ) = x 2 and A 1 = { 0 , 1 , 1 2 , 1 3 , . . . } , A 2 = { 0 , − 1 , − 1 2 , − 1 3 , . . . } . Here, f ( A 1 ∩ A 2 ) = { 0 } � = { 0 , 1 , 1 2 2 , 1 3 2 } = f ( A 1 ) ∩ f ( A 2 ). Let f : A → B be an onto mapping, with B 1 , B 2 ⊆ B . Then, (i) If B 1 ⊂ B 2 ⇒ f − 1 ( B 1 ) ⊂ f − 1 ( B 2 ), (ii) f − 1 ( B 1 ) = f − 1 ( B 1 ), (iii) f − 1 ( B 1 ∪ B 2 ) = f − 1 ( B 1 ) ∪ f − 1 ( B 2 ), and (iv) f − 1 ( B 1 ∩ B 2 ) = f − 1 ( B 1 ) ∩ f − 1 ( B 2 ). Proof: (i) Let x ∈ f − 1 ( B 1 ) ⇒ f ( x ) ∈ B 1 . Since B 1 ⊂ B 2 , therefore f ( x ) ∈ B 1 ⇒ f ( x ) ∈ B 2 . So, x ∈ f − 1 ( B 2 ) implying f − 1 ( B 1 ) ⊂ f − 1 ( B 2 ). Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 17

  72. Properties with Direct and Inverse Images Direct Image: Let f : A → B and (non-empty) A ′ ⊆ A . The direct image of A ′ under f is f ( A ′ ) ⊆ B given by, f ( A ′ ) = { f ( x ) | x ∈ A ′ } . Inverse Image: Let f : A → B and (non-empty) B ′ ⊆ B . The inverse image (pre-image) of B ′ under f is f − 1 ( B ′ ) ⊆ A given by, f − 1 ( B ′ ) = { x | f ( x ) ∈ B ′ } . Example: f : R → R is defined by f ( x ) = x 2 ( x ∈ R ). Let P = { x ∈ R | x ∈ [0 , 2] } . The direct image f ( P ) = { y | y ∈ [0 , 4] } ( y ∈ R ) and the inverse image of set f ( P ) is f − 1 ( f ( P )) = { x | x ∈ [ − 2 , 2] } . So, f − 1 ( f ( P )) � = P and f is not a bijection / invertible. Properties: (RECAP) Let f : A → B , with A 1 , A 2 ⊆ A . Then, (i) If A 1 ⊂ A 2 ⇒ f ( A 1 ) ⊂ f ( A 2 ), (ii) f ( A 1 ∪ A 2 ) = f ( A 1 ) ∪ f ( A 2 ), and (iii) f ( A 1 ∩ A 2 ) ⊂ f ( A 1 ) ∩ f ( A 2 ). Note: In general, f ( A 1 ∩ A 2 ) � = f ( A 1 ) ∩ f ( A 2 ). Consider, f : R → R as f ( x ) = x 2 and A 1 = { 0 , 1 , 1 2 , 1 3 , . . . } , A 2 = { 0 , − 1 , − 1 2 , − 1 3 , . . . } . Here, f ( A 1 ∩ A 2 ) = { 0 } � = { 0 , 1 , 1 2 2 , 1 3 2 } = f ( A 1 ) ∩ f ( A 2 ). Let f : A → B be an onto mapping, with B 1 , B 2 ⊆ B . Then, (i) If B 1 ⊂ B 2 ⇒ f − 1 ( B 1 ) ⊂ f − 1 ( B 2 ), (ii) f − 1 ( B 1 ) = f − 1 ( B 1 ), (iii) f − 1 ( B 1 ∪ B 2 ) = f − 1 ( B 1 ) ∪ f − 1 ( B 2 ), and (iv) f − 1 ( B 1 ∩ B 2 ) = f − 1 ( B 1 ) ∩ f − 1 ( B 2 ). Proof: (i) Let x ∈ f − 1 ( B 1 ) ⇒ f ( x ) ∈ B 1 . Since B 1 ⊂ B 2 , therefore f ( x ) ∈ B 1 ⇒ f ( x ) ∈ B 2 . So, x ∈ f − 1 ( B 2 ) implying f − 1 ( B 1 ) ⊂ f − 1 ( B 2 ). (ii), (iii) and (iv) Left for You as an Exercise! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 17

  73. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  74. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  75. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  76. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  77. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  78. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  79. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 If A = { w , x , y , z } , B = { 1 , 2 , 3 } , then all possible functions = 3 4 ; Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  80. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 If A = { w , x , y , z } , B = { 1 , 2 , 3 } , then all possible functions = 3 4 ; this includes 2 4 non-onto functions each from A → { 1 , 2 } , A → { 1 , 3 } and A → { 2 , 3 } . Now, the running count for onto functions = 3 4 − 3 . 2 4 . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  81. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 If A = { w , x , y , z } , B = { 1 , 2 , 3 } , then all possible functions = 3 4 ; this includes 2 4 non-onto functions each from A → { 1 , 2 } , A → { 1 , 3 } and A → { 2 , 3 } . Now, the running count for onto functions = 3 4 − 3 . 2 4 . But, we removed the constant function { ( w , 2) , ( x , 2) , ( y , 2) , ( z , 2) } twice – both during function removal from A → { 1 , 2 } , A → { 2 , 3 } . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  82. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 If A = { w , x , y , z } , B = { 1 , 2 , 3 } , then all possible functions = 3 4 ; this includes 2 4 non-onto functions each from A → { 1 , 2 } , A → { 1 , 3 } and A → { 2 , 3 } . Now, the running count for onto functions = 3 4 − 3 . 2 4 . But, we removed the constant function { ( w , 2) , ( x , 2) , ( y , 2) , ( z , 2) } twice – both during function removal from A → { 1 , 2 } , A → { 2 , 3 } . So, the final onto functions count = 3 4 − 3 . 2 4 + 3 = 3 4 − 2 4 + � 3 � 3 � 3 1 4 . � � � 3 2 1 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  83. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 If A = { w , x , y , z } , B = { 1 , 2 , 3 } , then all possible functions = 3 4 ; this includes 2 4 non-onto functions each from A → { 1 , 2 } , A → { 1 , 3 } and A → { 2 , 3 } . Now, the running count for onto functions = 3 4 − 3 . 2 4 . But, we removed the constant function { ( w , 2) , ( x , 2) , ( y , 2) , ( z , 2) } twice – both during function removal from A → { 1 , 2 } , A → { 2 , 3 } . So, the final onto functions count = 3 4 − 3 . 2 4 + 3 = 3 4 − 2 4 + � 3 � 3 � 3 1 4 . � � � 3 2 1 If |A| = m ≥ n = |B| , how many Onto functions? = O ( m , n ) Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  84. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 If A = { w , x , y , z } , B = { 1 , 2 , 3 } , then all possible functions = 3 4 ; this includes 2 4 non-onto functions each from A → { 1 , 2 } , A → { 1 , 3 } and A → { 2 , 3 } . Now, the running count for onto functions = 3 4 − 3 . 2 4 . But, we removed the constant function { ( w , 2) , ( x , 2) , ( y , 2) , ( z , 2) } twice – both during function removal from A → { 1 , 2 } , A → { 2 , 3 } . So, the final onto functions count = 3 4 − 3 . 2 4 + 3 = 3 4 − 2 4 + � 3 � 3 � 3 1 4 . � � � 3 2 1 If |A| = m ≥ n = |B| , how many Onto functions? = O ( m , n ) What do the above steps reveal? Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  85. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 If A = { w , x , y , z } , B = { 1 , 2 , 3 } , then all possible functions = 3 4 ; this includes 2 4 non-onto functions each from A → { 1 , 2 } , A → { 1 , 3 } and A → { 2 , 3 } . Now, the running count for onto functions = 3 4 − 3 . 2 4 . But, we removed the constant function { ( w , 2) , ( x , 2) , ( y , 2) , ( z , 2) } twice – both during function removal from A → { 1 , 2 } , A → { 2 , 3 } . So, the final onto functions count = 3 4 − 3 . 2 4 + 3 = 3 4 − 2 4 + � 3 � 3 � 3 1 4 . � � � 3 2 1 If |A| = m ≥ n = |B| , how many Onto functions? = O ( m , n ) What do the above steps reveal? ⇒ Principle of Inclusion-Exclusion! Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  86. The Leftover: Number of Onto Functions under f : A → B If 0 < |A| = m < n = |B| , how many Onto functions? = 0 If |A| = m = 1 = n = |B| , how many Onto functions? = 1 If |A| = m ≥ n = 2 = |B| , how many Onto functions? = 2 m − 2 If A = { x , y , z } , B = { 1 , 2 } , then all possible functions = |B| |A| = 2 3 ; but f 1 = { ( x , 1) , ( y , 1) , ( z , 1) } and f 2 = { ( x , 2) , ( y , 2) , ( z , 2) } are NOT onto. Hence, number of onto functions = 2 3 − 2 = 6. 3 m − 2 m + � 3 � 3 � 3 1 m � � � If |A| = m ≥ n = 3 = |B| , how many Onto functions? = 3 2 1 If A = { w , x , y , z } , B = { 1 , 2 , 3 } , then all possible functions = 3 4 ; this includes 2 4 non-onto functions each from A → { 1 , 2 } , A → { 1 , 3 } and A → { 2 , 3 } . Now, the running count for onto functions = 3 4 − 3 . 2 4 . But, we removed the constant function { ( w , 2) , ( x , 2) , ( y , 2) , ( z , 2) } twice – both during function removal from A → { 1 , 2 } , A → { 2 , 3 } . So, the final onto functions count = 3 4 − 3 . 2 4 + 3 = 3 4 − 2 4 + � 3 � 3 � 3 1 4 . � � � 3 2 1 If |A| = m ≥ n = |B| , how many Onto functions? = O ( m , n ) What do the above steps reveal? ⇒ Principle of Inclusion-Exclusion! � n � n n m − ( n − 1) m + ( n − 2) m − · · · + ( − 1) n − 2 � n 2 m + ( − 1) n − 1 � n � n 1 m � � � � � O ( m , n ) = n n − 1 n − 2 2 1 n − 1 n ( − 1) i � n ( − 1) i � n � ( n − i ) m � ( n − i ) m = � = � n − i n − i i =0 i =0 Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 17

  87. Stirling Number of the Second Kind Combinatorial Definition For m ≥ n , Number of ways to distribute m objects into n identical (but i =0 ( − 1) i � n numbered) containers with no container empty = � n � ( n − i ) m . n − i Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 15 / 17

Recommend


More recommend