Mathematical Foundations of Computer Science Lecture Outline
Mathematical Foundations of Computer Science Lecture Outline
Lecture Outline
November 20, 2018
Binomial Distributions
Consider an experiment in which we perform a sequence of n coin flips in which the prob-
ability of obtaining heads is p. How many flips result in heads?
We can obtain the result in a much simpler way by using the linearity of expectation. Let
Xi , 1 ≤ i ≤ n be the indicatorP
random variable that is 1 if the ith flip results in heads and
is 0 otherwise. We have X = ni=1 Xi . By the lineartity of expectation we have
n
X n
X
E[X] = E[Xi ] = p = np
i=1 i=1
Pn
What is the variance of the binomial random variable X? Since X = i=1 Xi , and
X1 , X2 , . . . , Xn are independent we have
n
X
Var[X] = Var[Xi ]
i=1
Xn
= E[Xi2 ] − E[Xi ]2
i=1
n
X
= (p − p2 )
i=1
= np(1 − p)
Solution. Let the random variable X denote the number of cereal boxes bought until we
have at least one coupon of each type. We want to compute E[X]. Let Xi be the random
variable denoting the number of boxes bought to get the ith new coupon. Clearly,
X = X1 + X2 + X3 + . . . + Xn
What is the distribution of random variable Xi ? Observe that the probability of obtaining
the ith new coupon is given by
n − (i − 1) n−i+1
pi = =
n n
Thus the random variable Xi , 1 ≤ i ≤ n is a geometric random variable with parameter pi .
1 n
E[Xi ] = =
pi n−i+1
November 20, 2018 Lecture Outline 3
Hence the expected number of boxes needed to collect n coupons is about nH(n) < n(ln n+
1).
Relations
A binary relation is a set of ordered pairs. For example, let R = {(1, 2), (2, 3), (5, 4)}. Then
since (1, 2) ∈ R, we say that 1 is related to 2 by relation R. We denote this by 1 R 2.
Similarly, since (4, 7) 6∈ R, 4 is not related to 7 by relation R, denoted by 4 6R 7.
A binary relation R from set A to set B is a subset of the cartesian product A × B.
When A = B, we say that R is a relation on set A.
Example. Let A = {1, 2, 3, 4} and B = {a, b, c}. Consider the following relations.
• “is a student in” is a relation from the set of students to the set of courses.
• “=” is a relation on Z.
Properties of Relations
Let R be a relation defined on set A. We say that R is
Note that the terms symmetric and antisymmetric are not opposites. A relation may be
both symmetric and antisymmetric or can neither be symmetric nor be antisymmetric.