# Second Midterm Exam

### Directions:

• Answer the problems on the exam pages.
• There are six problems, some with multiple parts, for 100 total points plus 10 extra credit. Actual scale was A = 90, C = 60.
• Some useful definitions precede the questions below.
• No books, notes, calculators, or collaboration.
• In case of a numerical answer, an arithmetic expression like "217 - 4" need not be reduced to a single integer.

```  Q1: 10 points
Q2: 20 points
Q3: 15 points
Q4: 15 points
Q5: 20 points
Q6: 20+10 points
Total: 100+10 points
```

### Definitions Used on the Exam:

• Remember that natural number always means "non-negative integer".

• The scope of any quantifier is always to the end of the statement it is in.

• Questions 1-3 use a set of dogs D that includes the four named dogs Ace, Biscuit, Cardie, and Duncan. In Questions 1 and 2 these are the only dogs in D, but in Question 3 there may be others. The predicate F(x, y) means "dog x and dog y are friends". We assume that F is antireflexive (meaning ∀x: ¬F(x, x)) and symmetric (meaning ∀x: ∀y: F(x, y) ⇔ F(y, x)). These two assumptions mean that F may be modeled as a simple (undirected) graph.

• The three statements of Question I are:
• (I) Ace is friends with every dog except himself.
• (II) ∃x:∃y:∃z: (x ≠ y) ∧ (x ≠ z) ∧ (y ≠ z) ∧ F(x, y) ∧ (¬F(x, z)) ∧ (¬F(y, z))
• (III) Biscuit is friends with exactly one dog.

• A Family of Directed Graphs: In Question 6, we define a directed graph Gn for each natural number n. Gn models part of a road network like that of Manhattan Island in New York City. There are 2n + 2 vertices in Gn, named a0, a1,..., an and b0, b1,..., bn. There is an arc (directed edge) from ai to ai-1 and from bi to bi+1 for every i such that those vertices are both in Gn. There is an arc from ai to bi for every even i, and an arc from bi to ai for every odd i. There are no other arcs. Here is a diagram for G3:

``````
[a0] <---- [a1] <---- [a2] <---- [a3]
|          ^          |          ^
|          |          |          |
|          |          |          |
V          |          V          |
[b0] ----> [b1] ----> [b2] ----> [b3]
``````

• A directed graph is defined to be strongly connected if for any two vertice u and v in the graph, there is a (directed) path from u to v.

• Question 1 (20): Translate each statement as indicated, using the set of dogs {Ace, Biscuit, Cardie, Duncan} and the predicate F(x, y) meaning "dog x and dog y are friends".

• (a, 3) (to symbols) (Statement I) Ace is friends with every dog except himself.

• (b, 3) (to English) (Statement II) ∃x:∃y:∃z: (x ≠ y) ∧ (x ≠ z) ∧ (y ≠ z) ∧ F(x, y) ∧ (¬F(x, z)) ∧ (¬F(y, z))

• (c, 4) (to symbols) (Statement III) Biscuit is friends with exactly one dog.

• Question 2 (15): These questions use the definitions, assumptions, and predicates from Question 1, which are also listed above. Those facts give you enough information to determine all the values of F(x, y) for any dogs x and y.

• (a, 10) Draw the simple (undirected) graph for the relation F -- that is, draw a vertex for each of the four dogs and an edge between x and y if and only if F(x, y) is true.

• Question 3 (15): This question involves a set of dogs D that includes the four named dogs but possibly others. Assume that F is antireflexive and symmetric (as defined above) and assume Statements I and III from Question 1 but not Statement II. Prove the following statement using quantifier rules:

∃x: ∃y: ∃z: (x ≠ y) ∧ (x ≠ z) ∧ (y ≠ z) ∧ [(F(x, y) ∧ F(x, z) ∧ F(y, z)) ∨ ((¬F(x, y)) ∧ (¬F(x, z)) ∧ (¬F(y, z)))]

or in English, "There exist three distinct dogs such that either every pair is friendly or every pair is unfriendly". (Hint: Let two of your dogs be Cardie and Duncan and use an argument by cases to determine your third dog.)

• Question 4 (15): Suppose we are searching for a target number, where we guess a number and are told that it is too low, exactly right, or too high. We know that our number n is an integer in the range from x to y, inclusive, and that there are n integers in that range for some n > 0.

Let P(k) be the statement "If n ≤ 2k - 1, then we can find the number with k guesses". Prove P(k) by induction for all positive integers k.

• Question 5 (20): Consider the following two-player game played on a grid where each square is labeled by a pair of natural numbers. The square (i, j) is i units each and j units north of the square (0, 0). We begin the game with a chess rook on some square (i, j). The players alternate moves, and a move consists of moving the rook either west or south some number of squares, thus subtracting a positive integer from either i or j. The first player who cannot move loses, so moving to (0, 0) wins the game.

Prove that the first player has a winning strategy starting from (i, j) if and only if i ≠ j. (Hint: Let P(k) be the statement: "If k is the minimum of i an dj, then the first player has a winning strategy starting from (i, j) if and only if i ≠ j." Then prove P(k) for all natural numbers k by strong induction. But if you can't do the strong induction, make the most convincing argument you can.) problems:

• Question 6 (20+10): These three questions use the family of directed graphs Gn defined above.

• (a, 10) For any natural number n, Gn+1 can be made from Gn by adding exactly two more vertices, an+1 and bn+1, and exactly three more arcs, (an+1, an), (bn, bn+1), and either (an+1, bn+1) or (bn+1, an+1). From these facts, prove (by induction on n) that each graph Gn has exactly 3n + 1 arcs.

• (b, 10) Explain why Gn is strongly connected (as defined above) if and only if n is odd. You may be informal if you are convincing.

• (c, 10XC) Let f(k) be the number of k-step paths in the graph G3 from the vertex a0 to itself. Determine f(k) for as many values of k as you can. For full credit, give a general rule that gives f(k) for any natural number k, and prove your rule (preferably by induction).