Discrete Mathematics for CS
Random Variables and Expectation
: The homeworks of 20 students are collected in, randomly shuffled and returned to the students.
How many students receive their own homework?
To answer this question, we first need to specify the probability space: plainly, it should consist of all 20!
permutations of the homeworks, each with probability
. [Note that this is the same as the probability
space for card shuffling, except that the number of items being shuffled is now 20 rather than 52.] It helps
to have a picture of a permutation. Think of 20 books lined up on a shelf, labeled from left to right with
, . . . ,
20. A permutation
is just a reordering of the books, which we can describe just by listing their
labels from left to right. Let’s denote by
the label of the book that is in position
. We are interested in the
number of books that are still in their original position, i.e., in the number of
’s such that
. These are
often known as fixed points
of the permutation.
Of course, our question does not have a simple numerical answer (such as 6), because the number depends on
the particular permutation we choose (i.e., on the sample point). Let’s call the number of fixed points
make life simpler, let’s also shrink the class size down to 3 for a while. The following table gives a complete
listing of the sample space (of size 3!
6), together with the corresponding value of
for each sample
point. [We use our bookshelf convention for writing a permutation: thus, for example, the permutation 312
means that book 3 is on the left, book 1 in the center, and book 2 on the right. You should check you agree
with this table.]
Thus we see that
takes on values 0, 1 or 3, depending on the sample point. A quantity like this, which
takes on some numerical value at each sample point, is called a
) on the sample
Definition 20.1 (random variable)
A random variable
on a sample space
is a function that assigns
to each sample point
a real number
Until further notice, we’ll restrict our attention to discrete
random variables: i.e., their values will be integers
or rationals, rather than arbitrary real numbers.
in our permutation example above is completely specified by its values at all sample points, as
given in the above table. (Thus, for example,
Rather than the value at each sample point, we are usually more interested in the
of points at which the
CS 70, Spring 2005, Notes 20