Você está na página 1de 5

1

Functions on nite sets

If f : A B is a function, the set A is the source of f and the set B is the target of f . Two functions f, g are equal when the source of f is the same as the source of g, the target of f is the same as the target of g, and for each x in the common source, the values f (x) and g(x) are the same. Recall the notation: [n] = {0, 1, . . . , n 1}. A function f : [n] [m] may be identied with a list of integers in [m] of length n. For example, the function [3] [4] dened by the table i 0 1 2 f (i) 2 0 2

is represented by the list (2 0 2). Thus, there are mn functions [n] [m], since each of the n positions in the list may have any of m values. Denition 1.1 A function f : A B is injective or 1-1, if for any a, a A, if f (a) = f (a ) then a = a . In other words, a function f : A B is NOT injective if there exists a, a A with a = a but f (a) = f (a ). Denition 1.2 A function f : A B is surjective or onto, if for any b B there is some a A such that b = f (a). In other words, a function f : A B is NOT surjective if there is some b B such that f (a) = b, for all a A. Denition 1.3 A function f : A B is bijective, or a 1-1 correspondence if f is both injective and surjective.

Function composition

Suppose that f : A B and g : B C are functions. Then the composite g f : A C is the function dened by: (g f )(a) = g(f (a)).

Example 2.1 Suppose A = Z3 and B = Z4 and C = Z5 and f : A B, g : 1

B C are the functions f (x) = 2x mod 4 g(x) = x + 3 mod 5. Then, if h = g f , x Z3 0 1 2 h(x) Z5 3 0 3

The fundamental fact about function composition is Theorem 2.2 Function composition is associative; i.e., if f : A B, g : B C, h : C D are functions, then h (g f ) Also, g 1B 1B f = g:BC = f : A B, = (h g) f.

where, for any set X, 1X : X X denotes the identity function on X. Proof of associativity. For x A, both sides have the value h(g(f (x))). In particular, if all functions have the same set as source and target, i.e., if f, g, h : A A for some set A, then the composites f (gh) and (f g)h are the same. In Scheme, (define (comp g f) (lambda(x) (g (f x))) ) (define (m2 x) (* 2 x)) ;; multiply x by 2 (define (m3 x) (* 3 x)) > ((comp m2 m3) 4) 24 As expected, m3(m2(x)) = m3(2x) = 3(2x) = 6x.

Pigeon hole principle

This principle may be roughly stated as follows: you cant place n + 1 pigeons into n pigeon holes without putting at least two pigeons in the same pigeon hole. More mathematically, the statement is: there is no injective function from a set of size n + 1 to a set of size n if n 0. This fact is named for the above-mentioned bird. It is proved by induction on n. Basis: there is no injective function [1] [0]. Indeed, there is no function whatsoever from a nonempty set to the empty set. Induction assumption: there is no injective function [n + 1] [n]. Induction step: To prove: there is no injection [n + 2] [n + 1]. We argue by contradiction. Assume f : [n + 2] [n + 1] is injective. Case 1. f (n + 1) = n. Then the restriction of f to [n + 1] maps [n + 1] [n] and the restriction is injective. This is a contradiction. Case 2. f (n + 1) < n. Case 2a. There is some i < n + 1 with f (i) = n. Then the function g : [n + 2] [n + 1] dened by n x=n+1 g(x) = f (n + 1) x = i f (x) otherwise.

is an injection [n + 2] [n + 1] satisfying Case 1. This is impossible.

Case 2b. There is no i < n with f (i) = n. Then the function g : [n+2] [n+1] dened by g(x) = n x=n+1 f (x) otherwise.

is an injection [n + 2] [n + 1] satisfying Case 1. This is impossible. The argument is complete. Corollary 3.1 There is no injective function [n + k] [n], for n 0, k > 0. Proof. When k = 1, this is the pigeon hole principle. Assume that k > 1 and f : [n + k] [n]. Then, the function g : [n + 1] [n], dened, for i [n + 1], by g(i) = f (i), 3

cannot be injective, by the pigeon hole principle. Thus, f is not injective. Using the pigeon hole principle, we prove Proposition 3.2 If f : [n] [n] is injective, it is surjective. Proof. We prove this by induction on n. Basis step: n = 0. The unique function is surjective, by default. Induction Assumption: For any function f : [n] [n], if f is injective, it is surjective. Induction step. Assume the function g : [n + 1] [n + 1] is injective. We show g is surjective. Case 1. g(n) = n. In this case, for i [n], g(i) [n], since g is injective. Thus, we may dene the function f : [n] [n] by: f (i) = g(i). Since g is injective, so is f , by the induction assumption. It now follows that g is surjective. Case 2. g(n) = a < n. Case 2a. For some i [n], g(i) = n. Since g is injective, there is exactly one such i. Let the function h : [n + 1] [n + 1] be dened by n j=n h(j) = a j=i g(j) otherwise.

Then h is injective, since g is. Also, h satises Case 1. Thus h, and thus g is surjective. Case 3. g(i) < n, all i [n]. Then g is an injective function [n + 1] [n], violating the pigeon hole principle. The proof is complete. Proposition 3.3 If f : [n] [n] is surjective, f is injective. Proof. Since f is surjective, for each i [n], the set X(i) is nonempty, where X(i) = {j [n] : f (j) = i}. Choose some xi X(i), for each i [n]. Dene g(i) = xi . Then g : [n] [n] is injective, since the sets X(i) are pairwise disjoint. Thus, by the previous proposition, g is surjective. Now if f (a) = f (b) = i, then both a, b X(i). Thus a = g(k) and b = g(k ), since g is surjective. If k = k , then a and b are in dierent sets, a contradiction. Thus, a = b, so f is injective. 4

Homework
1. Read Chapter 5. 2. Do problems: 1,2,4,7,8,9,10, page 182. 3. Do 12, page 182. 4. Show that idA : A A is a bijection, where idA (x) = x, all x A. 5. Suppose that f : A B is a bijection. Show there is some g : B A f g such that the composite A B A is the identity function on A. 6. Suppose that the composite A B A is the identity function on A. Show that f is injective and g is surjective.
f g

Você também pode gostar