cs537 randomness in computing
TRANSCRIPT
9/14/2021
Randomness in Computing
LECTURE 4Last timeβ’ Randomized min-cut algorithm
β’ Amplification: Bayesian
approach
Todayβ’ Finish Kargerβs algorithm
β’ Random variables
β’ Expectation
β’ Linearity of expectation
β’ Jensenβs inequality
Sofya Raskhodnikova; Randomness in Computing
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Β§1.5 (MU) Kargerβs Min Cut Algorithm
1. While π > 22. choose π β πΈ uniformly at random3. πΊ β graph obtained by contracting π in πΊ4. Return the only cut in πΊ.
(input: undirected graph πΊ = (π, πΈ)Algorithm Basic Karger
Theorem
Basic-Karger returns a min cut with probability β₯2
π(πβ1).
Probability amplification for Kargerβs algorithm
Probability Amplification: Repeat π = π π β 1 ln π times and
return the smallest cut found.
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Theorem
Basic-Karger returns a min cut with probability β₯2
π(πβ1).
Probability Amplification: Repeat π = π π β 1 ln π times and
return the smallest cut found.
Running time of Basic Karger: Best known implementation: O π
β’ Easy: π(π) per contraction, so π(ππ)
β’ View as Kruskalβs MST algorithm in πΊ with π€ ππ = π(π) run until
two components are left: π(π log π)
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Β§1.5 (MU) Kargerβs Min Cut Algorithm
1. While π > 22. choose π β πΈ uniformly at random3. πΊ β graph obtained by contracting π in πΊ4. Return the only cut in πΊ.
(input: undirected graph πΊ = (π, πΈ)Algorithm Basic Karger
Measurements in random experiments
β’ Example 1: coin flips
β Measurement X: number of heads.
β E.g., if the outcome is HHTH, then X=3.
β’ Example 2: permutations
β π students exchange their hats, so that everybody gets a
random hat
β Measurement X: number of students that got their own hats.
β E.g., if students 1,2,3 got hats 2,1,3 then X=1.
9/14/2021
Recall: random variables
β’ A random variable X on a sample space Ξ© is a
function π:Ξ© β β that assigns to each sample
point π β Ξ© a real number π π .
β’ For each random variable, we should understand:
β The set of values it can take.
β The probabilities with which it takes on these values.
β’ The distribution of a discrete random variable X
is the collection of pairs π, Pr π = π .
9/14/2021
Question
You roll two dice. Let X be the random variable that represents the
sum of the numbers you roll.
What is the probability of the event X=6?
A. 1/36
B. 1/9
C. 5/36
D. 1/6
E. None of the above.
9/14/2021
Question
You roll two dice. Let X be the random variable that represents the
sum of the numbers you roll.
How many different values can X take on?
A. 6
B. 11
C. 12
D. 36
E. None of the above.
9/14/2021
Question
You roll two dice. Let X be the random variable that represents the
sum of the numbers you roll.
What is the distribution of X?
A. Uniform distribution on the set of possible values.
B. It satisfies Pr π = 2 < Pr π = 3 < β― < Pr π = 12 .
C. It satisfies Pr π = 2 > Pr π = 3 > β― > Pr π = 12 .
D. It satisfies Pr π = 2 < Pr π = 3 < β― < Pr π = 7 and
Pr π = 7 > Pr π = 8 > β― > Pr π = 12 .
E. None of the above is true.
9/14/2021
Independent RVs: definition
β’ Random variables π and π are independent ifPr π = π₯ β© π = π¦= Pr π = π₯ β Pr π = π¦
for all values π₯ and π¦.
β’ Random variables π1, π2, β¦ , ππ are mutually independent
if for all subsets of πΌ β [π] and all values π₯π, where π β πΌ,
Pr[β©πβπΌ ππ = π₯π ]
=ΰ·
πβπΌ
Pr ππ = π₯π .
9/14/2021
Question
You roll one die. Let X be the random variable that represents the
result.
What value does X take, on average?
A. 1/6
B. 3
C. 3.5
D. 6
E. None of the above.
9/14/2021
Random variables: expectation
β’ The expectation of a discrete random variable X over a
sample space Ξ© is
πΌ π = ΟπβΞ©π π β Pr π .
β’ We can group together outcomes π for which π π = π:
πΌ π =
π
π β Pr π = π ,
where the sum is over all possible values π taken by X.
β’ The second equality is more useful for calculations.
9/14/2021
Example: random hats
β’ Example: permutations
β π students exchange their hats, so that everybody gets a
random hat
β R.V. X: the number of students that got their own hats.
β E.g., if students 1,2,3 got hats 2,1,3 then X=1.
β’ Distribution of X:
Pr π = 0 =1
3, Pr π = 1 =
1
2, Pr π = 3 =
1
6.
β’ Whatβs the expectation of X?
9/14/2021
Linearity of expectation
β’ Theorem. For any two random variables X and Y on the
same probability space,
πΌ π + π = πΌ π + πΌ π .
Also, for all π β β,
πΌ ππ = π β πΌ π .
9/14/2021
Indicator random variables
β’ An indicator random variable takes on two
values: 0 and 1.
β’ Lemma. For an indicator random variable X,
πΌ π = Pr π = 1 .
9/14/2021
Question
You have a coin with bias 3/4 (the bias is the probability of HEADS).
Let X be the number of HEADS in 1000 tosses of your coin.
You represent X as the sum: X = π1 + π2 +β―+ π1000.
What is π1?
A. 3/4.
B. The number of HEADS.
C. The probability of HEADS in toss 1.
D. The number of heads in toss 1.
E. None of the above.
9/14/2021
Question
You have a coin with bias 3/4 (the bias is the probability of HEADS).
Let X be the number of HEADS in 1000 tosses of your coin.
What is the expectation of X?
A. 3/4.
B. 4/3.
C. 500.
D. 750.
E. None of the above.
9/14/2021
Example: random hats
β’ Example: permutations
β π students exchange their hats, so that everybody gets a
random hat
β R.V. X: the number of students that got their own hats.
β E.g., if students 1,2,3 got hats 2,1,3 then X=1.
β’ Whatβs the expectation of X for general π?
9/14/2021
Jensenβs inequality: example
β’ Exercise: Let π be the length of a side of a square chosen from
[99] uniformly at random. What is the expected value of the area?
Solution: Find πΌ π2 .πΌ π2 =
β’ Comparison. πΌ π 2 =
β’ In general, πΌ π2 β₯ πΌ π 2
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Jensenβs inequality
In general, πΌ π2 β₯ πΌ π 2
Proof: Let π = πΌ[π]. Consider π = π β π 2.
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Jensenβs inequality
β’ A function π:β β β is convex if, for all π₯, π¦ and all π β 0,1 ,π ππ₯ + 1 β π π¦ β€ ππ π₯ + 1 β π π π¦ .
β’ Jensenβs inequality. If π is a convex function and X is a random
variable, then
πΌ π π β₯ π πΌ π .
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Bernoulli random variables
β’ A Bernoulli random variable with parameters π:
1 with probability π;
0 otherwise.
β’ The expectation of a Bernoulli R.V. π is
πΌ π = π β 1 + 1 β π β 0 = π.
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Binomial random variables
β’ A binomial random variable with parameters πand π, denoted Bin(π, π), is the number of
HEADS in π tosses of a coin with bias π.
β’ Lemma. The probability distribution of π =Bin(π, π) is
Pr π = π =π
πππ(1 β π)πβπ
for all π = 0,1, β¦ , π.
β’ Lemma. The expectation of π =Bin(π, π) is
πΌ π = ππ.
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Question
Throw π balls into π bins.
Let X be the number of balls that land into bin 1.
(Recall that Bin(π,π) is the binomial distribution, i.e., the distribution
of the number of HEADS in π tosses of a coin with bias π. )
Then the distribution of X is
A. Bin (π,π)
B. Bin (π, 1/π)
C. Bin π,πβ1
π
D. a binomial distribution, but none of the above.
E. not a binomial distribution.
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Question
Throw π balls into π bins. Let Y be the number of empty bins.
Compute πΌ[Y].
A. 1
B. π/2
C. 1 β1
π
π
D. π 1 β1
π
π
E. None of the above.
9/14/2021 Sofya Raskhodnikova; Randomness in Computing
Product of independent RVs
β’ Theorem. For any two independent random variables X
and Y on the same probability space,
πΌ π β π = πΌ π β πΌ π .
β’ Note. The equality does not hold, in general, for
dependent random variables.
Example. We toss two coins.
Let X= number of HEADS, Y= number of TAILS.
Calculate πΌ[X], πΌ[Y] and πΌ[XY].
9/14/2021 Sofya Raskhodnikova; Randomness in Computing