SlideShare a Scribd company logo
The Power of Randomization
Example 1: Checking Equality


• Two large files at two different locations.

• Are they identical?
  – By communicating only a small amount of
    information!
Checking Equality
                The Challenge

• Two large numbers N1 and N2 , n bits each

• Communication allowed: m<<n bits

• Possible?
Checking Equality
                   Impossibility


• Suppose the communication is based on N1 alone

• m<<n,
   – Two different N1’s will have the same m-bit communication
     pattern
   – Switch N2 from one to another (YES->NO)
Checking Equality
          Randomized Algorithms


• Communicate N1 mod M for some number M

• If N1 = N2 then you always get YES


• If N1 != N2 then you get YES if M divides N1 - N2
Checking Equality
                    Analysis


• Probability N1 != N2 but M divides N1 - N2 ?

• Probability over what?
     • M and not N1,N2
     • Choose M at random in the range 1..2m
Checking Equality
                      Analysis


• How many factors does N1 - N2 have?
   – N1 - N2 <= 2n, so (2n)1/log n


• If we choose M randomly in the range 1..2 (2n)1/log n
   – Probability N1 != N2 but M divides N1 - N2 <= 1/2
   – So m is ~ n/log n bits (minor gains)
Checking Equality
                Use Prime Numbers

• How many prime factors does N1 - N2 have?
   – N1 - N2 <= 2n, so 2n/log n

• If we choose M to be a random prime in 1..4n

   – There are at least 4n/log 4n > 4n/log(4n) primes

   – Probability N1 != N2 but M divides N1 - N2 <= ~ 1/2

   – So m is ~ log n bits (major gains)
Checking Equality
                   The Solution

• Two large numbers N1 and N2 , n bits each

• log n bits of communication
   – Remainder w.r.t random prime in range 1..4n


• Error Prob < 1/2
Checking Equality
             Reducing Error Prob

• Repeat k times

• Communication is klog n bits

• Error prob < (½)k
Checking Equality
               Example Numbers

• 10GB file, n=1010

• Desired Error Prob 10-30

• Communication 99 * 33 = 3267 bits = 400 bytes


If 10 billion people do 10 billion checks a day, the prob
  that even one of the checks is erroneous is 1/10
  billion
Another Example
                     PCA

• Fit a line thru 0 to a
  collection of points so as
  to maximize sum of
  squares of projections
PCA
                 Random Sampling


• Too many points?

• Pick a random sample
   – The fitting line doesn’t
     change too much?
PCA
             Random Sampling


• How should you sample
  here?
Puzzle
          Checking Matrix Products

• Given three matrices A and BC, check if A=BC?
   – mod p for simplicity


• Matrices are n*n


• Easy to do in n3 time

• Can you do better?
Puzzle
         Checking Matrix Products

• Given three matrices A and BC, check if A=BC?

• Matrices are n*n


• Easy to do in n3 time

• Can you do better?

More Related Content

PDF
Checksum explaination
PPTX
Mthys of probability
PPTX
Probability and fair chance
PPT
Probability Games
PPT
Combinatorics
PPT
Lecture slides week14-15
PDF
Counting (Using Computer)
PDF
Dynamic Programming From CS 6515(Fibonacci, LIS, LCS))
Checksum explaination
Mthys of probability
Probability and fair chance
Probability Games
Combinatorics
Lecture slides week14-15
Counting (Using Computer)
Dynamic Programming From CS 6515(Fibonacci, LIS, LCS))

Similar to Randomized algorithms (20)

PPT
Discrete Math Ch5 counting + proofs
PDF
Significance tests
PDF
Unit7
PPT
Statisticsforbiologists colstons
PPTX
chapter 4-part 2.pptx uploaded presentation
PDF
k-nearest neighbour Machine Learning.pdf
PPTX
k-nearest neighbour Machine Learning.pptx
PPT
Combinatorics.ppt
PPTX
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
PPTX
Brute force method
PDF
AS physics - Physical quantities & units
PPTX
Undecidable Problems and Approximation Algorithms
PPTX
Statistical Machine Learning unit3 lecture notes
PPT
natural language processing by Christopher
PPTX
Pn sequence
PPT
3. Recursion and Recurrences.ppt detail about recursive learning
PPT
densematrix.ppt
PPT
recurrence relations in analysis of algorithm
PPT
Matt Purkeypile's Doctoral Dissertation Defense Slides
PPT
unit 4 nearest neighbor.ppt
Discrete Math Ch5 counting + proofs
Significance tests
Unit7
Statisticsforbiologists colstons
chapter 4-part 2.pptx uploaded presentation
k-nearest neighbour Machine Learning.pdf
k-nearest neighbour Machine Learning.pptx
Combinatorics.ppt
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Brute force method
AS physics - Physical quantities & units
Undecidable Problems and Approximation Algorithms
Statistical Machine Learning unit3 lecture notes
natural language processing by Christopher
Pn sequence
3. Recursion and Recurrences.ppt detail about recursive learning
densematrix.ppt
recurrence relations in analysis of algorithm
Matt Purkeypile's Doctoral Dissertation Defense Slides
unit 4 nearest neighbor.ppt
Ad

More from Strand Life Sciences Pvt Ltd (12)

PDF
Strand genomics features in CIO review
PPTX
Rules of a Quantum World
PPTX
Least common ancestors in constant time
PPTX
Introduction to statistics iii
PPTX
Introduction to statistics ii
PPTX
Introduction to statistics
PPTX
Dynamic programming for simd
PPTX
Complex numbers polynomial multiplication
PPTX
Converting High Dimensional Problems to Low Dimensional Ones
PPTX
Searching using Quantum Rules
PPTX
PPTX
Alignment of raw reads in Avadis NGS
Strand genomics features in CIO review
Rules of a Quantum World
Least common ancestors in constant time
Introduction to statistics iii
Introduction to statistics ii
Introduction to statistics
Dynamic programming for simd
Complex numbers polynomial multiplication
Converting High Dimensional Problems to Low Dimensional Ones
Searching using Quantum Rules
Alignment of raw reads in Avadis NGS
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPT
Teaching material agriculture food technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Cloud computing and distributed systems.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Electronic commerce courselecture one. Pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Encapsulation_ Review paper, used for researhc scholars
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Teaching material agriculture food technology
Review of recent advances in non-invasive hemoglobin estimation
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
The AUB Centre for AI in Media Proposal.docx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Cloud computing and distributed systems.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Electronic commerce courselecture one. Pdf
MIND Revenue Release Quarter 2 2025 Press Release
Encapsulation_ Review paper, used for researhc scholars

Randomized algorithms

  • 1. The Power of Randomization
  • 2. Example 1: Checking Equality • Two large files at two different locations. • Are they identical? – By communicating only a small amount of information!
  • 3. Checking Equality The Challenge • Two large numbers N1 and N2 , n bits each • Communication allowed: m<<n bits • Possible?
  • 4. Checking Equality Impossibility • Suppose the communication is based on N1 alone • m<<n, – Two different N1’s will have the same m-bit communication pattern – Switch N2 from one to another (YES->NO)
  • 5. Checking Equality Randomized Algorithms • Communicate N1 mod M for some number M • If N1 = N2 then you always get YES • If N1 != N2 then you get YES if M divides N1 - N2
  • 6. Checking Equality Analysis • Probability N1 != N2 but M divides N1 - N2 ? • Probability over what? • M and not N1,N2 • Choose M at random in the range 1..2m
  • 7. Checking Equality Analysis • How many factors does N1 - N2 have? – N1 - N2 <= 2n, so (2n)1/log n • If we choose M randomly in the range 1..2 (2n)1/log n – Probability N1 != N2 but M divides N1 - N2 <= 1/2 – So m is ~ n/log n bits (minor gains)
  • 8. Checking Equality Use Prime Numbers • How many prime factors does N1 - N2 have? – N1 - N2 <= 2n, so 2n/log n • If we choose M to be a random prime in 1..4n – There are at least 4n/log 4n > 4n/log(4n) primes – Probability N1 != N2 but M divides N1 - N2 <= ~ 1/2 – So m is ~ log n bits (major gains)
  • 9. Checking Equality The Solution • Two large numbers N1 and N2 , n bits each • log n bits of communication – Remainder w.r.t random prime in range 1..4n • Error Prob < 1/2
  • 10. Checking Equality Reducing Error Prob • Repeat k times • Communication is klog n bits • Error prob < (½)k
  • 11. Checking Equality Example Numbers • 10GB file, n=1010 • Desired Error Prob 10-30 • Communication 99 * 33 = 3267 bits = 400 bytes If 10 billion people do 10 billion checks a day, the prob that even one of the checks is erroneous is 1/10 billion
  • 12. Another Example PCA • Fit a line thru 0 to a collection of points so as to maximize sum of squares of projections
  • 13. PCA Random Sampling • Too many points? • Pick a random sample – The fitting line doesn’t change too much?
  • 14. PCA Random Sampling • How should you sample here?
  • 15. Puzzle Checking Matrix Products • Given three matrices A and BC, check if A=BC? – mod p for simplicity • Matrices are n*n • Easy to do in n3 time • Can you do better?
  • 16. Puzzle Checking Matrix Products • Given three matrices A and BC, check if A=BC? • Matrices are n*n • Easy to do in n3 time • Can you do better?