Let’s begin with a fundamental algebraic property of random vectors:
The Mod-2 Lemma
If d \neq 0, then the inner product of d and r mod 2 is balanced: \Pr\left[ d \cdot r \equiv 0 \pmod 2 \right] = \frac{1}{2}
Since d \neq 0, there exists at least one coordinate k where d_k = 1.
We can partition the sum: d \cdot r = d_k r_k + \sum_{i \neq k} d_i r_i \equiv r_k + \sum_{i \neq k} d_i r_i \pmod 2
Let S = \sum_{i \neq k} d_i r_i \bmod 2. Its value is determined entirely by the choices of r_i for i \neq k.
To make d \cdot r \equiv 0 \pmod 2, we must have: r_k \equiv S \pmod 2
Since r_k is chosen uniformly and independently: \Pr[r_k = S] = \frac{1}{2}
Let’s apply this mathematical property to verify matrix multiplication: AB = C.
The protocols we just designed are examples of randomized algorithms:
State Machine Model: Defined by a set of states Q and a probabilistic transition function: \delta: Q \times \{0, 1\} \to Q where transitions depend on a random coin flip b \in \{0, 1\}.
The Random Tape Model (WLOG): Equivalent to a deterministic algorithm A(x, r) taking the input x and a pre-flipped random tape r.
Once r is fixed, the execution path is deterministic.
This model makes it easier to analyze complexity classes.
We classify randomized algorithms based on where the uncertainty lies.
| Feature | Las Vegas | Monte Carlo |
|---|---|---|
| Correctness | Always correct | Correct with probability 1 - \delta |
| Running Time | Random variable (analyze expectation) | Bounded / Deterministic |
| Error Type | None | One-sided or Two-sided |
| Primary Use | Sorting, searching, optimization | Decision problems, verification |
We can amplify success by running the algorithm k times independently.
Suppose the algorithm errs only on “Yes” inputs with probability \le \delta.
Output “Yes” if any of the k runs output “Yes”.
A failure requires every single run to err.
The error probability drops exponentially: \Pr(\text{error}) \le \delta^k
For \delta = 1/2 and k = 30, error is \le 2^{-30} \approx 10^{-9}.
Two-Sided Error Amplification & Randomized Complexity Classes (RP, co-RP, BPP, ZPP).
CS G526: Advanced Algorithms & ComplexityTulasimohan Molli