Math 100/COSC 149 and COSC 49
Topics in Probability:
Instructor: Prof. Peter Winkler (peter.winkler at dartmouth.edu)
Abstract  Classes  Staff  Textbooks  Grading  News and current assignment  Past assignments  Exams  Honor Code
News 
The final exam has been graded; everyone passed. (The last question was treated as extra credit, thus the scores are out of 56; range, 18 to 58, median 38.) Grad students all earned P's; all students can get their exam score and final grade by email to the instructor. Check this site when you return to campus in early January: a time and place will be announced where the answers to the final exam questions will be explained, and exams seen (but not kept). The syllabus below has been changed to reflect actual coverage. Instructor's office hours this week (Nov 1317) will be the usual, 1:152:45 Tues and 10:1511:45 Thursday. In addition, our TA, Andrew Bohm, will host an office hour on Thursday morning 89 am in Vail 702 (highly recommended for homework issues). 

Abstract 
What is randomness, and what is it good for? It was once thought by many that randomness is an invention of humans, needed to account for our limited ability to predict the future. Now it seems that randomness is the oldest concept in the universe, dating to the Big Bang. For us mathematicians and computer scientists, randomness turns out to be a valuable commodityproviding in some cases the best, even the only, way to solve certain problems and perform certain computations. But it is elusive and hard to find in its pure form. Can we improve it? Can we measure it? Can we even define it? Once we have used it to help solve a problem, can we dispense with it? In this course we will examine randomness, trying to find out how to best obtain it and best use it. Programming will not be required (but might be useful for some students in some special projects). Prerequisites: Mathematical background of a senior mathematics major or a
beginning graduate student in mathematics or theoretical computer science, including
a course in probability (e.g., MATH 20 or Math 60). If in doubt, please see the instructor. Dist: QDS.
Here is what was covered in the course:


Classes 
Room: Kemeny Hall 105 

Staff 


Textbook 
Rajeev Motwani and Prabhakar Raghavan, Randomized Algorithms Cambridge 1995. 

Grading 
Your grade will be based on homework, class participation, two hour exams, and a final exam. Homework and grading might be slightly different for enrollees of MATH 100/COSC 149 and enrollees of the simultaneous undergraduate course, COSC 49. The hour exams will be given in class on Monday, Oct 2 and Monday, Oct 23; let me know immediately if you have any possible conflict. The final exam will be in the regular slot for MWF10 courses, namely, 8am on Tuesday morning, Nov 21. 

Quizzes 
There may be unannounced inclass quizzes, just to make sure everyone is keeping up. 

Homework 
Homework will be assigned at each class period, due at the beginning of the next class.


Assignments 
Due Wednesday Sept 13: Read Chapter 1 of your text, and: (easy) compute the precise number of comparisons needed by Midsort to sort 255 records; (hard) compute the number of comparisons needed by Midsort to sort 2^{k}  1 records, as a function of k. In Midsort, you are miraculously provided at each stage with an element that has exactly half the remaining elements below it and half above. You still have to determine for each other element whether it is below or above. As a check, Midsorting 7 records takes 10 comparisons. Due Friday Sept 15: In our ideal tennis tournament, 2^{n} players are bracketed randomly and the outcome of each match is equally likely to be won by either player. As usual in an elimination tournament, all the players meet in pairs in Round 1, then the survivors meet in Round 2, etc., until one player is left. What is the probability that, at some point, Rafa plays Roger? Due Monday Sept 18: Show that the min cut algorithm that contracts random pairs of vertices, instead of random edges, could (for some graphs) succeed with only exponentially small probability; that is, there are graphs on n vertices for which it works with probability less than c^{n}, for some constant c. This is Exercise 1.2 in your text. Warning: this requires a bit more care than you might think. Due Wednesday Sept 20: Given a coin whose probability of coming up heads is a positive number p other than 1/2, get an upper and lower bound for the minimum expected number of flips needed to make a fair binary decision. Von Neumann's trick already gives you an upper bound, namely 1/p(1p) flips; can you do better? How could you go about getting a lower bound bigger than 2 flips? Due Friday Sept 22: Derive a Huffman code for the Hawaiian alphabet, using the following letter frequencies: A 27%, O 13%, K 12%, N 9%, I 8%, E 7%, U 6%, L 5%, H 5%, P 4%, M 3%, W 1%. (You are encouraged to check Wikipedia or your favorite source to make sure you understand the Huffman code algorithm.) Then, compute your average code length (sum of code length times frequency). Due Monday Sept 25: Suppose that you need lossless compression of 128bit strings in which each bit is independently a 1 with probability 1%, and 0 with probability 99%. Design a code for this purpose. What is the average length of your code? Example: you could divide the string into 64 pairs of consecutive bits and code 00 as 0, 10 as 10, 01 as 110 and 11 as 111; this would give you average codelength 64(1x.99x.99 + 2x.01x.99 + 3x.99x.01 + 3x.01x.01) ~ 65.9, a considerable improvement from 128. But I bet you can do better. Due Wednesday Sept 27: How many random bits do you need, on average, to do the following? (a) Generate a random integer between 1 and n (inclusive); (b) Shuffle a deck of n cards, that is, generate a uniformly random permutation of the integers 1 through n. In each case, you'll want to construct an algorithm and then compute the expected number of random bits it uses. Due Friday Sept 29: Suppose you are creating a random integer between 1 and n by using your random bits as the binary expansion random real number r = .b_{1}b_{2}b_{3}... in [0,1]. As soon as you know which interval [(j1)/n, j/n) your r is in, you stop and output j. What's the expected number of bits required by this algorithm? HINT #1: Try this first for n = 3. HINT #2: You don't need to know the binary expansion of 1/n, 2/n, etc. to do this. The key is to observe that fewer than logn bits never suffice, and after that there are just n1 "bad" strings of any given length that leave you undecided between two intervals. Due Wednesday Oct 4: Show that for any n and any deterministic algorithm that evaluates complete binary game trees of depth n with binary inputs, there is an instance that forces the algorithm to read every one of the 2^{n} input bits. (This is Problem 2.1 in your text.) Due Friday Opt 6: What happens if you change the book's definition of ZPP to require that there is a polynomial P such that given input of size n, the Turing machine always stops in time bounded by P(n)? Due Monday Oct 9: Let T be a complete ternary tree of depth d, that is, each node has three children until you get down to the leaves. At each nonleaf node is a majority gate that returns the majority value of its three input bits. Design a randomized algorithm to evaluate T, and determine its performance, i.e., the expected number of the 3^{d} input bits that it reads assuming worstcase input. Due Wednesday Oct 11: How big can n be so that a random graph on n vertices might not contain a clique or anticlique of size 5? (Use the sum bound.) Due Friday Oct 13: Jake amasses a complete collection of Snapple caps, of which there are n types, each equally likely. Right after he completes his set he gives all of his duplicate caps to Sally, keeping only one of each type. What is the expected number of caps Sally needs to add, to complete her own collection? Due Monday Oct 16: Show that if n is big enough (how big?) then with positive probability it will have the property that for any two distinct vertices u and v, there is a third vertex w that is adjacent to u but not to v. Due Wednesday Oct 18: Roberta and Charles each write down a positive integer. The one who writes a smaller number earns $1 from the other player, unless it is only smaller by 1, in which case the writer of the bigger number wins $2 from the other player. If both players write down the same number, no money changes hands. For example, say Roberta writes "4". If Charles writes "1" or "2" he wins $1; if "3", he loses $2; if "4", they tie; if "5", he wins $2; if more than 5, he loses $1. What's the equilibrium strategy (same for both players)? HINT: The answer gives positive probability to the numbers 1 through k, for a certain value of k. Due Friday Oct 20: Compute the expected hitting time h_{0i} from vertex 0 to vertex i for simple random walk on the ncycle C_{n}. Due Wednesday Oct 25: Let G be the graph on n vertices consisting of a clique on k vertices and a path attached to vertex z of the clique, ending at vertex v. Let u be a vertex of the clique other than z; compute the expected hitting time from u to v. HINT: Do it in three stages: u to z, z to the first vertex on the path, and from there to v. Due Friday Oct 27: Compute the expected number of coinflips needed to get n heads in a row. (You can think of this process as an n+1state Markov chain with absorption at the last state.) Due Monday Oct 30: Compute the stationary distribution of the Markov chain whose states are all possible lefttoright orderings of four tokens, labeled 1, 2, 3, and 4. A step of the chain is made by choosing token i with probability 0.i, then exchanging it with the token on its right. If the chosen token i is already in the rightmost position, the chain remains in its previous state (but time still advances by 1). ADVICE: Before struggling with a 4!x4! matrix, try detailed balance. Due Wednesday Nov 1: Let X_{t} be a lazy random walk on the ndimensional discrete hypercube, i.e., the set of binary sequences of length n. You start at (0,0,...,0) and at each tick of the clock, you roll your nsided die (getting, say, the value i) and then flip your coin. If the coin comes up heads you flip the ith bit of your state, otherwise you do nothing. Let t(k) be the time it takes to get your kth new die value. (All rolls count, even if you didn't make the corresponding move.) By symmetry, you know that the stationary distribution of this Markov chain is uniform (each state having probability 1/2^{n}). Compute the total variation distance between X_{t(k)} and the stationary distribution. Due Friday Nov 3: Show that kCOLOR COUNT is selfreducible. In other words, show that the number of colorings of the vertices of a graph G by colors 1 through k is equal to the sum of those numbers for two other graphswhich will eventually be easy to count colorings of. Due Monday Nov 6: Let P be a partially ordered set with n elements, and let M be the Markov chain on linear extensions of P that chooses a number k u.a.r. in {1,2,...,n1} and interchanges the elements at levels k and k+1, if possiblethat is, if those elements are incomparable in P. Show M is irreducible. Due Wednesday Nov 8: Let P be a partially ordered set with n elements, and let S be the region of nspace consisting of all vectors (x_{1},...,x_{n}) for which x_{i} ≤ x_{j} whenever i < j in P, and 0 ≤ x_{i} ≤ 1 for all i. Show that the problem of estimating the number of linear extensions of P can be reduced to estimating the volume of S. Due Friday Nov 10: For n = 4, 5, 6 determine whether our Markov chain on 3colorings of the ncycle C_{n} is irreducible. Justify your answers. Due Monday Nov 13: This is the final homework assignment, and will count a little more heavily than the others. Do one of the following:Write a program that runs two coupled chains of 4colorings of a 6cycle, and run it until the chains merge. The coupling will be the natural one, where you choose a vertex and a color and in each chain, you use that color on that vertex when possible. Then, alter your program so that it applies the JerrumSinclair switcheroo: if the chosen vertex v currently has the same color in both copies, but color i appears on a neighbor of v in only one chain while color j appears only in the other, then when you choose i in one chain you choose j in the other and viceversa. (In all other cases, the coupling is as before.) Run againas often as you likeand compare the merging time with what you got before. Obtain (with justification) a closedform expression for the number of kcolorings of an ncycle.  
Honor Code 
Students are encouraged to work together to do homework problems. What is important is a student's eventual understanding of homework problems, and not how that is achieved. The honor principle applies to homework in the following way. What a student turns in as a written homework solution is to be his or her own understanding of how to do the problem. Students must state what sources they have consulted, with whom they have collaborated, and from whom they have received help. Students are discouraged from using solutions to problems that may be posted on the web, and as just stated, must reference them if they use them. The solutions you submit must be written by you alone. Any copying (electronic or otherwise) of another person's solutions, in whole or in part, is a violation of the Honor Code. If you have any questions as to whether some action would be acceptable under the Academic Honor Code, please speak to me, and I will be glad to help clarify things. It is always easier to ask beforehand than to have trouble later! 

Disabilities 
I encourage any students with disabilities, including "invisible" disabilities such as chronic diseases and learning disabilities, to discuss appropriate accommodations that might help you with this class, either after class or during office hours. Dartmouth College has an active program to help students with disabilities, and I am happy to do whatever I can to help out, as appropriate. The Student Disabilities Center is located at 318 Wilson Hall, ext. 69900, http://www.dartmouth.edu/~accessibility, if you have any questions. Any student with a documented disability requiring academic adjustments or accommodations is requested to speak with me by the end of the second week of the term. All discussions will remain confidential, although the Academic Skills Center may be consulted to verify the documentation of the disability and advise on an appropriate response to the need. It is important, however, that you talk to me soon, so that I can make whatever arrangements might be needed in a timely fashion. 