{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MIT6_042JF10_midterm_sol

# MIT6_042JF10_midterm_sol - 6.042/18.062J Mathematics for...

This preview shows pages 1–4. Sign up to view the full content.

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 .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 = 0 : G 0 = 1 = 3 0 . 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 ( 0 ) 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 the computer will choose 2 shapes, or you will choose two shapes. In either case the two

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern