You are on page 1of 1

CS648 : Randomized Algorithms

Semester I, 2010-11, CSE, IIT Kanpur


Practice sheet of problems on linearity of expectation

Note : Try to solve the following problems by applying linearity of expectation. Just think about the
ways you would have used to solve these problems if you were not aware of linearity of expectation. Of
course, these are toy problems. You will realize the power of the linearity of expectation many times
during the course ...

1. There is a coin which shows HEADS with probability p. We toss the coin n times. What is the
expected number of HEADS you will see ? (Answer : np)

2. Recall ball-bin problem where n is the number of balls and m is the number of bins. What is the
expected number of bins containing exactly 2 balls ? (Answer : m n2 ( n1 )2 (1 − n1 )n−2 )

3. We toss a fair coin n times. A k-streak of flips is said to occur starting at toss i, if the outcome of
all the k flips starting from ith flip is the same. For example, for the sequence HT T T HH, there is
a 2-streak occurring at 2nd toss, there is a 2-streak occurring at 3rd toss, and there is a 2-streak
occurring at 5th toss. Here the total number of 2-streaks is 3 in the sequence HT T T HH.
What is the expected number of k-streaks which you will see in n tosses of a fair coin ?
(Answer : (n − k + 1)( 12 )k−1 if k ≤ n, and 0 otherwise)

4. There is a stick which has m weak joints. The part of the stick between consecutive joints is called
a segment. So there are m + 1 segments in the stick. When the stick is dropped on the floor, each
joint breaks with probability p independent of other joints. So the stick will either remain intact or
break into pieces.

(a) What is the expected number of pieces consisting of exactly 2 segments on the floor ?
(Answer : 0 if m = 0, p if m = 1, 2p(1 − p) + (m − 2)p2 (1 − p) if m ≥ 2)
(b) What is the expected total number of pieces into which the stick breaks ? (Answer : 1 + mp)

You might also like