Randomized Algorithms (Spring 2010)/Balls and bins: Difference between revisions
imported>WikiSysop |
imported>WikiSysop |
||
Line 96: | Line 96: | ||
Due to the [http://en.wikipedia.org/wiki/Pigeonhole_principle pigeonhole principle], it is obvious that for <math>m>365</math>, there must be two students with the same birthday. Surprisingly, for any <math>m>57</math> this event occurs with more than 99% probability. This is called the [http://en.wikipedia.org/wiki/Birthday_problem '''birthday paradox''']. Despite the name, the birthday paradox is not a real paradox. | Due to the [http://en.wikipedia.org/wiki/Pigeonhole_principle pigeonhole principle], it is obvious that for <math>m>365</math>, there must be two students with the same birthday. Surprisingly, for any <math>m>57</math> this event occurs with more than 99% probability. This is called the [http://en.wikipedia.org/wiki/Birthday_problem '''birthday paradox''']. Despite the name, the birthday paradox is not a real paradox. | ||
We can model this problem as a balls-into-bins problem. <math>m</math> balls (students) are uniformly and independently thrown into 365 bins (days), we ask for the probability that there is no bin with more than one balls (no two students share birthday). More generally, let <math>n</math> be the number of bins. The probability is given by: | |||
:<math>\begin{align} | |||
\frac{\mbox{number of assignments that no bins with more than one ball}}{\mbox{total number of assignments}} | |||
\end{align} | |||
</math> | |||
=== The occupancy problem === | === The occupancy problem === |
Revision as of 10:51, 16 January 2010
Probability Basics
Independent events
We are all familiar with the concept of independent events:
Definition (Independent events):
|
This definition can be generalized to more events:
Definition (Independent events):
|
Note that in probability theory, the word "mutually independent" is not equivalent with "pair-wise independent", which we will learn in the future.
The union bound
We are familiar with the principle of inclusion-exclusion for finite sets.
Principle of Inclusion-Exclusion:
|
The principle can be generalized to probability events.
Principle of Inclusion-Exclusion:
|
The proof of the principle is due to measure theory, and is omitted here. The following inequality is implied (nontrivially) by the principle of inclusion-exclusion:
Theorem (the union bound):
|
The name of this inequality is Boole's inequality. It is usually referred by its nickname "the union bound". The bound holds for arbitrary events, even if they are dependent. Due to this generality, the union bound is one of the most useful probability inequalities for randomized algorithm analysis.
Linearity of expectation
Let [math]\displaystyle{ X }[/math] be a discrete random variable. The expectation of [math]\displaystyle{ X }[/math] is defined as follows.
Definition (Expectation):
|
Balls-into-bins model
Imagine that [math]\displaystyle{ m }[/math] balls are thrown into [math]\displaystyle{ n }[/math] bins, in such a way that each ball is thrown into a bin which is uniformly and independently chosen from all [math]\displaystyle{ n }[/math] bins.
There are several interesting questions we could ask about this random process. For example:
- the probability that there is no bin with more than one balls (the birthday problem)
- the expected number of balls in each bin (occupancy problem)
- the maximum load of all bins with high probability (occupancy problem)
- the probability that there is no empty bin (coupon collector problem)
The birthday paradox
There are [math]\displaystyle{ m }[/math] students in the class. Assume that for each student, his/her birthday is uniformly and independently distributed over the 365 days in a years. We wonder what the probability that no two students share a birthday.
Due to the pigeonhole principle, it is obvious that for [math]\displaystyle{ m\gt 365 }[/math], there must be two students with the same birthday. Surprisingly, for any [math]\displaystyle{ m\gt 57 }[/math] this event occurs with more than 99% probability. This is called the birthday paradox. Despite the name, the birthday paradox is not a real paradox.
We can model this problem as a balls-into-bins problem. [math]\displaystyle{ m }[/math] balls (students) are uniformly and independently thrown into 365 bins (days), we ask for the probability that there is no bin with more than one balls (no two students share birthday). More generally, let [math]\displaystyle{ n }[/math] be the number of bins. The probability is given by:
- [math]\displaystyle{ \begin{align} \frac{\mbox{number of assignments that no bins with more than one ball}}{\mbox{total number of assignments}} \end{align} }[/math]