# Second Midterm Exam

### Directions:

• Answer the problems on the exam pages.
• There are five problems on pages 2-7, for 100 total points plus 10 extra credit. Actual scale was A=90, C = 54.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

```  Q1: 20 points
Q2: 20 points
Q3: 20 points
Q4: 20 points
Q5: 20 points plus 10 extra credit
Total: 100 points plus 10 extra credit
```

Questions 1 and 2 deal with the Fibonacci sequence from Discussion #5. Recall that the function F from naturals to naturals is defined recursively, by the rules F(0) = 0, F(1) = 1, and (for n > 1) F(n) = F(n-1) + F(n-2). As we calculated in the discussion, F(2) = 1, F(3) = 2, F(4) = 3, and F(5) = 5.

• Question 1 (20): Define SE(n) to be the sum of the even-numbered Fibonacci numbers from F(0) through F(2n). -- that is, SE(n) = ∑ni=0 F(2i). (Thus, for example, SE(2) = F(0) + F(2) + F(4) = 0 + 1 + 3 = 4.) Prove, by ordinary induction on n, that SE(n) = F(2n+1) - 1.

• Question 2 (20): Prove by ordinary induction that for any natural n, F(6n) is congruent to 0 modulo 4 (that is, F(6n) ≡ 0 (mod 4)) and F(6n+1) is congruent to 1 modulo 4 (that is, F(6n+1) ≡ 1 (mod 4)). (Hint: Your induction should use both statements about n together to prove both statements about n+1.)

• Question 3 (30+10): In my pocket I have a large number of dollar bills and exactly six cents in change. Chocolate bars cost \$1.43 each. I want to buy some number x of chocolate bars such that I can pay for them with my six cents of change and some of my dollar bills -- that is, I want x(1.43) to be exactly 0.06 more than some natural number.
• (a,5) Formulate an equation in modular arithmetic that expresses my goal for the number x.
• (b,5) Carefully state the Inverse Theorem and explain how it applies to this situation.
• (c,10) Prove that the integers 43 and 100 are relatively prime.
• (d,10) Find both an inverse of 43, modulo 100, and an inverse of 100, modulo 43. Use one of these to find a natural number x that meets my goal stated above (and in part (a)).
• (e,10 XC) Suppoe how that the choclolate bars cost a cents and I have b cents worth of change in my pocket, where a is a natural and b is a natural less than 100. Exactly what conditions on a and b will guarantee that there exists an x such that I can buy x chocolate bars for some number of dollars plus b cents? I want an "if and only if" condition, so that if a and b meet your condition then x exists, and if they don't meet your condition then x doesn't exist. (Hint: If the process you used in (d) is not possible, how might you still be able to solve the problem?)

• Question 4 (30): This problem deals with a directed graph G where each node Ni,j is given by a pair of naturals i and j. We can picture G with node Ni,j drawn at the position x=i and y=j in the usual Euclidean plane. There are four kinds of arcs (directed edges) in G:
• For all even i and all j, there is an arc from Ni,j north to Ni,j+1.
• For all odd i and all j, there is an arc from Ni,j south to Ni,j-1.
• For all even j and all j, there is an arc from Ni,j east to Ni+1,j.
• For all odd j and all i, there is an arc from Ni,j west to Ni-1,j.

(Note: This directed graph models the pattern of one-way streets in large parts of Manhattan Island.) It is not important to the problem how far G extends.

Here is an ASCII-art picture of part of G:

```N03 <--- N13 <--- N23 <--- N33 <--- ...
^        |        ^        |
|        |        |        |
|        v        |        v
N02 ---> N12 ---> N22 ---> N32 ---> ...
^        |        ^        |
|        |        |        |
|        v        |        v
N01 <--- N11 <--- N21 <--- N31 <--- ...
^        |        ^        |
|        |        |        |
|        v        |        v
N00 ---> N10 ---> N20 ---> N30 ---> ...
```

Recall the inductive definition of paths in a directed graph:

• (1) For any node x, there is a path of length 0 from x to x.
• (2) If there is a path α of length k from x to y, and an arc e from y to z, then there is a path αe of length k+1 from x to z.
• (3) The only paths are those constructed from (1) and (2). Thus if a predicate P(α) is true for the empty path, and P(α) → P(αe) for any such path α and arc e, then P(α) is true for all α.
Here are the questions:
• (a,10) Prove by induction on all paths that if α is a path from N0,0 to Ni,j, then the length of α is greater than or equal to i+j.
• (b,10) Explain (informally but carefully) why there is a path of length exactly i+j from N0,0 to Ni,j if i is even, if j is even, or if both are even.
• (c,10) Prove by induction on all paths that if α is a path from N0,0 to Ni,j and i and j are both odd, then the length of α is greater than or equal to i+j+2. You may use the result of part (a).