Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)

Similar documents
Problem Set 2 Solutions

n outcome is (+1,+1, 1,..., 1). Let the r.v. X denote our position (relative to our starting point 0) after n moves. Thus X = X 1 + X 2 + +X n,

f X (12) = Pr(X = 12) = Pr({(6, 6)}) = 1/36

Design and Analysis of Algorithms

CS 171 Lecture Outline October 09, 2008

f X (12) = Pr(X = 12) = Pr({(6, 6)}) = 1/36

Final Review for MATH 3510

Problems from 9th edition of Probability and Statistical Inference by Hogg, Tanis and Zimmerman:

STAT Homework 1 - Solutions

CS 330 Discussion - Probability

HOMEWORK 2 SOLUTIONS

An Introduction to Randomized Algorithms

Sequences and Series of Functions

Massachusetts Institute of Technology

Probability theory and mathematical statistics:

Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 21. Some Important Distributions

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 22

Learning Theory: Lecture Notes

Lecture 6: Coupon Collector s problem

CS 70 Second Midterm 7 April NAME (1 pt): SID (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt): Name of Neighbor to your right (1 pt):

CS / MCS 401 Homework 3 grader solutions

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 15

Lecture 2: April 3, 2013

Application to Random Graphs

Math 155 (Lecture 3)

Lecture 12: November 13, 2018

( ) = p and P( i = b) = q.

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 19

1. By using truth tables prove that, for all statements P and Q, the statement

UC Berkeley Department of Electrical Engineering and Computer Sciences. EE126: Probability and Random Processes

6.3 Testing Series With Positive Terms


Infinite Sequences and Series

This exam contains 19 pages (including this cover page) and 10 questions. A Formulae sheet is provided with the exam.

Discrete Mathematics and Probability Theory Spring 2012 Alistair Sinclair Note 15

Lecture 5: April 17, 2013

Lecture 2: Concentration Bounds

Integrable Functions. { f n } is called a determining sequence for f. If f is integrable with respect to, then f d does exist as a finite real number

Induction: Solutions

Axioms of Measure Theory

It is always the case that unions, intersections, complements, and set differences are preserved by the inverse image of a function.

7.1 Convergence of sequences of random variables

Random Models. Tusheng Zhang. February 14, 2013

PRACTICE PROBLEMS FOR THE FINAL

On Random Line Segments in the Unit Square

Lecture 2. The Lovász Local Lemma

Week 5-6: The Binomial Coefficients

Chapter 6 Infinite Series

Read carefully the instructions on the answer book and make sure that the particulars required are entered on each answer book.

STAT 516 Answers Homework 6 April 2, 2008 Solutions by Mark Daniel Ward PROBLEMS

kp(x = k) = λe λ λ k 1 (k 1)! = λe λ r k e λλk k! = e λ g(r) = e λ e rλ = e λ(r 1) g (1) = E[X] = λ g(r) = kr k 1 e λλk k! = E[X]

Find a formula for the exponential function whose graph is given , 1 2,16 1, 6

MA131 - Analysis 1. Workbook 3 Sequences II

Convergence of random variables. (telegram style notes) P.J.C. Spreij

Sample Midterm This midterm consists of 10 questions. The rst seven questions are multiple choice; the remaining three

Mathematical Statistics - MS

1 Convergence in Probability and the Weak Law of Large Numbers

Please do NOT write in this box. Multiple Choice. Total

MATH 112: HOMEWORK 6 SOLUTIONS. Problem 1: Rudin, Chapter 3, Problem s k < s k < 2 + s k+1

Solutions to Tutorial 3 (Week 4)

7.1 Convergence of sequences of random variables

4.1 Sigma Notation and Riemann Sums

0, otherwise. EX = E(X 1 + X n ) = EX j = np and. Var(X j ) = np(1 p). Var(X) = Var(X X n ) =

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Final Solutions

Math 475, Problem Set #12: Answers

Expectation and Variance of a random variable

Series III. Chapter Alternating Series

Optimally Sparse SVMs

January 25, 2017 INTRODUCTION TO MATHEMATICAL STATISTICS

4.3 Growth Rates of Solutions to Recurrences

1 Approximating Integrals using Taylor Polynomials

Discrete Mathematics and Probability Theory Fall 2016 Walrand Probability: An Overview

CIS Spring 2018 (instructor Val Tannen)

EXAMINATIONS OF THE ROYAL STATISTICAL SOCIETY

1 Statement of the Game

PUTNAM TRAINING PROBABILITY

Probability for mathematicians INDEPENDENCE TAU

Lecture 7: Properties of Random Samples

Notes 5 : More on the a.s. convergence of sums

STAT Homework 2 - Solutions

Ma/CS 6b Class 19: Extremal Graph Theory

CSE 191, Class Note 05: Counting Methods Computer Sci & Eng Dept SUNY Buffalo

Assignment 5: Solutions

(A sequence also can be thought of as the list of function values attained for a function f :ℵ X, where f (n) = x n for n 1.) x 1 x N +k x N +4 x 3

Massachusetts Institute of Technology

Topic 8: Expected Values

Topic 5: Basics of Probability

The Simplex algorithm: Introductory example. The Simplex algorithm: Introductory example (2)

Section 5.1 The Basics of Counting

MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 19 11/17/2008 LAWS OF LARGE NUMBERS II THE STRONG LAW OF LARGE NUMBERS

Discrete Mathematics for CS Spring 2008 David Wagner Note 22

CS284A: Representations and Algorithms in Molecular Biology

PH 425 Quantum Measurement and Spin Winter SPINS Lab 1

DS 100: Principles and Techniques of Data Science Date: April 13, Discussion #10

2.1. Convergence in distribution and characteristic functions.

UNIT 2 DIFFERENT APPROACHES TO PROBABILITY THEORY

How to Maximize a Function without Really Trying

Solutions of Homework 2.

Review Problems 1. ICME and MS&E Refresher Course September 19, 2011 B = C = AB = A = A 2 = A 3... C 2 = C 3 = =

Chapter 5. Inequalities. 5.1 The Markov and Chebyshev inequalities

Transcription:

Radomized Algorithms I, Sprig 08, Departmet of Computer Sciece, Uiversity of Helsiki Homework : Solutios Discussed Jauary 5, 08). Exercise.: Cosider the followig balls-ad-bi game. We start with oe black ball ad oe white ball i a bi. We repeatedly do the followig: choose oe ball from the bi uiformly at radom, ad the put the ball back i the bi with aother ball of the same color. We repeat util there are balls i the bi. Show that the umber of white balls is equally likely to be ay umber betwee ad. Let W be the umber of white balls whe the total umber of balls is. We eed to show that for all we have PrW k) / ), k,...,. We prove this by iductio. The base case is that, i which case the claim is clearly true. Now assume that the claim is true for some. For k,...,, the evet W + k ca take place i two ways: W k ad a black ball is chose. Possible oly if k <.) W k ad a white ball is chose. Possible oly if k >.) First ote that give W the probability of choosig a white ball is W /. Now usig this ad the defiitio of coditioal probability we get the probability of the first case: Prblack W k) Prblack W k)prw k) k ) k ) Note that i the special case k, the above derivatio is ot valid but the resultig formula still gives the right aswer, amely Prblack W ) 0. Similarly we get the probability of the secod case: Prwhite W k ) Prwhite W k )PrW k ) k Agai the formula gives the right asver for the special case k. Sice the two cases are disjoit evets, we get PrW + k) k ) + k ), Thus the claim is also true for + ad by iductio priciple it holds for all. k ). Exercise.5: Suppose that we roll te stadard six-sided dice. What is the probability that their sum will be divisible by, assumig that the rolls are idepedet? First ote that the rolls are mutually idepedet. Let X i be the result of ith roll ad S X i. The sum of the rolls is divisible by if S 0 0 mod ), where S 0 X 0 + S 9. Assume that the results of first 9 rolls are fixed ad their sum is S 9 s 9. Now there is oly oe value of the last die that makes S 0 divisible by, amely X 0 s 9 mod ). Sice each value i {,,...,} has equal probability, the probability

of the evet is /. More formally we have PrS 0 0 mod )) PrX 0 + S 9 0 mod )) Pr X 0 + x,...,x 9 ) {,...,} 9 Pr X 0 + x,...,x 9 ) {,...,} 9 9 9 x i 0 mod ) X,...,X 9 ) x,...,x 9 ) x i 0 mod ) PrX,...,X 9 ) x,...,x 9 )) x,...,x 9 ) {,...,} 9, ) PrX,...,X 9 ) x,...,x 9 )) where we first used the law of total probability ad the used the fact that the rolls are mutually idepedet. ) 3. Exercise.: Suppose that we idepedetly roll two stadard six-sided dice. Let X be the umber that shows o the first die, X the umber o the secod die, ad X the sum of the umber o the two dice. a) What is E[X X is eve]? Usig the liearity of expectatio: E[X X is eve] E[X + X X is eve] E[X X is eve] + E[X X is eve] E[X X is eve] + E[X ] 3 + 4 3 + 3 ) + + + 3 + 4 + 5 + ) 4 + 3 7 b) What is E[X X X ]? c) What is E[X X 9]? E[X X X ] x x PrX x X X ) 7 E[X X 9] x x x d) What is E[X X X k] for k i the rage [,]? x PrX x X 9) x PrX x X 9) PrX 9) x /3 4/3 4 3 + 4 + 5 + ) 4 Usig the liearity of expectatio ad the fact that X ad X have the same distributio: E[X X X k] E[X X k] E[X X k] 0

4. Exercise.: Suppose we flip a coi times to obtai a sequece of flips X,X,...,X. A streak of flips is a cosecutive subsequece of flips that are all the same. For example, if X 3, X 4, ad X 5 are all heads, there is a streak of legth 3 startig at the third flip. If X is also heads, the there is also a streak of legth 4 startig at the third flip.) a) Let be a power of. Show that the expected umber of streaks of legth log + is o). Deote by k log + the legths of the streaks we are cosiderig. Let Y i be a idicator variable which gets value if there is a streak of legth k startig from the ith flip i,..., k + ). Now the total umber of streaks of legth k is S k+ Y i. Usig the liearity of expectatio ad the fact that E[Y i ] PrY i ), the expectatio of S is k+ E[S] k+ E[Y i ] PrY i ). For Y i to be true, X i ca be either heads or tails but the ext k flips must be the same as X i. Assumig that the flips are idepedet ad the coi is fair, the probability that this happes is PrY i ) /) k. By isertig this to the above equatio we get E[S] k+ ) k which is o) with respect to. k+ ) log k+ k log, b) Show that, for sufficiet large, the probability that there is o streak of legth at least log log log is less tha /. Hit: Break the sequece of flips up ito disjoit blocks of log log log cosecutive flips, ad use that the evet that oe block is a streak is idepedet of the evet that ay other block is a streak.) Let s use otatio k log log log. We break the sequece ito disjoit blocks of k cosecutive flips. There are /k such blocks we igore possible extra flips). For the sequece of flips to ot cotai a streak of k flips deote this evet by A) it is ecessary that oe of the blocks cotais a streak of legth k deote this evet by B). Thus we have PrA) PrB). The probability that a sigle block does ot cotai a streak is /) k. Sice the blocks are disjoit ad thus idepedet), the probability that oe of the blocks cotais a streak is PrB) ) ) k /k Now, sice k log log log ad /k /log, we get ) ) log log log /log PrB) log ) /log exp log )) /log exp log )) exp log log log where the secod iequality is based o the fact that x e x. Let g) log /. Sice g4) 3/4 > /log e ad sice g) is icreasig for > 4 as the derivative Dg)) log /l)) > 0 whe 4), for 4 we have that g) /log e ad therefore )), 3

PrB) exp log ) exp l) log e. 5. Exercise.: A permutatio π : [,] [,] ca be repseted as a set of cycles as follows. Let there be oe vertex for each umber i, i,...,. If the permutatio maps the umber i to the umber πi), the a directed arc is draw from vertex i to vertex πi). This leads to a graph that is a set of disjoit cycles. Notice that some of the cycles could be self-loops. What is the expected umber of cycles i a radom permutatio of umbers? Let X k i be a idicator variable which is if vertex i belogs to a cycle of legth k. Let Y k X k +X k +...+ X k be the total umber of odes belogig to a k-cycle ad let N k be the umber of k-cycles i the graph. By defiitio we must have N k Y k /k. Fially, let N be the total umber of cycles i the graph, which is N k N k. How may permutatios π are there such that Xi k? If vertex i belogs to a k-cycle, the the ext vertex j πi) ca ot be vertex i, vertex π j) ca be either i or j, ad so o, util the k:th vertex is agai i. Thus, we ca choose the cosecutive k vertices o the same cycle i ) ) k + ) ways. The remaiig k vertices ca be i ay order i π, so the umber of possibilities is k) k ). The total umber of permutatios such that Xi k therefore )!. As there are! permutatios i total, the probability of such evet is PrXi k ) )!/! /. Now, by usig the liearity of expectatios twice, we ca get the expecter umber or cycles E[N] k E[N k ] k k E[Y k] k k E[Xi k ] k k k k H).. Exercise.4: We roll a stadard fair die over ad over. What is the expected umber of rolls util the first pair of cosecutive sixes appears? Hit: The aswer is ot 3.) We partitio the roll sequece ito cosecutive subsequeces such that each subsequece begis where the previous subsequece eds, cotiues util the first six is ecoutered, the cotais oe extra roll more ad eds. For example, a sequece,4,,4,3,,,,,) cosists of three such subsequeces:,4),,4,3,,) ad,,). The first pair of cosecutive sixes appears whe, for the first time, the last roll of a subsequece is six. Let N be the umber subsequeces eeded before this happes. Let E i deote the evet that last roll of ith subsequece is six. For ay sigle subsequece the probability of this evet is PE i ) /. Clearly evets E i are idepedet, ad thus N is geometrically distributed with parameter / ad its expectatio is E[N]. Now, let X i be the legth of ith subsequece. The total umber of rolls util the first pair of cosecutive sixes appears is the X N X i. By first usig Lemma.5 ad liearity of expectatios, we get E[X] PrN )E[X N ] PrN )E [ X i ] PrN ) E[X i ]. O the other had, we have X i Y i +, where Y i is the umber of rolls eeded util the first six is ecoutered i ith subsequece. Sice the rolls are idepedet ad the probability of gettig six is / for each roll, Y i is geometrically distributed with parameter /. Thus, we have E[Y i ] ad furthermore E[X i ] + 7. Pluggig that ito the above equatio, we get E[X] PrN ) 7 7 PrN ) 7 E[N] 7 4. 4

Aother way to approach this is to use the memorylessess property. Let X be the umber of rolls util the first pair of cosecutive sixes appears ad let A i deote the evet that ith roll is six. Evets A i are mutually idepedet ad we have PrA i ) /. Now, sice at least two rolls is always required, we ca split up the expectatio as follows: E[X] PrĀ )E[X Ā ] + PrA )E[X A ] PrĀ )E[X Ā ] + PrA ) PrĀ A )E[X A,Ā ] + PrA A )E[X A,A ] ) PrĀ )E[X Ā ] + PrA ) PrĀ )E[X A,Ā ] + PrA )E[X A,A ] ) 5 E[X Ā ] + 5 E[X A,Ā ] + ) E[X A,A ]. Now, as the past rolls do ot have ay effect o the future, if our previous roll is ot six, the the expected umber of additioal rolls we eed is the same as the expected umber of rolls i the begiig. That is, we have E[X A c ] +E[X] ad E[X A,A c ] +E[X]. Also, we have E[X A,A ], sice if A ad A are true, the we already have two cosecutive sixes. Hece, we have E[X] 5 + E[X]) + 5 + E[X]) + ) 35 4 E[X] + 3 3 E[X] 4. 7. Exercise.3: You eed a ew staff assistat, ad you have people to review. You wat to hire the best cadidate for the positio. Whe you iterview a cadidate, you ca give them a score, with the highest score beig the best ad o ties beig possible. You iterview the cadidates oe by oe. Because of your compay s hirig practices, after you iterview the kth cadidate, you either offer the cadidate the job before the ext iterview or you forever lose the chace to hire that cadidate. We suppose the cadidates are iterviewed i a radom order, chose uiformly at radom from all! possible orderigs. We cosider the followig strategy. First, iterview m cadidates but reject them all; these cadidates give you a idea of how strog the field is. After the mth cadidate, hire the first cadidate you iterview who is better tha all of the previous cadidates you have iterviewed. a) Let E be the evet that we hire the best assistat, ad let E i be the evet that ith cadidate is the best ad we hire him. Determie PrE i ), ad show that PrE) m jm+ j. Sice the the order of cadidates is chose uiformly at radom, for the best cadidate each positio is equally likely. Thus, the probability that ith cadidate is the best is /. Now assume, that ith cadidate is the best oe. If i m, the the ith caditate ca ot be hired ad PrE i ) 0. Otherwise, the ith cadidate is hired if ad oly if oe of the cadidates m +,m +,...,i is better tha the best of the first m cadidates, i other words, if the best of the first i cadidates is oe of the first m cadidates. Sice each positio is equally likely, the probability that this happes is m/i ). Therefore we have: PrE i ) { m i if i > m 0 if i m. Now, E E i ad evets E i are disjoit, so the probability of E is PrE) PrE i ) im+ m i m im+ i. b) Boud jm+ j to obtai m l lm) PrE) m l ) lm )). 5

We use the same method as i Lemma.0 to boud the probability PrE). I geeral, if f k) is mootiically decreasig, the b+ b f x)dx f k) f x)dx. a a b ka Hece, by settig f i) /i ), we get a lower boud m + dx m+ x m l lm) ad a upper boud m dx m x m l ) lm )). c) Show that ml lm)/ is maximized whe m /e, ad explai why this meas PrE) /e for this choise of m. We fid the maximum of a fuctio f m) ml lm)/ by fidig where its derivative is zero: f m) l lm 0 lm l m /e To check that this actually is a maximum poit, we calculate the secod derivative: f m) m. This is egative for all m, > 0, so f is cocave w.r.t. m ad thus m /e is a actual maximum poit. By pluggig m /e ito the lower boud iequatio we get PrE) e l l e ) e.