Docsity

Calculating Payoff in a Probability Game: Expectation, Variance, and Indicators, Exercises of Computer Science

Toggle sidebar
bg1
CIS 160
Reading: Random Variables and LOE
Topics Covered: Expectation, Variance, Indicator Random Variables
Exercise 1:
We are playing a game. I first roll a fair 6-sided die. If the number that shows is divisible by 3, I
roll again and I pay you the dollar amount that shows up on the second roll. If not, then I flip a
fair coin. If it”s tails, I take 10 dollars from you, and if it”s heads, I pay you 5 dollars. What is
your expected payoff?
Solution:
We define a sample space Ω = {(x, r)|x∈ {3,6}, r ∈[1..6]} ∪ {(y , c)|y∈ {1,2,4,5}, c ∈ {H, T }}.
In other words, our sample space is a set of ordered pairs, in which the first coordinate denotes the
number shown on the first roll and the second coordinate denotes either (a) the number shown on
the second roll (if the first coordinate is divisible by 3) or (b) the result of coin toss (if the first
coordinate is not divisible by 3).
We will denote the payoff using a random variable X. In this case, it’s actually easiest to determine
Xusing the basic formula for expected value, where we calculate the probability and payoff of each
outcome in the sample space.
For each outcome in which the first roll is divisible by 3 (which happens with probability 2
6=1
3),
then the payoff for the outcome is just equal to the value of the second roll, and the probability of
each outcome is 1
3·1
6.
For each outcome in which the first roll is not divisible by 3, then the payoffs are equal to -10 or
5, depending on the coin flip, and both outcomes have probability 2
3·1
2. Thus, the expected value
is:
E[X] = X
ω∈Ω
Pr[ω]·X[ω] = 1
3·1
6(1+2+3+4+5+6)+2
3·1
2(−10 + 5) = 1
18(21) + 1
3(−5) = −1
2
1
pf3
pf4

Partial preview of the text

Download Calculating Payoff in a Probability Game: Expectation, Variance, and Indicators and more Exercises Computer Science in PDF only on Docsity!

CIS 160

Reading: Random Variables and LOE

Topics Covered: Expectation, Variance, Indicator Random Variables

Exercise 1: We are playing a game. I first roll a fair 6-sided die. If the number that shows is divisible by 3, I roll again and I pay you the dollar amount that shows up on the second roll. If not, then I flip a fair coin. If it”s tails, I take 10 dollars from you, and if it”s heads, I pay you 5 dollars. What is your expected payoff?

Solution:

We define a sample space Ω = {(x, r) | x ∈ { 3 , 6 }, r ∈ [1..6]} ∪ {(y, c) | y ∈ { 1 , 2 , 4 , 5 }, c ∈ {H, T }}. In other words, our sample space is a set of ordered pairs, in which the first coordinate denotes the number shown on the first roll and the second coordinate denotes either (a) the number shown on the second roll (if the first coordinate is divisible by 3) or (b) the result of coin toss (if the first coordinate is not divisible by 3).

We will denote the payoff using a random variable X. In this case, it’s actually easiest to determine X using the basic formula for expected value, where we calculate the probability and payoff of each outcome in the sample space.

For each outcome in which the first roll is divisible by 3 (which happens with probability 26 = 13 ), then the payoff for the outcome is just equal to the value of the second roll, and the probability of each outcome is 13 · 16.

For each outcome in which the first roll is not divisible by 3, then the payoffs are equal to -10 or 5, depending on the coin flip, and both outcomes have probability 23 · 12. Thus, the expected value is:

E[X] =

ω∈Ω

Pr[ω] · X[ω] =^1 3

(1 + 2 + 3 + 4 + 5 + 6) +^2

(21) +^1

Exercise 2: There are n people in a room. Each (unordered) pair of people has probability p of being friends mutually independently among all the pairs of people. What is the expected number of friend groups of size m in the room (in terms of n, p, and m)? Friend groups are groups of m people in which everyone in the group is friends with everyone else in the group.

Solution:

Let the random variable X denote the number of groups of size m where everyone is friends with everyone else within that group. We are asked to find E[X].

Note that there are

( (^) n m

distinct groups of m people among n people. We can then label these groups with natural numbers from [1..

( (^) n m

].

For each i ∈ [1..

( (^) n m

] define the event Xi corresponding to the event “group i is a group where everyone is friends with everyone else within that group.” Similarly, for each i ∈ [1..

( (^) n m

] define the indicator random variable IXi corresponding to the event Xi.

For each i (where mx and my are the xth^ and yth^ person in group i) we have

Pr[IXi = 1] =

x,y|x<y,x,y≤m

P r[mx and my are friends] = p(

m 2 )

because every possible friendship between any two people in the group must exist, and these friend- ships are mutually independent. If mutual independence does not hold, then we cannot assume that Pr[IXi = 1] = p(

m 2 ) (i.e. we cannot multiply the probabilities together). If we only assume pairwise independence (i.e. every pair of friends are independent of any other pair), we could have subsets of friends who occur with a higher probability than others.

We can then compute the expectation:

E[X] = E[

(∑mn)

i=

IXi ]

(∑mn)

i=

E[IXi ] (Linearity of Expectation)

(∑mn)

i=

P r[IXi = 1] (by Lecture 16 slide 2)

(∑mn)

i=

p(

m 2 )

n m

· p(

m 2 )

Also, observe the following:

E[I X^2 a ] = E[IXa ] (I X^2 a is also an indicator variable with the same probability distribution as IXa )

= (1 − 19 )

10

10

Therefore, we get:

E[N 2 ] = E[(IX 1 + IX 2 + ... + IX 9 )^2 ] = E[

a 6 =b

IXa · IXb +

a

IXa · IXa ]

= E[

a 6 =b

IXa · IXb ] + E[

a

IXa · IXa ] (by Linearity of Expectation)

a 6 =b

E[IXa · IXb ] +

a

E[IXa · IXa ]

10

  • 9(

10

Hence, we get our variance: Var[N ] = E[N 2 ] − E[N ]^2

Var[N ] = 9