cs 6214-001: randomized algorithms

60
Administrativia and Syllabus Why Randomness? Randomness in Computer Science CS 6214-001: Randomized Algorithms Lecture 1. Introduction to Randomness September 2, 2021 Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Upload: others

Post on 24-Mar-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

CS 6214-001: Randomized Algorithms

Lecture 1. Introduction to Randomness

September 2, 2021

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 2: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Administrativia

Lecture is 13:50-16:20 in room ECES 114.

Instructor: Alexandra Kolla, 122 ECEE. Office hours byappointment.

Class webpage:https://home.cs.colorado.edu/ alko5368/indexCSCI6214.html

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 3: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Administrativia

Lecture is 13:50-16:20 in room ECES 114.

Instructor: Alexandra Kolla, 122 ECEE. Office hours byappointment.

Class webpage:https://home.cs.colorado.edu/ alko5368/indexCSCI6214.html

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 4: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Administrativia

Lecture is 13:50-16:20 in room ECES 114.

Instructor: Alexandra Kolla, 122 ECEE. Office hours byappointment.

Class webpage:https://home.cs.colorado.edu/ alko5368/indexCSCI6214.html

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 5: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Advanced undergraduate algorithms or equivalent.

Probability theory and statistics or equivalent.

For example, if you have never heard what is a probabilitydistribution, expectation, variance, Bernoulli distribution,Binomial distribution, Gaussian distribution, Union Bound (asa small sample) then probably taking the class won’t be agood idea for you.

Talk to the instructor at the end of class today if you thinkyou don’t meet the requirements.

By the end of second week of classes (September 8), youmust have filled all possible prerequisite gaps. You will betested on (some of) those skills in the first homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 6: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Advanced undergraduate algorithms or equivalent.

Probability theory and statistics or equivalent.

For example, if you have never heard what is a probabilitydistribution, expectation, variance, Bernoulli distribution,Binomial distribution, Gaussian distribution, Union Bound (asa small sample) then probably taking the class won’t be agood idea for you.

Talk to the instructor at the end of class today if you thinkyou don’t meet the requirements.

By the end of second week of classes (September 8), youmust have filled all possible prerequisite gaps. You will betested on (some of) those skills in the first homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 7: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Advanced undergraduate algorithms or equivalent.

Probability theory and statistics or equivalent.

For example, if you have never heard what is a probabilitydistribution, expectation, variance, Bernoulli distribution,Binomial distribution, Gaussian distribution, Union Bound (asa small sample) then probably taking the class won’t be agood idea for you.

Talk to the instructor at the end of class today if you thinkyou don’t meet the requirements.

By the end of second week of classes (September 8), youmust have filled all possible prerequisite gaps. You will betested on (some of) those skills in the first homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 8: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Advanced undergraduate algorithms or equivalent.

Probability theory and statistics or equivalent.

For example, if you have never heard what is a probabilitydistribution, expectation, variance, Bernoulli distribution,Binomial distribution, Gaussian distribution, Union Bound (asa small sample) then probably taking the class won’t be agood idea for you.

Talk to the instructor at the end of class today if you thinkyou don’t meet the requirements.

By the end of second week of classes (September 8), youmust have filled all possible prerequisite gaps. You will betested on (some of) those skills in the first homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 9: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Advanced undergraduate algorithms or equivalent.

Probability theory and statistics or equivalent.

For example, if you have never heard what is a probabilitydistribution, expectation, variance, Bernoulli distribution,Binomial distribution, Gaussian distribution, Union Bound (asa small sample) then probably taking the class won’t be agood idea for you.

Talk to the instructor at the end of class today if you thinkyou don’t meet the requirements.

By the end of second week of classes (September 8), youmust have filled all possible prerequisite gaps. You will betested on (some of) those skills in the first homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 10: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Advanced undergraduate algorithms or equivalent.

Probability theory and statistics or equivalent.

For example, if you have never heard what is a probabilitydistribution, expectation, variance, Bernoulli distribution,Binomial distribution, Gaussian distribution, Union Bound (asa small sample) then probably taking the class won’t be agood idea for you.

Talk to the instructor at the end of class today if you thinkyou don’t meet the requirements.

By the end of second week of classes (September 8), youmust have filled all possible prerequisite gaps. You will betested on (some of) those skills in the first homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 11: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Grades are 70% homeworks/in class exercises (weekly) and30% final exam (take-home).

New homework will be assigned by the end of the week,except the first lecture. You will have one week to completeeach homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 12: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Grades are 70% homeworks/in class exercises (weekly) and30% final exam (take-home).

New homework will be assigned by the end of the week,except the first lecture. You will have one week to completeeach homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 13: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Prerequisites/Grading

Grades are 70% homeworks/in class exercises (weekly) and30% final exam (take-home).

New homework will be assigned by the end of the week,except the first lecture. You will have one week to completeeach homework.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 14: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Tentative Syllabus

Weeks 1-6, Discrete Probability: First and Second Momentmethod, coupon collector problem, Probabilistic Method, ChernoffBound and applications, Martingales and Azuma. Lovasz LocalLemma, Method of Conditional Probabilities

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 15: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Tentative Syllabus

Weeks 7-9, High-dimensional probability: Bourgain’sembedding, Curse of Dimensionality, Dimension Reduction, MatrixConcentration (Golden-Thompson, Bernstein), Random Grapheigenvalues via matrix concentration, Spectral Graph Sparsificationvia Sampling.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 16: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Tentative Syllabus

Weeks 10-12, Random Walk topics: Random Walks: hittingtimes, cover times etc, Markov Chains and Mixing, Eigenvalues,Expanders and Mixing.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 17: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Remaining time, Special Topics: Including but not limited toLifts and expansion, Algorithms for Stochastic Block Models,Random Graph Spectra.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 18: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Class Format

Class slides will be provided for some lectures (but not all) butthey are meant to give only the lecture skeleton. Most of thematerial will be covered on the board, so please take notes.

I will post the sildes (if applicable) and supplementary readingmaterial for each lecture on the webpage.

There is no fixed textbook, but most of the material we willcover can be found in “ Probability and Computing:Randomized Algorithms and Probabilistic Analysis” byMitzenmacher and Upfal.

We will have class assignments in almost every class, whereyou will work in groups and solve a question relevant to thelecture topic.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 19: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Class Format

Class slides will be provided for some lectures (but not all) butthey are meant to give only the lecture skeleton. Most of thematerial will be covered on the board, so please take notes.

I will post the sildes (if applicable) and supplementary readingmaterial for each lecture on the webpage.

There is no fixed textbook, but most of the material we willcover can be found in “ Probability and Computing:Randomized Algorithms and Probabilistic Analysis” byMitzenmacher and Upfal.

We will have class assignments in almost every class, whereyou will work in groups and solve a question relevant to thelecture topic.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 20: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Class Format

Class slides will be provided for some lectures (but not all) butthey are meant to give only the lecture skeleton. Most of thematerial will be covered on the board, so please take notes.

I will post the sildes (if applicable) and supplementary readingmaterial for each lecture on the webpage.

There is no fixed textbook, but most of the material we willcover can be found in “ Probability and Computing:Randomized Algorithms and Probabilistic Analysis” byMitzenmacher and Upfal.

We will have class assignments in almost every class, whereyou will work in groups and solve a question relevant to thelecture topic.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 21: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Class Format

Class slides will be provided for some lectures (but not all) butthey are meant to give only the lecture skeleton. Most of thematerial will be covered on the board, so please take notes.

I will post the sildes (if applicable) and supplementary readingmaterial for each lecture on the webpage.

There is no fixed textbook, but most of the material we willcover can be found in “ Probability and Computing:Randomized Algorithms and Probabilistic Analysis” byMitzenmacher and Upfal.

We will have class assignments in almost every class, whereyou will work in groups and solve a question relevant to thelecture topic.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 22: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Why Randomness?

Nature is random (quantum physics)!

Flip a coin 1000 times, comes out heads about 500± 35 times.

For n coin tosses, about n/2±√n. Converges to 1/2 quickly.

Random Cooking works well: Randomly cook one side of theonion each time. Expect half the time on each side.

Polling for elections. Huge population. Sample sizeindependent of population.

Final exams: large size of material, choose problemsindependently.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 23: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Why Randomness?

Nature is random (quantum physics)!

Flip a coin 1000 times, comes out heads about 500± 35 times.

For n coin tosses, about n/2±√n. Converges to 1/2 quickly.

Random Cooking works well: Randomly cook one side of theonion each time. Expect half the time on each side.

Polling for elections. Huge population. Sample sizeindependent of population.

Final exams: large size of material, choose problemsindependently.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 24: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Why Randomness?

Nature is random (quantum physics)!

Flip a coin 1000 times, comes out heads about 500± 35 times.

For n coin tosses, about n/2±√n. Converges to 1/2 quickly.

Random Cooking works well: Randomly cook one side of theonion each time. Expect half the time on each side.

Polling for elections. Huge population. Sample sizeindependent of population.

Final exams: large size of material, choose problemsindependently.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 25: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Why Randomness?

Nature is random (quantum physics)!

Flip a coin 1000 times, comes out heads about 500± 35 times.

For n coin tosses, about n/2±√n. Converges to 1/2 quickly.

Random Cooking works well: Randomly cook one side of theonion each time. Expect half the time on each side.

Polling for elections. Huge population. Sample sizeindependent of population.

Final exams: large size of material, choose problemsindependently.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 26: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Why Randomness?

Nature is random (quantum physics)!

Flip a coin 1000 times, comes out heads about 500± 35 times.

For n coin tosses, about n/2±√n. Converges to 1/2 quickly.

Random Cooking works well: Randomly cook one side of theonion each time. Expect half the time on each side.

Polling for elections. Huge population. Sample sizeindependent of population.

Final exams: large size of material, choose problemsindependently.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 27: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Why Randomness?

Nature is random (quantum physics)!

Flip a coin 1000 times, comes out heads about 500± 35 times.

For n coin tosses, about n/2±√n. Converges to 1/2 quickly.

Random Cooking works well: Randomly cook one side of theonion each time. Expect half the time on each side.

Polling for elections. Huge population. Sample sizeindependent of population.

Final exams: large size of material, choose problemsindependently.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 28: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Randomness in Computer Science

Random algorithms make random choices during theirexecution.

Can be much faster than deterministic counterparts.

Simpler and easier to program.

Uses in cryptography (eg. primality testing), NP-hardproblems, average case complexity...

They come with a price (running time, error).

This class: analyze running time, complexity, techniques...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 29: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Randomness in Computer Science

Random algorithms make random choices during theirexecution.

Can be much faster than deterministic counterparts.

Simpler and easier to program.

Uses in cryptography (eg. primality testing), NP-hardproblems, average case complexity...

They come with a price (running time, error).

This class: analyze running time, complexity, techniques...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 30: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Randomness in Computer Science

Random algorithms make random choices during theirexecution.

Can be much faster than deterministic counterparts.

Simpler and easier to program.

Uses in cryptography (eg. primality testing), NP-hardproblems, average case complexity...

They come with a price (running time, error).

This class: analyze running time, complexity, techniques...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 31: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Randomness in Computer Science

Random algorithms make random choices during theirexecution.

Can be much faster than deterministic counterparts.

Simpler and easier to program.

Uses in cryptography (eg. primality testing), NP-hardproblems, average case complexity...

They come with a price (running time, error).

This class: analyze running time, complexity, techniques...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 32: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Randomness in Computer Science

Random algorithms make random choices during theirexecution.

Can be much faster than deterministic counterparts.

Simpler and easier to program.

Uses in cryptography (eg. primality testing), NP-hardproblems, average case complexity...

They come with a price (running time, error).

This class: analyze running time, complexity, techniques...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 33: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Randomness in Computer Science

Random algorithms make random choices during theirexecution.

Can be much faster than deterministic counterparts.

Simpler and easier to program.

Uses in cryptography (eg. primality testing), NP-hardproblems, average case complexity...

They come with a price (running time, error).

This class: analyze running time, complexity, techniques...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 34: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

A little probability of error goes a long way

Suppose Bob just spent hours downloading the season finaleof Game of Thrones (approx 4GB file) from Alice’s database.

He wants to check if he has the same file as Alice, butobviously they don’t want to send back another 4 GB file.

The solution is hashing!

For two n-bit strings A and B, Alice picks random primenumber p ∈ {2, 3, · · · ,T} (where T t.b.d later) and sendsBob the hash Hp(A) = A mod p.

Bob accepts that they have the same string ifHp(B) = Hp(A). Length of message is logT bits.

Otherwise, Bob REJECTS and is really annoyed cause a maincharacter is dead and doesn’t even know it!

One-sided error.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 35: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

A little probability of error goes a long way

Suppose Bob just spent hours downloading the season finaleof Game of Thrones (approx 4GB file) from Alice’s database.

He wants to check if he has the same file as Alice, butobviously they don’t want to send back another 4 GB file.

The solution is hashing!

For two n-bit strings A and B, Alice picks random primenumber p ∈ {2, 3, · · · ,T} (where T t.b.d later) and sendsBob the hash Hp(A) = A mod p.

Bob accepts that they have the same string ifHp(B) = Hp(A). Length of message is logT bits.

Otherwise, Bob REJECTS and is really annoyed cause a maincharacter is dead and doesn’t even know it!

One-sided error.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 36: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

A little probability of error goes a long way

Suppose Bob just spent hours downloading the season finaleof Game of Thrones (approx 4GB file) from Alice’s database.

He wants to check if he has the same file as Alice, butobviously they don’t want to send back another 4 GB file.

The solution is hashing!

For two n-bit strings A and B, Alice picks random primenumber p ∈ {2, 3, · · · ,T} (where T t.b.d later) and sendsBob the hash Hp(A) = A mod p.

Bob accepts that they have the same string ifHp(B) = Hp(A). Length of message is logT bits.

Otherwise, Bob REJECTS and is really annoyed cause a maincharacter is dead and doesn’t even know it!

One-sided error.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 37: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

A little probability of error goes a long way

Suppose Bob just spent hours downloading the season finaleof Game of Thrones (approx 4GB file) from Alice’s database.

He wants to check if he has the same file as Alice, butobviously they don’t want to send back another 4 GB file.

The solution is hashing!

For two n-bit strings A and B, Alice picks random primenumber p ∈ {2, 3, · · · ,T} (where T t.b.d later) and sendsBob the hash Hp(A) = A mod p.

Bob accepts that they have the same string ifHp(B) = Hp(A). Length of message is logT bits.

Otherwise, Bob REJECTS and is really annoyed cause a maincharacter is dead and doesn’t even know it!

One-sided error.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 38: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

A little probability of error goes a long way

Suppose Bob just spent hours downloading the season finaleof Game of Thrones (approx 4GB file) from Alice’s database.

He wants to check if he has the same file as Alice, butobviously they don’t want to send back another 4 GB file.

The solution is hashing!

For two n-bit strings A and B, Alice picks random primenumber p ∈ {2, 3, · · · ,T} (where T t.b.d later) and sendsBob the hash Hp(A) = A mod p.

Bob accepts that they have the same string ifHp(B) = Hp(A). Length of message is logT bits.

Otherwise, Bob REJECTS and is really annoyed cause a maincharacter is dead and doesn’t even know it!

One-sided error.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 39: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

A little probability of error goes a long way

Suppose Bob just spent hours downloading the season finaleof Game of Thrones (approx 4GB file) from Alice’s database.

He wants to check if he has the same file as Alice, butobviously they don’t want to send back another 4 GB file.

The solution is hashing!

For two n-bit strings A and B, Alice picks random primenumber p ∈ {2, 3, · · · ,T} (where T t.b.d later) and sendsBob the hash Hp(A) = A mod p.

Bob accepts that they have the same string ifHp(B) = Hp(A). Length of message is logT bits.

Otherwise, Bob REJECTS and is really annoyed cause a maincharacter is dead and doesn’t even know it!

One-sided error.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 40: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

A little probability of error goes a long way

Suppose Bob just spent hours downloading the season finaleof Game of Thrones (approx 4GB file) from Alice’s database.

He wants to check if he has the same file as Alice, butobviously they don’t want to send back another 4 GB file.

The solution is hashing!

For two n-bit strings A and B, Alice picks random primenumber p ∈ {2, 3, · · · ,T} (where T t.b.d later) and sendsBob the hash Hp(A) = A mod p.

Bob accepts that they have the same string ifHp(B) = Hp(A). Length of message is logT bits.

Otherwise, Bob REJECTS and is really annoyed cause a maincharacter is dead and doesn’t even know it!

One-sided error.

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 41: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Probabillity Technique: Counting

We hope that if A 6= B then Bob almost always rejects!

Claim

If A 6= B then

Pr [Hp(A) = Hp(B)] ≤ 1.26n lnT

T ln n

Example: setting T = n2, we get an O(log n) bit messagewith error probability O(1/n).

How to choose a uniformly random prime?

Use randomized primality testing algorithm (Miller-Rabin)!

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 42: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Probabillity Technique: Counting

We hope that if A 6= B then Bob almost always rejects!

Claim

If A 6= B then

Pr [Hp(A) = Hp(B)] ≤ 1.26n lnT

T ln n

Example: setting T = n2, we get an O(log n) bit messagewith error probability O(1/n).

How to choose a uniformly random prime?

Use randomized primality testing algorithm (Miller-Rabin)!

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 43: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Probabillity Technique: Counting

We hope that if A 6= B then Bob almost always rejects!

Claim

If A 6= B then

Pr [Hp(A) = Hp(B)] ≤ 1.26n lnT

T ln n

Example: setting T = n2, we get an O(log n) bit messagewith error probability O(1/n).

How to choose a uniformly random prime?

Use randomized primality testing algorithm (Miller-Rabin)!

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 44: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Probabillity Technique: Counting

We hope that if A 6= B then Bob almost always rejects!

Claim

If A 6= B then

Pr [Hp(A) = Hp(B)] ≤ 1.26n lnT

T ln n

Example: setting T = n2, we get an O(log n) bit messagewith error probability O(1/n).

How to choose a uniformly random prime?

Use randomized primality testing algorithm (Miller-Rabin)!

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 45: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Probabillity Technique: Counting

We hope that if A 6= B then Bob almost always rejects!

Claim

If A 6= B then

Pr [Hp(A) = Hp(B)] ≤ 1.26n lnT

T ln n

Example: setting T = n2, we get an O(log n) bit messagewith error probability O(1/n).

How to choose a uniformly random prime?

Use randomized primality testing algorithm (Miller-Rabin)!

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 46: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Pattern Matching

Given two strings X = x1x2 · · · xn and Y = y1y2 · · · ym, withm < n we want to check whether Y = X (j) for somej ∈ {1, · · · , n −m + 1}. Here X (j) = xjxj+1 · · · xj+m−1.

Naive algorithm too slow, there are O(n + m) deterministicalgorithms but we will see a simple random one (Karp-Rabin).

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 47: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Pattern Matching

Given two strings X = x1x2 · · · xn and Y = y1y2 · · · ym, withm < n we want to check whether Y = X (j) for somej ∈ {1, · · · , n −m + 1}. Here X (j) = xjxj+1 · · · xj+m−1.

Naive algorithm too slow, there are O(n + m) deterministicalgorithms but we will see a simple random one (Karp-Rabin).

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 48: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Karp-Rabin Algorithm

Choose a prime p ∈ {1, 3, · · · ,T} at random.

Compute Hp(Y ) = Y mod pFor j = 1, · · · , n −m + 1 compute Hp(X (j)) and check ifHp(X (j)) = Hp(Y ). If yes, output “matched at position j”Output “no match”.

One sided error again, can be converted to zero error if itchecks the match.

Still O(nm) running time. Can we do something more clever?

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 49: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Karp-Rabin Algorithm

Choose a prime p ∈ {1, 3, · · · ,T} at random.Compute Hp(Y ) = Y mod p

For j = 1, · · · , n −m + 1 compute Hp(X (j)) and check ifHp(X (j)) = Hp(Y ). If yes, output “matched at position j”Output “no match”.

One sided error again, can be converted to zero error if itchecks the match.

Still O(nm) running time. Can we do something more clever?

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 50: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Karp-Rabin Algorithm

Choose a prime p ∈ {1, 3, · · · ,T} at random.Compute Hp(Y ) = Y mod pFor j = 1, · · · , n −m + 1 compute Hp(X (j)) and check ifHp(X (j)) = Hp(Y ). If yes, output “matched at position j”

Output “no match”.

One sided error again, can be converted to zero error if itchecks the match.

Still O(nm) running time. Can we do something more clever?

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 51: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Karp-Rabin Algorithm

Choose a prime p ∈ {1, 3, · · · ,T} at random.Compute Hp(Y ) = Y mod pFor j = 1, · · · , n −m + 1 compute Hp(X (j)) and check ifHp(X (j)) = Hp(Y ). If yes, output “matched at position j”Output “no match”.

One sided error again, can be converted to zero error if itchecks the match.

Still O(nm) running time. Can we do something more clever?

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 52: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Karp-Rabin Algorithm

Choose a prime p ∈ {1, 3, · · · ,T} at random.Compute Hp(Y ) = Y mod pFor j = 1, · · · , n −m + 1 compute Hp(X (j)) and check ifHp(X (j)) = Hp(Y ). If yes, output “matched at position j”Output “no match”.

One sided error again, can be converted to zero error if itchecks the match.

Still O(nm) running time. Can we do something more clever?

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 53: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

Karp-Rabin Algorithm

Choose a prime p ∈ {1, 3, · · · ,T} at random.Compute Hp(Y ) = Y mod pFor j = 1, · · · , n −m + 1 compute Hp(X (j)) and check ifHp(X (j)) = Hp(Y ). If yes, output “matched at position j”Output “no match”.

One sided error again, can be converted to zero error if itchecks the match.

Still O(nm) running time. Can we do something more clever?

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 54: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

When the Answer is Everywhere

Consider a task known as program checking.

Given n×n real matrices A,B,C we want to check if A = BC .

Expensive to multiply matrices.

Choose a random vector instead v ∈ {−1, 1}n and check ifAv = (BC )v .

Claim

If A 6= BC then Pr [Av = BCv ] ≤ 1/2

Principle of deferred decisions

Probability Technique: Error Amplification. Can choose kindependent vectors...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 55: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

When the Answer is Everywhere

Consider a task known as program checking.

Given n×n real matrices A,B,C we want to check if A = BC .

Expensive to multiply matrices.

Choose a random vector instead v ∈ {−1, 1}n and check ifAv = (BC )v .

Claim

If A 6= BC then Pr [Av = BCv ] ≤ 1/2

Principle of deferred decisions

Probability Technique: Error Amplification. Can choose kindependent vectors...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 56: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

When the Answer is Everywhere

Consider a task known as program checking.

Given n×n real matrices A,B,C we want to check if A = BC .

Expensive to multiply matrices.

Choose a random vector instead v ∈ {−1, 1}n and check ifAv = (BC )v .

Claim

If A 6= BC then Pr [Av = BCv ] ≤ 1/2

Principle of deferred decisions

Probability Technique: Error Amplification. Can choose kindependent vectors...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 57: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

When the Answer is Everywhere

Consider a task known as program checking.

Given n×n real matrices A,B,C we want to check if A = BC .

Expensive to multiply matrices.

Choose a random vector instead v ∈ {−1, 1}n and check ifAv = (BC )v .

Claim

If A 6= BC then Pr [Av = BCv ] ≤ 1/2

Principle of deferred decisions

Probability Technique: Error Amplification. Can choose kindependent vectors...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 58: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

When the Answer is Everywhere

Consider a task known as program checking.

Given n×n real matrices A,B,C we want to check if A = BC .

Expensive to multiply matrices.

Choose a random vector instead v ∈ {−1, 1}n and check ifAv = (BC )v .

Claim

If A 6= BC then Pr [Av = BCv ] ≤ 1/2

Principle of deferred decisions

Probability Technique: Error Amplification. Can choose kindependent vectors...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 59: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

When the Answer is Everywhere

Consider a task known as program checking.

Given n×n real matrices A,B,C we want to check if A = BC .

Expensive to multiply matrices.

Choose a random vector instead v ∈ {−1, 1}n and check ifAv = (BC )v .

Claim

If A 6= BC then Pr [Av = BCv ] ≤ 1/2

Principle of deferred decisions

Probability Technique: Error Amplification. Can choose kindependent vectors...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms

Page 60: CS 6214-001: Randomized Algorithms

Administrativia and SyllabusWhy Randomness?

Randomness in Computer Science

When the Answer is Everywhere

Consider a task known as program checking.

Given n×n real matrices A,B,C we want to check if A = BC .

Expensive to multiply matrices.

Choose a random vector instead v ∈ {−1, 1}n and check ifAv = (BC )v .

Claim

If A 6= BC then Pr [Av = BCv ] ≤ 1/2

Principle of deferred decisions

Probability Technique: Error Amplification. Can choose kindependent vectors...

Lecture 1. Introduction to Randomness CS 6214-001: Randomized Algorithms