# Solutions to Third Midterm Exam

### Directions:

• Answer the problems on the exam pages.
• There are five problems for 100 total points. Actual scale was A = 85, C = 55.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

```  Q1: 15 points
Q2: 15 points
Q3: 35 points
Q4: 15 points
Q5: 20 points
Total: 100 points
```

Question text is in black, solutions in blue.

• Question 1 (15): Briefly identify the following terms or concepts (3 points each):

• (a) an equivalence relation

An equivalence relation on a set A is a relation R ⊆ A × A that is reflexive, symmetric, and transitive. Equivalently, it is the "same set" relation for some partition of A, that is, R(x, y) is true if and only if x and y are in the same set of the partition.

• (b) for two sets to be disjoint

They have no element in common, i.e., A and B are disjoint if and only if A ∩ B = ∅.

• (c) what it means for a relation R ⊆ A × B to be a function

Such a relation is a function if and only if for every element a of A, there is exactly one element b of B such that R(a, b) is true.

• (d) a bijection

A bijection is a function that is both one-to-one and onto.

• (e) the Product Rule for counting sets

The Product Rule says that if A and B are finite sets, |A × B| = |A| times |B|.

• Question 2 (15): Determine whether each of these five statements is true or false (3 points each). No explanation is needed or wanted, and there is no penalty for guessing. In the first three statements, A and B are finite sets and f: A → B is a function.

• (a) If B has more elements than A, then f is not onto.

TRUE. There cannot be an onto function from a smaller finite set to a larger set.

• (b) If f is not onto, then B has more elements than A.

FALSE. Let A = {x, y} and B = {1, 2} and define f(x) = f(y) = 1. This f is not onto, yet A and B have the same number of elements.

• (c) If A has m elements and B has n elements, then the power set of A × B has 2m × 2n elements.

FALSE. The correct number is 2|A × B| = 2mn, not 2m2n = 2m+n.

• (d) If I distribute seven treats among four dogs, then at least one dog gets more than two treats.

FALSE. They might be distributed 2-2-2-1, with no dog having more than two. The Pigeonhole Principle here says that at least one dog must get at least 7/4 treats, hence at least two treats.

• (e) Of all the binary strings of length 5, more have an odd number of ones than have an even number of ones.

FALSE. There are sixteen of each. We can calculate C(5, 0) + C(5, 2) + C(5, 4) = 1 + 10 + 5 = 16, or observe that flipping the first bit gives a bijection between the even-ones and odd-ones strings. Since there is a bijection between those two sets, they must have the same size.

• Question 3 (35): Let X be the set of dogs {Arly, Baxter, Cardie, Duncan}. Give the sizes of each of the following sets. No proof is necessary for a correct answer, but a justification may help with partial credit (5 points each).

• (a) {F: F is a subset of X containing Baxter but not Duncan}

Such an F is {B} ∪ Z where Z is any subset of {A, C}. There are 22 = 4 subsets of a two-element set.

• (b) {G: G is an ordered list from X of size 5}

This is |X|5 = 45 = 1024.

• (c) {H: H is an unordered list from X of size 7}

By the Stars and Bars argument, such a list corresponds to a string containing 7 stars and 4 - 1 = 3 bars. There are C(10, 3) = 120 such strings.

• (d) {I: I is a permutation from X of length 3, not containing Baxter}

The permutation is from the three-element set of remaining dogs, so there are P(3, 3) = 6 possible permutations.

• (e) {J: J is a subset of X and the size of J is odd}

We could observe as in Question 2(e) that the odd-size subsets form half the possible subsets, so there are (1/2)24 = 8 of them. Or we could calculate C(4, 1) + C(4, 3) = 4 + 4 = 8.

• (f) {K: K is a binary relation on X (a subset of X × X)}

There are |X| times |X| or 4 times 4 = 16 elements of the set X × X. There are thus 216 = 65536 possible subsets of this set.

• (g) {L: L is a permutation form X of size 5}

A permutation of size 5 would be a one-to-one function from {1, 2, 3, 4, 5} to X, which cannot exist by the Pigeonhole Principle. There are thus 0 such permutations. We could also calculate P(4, 5) = 4*3*2*1*0 = 0.

• Question 4 (15): Let A, B, C, and D be any four sets. Assume that A ⊆ B and that C ⊆ D. Give an element-wise proof that (A ∪ C) ⊆ (B ∪ D).

Let x be an arbitrary element of A ∪ C.

Case 1: x is in A. Since A ⊆ B, x is also in B, and thus in B ∪ D.

Case 2: x is in C. Since C ⊆ D, x is also in D, and thus in B ∪ D.

Since every element of A ∪ C is in B ∪ D, the subset relationship (A ∪ C) ⊆ (B ∪ D) follows.

• Question 5 (20): Let A, B, and C be finite sets with |A| > |B| and |A| = |C|. (Here "|X|" denotes the number of elements in X.) Let f: A → B and g: B → C be any two functions. Define h: A → C be defined by the rule h(a) = g(f(a)). Prove that h not a bijection.

There are several ways to do this.

Proof 1: Since |B| < |C|, g cannot be onto. Thus there exists an element c of C such that c is not equal to g(b) for any possible b. This c thus cannot be g(f(a)) = h(a) for any possible a. So h is not onto and therefore not a bijection.

Proof 2: Since |A| > |B|, f cannot be one-to-one. Thus there exist two elements a and a' of A such that f(a) = f(a'). Therefore g(f(a)) = g(f(a')), which means h(a) = h(a') by definition, and h is not one-to-one and therefore not a bijection.