



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




6.042/18.062J Mathematics for Computer Science September 14, 2010 Tom Leighton and Marten van Dijk
Problem 1. [12 points] Define a 3-chain to be a (not necessarily contiguous) subsequence of three integers, which is either monotonically increasing or monotonically decreasing. We will show here that any sequence of five distinct integers will contain a 3-chain. Write the sequence as a 1 , a 2 , a 3 , a 4 , a 5. Note that a monotonically increasing sequences is one in which each term is greater than or equal to the previous term. Similarly, a monotonically decreasing sequence is one in which each term is less than or equal to the previous term. Lastly, a subsequence is a sequence derived from the original sequence by deleting some elements without changing the location of the remaining elements.
(a) [4 pts] Assume that a 1 < a 2. Show that if there is no 3-chain in our sequence, then a 3 must be less than a 1. (Hint: consider a 4 !)
(b) [2 pts] Using the previous part, show that if a 1 < a 2 and there is no 3-chain in our sequence, then a 3 < a 4 < a 2.
(c) [2 pts] Assuming that a 1 < a 2 and a 3 < a 4 < a 2 , show that any value of a 5 must result in a 3-chain.
(d) [4 pts] Using the previous parts, prove by contradiction that any sequence of five distinct integers must contain a 3-chain.
Problem 2. [8 points]
Prove by either the Well Ordering Principle or induction that for all nonnegative integers, n: (^) n ( ) ∑ 2 i^3 =
n(n + 1)
. (1) i=0^2
Problem 3. [25 points] The following problem is fairly tough until you hear a certain one-word clue. The solution is elegant but is slightly tricky, so don’t hesitate to ask for hints!
During 6.042, the students are sitting in an n × n grid. A sudden outbreak of beaver flu (a rare variant of bird flu that lasts forever; symptoms include yearning for problem sets and craving for ice cream study sessions) causes some students to get infected. Here is an example where n = 6 and infected students are marked ×.
Now the infection begins to spread every minute (in discrete time-steps). Two students are considered adjacent if they share an edge (i.e., front, back, left or right, but NOT diagonal); thus, each student is adjacent to 2, 3 or 4 others. A student is infected in the next time step if either
� the student was previously infected (since beaver flu lasts forever), or
� the student is adjacent to at least two already-infected students.
In the example, the infection spreads as shown below.
× × × × ×
In this example, over the next few time-steps, all the students in class become infected.
Theorem. If fewer than n students in class are initially infected, the whole class will never be completely infected.
Prove this theorem.
Hint: When one wants to understand how a system such as the above “evolves” over time, it is usually a good strategy to (1) identify an appropriate property of the system at the initial stage, and (2) prove, by induction on the number of time-steps, that the property is preserved at every time-step. So look for a property (of the set of infected students) that remains invariant as time proceeds.
If you are stuck, ask your recitation instructor for the one-word clue and even more hints!
Problem 4. [10 points] Find the flaw in the following bogus proof that an^ = 1 for all nonnegative integers n, whenever a is a nonzero real number.
Proof. The bogus proof is by induction on n, with hypothesis
P (n) ::= →k � n. ak^ = 1,
(b) [2 pts] How many pairs of tiles will have their relative order changed by a column move? More formally, for how many pairs of letters L 1 and L 2 will L 1 appear earlier in the order of the tiles than L 2 before the column move and later in the order after the column move? Prove your answer correct.
(c) [2 pts] We define an inversion to be a pair of letters L 1 and L 2 for which L 1 precedes L 2 in the alphabet, but L 1 appears after L 2 in the order of the tiles. For example, consider the following configuration: A B C E D H G F I J K L M N O
There are exactly four inversions in the above configuration: E and D, H and G, H and F , and G and F.
What effect does a row move have on the parity of the number of inversions? Prove your answer.
(d) [4 pts] What effect does a column move have on the parity of the number of inversions? Prove your answer.
(e) [8 pts] The previous problem part implies that we must make an odd number of column moves in order to exchange just one pair of tiles (N and O, say). But this is problematic, because each column move also knocks the blank square up or down one row. So after an odd number of column moves, the blank can not possibly be back in the last row, where it belongs! Now we can bundle up all these observations and state an invariant, a property of the puzzle that never changes, no matter how you slide the tiles around.
Lemma. In every configuration reachable from the position shown below, the parity of the number of inversions is different from the parity of the row containing the blank square.
row 1 row 2 row 3 row 4
Prove this lemma.
(f) [2 pts] Prove the theorem that we originally set out to prove.
Problem 7. [15 points] There are two types of creature on planet Char, Z-lings and B- lings. Furthermore, every creature belongs to a particular generation. The creatures in each generation reproduce according to certain rules and then die off. The subsequent generation consists entirely of their offspring.
The creatures of Char pair with a mate in order to reproduce. First, as many Z-B pairs as possible are formed. The remaining creatures form Z-Z pairs or B-B pairs, depending on whether there is an excess of Z-lings or of B-lings. If there are an odd number of creatures, then one in the majority species dies without reproducing. The number and type of offspring is determined by the types of the parents
� If both parents are Z-lings, then they have three Z-ling offspring.
� If both parents are B-lings, then they have two B-ling offspring and one Z-ling offspring.
� If there is one parent of each type, then they have one offspring of each type.
There are 200 Z-lings and 800 B-lings in the first generation. Use induction to prove that the number of Z-lings will always be at most twice the number of B-lings.
Hint: You may want to use a stronger hypothesis for the induction.