# Solutions for Practice Third Midterm Exam

### Directions:

• Answer the problems on the exam pages.
• There are five problems for 100 total points. Scale will be determined after the exam but a good guess is A = 90, C = 60.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

Question text is in black, solutions in blue.

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

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

• (a) the power set of a set X

The power set of X is the set {Y: Y ⊆ X}, that is, the set consisting of every possible subset of X.

• (b) the codomain of a function

The codomain of a function is the set from which its output values are taken. If f is a function from X to Y, the codomain of f is Y. It is not necessarily true that every element of the codomain is the output from some input -- this is true only if the function is onto.

• (c) a one-to-one function

A one-to-one function is a function (say f from X to Y) where every element of Y is the output for at most one input in X. Equivalently, there are not two distinct elements x and x' of X such that f(x) = f(x').

• (d) an antisymmetric binary relation

A relation R ⊆ A × A is antisymmetric if whenever (x, y) and (y, x) are both elements of R, then x = y. That is, no two distinct elements of A are related by R in both directions.

• (e) the rule of sums with overlap

This rule states that for any two finite sets A and B, |A ∪ B| = |A| + |B| - |A ∩ B|, where "|X|" denotes the size of X (the number of elements in X).

• Question 2 (15): Determine whether each of these five statements is true or false. No explanation is needed or wanted, and there is no penalty for guessing.

• (a) If f(x) ≠ f(y), we know that f is not an onto function.

FALSE. The given condition does not determine whether some other element z of the codomain fails to be hit by f. (I meant to say that the domain and codomain each had two elements, where then f(x) = f(y) would mean that f was onto.)

• (b) Let m and n be any two positive integers. Then there exist two sets A and B, where A has m elements, B has n elements, and A ∩ B has m + n - 2 elements.

FALSE. If n > 2 this would force A ∩ B to have more elements than A, which is impossible. I meant to say "A ∪ B" instead of "A ∩ B". That would make it true, since then A could be {1,..., m} and B could be {m,..., m+n-2}.

• (c) There are more than 10 binary strings of length 4 that have at least two 1's.

TRUE. There are C(4, 2) = 6 with exactly two 1's, C(4, 3) = 4 with exactly three, and C(4, 4) = 1 with exactly four, making 11 with two or more.

• (d) If S is a set of seven dogs, and each dog is of exactly one breed from the set {retriever, spaniel, terrier}, then the must be at least two dogs of each breed.

FALSE. There could be four retrievers, three spaniels, and no terriers. There must be at least three dogs of some breed by the Pigeonhole Principle.

• (e) For any finite set S, if P is the power set of S, then S ⊆ P.

FALSE. The elements of S are not sets and so are not members of P. It is true that for every element x of S, the set {x} is in P, but x itself is not.

• Question 3 (35): Let X be the set of dogs {Arly, Baxter, Cardie, Duncan, Ebony}. 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) {Y: Y ⊆ X and Y contains exactly two dogs}

C(5, 2) = 5*4/1*2 = 10.

• (b) {L: L is an ordered list from X of size 3}

5*5*5 = 125.

• (c) {Z: L is an unordered list from X of size 4}

C(8, 4) = 8*7*6*5/1*2*3*4 = 70, by the "stars and bars" argument -- any arrangement of four stars (for the elements of the list) and four bars (for the barriers between A, B, C, D, and E) will give such an unordered list. (I should have given a question with a smaller answer that could more easily be counted by hand.)

• (d) {Q: Q is a permutation from X of length 4, beginning with Baxter}

P(4, 3) = 4*3*2 = 24. There are four choices for the second dog, three for the third, and two for the fourth.

• (e) {(S, T): S and T are each sets of two dogs from X and S ∩ T = ∅}

There are many ways to think about this. Perhaps simplest is to first choose which of the five dogs is in neither S nor T, then consider the ways to split the other four dogs. There are C(4, 2) = 6 size-two subsets of those four, but since these come in pairs there are only three ways to divide them. So the total number of choices is 5*3 = 15.

• (f) {R: R is an permutation from X of size 3 where the dogs in R come in alphabetical order}

There is one such permutation for each size-3 subset of X, so the total number is C(5, 3) = 5*4*3/1*2*3 = 10. They could also be listed by hand as ABC, ABD, ABE, ACD, ACE, ADE, BCD, BCE, BDE, CDE.

• (g) {P: P is a nonempty subset of X}

There are 25 = 32 subsets of a five-element set. Since only one is empty, the other 31 are nonempty.

• Question 4 (15): Let A, B, and C be any three sets. Give an element-wise proof that (A - B) ∪ (B - C) ⊆ (B ∩ C)'. (Recall that if X and Y are any two sets, Y' is the complement of Y and "X - Y" means "(X ∩ Y')".)

Let x be an arbitrary element of the left-hand set. We must show that it is in the right-hand set.

Case 1: x is in (A - B). Since x is not in B, it is not in (B ∩ C) and so it is in (B ∩ C)'.

Case 2: x is in (B - C). Since x is not in C, it is not in (B ∩ C) and so it is in (B ∩ C)'.

• Question 5 (20): Let f: A → B and g: B → C be two functions that are each bijections. Let h: A → C be defined so that for any x in A, h(x) = g(f(x)). Prove that h is a bijection. (Recall that a function is a bijection if and only if it is both one-to-one and onto.)

Proof 1: Since f is a bijection, it has an inverse f-1: B → A. Since g is a bijection, it has an inverse g-1: C → B. We can define a function z: C → A by letting z(y) = f-1(g-1(y)) for any y in C. This function is an inverse of h because z(h(x)) = x for any element x of A, and h(z(y)) = y for any element y of C. Since h has an inverse, it must be a bijection.

Proof 2: We show separately that h is both onto and one-to-one. If c is any element of C, it equals g(b) for some b in B because g is onto. This b then equals f(a) for some a in A because f is onto. So c = g(f(a)) = h(a), and since any arbitary element of c is hit by h, h must be onto.

Let x and y be two different elements of A. Since f is one-to-one, f(x) and f(y) must be two different elements of B. Since g is one-to-one, g(f(x)) and g(f(y)) must be two different elements of C. These elements are h(x) and h(y) respectively. Since h maps any two distinct elements of A to distinct elements of C, it is one-to-one.

Since h is both onto and one-to-one, it is a bijection.