Randomness in Computing L ECTURE 7 Last time Randomized quicksort - - PowerPoint PPT Presentation

β–Ά
randomness in computing
SMART_READER_LITE
LIVE PREVIEW

Randomness in Computing L ECTURE 7 Last time Randomized quicksort - - PowerPoint PPT Presentation

Randomness in Computing L ECTURE 7 Last time Randomized quicksort Markovs inequality Variance Today Variance, covariance Chebyshevs inequality Variance of Binomial and Geometric RVs 2/11/2020 Sofya


slide-1
SLIDE 1

2/11/2020

Randomness in Computing

LECTURE 7

Last time

  • Randomized quicksort
  • Markov’s inequality
  • Variance
  • Today
  • Variance, covariance
  • Chebyshev’s inequality
  • Variance of Binomial and

Geometric RVs

Sofya Raskhodnikova;Randomness in Computing

slide-2
SLIDE 2

Recall: variance

  • The variance of a random variable X with expectation

𝔽[π‘Œ] = 𝜈 is Var π‘Œ = 𝔽 π‘Œ βˆ’ 𝜈 2 .

  • Equivalently, Var π‘Œ = 𝔽 π‘Œ2 βˆ’πœˆ2.
  • The standard deviation of X is 𝜏 π‘Œ =

Var π‘Œ .

2/11/2020

slide-3
SLIDE 3

Compute expectation and variance

  • Fair die. Let X be the number showing on a roll of a die.

Var π‘Œ = 𝐹 π‘Œ2 βˆ’πœˆ2 = 1 + 4 + 9 + 16 + 25 + 36 6 βˆ’ 7 2

2

= 91 6 βˆ’ 49 4 = 35 12

  • Uniform distribution. X is uniformly distributed over [π‘œ].

– The sum of the first π‘œ squares is

π‘œ(π‘œ+1)(2π‘œ+1) 6

Var π‘Œ = 1 π‘œ

π‘—βˆˆ[π‘œ]

𝑗2 βˆ’ 1 π‘œ

π‘—βˆˆ π‘œ

𝑗

2

= (π‘œ + 1)(2π‘œ + 1) 6 βˆ’ π‘œ + 1 2 4 = π‘œ2 βˆ’ 1 12

2/11/2020

slide-4
SLIDE 4

Compute expectation and variance

Number of fixed points of a permutation. Let X be the number of students that get their hats back when π‘œ students randomly switch hats, so that every permutation of hats is equally likely. Solution: π‘Œπ‘—= the indicator R.V. for person 𝑗 getting their hat back. π‘Œ = π‘Œ1 + β‹― + π‘Œπ‘œ

By linearity of expectation and symmetry, 𝔽 π‘Œ = π‘œ β‹… 𝔽 π‘Œ1 = π‘œ β‹…

1 π‘œ = 1

𝔽 π‘Œ2 = 𝔽 π‘Œ1 + β‹― + π‘Œπ‘œ 2 = π‘œ β‹… 𝔽 π‘Œ1

2 + π‘œ π‘œ βˆ’ 1 β‹… 𝔽 π‘Œ1 β‹… π‘Œ2

= π‘œ β‹… 1 π‘œ + π‘œ π‘œ βˆ’ 1 β‹… 1 π‘œ π‘œ βˆ’ 1 = 2 Var π‘Œ = 𝔽 π‘Œ2 βˆ’ 𝔽 π‘Œ

2 = 2 βˆ’ 1 = 1

2/11/2020

slide-5
SLIDE 5

Random variables: covariance

  • The covariance of two random variables X and Y

with expectations 𝔽[π‘Œ] = πœˆπ‘Œ and 𝔽[𝑍] = πœˆπ‘ is Cov(π‘Œ, 𝑍) = 𝔽 (π‘Œ βˆ’ πœˆπ‘Œ)(𝑍 βˆ’ πœˆπ‘) .

  • Theorem. For any two random variables π‘Œ and 𝑍,

Var π‘Œ + 𝑍 = Var π‘Œ + Var 𝑍 + 2 Cov π‘Œ, 𝑍 .

  • Proof: Var π‘Œ + 𝑍

= 𝔽 π‘Œ + 𝑍 βˆ’ 𝔽 π‘Œ + 𝑍

2

= 𝔽 ( π‘Œ βˆ’ πœˆπ‘Œ) + (𝑍 βˆ’ πœˆπ‘) 2 = 𝔽 π‘Œ βˆ’ πœˆπ‘Œ 2 + 𝑍 βˆ’ πœˆπ‘ 2 + 2(π‘Œ βˆ’ πœˆπ‘Œ)(𝑍 βˆ’ πœˆπ‘) = 𝔽 π‘Œ βˆ’ πœˆπ‘Œ 2] + 𝔽[ 𝑍 βˆ’ πœˆπ‘ 2] + 2𝔽[(π‘Œ βˆ’ πœˆπ‘Œ)(𝑍 βˆ’ πœˆπ‘) = Var π‘Œ + Var 𝑍 + 2 Cov π‘Œ, 𝑍

2/11/2020

slide-6
SLIDE 6

Independent RVs

  • Random variables X and Y on the same probability

space are independent if for all values 𝑏 and 𝑐, the events π‘Œ = 𝑏 and 𝑍 = 𝑐 are independent. Equivalently, for all 𝑏, 𝑐, Pr π‘Œ = 𝑏 ∧ 𝑍 = 𝑐 = Pr π‘Œ = 𝑏 β‹… Pr[𝑍 = 𝑐].

  • Theorem. For independent random variables X and Y,

– 𝔽 π‘Œπ‘ = 𝔽 π‘Œ β‹… 𝔽[𝑍]. – Var π‘Œ + 𝑍 =Var π‘Œ +Var[𝑍]. – Cov(X,Y)=0.

2/11/2020

slide-7
SLIDE 7

Example: π‘œ coin tosses

  • Let X be the number of HEADS in π‘œ tosses of a biased

coin with HEADS probability π‘ž.

  • We know: X has binomial distribution Bin(π‘œ, π‘ž).
  • What is the variance of X?

Answer: π‘œπ‘ž 1 βˆ’ π‘ž .

2/11/2020

slide-8
SLIDE 8

Example: Geometric RV

  • Let X be the # of coin tosses until the first HEADS of a

biased coin with HEADS probability π‘ž.

  • We know: X has geometric distribution Geom(π‘ž).
  • What is the variance of X?

Answer:

1βˆ’π‘ž π‘ž2 .

2/11/2020

Sofya Raskhodnikova; Randomness in Computing

slide-9
SLIDE 9

Variance: additional facts

  • Theorem. For 𝑏, 𝑐 ∈ ℝ and a random variable X,

Var π‘π‘Œ + 𝑐 = 𝑏2Var π‘Œ .

  • Theorem. If π‘Œ1, … , π‘Œπ‘œ are pairwise independent random

variables, then

Var π‘Œ1 + β‹― + π‘Œπ‘œ = Var π‘Œ1 + β‹― + Var[π‘Œπ‘œ].

2/11/2020

Sofya Raskhodnikova; Randomness in Computing

slide-10
SLIDE 10

Chebyshev’s Inequality

  • Theorem. For a random variable X and 𝑏 > 0,

Pr |π‘Œ βˆ’ 𝔽 π‘Œ | β‰₯ 𝑏 ≀ Var[π‘Œ] 𝑏2 .

  • Proof: Pr |π‘Œ βˆ’ 𝔽 π‘Œ | β‰₯ 𝑏 = Pr π‘Œ βˆ’ 𝔽 π‘Œ

2 β‰₯ 𝑏2

≀ 𝔽 𝑍 𝑏2 (by Markov) = 𝔽 π‘Œ βˆ’ 𝔽 π‘Œ

2

𝑏2 = Var π‘Œ 𝑏2

2/11/2020

𝒁 β‰₯ 0

slide-11
SLIDE 11

Chebyshev’s Inequality

  • Theorem. For a random variable X and 𝑏 > 0,

Pr |π‘Œ βˆ’ 𝔽 π‘Œ | β‰₯ 𝑏 ≀ Var[π‘Œ] 𝑏2 .

  • Alternatively: Then, for all 𝑒 > 1,

Pr |π‘Œ βˆ’ 𝔽 π‘Œ | β‰₯ 𝑒 β‹… 𝜏[π‘Œ] ≀ 1 𝑒2 .

  • Example 1: π‘Œ ∼Bin(π‘œ,1/2).

Bound Pr π‘Œ >

3π‘œ 4

using Markov and Chebyshev.

  • Example 2: Coupon Collector Problem.

Bound Pr π‘Œ > 2π‘œπΌπ‘œ using Markov and Chebyshev.

2/11/2020