Solution to Problem 6 on Baby Exam M366 Spring 2012 Problem 6 Prove that if X and Y are finite sets with the same number of elements and f :X→Y is a function from X to Y , then f is injective if and only if it is surjective. Proof: we are given that X and Y are finite sets with the same number of elements. Without loss of generality, throughout the proof we assume: |X| = |Y | = n for some positive integer n and we denote the elements of X by x1 , . . . , xn and the elements of Y by y1 , . . . , yn . f injective implies f surjective: we assume that f is an injective function. This means that if xi 6= xj then f (xi ) 6= f (xj ). Therefore the set R = {f (x1 ), f (x2 ), . . . , f (xn )} consists of n distinct elements of Y . R is a subset of Y and it has the same number of elements as Y : this means that R = Y . Therefore for every y ∈ Y , y ∈ R, i.e. y = f (xi ) for some i. But this is the definition of f being surjective. f surjective implies f injective: now it is part of our hypotheses that f is a surjective function. We proceed to make a proof by contradiction. Let us assume that f is not injective and derive a contradiction to our hypotheses. If f is not injective there must be two distinct elements of X, that we can name x1 and x2 , such that f (x1 ) = f (x2 ). Then the set R = {f (x1 ) = f (x2 ), f (x3 ), . . . , f (xn )} has at most n − 1 elements and is therefore a proper subset of Y. This means that there is an element of Y that does not belong to R, i.e. that is not the image of any element of X via f . But this contradicts the assumption that f is a surjective function.