Discrete Mathematics for CS
Introduction to Discrete Probability
Probability theory has its origins in gambling — analyzing card games, dice, roulette wheels. Today it is an
essential tool in engineering and the sciences. No less so in computer science, where its use is widespread
in algorithms, systems, learning theory and artificial intelligence.
Here are some typical statements that you might see concerning probability:
1. The chance of getting a flush in a 5-card poker hand is about 2 in 1000.
2. The chance that a particular implementation of the primality testing algorithm outputs prime when the
input is composite is at most one in a trillion.
3. The average time between system failures is about 3 days.
4. In this load-balancing scheme, the probability that any processor has to deal with more than 12 re-
quests is negligible.
5. There is a 30% chance of a magnitude 8.0 earthquake in Northern California before 2030.
Implicit in all such statements is the notion of an underlying
. This may be the result of a
random experiment that we have ourselves constructed (as in 1, 2 and 3 above), or some model we build of
the real world (as in 4 and 5 above). None of these statements makes sense unless we specify the probability
space we are talking about: for this reason, statements like 5 (which are typically made without this context)
are almost content-free.
Let us try to understand all this more clearly. The first important notion here is one of a random experiment.
An example of such an experiment is tossing a coin 4 times, or dealing a poker hand. In the first case an
outcome of the experiment might be
or it might be
. The question we are interested in might
be “what is the chance that there are exactly 2
’s?” Well, the number of outcomes that meet this condition
6 (corresponding to choosing the positions of the two
’s in the sequence of four tosses);
these outcomes are
. On the other hand, the total number
of distinct outcomes for this experiment is 2
16. If the coin is fair then all these 16 outcomes are equally
likely, so the chance that there are exactly 2
’s is 6
As we saw with counting, there is a common framework in which we can view random experiments about
flipping coins, dealing cards, rolling dice, etc. A finite process is the following:
We are given a finite population
, of cardinality
. In the case of coin tossing,
, and in card
is the set of 52 cards.
An experiment consists of drawing a sample of
. As before we will consider two cases:
sampling with replacement and sampling without replacement. Thus in our coin flipping example,
and the sample size is
4, and the sampling is with replacement. The outcome of the experiment is called
CS 70, Spring 2008, Note 15