This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 6.042/18.062J Mathematics for Computer Science October 27, 2010 Tom Leighton and Marten van Dijk Midterm Problem 1. [10 points] Consider these two propositions: P: ( A B ) C Q: ( C A ) ( C B ) Which of the following best describes the relationship between P and Q ? Please circle exactly one answer. 1. P and Q are equivalent 2. P Q 3. Q P 4. All of the above 5. None of the above Draw a truth table to illustrate your reasoning. You can use as many columns as you need. Solution. A B C P Q T T T T T T T F F F T F T T T T F F F T F T T T T F T F F T F F T T T F F F T T Observe from the last two columns of the table that P Q is always true, but Q P is not always true (e.g. line 4). Thus P and Q are not equivalent but P Q . 2 Midterm Problem 2. [10 points] Let G 0 = 1, G 1 = 3, G 2 = 9, and define G n = G n 1 + 3 G n 2 + 3 G n 3 (1) for n 3. Show by induction that G n 3 n for all n 0. Solution. The proof is by strong induction with hypothesis P ( n ) : = G n 3 n . Proof. Base Cases n = : G 0 = 1 = 3 . n = 1 : G 1 = 3 3 1 . n = 2 : G 2 = 9 3 2 . Inductive Step : Assume n 3 and P ( k ) for all k such that 0 k n . G n = G n 1 + 3 G n 2 + 3 G n 3 by ( 1 ) 3 n 1 + ( 3 ) 3 n 2 + ( 3 ) 3 n 3 by induction hypothesis = 3 n 2 [ 3 + 3 + 1 ] = ( 7 ) 3 n 2 < ( 9 ) 3 n 2 = 3 n 3 Midterm Problem 3. [20 points] In the game of Squares and Circles, the players (you and your computer) start with a shared finite collection of shapes: some circles and some squares. Players take turns making moves. On each move, a player chooses any two shapes from the collection. These two are replaced with a single one according to the following rule: A pair of identical shapes is replaced with a square. A pair of different shapes is replaced with a circle. At the end of the game, when only one shape remains, you are a winner if the remaining shape is a circle. Otherwise, your computer wins. (a) [5 pts] Prove that the game will end. Solution. Proof. We use induction on the number of turns to prove the statement. Let n be the number of shapes originally, and let P(k) be the proposition that if 0 k n 1 then after k turns, the number of remaining shapes is n k . Thus the game ends after n 1 steps. Base case: P ( ) is true by definition; the number of reamaining shapes after 0 turns is n 0 = n , the original number of shapes. Inductive step: Now we must show that P ( k ) implies P ( k + 1 ) for all k 0. If k > = n 1, P ( k ) implies P ( k + 1 ) would always be true, since P ( k + 1 ) would be trivially true. So we only need to prrove this for k < n 1. So assume for your inductive hypothesis that P ( k ) is true, where 0 k < n 1; that is, after k turns the number of remaining shapes in n k . Since k < n 1, the number of remaining shapes is n k > 1. Hence there are at least 2 shapes to choose from and the game has not ended yet. In the k+1st turn either least 2 shapes to choose from and the game has not ended yet....
View
Full
Document
This note was uploaded on 01/19/2012 for the course CS 6.042J / 1 taught by Professor Tomleighton,dr.martenvandijk during the Fall '10 term at MIT.
 Fall '10
 TomLeighton,Dr.MartenvanDijk
 Computer Science

Click to edit the document details