Docsity

Probability Theory for Math 55 at UC Berkeley, Lecture notes of Discrete Mathematics

Toggle sidebar
bg1
DEPARTMENT OF MATHEMATICS
UNIVERSITY OF CALIFORNIA, BERKELEY
Probability theory
H.W. Lenstra, Jr.
These notes contain material on probability for Math 55, Discrete mathematics. They
were written to supplement sections 3.6 and 3.7 of C. L. Liu, Elements of discrete math-
ematics (McGraw-Hill, second edition, 1985), but they can be used in conjunction with
other textbooks as well. November 1988.
1. Sample spaces, events and conditional probabilities.
Asample space is a finite or countable set Stogether with a function
P:S→[0,1] = {y∈R: 0 ≤y≤1},
such that the following condition is satisfied:
X
x∈S
P(x) = 1.
One thinks of Sas the set of all possible outcomes of an experiment, with P(x) equal to
the probability that the outcome is x. We call Pthe probability function.
In many interesting cases Sis finite and P(x) = 1/#Sfor all x∈S.
Let Sbe a sample space, with probability function P. An event is a subset Aof S,
and the probability of an event Ais given by
P(A) = X
x∈A
P(x).
If A,Bare two events, and P(B)6= 0, then the conditional probability of Agiven Bis
defined by
P(A|B) = P(A∩B)
P(B).
Examples of sample spaces, events and conditional probabilities, and exercises on them,
can be found in many textbooks on discrete mathematics.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Probability Theory for Math 55 at UC Berkeley and more Lecture notes Discrete Mathematics in PDF only on Docsity!

DEPARTMENT OF MATHEMATICS

UNIVERSITY OF CALIFORNIA, BERKELEY

Probability theory

H.W. Lenstra, Jr.

These notes contain material on probability for Math 55, Discrete mathematics. They were written to supplement sections 3.6 and 3.7 of C. L. Liu, Elements of discrete math- ematics (McGraw-Hill, second edition, 1985), but they can be used in conjunction with other textbooks as well. November 1988.

  1. Sample spaces, events and conditional probabilities.

A sample space is a finite or countable set S together with a function

P : S → [0, 1] = {y ∈ R : 0 ≤ y ≤ 1 },

such that the following condition is satisfied:

∑ x∈S

P (x) = 1.

One thinks of S as the set of all possible outcomes of an experiment, with P (x) equal to the probability that the outcome is x. We call P the probability function. In many interesting cases S is finite and P (x) = 1/#S for all x ∈ S. Let S be a sample space, with probability function P. An event is a subset A of S, and the probability of an event A is given by

P (A) =

x∈A

P (x).

If A, B are two events, and P (B) 6 = 0, then the conditional probability of A given B is defined by

P (A|B) = P^ ( PA (^ B∩^ )B ).

Examples of sample spaces, events and conditional probabilities, and exercises on them, can be found in many textbooks on discrete mathematics.

  1. Independence.

Two events A, B are called independent if P (A ∩ B) = P (A) · P (B). This means the same as P (A|B) = P (A) (if P (B) 6 = 0), so two events are independent if the occurrence of one of them does not make the other more likely or less likely to occur.

Example 1. Let S = { 1 , 2 , 3 , 4 , 5 , 6 } × { 1 , 2 , 3 , 4 , 5 , 6 }, the set of outcomes of rolling two dice, with each outcome having probability 361. Consider the events

A = the first die equals 3, B = the second die equals 4, C = the total equals 7, D = the total equals 6,

more precisely

A = { 3 } × { 1 , 2 , 3 , 4 , 5 , 6 }, B = { 1 , 2 , 3 , 4 , 5 , 6 } × { 4 }, C = {(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1)}, D = {(1, 5), (2, 4), (3, 3), (4, 2), (5, 1)}.

Here A and B are independent, since P (A ∩ B) = 361 = P (A) · P (B). Also A and C are independent, and B and C are independent. However, A and D are not independent, since P (A ∩ D) = 361 , whereas P (A) · P (D) = 16 · 365 , which is smaller than 361. Likewise B and D are not independent. Are C and D independent? Warning. Any two of the three events A, B, C are independent, but nevertheless the three events A, B, C cannot be considered independent, since the occurrence of any two of them implies the occurrence of the third one. For three events A, B, C to be independent one requires not only that any two are independent, but also that P (A ∩ B ∩ C) = P (A) · P (B) · P (C). For more than three events one has to look at even more combinations, see for example Exercise 25 (a).

This follows directly from the definition.

Example 4. Let S, P be as in Example 1 (rolling two dice). If f is the value of the first die (so f

(a, b)

= a), and g is the value of the second die (g

(a, b)

= b), then E(f ) = E(g) = 3 12. The total is f + g, so the expectation of the total score equals E(f + g) = E(f ) + E(g) = 7.

  1. Events as random variables.

Let S be a sample space, with probability function P. Let A be an event; so this is a subset of S. It gives rise to a random variable f that is defined by

f (x) =

{ (^1) if x ∈ A, 0 if x /∈ A. This random variable assumes only the values 0 and 1; and any random variable that assumes only the values 0 and 1 arises in this way from some event. The probability of the event A is the same as the expectation E(f ) of the corresponding random variable f.

Example 5. Let p ∈ R, 0 < p < 1, and write q = 1 − p. Let S be the sample space { 0 , 1 }, with probability function given by P (1) = p, P (0) = q. This sample space can be thought of as the set of outcomes of tossing a coin that is not fair (unless p = 12 ). The probability of the event A = { 1 } is the same as the expectation of the inclusion map (see Example 2), namely p.

Example 6. Repeat the experiment from the previous example n times; so S must then be replaced by { 0 , 1 }n, with x ∈ S having probability pkqn−k^ if x contains exactly k 1’s (any x ∈ S is a sequence of n 0’s and 1’s). For each i = 1, 2,... , n, let Ai be the event that the i-th toss of the coin gives a 1, and let fi be the corresponding random variable; so if x = (x 1 , x 2 ,... , xn), then fi(x) = xi. Each Ai has probability p, so each fi has expectation p. Now let f = f 1 + f 2 + · · · + fn. Then f (x) is the total number of 1’s in x, and E(f ) = E(f 1 + f 2 + · · · + fn) = E(f 1 ) + E(f 2 ) + · · · + E(fn) = np.

So the expected number of 1’s is np. We can also verify this by a direct calculation. First one notes that

(∗) P (f = k) =

(n k

pkqn−k,

because there are

(n k

elements x ∈ S that have exactly k 1’s, and each such x has proba- bility pkqn−k. Now

E(f ) =

∑^ n k=

k

n k

pkqn−k^ = np

∑^ n k=

n − 1 k − 1

pk−^1 qn−k^ = np(p + q)n−^1 = np.

A random variable f : S → R is said to be a binomial random variable, or to have a binomial distribution, if there exists an integer n ≥ 0 and a real number p, 0 < p < 1, such that (∗) holds for all k, 0 ≤ k ≤ n. If we take p = 12 , then we see (not surprisingly) that the average number of elements of a subset of a set of n elements equals 12 n.

Example 7. Ten men went to a party and checked their hats when they arrived. The hats were randomly returned to them when they departed. We want to know the expected number of men that get their own hats back. In this example, S is the set of bijective functions of a set M of 10 men to itself, all these functions having the same probability, which is 1/#S = 1/10! = 1/ 3628800 = 0. .0000002755732. The bijective function that is the outcome of the experiment maps i to j if i receives j’s hat. The number of men that receive their own hats back is given by the random variable f : S → R that sends each bijective function b: M → M to the number of elements that it fixes: f (b) = #{i ∈ M : b(i) = i}. We want to calculate the expectation of f. As in the previous example, this expectation can be written as the sum of the probabilities of 10 events Ai, where Ai is the event that the i-th man gets his own hat back. It is not hard to see that #Ai = 9! for each i, so P (Ai) = 101 and E(f ) = 10 · 101 = 1: on the average, one man gets his own hat back! This remains true for any (positive) number of men instead of 10.

Example 8. Consider the experiment of shooting at a target until there is a hit. Let p be the probability of hitting if one shoots once, with 0 < p < 1, and write q = 1 − p for the probability of missing. Assume that all shots are independent. What is the expected number of shots? Here S = {h, mh, mmh, mmmh,.. .}, where the n-th element has probability qn−^1 p (one factor q for each miss, and p for the hit); you may wish to check that all these numbers add up to 1. Let f : S → R count the number of shots; so f maps the n-th element of S to n. The expectation of f is

E(f ) =

∑^ ∞

n=

nqn−^1 p.

Using the formula ∑∞ n=

nxn−^1 = (^) (1 −^1 x) 2

(for |x| < 1) one finds that

E(f ) = (^) (1 −p q) 2 =^1 p.

This answer is intuitively clear: if one needs k shots for a hit, on the average, then a hit occurs once every k times, so p = 1/k and k = 1/p.

  1. Standard deviation and variance.

Example 10. Let S = { 1 , 2 , 3 , 4 , 5 , 6 } × { 1 , 2 , 3 , 4 , 5 , 6 }, with each (i, j) ∈ S having probability 361 , as in Example 1. Let the random variables f , t: S → R be defined by f

(i, j)

= 2i (twice the value of the first die) and t

(i, j)

= i + j (the total score). Both random variables have expectation 7. However, the value of f is usually much further removed from the expectation 7 than the value of t. To make this quantitative, one usually considers the standard deviation.

Let, generally, S be a sample space, with probability function P. Let f : S → R be a random variable. The standard deviation of f is defined by

σ(f ) =

x∈S

f (x) − E(f )

P (x)

Equivalently, if the random variable h: S → R is defined by h(x) =

f (x) − E(f )

, then

σ(f ) =

E(h).

So this is the square root of the expectation of the square of the deviation of f from its expected value. At first sight this definition seems unnecessarily complicated: why not simply take the expected value of the deviation itself? This can be done, and it yields τ (f ) =

x∈S |f^ (x)^ −^ E(f^ )|P^ (x) (the^ mean deviation^ of^ f^ ).^ However, it turns out that σ(f ) is far simpler to use than τ (f ), because it avoids the non-differentiable function | · |. The square of the standard deviation is called the variance of f , and denoted by V (f ):

V (f ) =

x∈S

f (x) − E(f )

P (x) = E(h).

This is the expectation of the squared deviation. A useful formula for the variance is:

V (f ) = E(f 2 ) − E(f )^2.

Proof: V (f ) =

x∈S

f (x) − E(f )

P (x)

=

x∈S

f (x)^2 P (x) − 2 E(f )

x∈S

f (x)P (x) + E(f )^2

x∈S

P (x)

= E(f 2 ) − 2 E(f )E(f ) + E(f )^2 = E(f 2 ) − E(f )^2.

Example 10 (continued). We calculate the variance of the function f. We have

E(f 2 ) =

2 + 4 2 + 6 2 + 8 2 + 10 2 + 12 2 ) =^364

6 = 60^

2 3 ,

and E(f ) = 7, so

V (f ) = 60 23 − 72 = 11 23 , σ(f ) =

11 23 = 3^.. 416.

We can calculate the variance of t in a similar straightforward way, but it is easier to apply another formula.

Let, generally, S be a sample space with probability function P , and let f , g: S → R be two independent random variables. Then we have

V (f + g) = V (f ) + V (g).

The proof uses the relation E(f g) = E(f )E(g), which we proved earlier for independent random variables:

V (f + g) = E

(f + g)^2

− E(f + g)^2 = E(f 2 ) + 2E(f g) + E(g^2 ) − E(f )^2 − 2 E(f )E(g) − E(g)^2 = E(f 2 ) − E(f )^2 + E(g^2 ) − E(g)^2 = V (f ) + V (g).

Example 10 (continued). We use this formula to calculate the variance of t. We write t = t 1 + t 2 , where t 1 is the value of the first die (so t 1

(i, j)

= i) and t 2 is the value of the second die. From t 1 = 12 f and the calculation we did for f we see that V (t 1 ) = ( 12 )^2 V (f ) = 3512. Since t 1 and t 2 are independent, it follows that

V (t) = V (t 1 ) + V (t 2 ) = 5 56 , σ(t) =

5 56 = 2^.. 415.

Example 11. Let p ∈ R, 0 < p < 1, and let S = { 0 , 1 } be the sample space from Example 5 (so P (1) = p, P (0) = q). We saw in Example 5 that the inclusion map f : S → R has expectation p. We have f 2 = f , so

V (f ) = E(f 2 ) − E(f )^2 = p − p^2 = pq, σ(f ) = √pq.

Example 12. Let S, f be as in Example 6; so P (f = k) = (n k

pkqn−k. To calculate V (f ), we write f = f 1 + f 2 + · · · + fn. We now have the formula

V (f ) = V (f 1 ) + V (f 2 ) + · · · + V (fn),

  1. Generating functions.

Let S be a sample space, and f : S → R a random variable with the property that the image of f is contained in the set of non-negative integers. The generating function g of f is defined by

g(z) =

∑^ ∞

k=

P (f = k)zk.

Here z is a real variable with |z| ≤ 1. From

∑^ ∞ k=

P (f = k) = 1

it follows that the series converges, and that g(1) = 1. The generating function can be used to calculate the expectation E(f ) and the vari- ance V (f ) of f. Namely, suppose that the radius of convergence of the power series defining g is larger than 1. Then the derivative g′^ = dg/dz is given by

g′(z) =

∑^ ∞

k=

kP (f = k)zk−^1 ,

for |z| ≤ 1. Putting z = 1 we find the following formula for the expectation:

E(f ) = g′(1).

Similarly, one can prove V (f ) = g′′(1) + g′(1) − (g′(1))^2 ,

see Exercise 22.

Example 13. Let p be a real number, 0 < p < 1, and n a positive integer. We let the sample space S = { 0 , 1 }n^ be as in Example 6; so an element x ∈ S that has exactly k 1’s has probability pkqn−k, where q = 1 − p. Let the random variable f also be as in Example 6; so f (x) is the number of 1’s in x. We have

P (f = k) =

n k

pkqn−k,

so the generating function g is given by

g(z) =

∑^ n k=

n k

(pz)kqn−k^ = (pz + q)n.

Notice that indeed g(1) = 1. We have

g′(z) = np(pz + q)n−^1 , g′′(z) = n(n − 1)p^2 (pz + q)n−^2

and therefore

E(f ) = g′(1) = np, V (f ) = g′′(1) + g′(1) − (g′(1))^2 = n(n − 1)p^2 + np − n^2 p^2 = npq,

in agreement with what we found in Example 6 and Example 12.

Exercises.

  1. Andrew, Beatrix and Charles are playing with a crown. If Andrew has the crown, he throws it to Charles. If Beatrix has the crown, she throws it to Andrew or to Charles, with equal probabilities. If Charles has the crown, he throws it to Andrew or to Beatrix, with equal probabilities. At the beginning of the game the crown is given to one of Andrew, Beatrix and Charles, with equal probabilities. What is the probability that, after the crown is thrown once, Andrew has it? that Beatrix has it? that Charles has it?
  2. From a shuffled deck of 52 playing cards one card is drawn. Let A be the event that an ace is drawn, B the event that a diamond is drawn, and C the event that a red card (heart or diamond) is drawn. Which two of A, B, and C are independent? What if a joker is added to the deck?
  3. Let S be a sample space, and let A, B ⊆ S be two independent events. Let A′^ = S − A and B′^ = S −B. Prove that A′^ and B′^ are independent events. Are A and B′^ independent? And A and A′?
  4. A random number is drawn from { 1 , 2 , 3 ,... , 899 , 900 }; each number has probability

9001.^ Are the events “the number is divisible by 3” and “the number is divisible by 5” independent? What is the probability that the number has no factor in common with 15?

  1. In a lottery 10,000 tickets are sold for $ 1 each. There are five prizes: $ 5,000 (once), $ 700 (once), $ 100 (three times). What is the expected value of a ticket?
  2. Four boxes contain red balls, white balls and blue balls: the first box contains 13 red balls, 11 white balls and 6 blue balls; the second box contains 13 blue balls, 11 red balls and 6 white balls;
  1. Fifty-two chocolate letters, two for each letter of the alphabet, are distributed at random among fifty-two children, one each. Can you calculate the expected number of children whose first name starts with the letter that they get, without knowing the names of the children? And the variance?
  2. Prove that at least 75% of all subsets of a set of 100 elements have cardinalities lying between 41 and 59 (inclusive).
  3. Let S be a sample space, and f : S → R a random variable. Define the random variable g: S → R by g(x) = |f (x)−E(f )|. Prove that V (g) = σ(f )^2 −τ (f )^2 , and that σ(f ) ≥ τ (f ). Under which conditions is σ(f ) = τ (f )?
  4. Can the equality sign hold in Chebyshev’s inequality?
  5. Let S be a sample space, A ⊆ S an event, and f : S → R the corresponding random variable; so f (x) = 1 for x ∈ A and f (x) = 0 for x /∈ A. Let the variance V (A) of A be defined as the variance of f. Prove that V (A) = P (A) · P (A′), where A′^ = S − A.
  6. Twenty distinct numbers are arranged in a list in a random order, such that all 20! orderings are equally likely. Going down the list, one marks every number that is larger than all earlier numbers on the list. (In particular, the first number of the list is marked.) Prove that, for each i = 1, 2 ,... , 20, the probability that the i-th number on the list is marked is 1/i. What is the expectation of the number of marked numbers on the list?
  7. Let the sample space be as in Example 7. (a) What is more likely: that no man gets his own hat back, or that exactly one man gets his own hat back? Does your answer change if the number of men is different from 10? (b) What is the probability that exactly nine men get their own hats back? (c) Let Aij be the event that the i-th man and the j-th man get their own hats back. What is the probability of Aij , for i 6 = j? Is the event that the i-th man gets his own hat back independent from the event that the j-th man gets his own hat back? (d) In Example 7 we saw that the expected number of men that get their own hats back equals 1. Prove that the standard deviation of the number of men that get their own hats back is also 1.
  8. Let f be a random variable assuming only non-negative integer values, and denote by Ak the event that f (x) ≥ k. Prove that E(f ) =

k=1 P^ (Ak).

  1. A street performer hides your coin under one of three cups. You want to get it back, but you don’t have the faintest idea under which cup it is. The rules of the game require that, first, you point at one of the cups; next, to help you, the performer lifts one of the other two cups, showing that there is no coin under it; finally, you must determine your choice: stick to the cup you chose initially, or change to the last one. What is your strategy?
  2. Klaas owes Karel an amount of x Dutch guilders, where 0 ≤ x ≤ 1; but all he has is one Dutch guilder, and neither has change. They decide to settle the debt by playing the following game. (i) First they make sure that 0 ≤ x ≤ 12. If this is not the case, it is achieved by letting the coin change hands, so that the debt x is changed into 1 − x (owed by the other person). If now x = 0 then the game is over, else they pass to (ii). (ii) The person having the coin flips it. If Queen Beatrix comes up, he pockets the coin, and the game is over. If the other side comes up, his debt is doubled (i. e., x is replaced by 2x). Now the game is started all over again (at (i)). Prove that this is a fair game, in the sense that the expected amount of money that Karel receives is x guilders, for the initial value of x. (You may suppose that the coin is fair; this is guaranteed by Queen Beatrix.) Hint: write x in binary.
  3. Let f be a random variable with the property that the image of f is contained in the set of non-negative integers, with generating function g. Prove the formula V (f ) = g′′(1) + g′(1) − (g′(1))^2. (You may assume that the radius of convergence of g is larger than 1.)
  4. Let p be a real number, 0 < p < 1, and q = 1 − p. Consider, as in Example 8 and Exercise 10, the sample space S = {h, mh, mmh, mmmh,.. .}, where the n-th element has probability qn−^1 p. Let the random variable f : S → R map the n-th variable to n. What is the generating function of f? Verify the result of Example 8 that E(f ) = 1/p, and the result of Exercise 10 that V (f ) = q/p^2.
  5. Let S be a sample space, and f 1 , f 2 : S → R two independent random variables. Assume that the images of f 1 and f 2 are contained in the set of non-negative integers, and denote by g 1 , g 2 the generating functions of f 1 , f 2. Let f be the random variable f 1 + f 2. Prove that the generating function g of f is given by

g(z) = g 1 (z)g 2 (z).